round 2: fight

This commit is contained in:
Boblet 2026-06-17 11:56:13 +02:00
parent 64b1dbcd5a
commit 1f36fd1a86
16 changed files with 104 additions and 39 deletions

View File

@ -11,9 +11,12 @@
* We have steam engines and industrial turbines are really not that expensive
* "oh no, i have to build an actually good looking setup now if i want to build a zirnox!" yeah you do
* Updated light brick texture
* The maximum character limit on RoR channels is now the same for all RoR devices, being 15
* This does not include special RoR interactive devices that don't use GUI text fields like the RoR terminal or the AUTOCAL units
## Fixed
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised
* Fixed broken thorium ore centrifuging recipe shown in NEI
* Fixed industrial turbine not properly saving its energy values, causing the flywheel to stop on relog
* Fixed lapis dust to cobalt shredder recipe not using oredict
* Fixed AUTOCAL's file opening buttons not working on some systems, it will fall back to opening the folder instead

View File

@ -8,13 +8,14 @@ import java.util.List;
import com.hbm.interfaces.NotableComments;
import com.hbm.inventory.SlotNonRetarded;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.ContainerCustomPayloadPacket;
import com.hbm.packet.toclient.ContainerNBTCommsPacket;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
import com.hbm.util.EnumUtil;
import com.hbm.util.InventoryUtil;
import api.hbm.ntl.StackCache;
import api.hbm.ntl.StackCache.CacheSlot;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
@ -29,6 +30,19 @@ import net.minecraft.nbt.NBTTagList;
@NotableComments // i long for the day when i never have to look at this fucking horseshit ever again
public class ContainerPneumoStorageAccess extends Container implements ICustomPayloadReceiver {
/*
* time wasted on this fucking class: a lot
*
* this approach was great right until it just stopped working.
* a proper search requires the client to decide if the item matches
* the criteria, and we have to process all items in the network, so
* this entire approach of only sending 48 items at once to the client
* just absolutely will not work.
*
* i may have to rewrite absolutely everything here now, but at least i
* finally know what i am up against. didn't hear no bell.
*/
protected TileEntityPneumoStorageAccess access;
protected InventoryPneumoStorageAccess inventory;
@ -290,7 +304,7 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
for(Object o : this.crafters) {
if(o instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) o;
PacketDispatcher.wrapper.sendTo(new ContainerCustomPayloadPacket(playerMP.currentWindowId, masterTag), playerMP);
PacketDispatcher.wrapper.sendTo(new ContainerNBTCommsPacket(playerMP.currentWindowId, masterTag), playerMP);
}
}
}
@ -306,9 +320,10 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
}
@Override
public void acceptData(int windowId, NBTTagCompound data) {
public void acceptData(Side side, int windowId, NBTTagCompound data) {
if(windowId != this.windowId) return;
if(side.isClient()) {
this.itemCountForClient = data.getInteger("itemCount");
this.listingStart = data.getInteger("listingStart");
@ -322,6 +337,9 @@ public class ContainerPneumoStorageAccess extends Container implements ICustomPa
if(msg == PneumoMesageType.UPDATE_ALL || msg == PneumoMesageType.UPDATE_COUNT) slot.amount = listEntry.getLong(KEY_LONG_COUNT);
if(msg == PneumoMesageType.UPDATE_ALL || msg == PneumoMesageType.UPDATE_TYPE) slot.putStack(ItemStack.loadItemStackFromNBT(listEntry));
}
} else {
}
}
@Override

View File

@ -1,8 +1,9 @@
package com.hbm.inventory.container;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.nbt.NBTTagCompound;
public interface ICustomPayloadReceiver {
public void acceptData(int windowsId, NBTTagCompound data);
public void acceptData(Side side, int windowsId, NBTTagCompound data);
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import java.util.List;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@ -10,15 +11,19 @@ import com.hbm.inventory.container.ContainerPneumoStorageAccess;
import com.hbm.inventory.container.ContainerPneumoStorageAccess.SlotPneumo;
import com.hbm.inventory.gui.element.GUIElements;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.ContainerNBTCommsPacket;
import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess;
import com.hbm.util.BobMathUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
@ -27,6 +32,7 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_pneumatic_access.png");
protected TileEntityPneumoStorageAccess access;
protected GuiTextField search;
protected int scrollIndex = 0;
protected int scrollBounds = 0;
@ -41,6 +47,19 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
this.ySize = 251;
}
@Override
public void initGui() {
super.initGui();
Keyboard.enableRepeatEvents(true);
search = new GuiTextField(this.fontRendererObj, guiLeft + 43, guiTop + 127, 90, 12);
search.setTextColor(0xffffff);
search.setDisabledTextColour(0xa0a0a0);
search.setEnableBackgroundDrawing(false);
search.setMaxStringLength(50);
search.setText("");
}
@Override
public void drawScreen(int x, int y, float interp) {
@ -73,6 +92,7 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
search.mouseClicked(x, y, i);
}
@Override
@ -125,6 +145,8 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
drawTexturedModalRect(guiLeft + getScrollBarXPos(), guiTop + getScrollBarYPos(), draggingScroll ? 188 : 176, 0, 12, 15);
search.drawTextBox();
}
public int getScrollBarXPos() {
@ -169,4 +191,23 @@ public class GUIPneumoStorageAccess extends GuiInfoContainer {
if(font == null) font = this.fontRendererObj;
GUIElements.drawHoveringText(list, x, y, font, itemRender, width, height, STANDARD_HEADER_OFFSET, STANDARD_LINE_DIST, STANDARD_COLOR_BACKGROUND, STANDARD_COLOR_BACKGROUND, 0xD57C4F, 0xAB4223);
}
@Override
protected void keyTyped(char c, int b) {
if(search.textboxKeyTyped(c, b)) {
NBTTagCompound data = new NBTTagCompound();
data.setString("search", search.getText());
PacketDispatcher.wrapper.sendToServer(new ContainerNBTCommsPacket(this.inventorySlots.windowId, data));
return;
}
super.keyTyped(c, b);
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
}
}

