Posted April 9, 201510 yr I am trying to send a packet from the client to server, but it crashes to the main menu, and minecraft says:"Connection Lost / A fatal error has occured, this connection is terminated" with this stacktrace: [07:48:37] [Netty Server IO #1/ERROR] [FML]: FMLIndexedMessageCodec exception caught io.netty.handler.codec.DecoderException: java.lang.InstantiationException: deconstruction.common.handler.PacketIndex at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:398) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:226) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [singleThreadEventExecutor.class:4.0.15.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) [NioEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51] Caused by: java.lang.InstantiationException: deconstruction.common.handler.PacketIndex at java.lang.Class.newInstance(Class.java:359) ~[?:1.7.0_51] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:79) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.15.Final] ... 25 more [07:48:37] [Netty Server IO #1/ERROR] [FML]: SimpleChannelHandlerWrapper exception io.netty.handler.codec.DecoderException: java.lang.InstantiationException: deconstruction.common.handler.PacketIndex at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:398) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:226) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [singleThreadEventExecutor.class:4.0.15.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) [NioEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51] Caused by: java.lang.InstantiationException: deconstruction.common.handler.PacketIndex at java.lang.Class.newInstance(Class.java:359) ~[?:1.7.0_51] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:79) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.15.Final] ... 25 more [07:48:37] [Netty Server IO #1/ERROR] [FML]: There was a critical exception handling a packet on channel DeconTable io.netty.handler.codec.DecoderException: java.lang.InstantiationException: deconstruction.common.handler.PacketIndex at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) ~[DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.15.Final] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:88) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:144) [NetworkManager.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:469) [NetworkManager.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:398) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:226) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:49) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [simpleChannelInboundHandler.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324) [DefaultChannelHandlerContext.class:4.0.15.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:312) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:44) [LocalChannel.class:4.0.15.Final] at io.netty.channel.local.LocalChannel$6.run(LocalChannel.java:298) [LocalChannel$6.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [singleThreadEventExecutor.class:4.0.15.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) [NioEventLoop.class:4.0.15.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:4.0.15.Final] at java.lang.Thread.run(Thread.java:744) [?:1.7.0_51] Caused by: java.lang.InstantiationException: deconstruction.common.handler.PacketIndex at java.lang.Class.newInstance(Class.java:359) ~[?:1.7.0_51] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:79) ~[FMLIndexedMessageToMessageCodec.class:?] at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:21) ~[FMLIndexedMessageToMessageCodec.class:?] at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.15.Final] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.15.Final] ... 25 more My code: mod_Deconstruction.java: public class mod_Deconstruction { public static SimpleNetworkWrapper networkWrapper; public GuiHandler guiHandler = new GuiHandler(); @Mod.Instance(Resources.MOD_ID) public static mod_Deconstruction instance; @SidedProxy(clientSide = "deconstruction.client.ClientProxy", serverSide = "deconstruction.common.CommonProxy") public static CommonProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); deconstructionTable = new BlockDeconstructionTable().setUnlocalizedName("deconstructionTable").setHardness(2.5F).setStepSound(Block.soundTypeWood); networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("DeconTable"); networkWrapper.registerMessage(PacketIndex.Handler.class, PacketIndex.class, 0, Side.SERVER); } @Mod.EventHandler public void load(FMLInitializationEvent event) { proxy.registerRenderers(); NetworkRegistry.INSTANCE.registerGuiHandler(instance, guiHandler); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } @Mod.EventHandler public void serverLoad(FMLServerStartedEvent event) { } } PacketIndex.java: public class PacketIndex implements IMessage { private int index; public PacketIndex(int index){ this.index = index; } @Override public void fromBytes(ByteBuf buf) { this.index = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.index); } public static class Handler implements IMessageHandler<PacketIndex, IMessage> { @Override public IMessage onMessage(PacketIndex message, MessageContext ctx) { mod_Deconstruction.debug.log("Recieved index packet: "+ message.index); ((ContainerDeconstructionTable)ctx.getServerHandler().playerEntity.openContainer).setCurrentRecipeIndex(message.index); return null; } } } ContainerDeconstructionTable.setCurrentRecipeIndex(): public void setCurrentRecipeIndex(int i){ this.index = i; this.onCraftMatrixChanged(in); } GuiDeconstructionTable: private ResourceLocation guiTexture = new ResourceLocation(Resources.MOD_ID, "textures/gui/deconstruction.png"); public int x, y, z; public World world; private GuiButtonDecon next; private GuiButtonDecon back; public int currentRecipeIndex = 0; public static GuiDeconstructionTable instance; private DeconstructionManager manager = DeconstructionManager.getInstance(); public InventoryPlayer playerInv; public GuiDeconstructionTable(Container container) { super(container); } public GuiDeconstructionTable(InventoryPlayer inventory, World world, int x, int y, int z) { super(new ContainerDeconstructionTable(inventory, world, x, y, z)); this.x = x; this.y = y; this.z = z; this.world = world; this.playerInv = inventory; } public void initGui(){ super.initGui(); int x = (this.width - this.xSize)/2; int y = (this.height - this.ySize)/2; this.buttonList.add(this.next = new GuiButtonDecon(1, x + 160, y + 53, true)); this.buttonList.add(this.back = new GuiButtonDecon(2, x + 92, y + 53, false)); this.next.enabled = false; this.back.enabled = false; this.next.text = StatCollector.translateToLocal("button.recipe.next"); this.back.text = StatCollector.translateToLocal("button.recipe.previous"); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(guiTexture); int x = (this.width - this.xSize) / 2; int y = (this.height - this.ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); } protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY){ this.fontRendererObj.drawString(StatCollector.translateToLocal("container.deconstruction"), 28, 6, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } public void updateScreen(){ super.updateScreen(); ContainerDeconstructionTable container = ((ContainerDeconstructionTable) this.inventorySlots); List recipeList = this.manager.getRecipeList(container.in.getStackInSlot(0)); if(recipeList != null && container.in.getStackInSlot(0) != null && this.currentRecipeIndex <= recipeList.size()){ this.next.enabled = this.currentRecipeIndex < recipeList.size() - 1; this.back.enabled = this.currentRecipeIndex > 0; }else{ this.next.enabled = false; this.back.enabled = false; } } @Override public void drawScreen(int mouseX, int mouseY, float gameTicks) { super.drawScreen(mouseX, mouseY, gameTicks); drawToolTips(mouseX, mouseY); } protected void drawToolTips(int mouseX, int mouseY){ if(isPointInRegion(162, 56, 10, 14, mouseX, mouseY)){ drawButtonTooltip(StatCollector.translateToLocal("button.recipe.next"), mouseX, mouseY); } if(isPointInRegion(94, 56, 10, 14, mouseX, mouseY)){ drawButtonTooltip(StatCollector.translateToLocal("button.recipe.previous"), mouseX, mouseY); } } protected void drawButtonTooltip(String name, int x, int y){ List<String> lines = new ArrayList<String>(); lines.add(name); drawTooltip(lines, x, y); } protected void drawTooltip(List<String> lines, int x, int y){ GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); int tooltipWidth = 0; int tempWidth; int xStart; int yStart; for(int i = 0; i < lines.size(); i++){ tempWidth = this.fontRendererObj.getStringWidth(lines.get(i)); if(tempWidth > tooltipWidth){ tooltipWidth = tempWidth; } } xStart = x + 12; yStart = y - 12; int tooltipHeight = 8; if(lines.size() > 1){ tooltipHeight += 2 + (lines.size() - 1) * 10; } if(this.guiTop + yStart + tooltipHeight + 6 > this.height){ yStart = this.height - tooltipHeight - this.guiTop - 6; } this.zLevel = 300.0F; itemRender.zLevel = 300.0F; int color1 = -267386864; this.drawGradientRect(xStart - 3, yStart - 4, xStart + tooltipWidth + 3, yStart - 3, color1, color1); this.drawGradientRect(xStart - 3, yStart + tooltipHeight + 3, xStart + tooltipWidth + 3, yStart + tooltipHeight + 4, color1, color1); this.drawGradientRect(xStart - 3, yStart - 3, xStart + tooltipWidth + 3, yStart + tooltipHeight + 3, color1, color1); this.drawGradientRect(xStart - 4, yStart - 3, xStart - 3, yStart + tooltipHeight + 3, color1, color1); this.drawGradientRect(xStart + tooltipWidth + 3, yStart - 3, xStart + tooltipWidth + 4, yStart + tooltipHeight + 3, color1, color1); int color2 = 1347420415; int color3 = (color2 & 16711422) >> 1 | color2 & -16777216; this.drawGradientRect(xStart - 3, yStart - 3 + 1, xStart - 3 + 1, yStart + tooltipHeight + 3 - 1, color2, color3); this.drawGradientRect(xStart + tooltipWidth + 2, yStart - 3 + 1, xStart + tooltipWidth + 3, yStart + tooltipHeight + 3 - 1, color2, color3); this.drawGradientRect(xStart - 3, yStart - 3, xStart + tooltipWidth + 3, yStart - 3 + 1, color2, color2); this.drawGradientRect(xStart - 3, yStart + tooltipHeight + 2, xStart + tooltipWidth + 3, yStart + tooltipHeight + 3, color3, color3); for(int stringIndex = 0; stringIndex < lines.size(); ++stringIndex){ String line = lines.get(stringIndex); if(stringIndex == 0){ line = "\u00a7" + Integer.toHexString(15) + line; }else{ line = "\u00a77" + line; } this.fontRendererObj.drawStringWithShadow(line, xStart, yStart, -1); if(stringIndex == 0){ yStart += 2; } yStart += 10; } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); this.zLevel = 0.0F; itemRender.zLevel = 0.0F; } protected void actionPerformed(GuiButton button){ mod_Deconstruction.debug.log("button clicked."); boolean changed = false; if(button == this.next){ ++this.currentRecipeIndex; changed = true; }else if(button == this.back){ --this.currentRecipeIndex; changed = true; } if(changed){ if(world.isRemote){ //!world.isRemote does not run, and anything true crashes. mod_Deconstruction.debug.log("Sending index packet: "+ this.getCurrentRecipeIndex()); mod_Deconstruction.instance.networkWrapper.sendToServer(new PacketIndex(this.getCurrentRecipeIndex())); } } } public int getCurrentRecipeIndex(){ return this.currentRecipeIndex; } public class GuiButtonDecon extends GuiButton { private final boolean mirrored; public String text = ""; protected GuiDeconstructionTable guiDeconstructionTable; private ResourceLocation guiTexture = new ResourceLocation(Resources.MOD_ID, "textures/gui/deconstruction.png"); public GuiButtonDecon(int buttonId, int x, int y, boolean mirrored) { super(buttonId, x, y, 12, 19, ""); this.mirrored = mirrored; } public void drawButtonForegroundLayer(int mouseX, int mouseY){ super.drawButtonForegroundLayer(mouseX, mouseY); } public void drawButton(Minecraft minecraft, int mouseX, int mouseY){ if(this.visible){ minecraft.getTextureManager().bindTexture(guiTexture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); boolean mouseOnButton = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + 12 && mouseY < this.yPosition + 19; int textureY = 0; int textureX = 176; if(!this.enabled){ textureX += 24; }else if(mouseOnButton){ textureX += 12; } if(!this.mirrored){ textureY += 19; } this.drawTexturedModalRect(this.xPosition, this.yPosition, textureX, textureY, 12, 19); } } }
April 9, 201510 yr Question: Why is this line here? MinecraftForge.EVENT_BUS.register(this); Your main mod is not, and should not be, an event handler. Yes, it has @EventHandler annotations, but the event bus looks for @SubscribeEvent (which you do not have), so why are you trying to subscribe your main class to the event bus? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 9, 201510 yr Author Every IMessage class needs a default constructor (no arguments) so that FML can create an instance of it when the packet is received. Thanks! this worked. -bdkuhman
April 9, 201510 yr Author Question: Why is this line here? MinecraftForge.EVENT_BUS.register(this); Your main mod is not, and should not be, an event handler. Yes, it has @EventHandler annotations, but the event bus looks for @SubscribeEvent (which you do not have), so why are you trying to subscribe your main class to the event bus? I actually do have a SubscribeEvent to RenderGameOverlayEvent, but just did not include it in the post.
April 9, 201510 yr I actually do have a SubscribeEvent to RenderGameOverlayEvent, but just did not include it in the post. Create a new class. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.