View File

@ -51,7 +51,7 @@ public class GUIScreenRBMKDisplay extends GuiScreen {
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 85 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 30, display.displays[i].label);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 85 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, display.displays[i].rtty);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, display.displays[i].rtty);
active[i] = display.displays[i].active;
polling[i] = display.displays[i].polling;

View File

@ -56,7 +56,7 @@ public class GUIScreenRBMKGauge extends GuiScreen {
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 15, gauge.gauges[i].label);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 36, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, gauge.gauges[i].rtty);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, gauge.gauges[i].rtty);
min[i] = new GuiTextField(this.fontRendererObj, guiLeft + 121 + oX, guiTop + 73 + oY + i * 36, 52 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(min[i], 32, gauge.gauges[i].min + "");
max[i] = new GuiTextField(this.fontRendererObj, guiLeft + 195 + oX, guiTop + 73 + oY + i * 36, 52 - oX * 2, 14);

View File

@ -51,7 +51,7 @@ public class GUIScreenRBMKGraph extends GuiScreen {
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 30, graph.graphs[i].label);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, graph.graphs[i].rtty);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, graph.graphs[i].rtty);
min[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(min[i], 15, graph.graphs[i].minBound ? graph.graphs[i].min + "" : "");
max[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 73 + oY + i * 54, 72 - oX * 2, 14);

View File

@ -56,7 +56,7 @@ public class GUIScreenRBMKIndicator extends GuiScreen {
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 37 + oY + i * 36, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 15, indicator.indicators[i].label);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, indicator.indicators[i].rtty);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, indicator.indicators[i].rtty);
min[i] = new GuiTextField(this.fontRendererObj, guiLeft + 121 + oX, guiTop + 55 + oY + i * 36, 52 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(min[i], 32, indicator.indicators[i].min + "");
max[i] = new GuiTextField(this.fontRendererObj, guiLeft + 195 + oX, guiTop + 55 + oY + i * 36, 52 - oX * 2, 14);

View File

@ -66,7 +66,7 @@ public class GUIScreenRBMKKeyPad extends GuiScreen {
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 36, 72 - oX * 2, 14);
setupTextFieldStandard(label[i], 15, keypad.keys[i].label);
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 73 + oY + i * 36, 72 - oX * 2, 14);
setupTextFieldStandard(rtty[i], 10, keypad.keys[i].rtty);
setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, keypad.keys[i].rtty);
cmd[i] = new GuiTextField(this.fontRendererObj, guiLeft + 121 + oX, guiTop + 73 + oY + i * 36, 126 - oX * 2, 14);
setupTextFieldStandard(cmd[i], 32, keypad.keys[i].command);

View File

@ -52,7 +52,7 @@ public class GUIScreenRBMKLever extends GuiScreen {
for(int i = 0; i < 2; i++) {
rtty[i] = new GuiTextField(this.fontRendererObj, guiLeft + 27 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], 10, lever.levers[i].rtty);
GUIScreenRBMKKeyPad.setupTextFieldStandard(rtty[i], GUIScreenRadioTorch.MAX_CHAN_LENGTH, lever.levers[i].rtty);
label[i] = new GuiTextField(this.fontRendererObj, guiLeft + 175 + oX, guiTop + 55 + oY + i * 54, 72 - oX * 2, 14);
GUIScreenRBMKKeyPad.setupTextFieldStandard(label[i], 15, lever.levers[i].label);
cmdOn[i] = new GuiTextField(this.fontRendererObj, guiLeft + 45 + oX, guiTop + 73 + oY + i * 54, 81 - oX * 2, 14);

View File

@ -21,6 +21,8 @@ import net.minecraft.util.ResourceLocation;
public class GUIScreenRadioTorch extends GuiScreen {
public static final int MAX_CHAN_LENGTH = 15;
protected ResourceLocation texture;
protected static final ResourceLocation textureSender = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_rtty_sender.png");
protected static final ResourceLocation textureReceiver = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_rtty_receiver.png");
@ -61,7 +63,7 @@ public class GUIScreenRadioTorch extends GuiScreen {
this.frequency.setTextColor(0x00ff00);
this.frequency.setDisabledTextColour(0x00ff00);
this.frequency.setEnableBackgroundDrawing(false);
this.frequency.setMaxStringLength(10);
this.frequency.setMaxStringLength(MAX_CHAN_LENGTH);
this.frequency.setText(radio.channel == null ? "" : radio.channel);
this.remap = new GuiTextField[16];

View File

@ -58,7 +58,7 @@ public class GUIScreenRadioTorchController extends GuiScreen {
this.frequency.setTextColor(0x00ff00);
this.frequency.setDisabledTextColour(0x00ff00);
this.frequency.setEnableBackgroundDrawing(false);
this.frequency.setMaxStringLength(10);
this.frequency.setMaxStringLength(GUIScreenRadioTorch.MAX_CHAN_LENGTH);
this.frequency.setText(rtty.channel == null ? "" : rtty.channel);
}

View File

@ -52,7 +52,7 @@ public class GUIScreenRadioTorchLogic extends GuiScreen {
this.frequency.setTextColor(0x00ff00);
this.frequency.setDisabledTextColour(0x00ff00);
this.frequency.setEnableBackgroundDrawing(false);
this.frequency.setMaxStringLength(10);
this.frequency.setMaxStringLength(GUIScreenRadioTorch.MAX_CHAN_LENGTH);
this.frequency.setText(logic.channel == null ? "" : logic.channel);
this.map = new GuiTextField[16];

View File

@ -59,7 +59,7 @@ public class GUIScreenRadioTorchReader extends GuiScreen {
this.frequencies[i].setTextColor(0x00ff00);
this.frequencies[i].setDisabledTextColour(0x00ff00);
this.frequencies[i].setEnableBackgroundDrawing(false);
this.frequencies[i].setMaxStringLength(15);
this.frequencies[i].setMaxStringLength(GUIScreenRadioTorch.MAX_CHAN_LENGTH);
this.frequencies[i].setText(rtty.channels[i] == null ? "" : rtty.channels[i]);
this.names[i] = new GuiTextField(this.fontRendererObj, guiLeft + 119 + oX, guiTop + 53 + i * 18 + oY, 126 - oX * 2, 14);

View File

@ -69,8 +69,9 @@ public class PacketDispatcher {
wrapper.registerMessage(HeldItemNBTPacket.Handler.class, HeldItemNBTPacket.class, i++, Side.CLIENT);
//Syncs muzzle flashes of SEDNA guns for clients from other entities/players
wrapper.registerMessage(MuzzleFlashPacket.Handler.class, MuzzleFlashPacket.class, i++, Side.CLIENT);
//Sends custom container-bound payload from a server container to a client one
wrapper.registerMessage(ContainerCustomPayloadPacket.Handler.class, ContainerCustomPayloadPacket.class, i++, Side.CLIENT);
//Sends custom container-bound payload between client and server, dual-use capable
wrapper.registerMessage(ContainerNBTCommsPacket.Handler.class, ContainerNBTCommsPacket.class, i++, Side.CLIENT);
wrapper.registerMessage(ContainerNBTCommsPacket.Handler.class, ContainerNBTCommsPacket.class, i++, Side.SERVER);
}
}

View File

@ -7,20 +7,18 @@ import com.hbm.util.BufferUtil;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
public class ContainerCustomPayloadPacket implements IMessage {
public class ContainerNBTCommsPacket implements IMessage {
int windowId;
NBTTagCompound data;
public ContainerCustomPayloadPacket() { }
public ContainerNBTCommsPacket() { }
public ContainerCustomPayloadPacket(int windowId, NBTTagCompound data) {
public ContainerNBTCommsPacket(int windowId, NBTTagCompound data) {
this.windowId = windowId;
this.data = data;
}
@ -37,14 +35,15 @@ public class ContainerCustomPayloadPacket implements IMessage {
BufferUtil.writeNBT(buf, this.data);
}
public static class Handler implements IMessageHandler<ContainerCustomPayloadPacket, IMessage> {
public static class Handler implements IMessageHandler<ContainerNBTCommsPacket, IMessage> {
@SideOnly(Side.CLIENT) @Override
public IMessage onMessage(ContainerCustomPayloadPacket m, MessageContext ctx) {
EntityPlayer player = MainRegistry.proxy.me();
@Override
public IMessage onMessage(ContainerNBTCommsPacket m, MessageContext ctx) {
EntityPlayer player = ctx.side.isClient() ? MainRegistry.proxy.me() : ctx.getServerHandler().playerEntity;
if(player.openContainer instanceof ICustomPayloadReceiver) {
ICustomPayloadReceiver cus = (ICustomPayloadReceiver) player.openContainer;
cus.acceptData(m.windowId, m.data);
cus.acceptData(ctx.side, m.windowId, m.data);
}
return null;
}