Jump to content

[SOLVED][1.8] [SimpleNetworkWrapper] Crash when sending packet.


bdkuhman

Recommended Posts

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);

		}
	}

}

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • rftoolsbuilder:shielding_cutout (from lostcities-1.19-6.0.24.jar),rftoolsstorage:crafting_manager (from lostcities-1.19-6.0.24.jar),deepresonance:dense_glass (from lostcities-1.19-6.0.24.jar),restrictions:oneway (from lostcities-1.19-6.0.24.jar),restrictions:oneway_wall (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_complete (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_complete (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_broken (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_broken (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_broken_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_broken_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_vines (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_vines (from lostcities-1.19-6.0.24.jar)[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/blackboard_clear as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/flag_dye as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/flag_clear as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Loaded 36 recipes[13:50:17] [main/INFO] [Spartan Weaponry/]: Adding Diamond Weapons to the End City Treasure Loot Table![13:50:17] [main/INFO] [Spartan Weaponry/]: Adding Longbow and Heavy Crossbow related loot to the Village Fletcher Loot Table![13:50:18] [main/INFO] [Spartan Weaponry/]: Adding Iron Weapons to the Village Weaponsmith Loot Table![13:50:18] [main/ERROR] [minecraft/ServerFunctionLibrary]: Failed to load function watching:checkjava.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Unknown or incomplete command, see below for error at position 0: <--[HERE]at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?] {re:mixin}at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?] {re:mixin}at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?] {}at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] {}at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {re:computing_frames}at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {re:computing_frames}at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Unknown or incomplete command, see below for error at position 0: <--[HERE]at net.minecraft.commands.CommandFunction.m_77984_(CommandFunction.java:63) ~[server-1.19.2-20220805.130853-srg.jar%23299!/:?] {re:classloading}at net.minecraft.server.ServerFunctionLibrary.m_214320_(ServerFunctionLibrary.java:85) ~[server-1.19.2-20220805.130853-srg.jar%23299!/:?] {re:classloading}at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] {}... 6 more[13:50:18] [main/INFO] [quark/]: [Automatic Recipe Unlock] Removed 3712 recipe advancements[13:50:18] [main/INFO] [minecraft/AdvancementList]: Loaded 684 advancements[13:50:18] [main/INFO] [at.dy.se.ItemLightLevels/]: Clearing item tag to light level mapping cache[13:50:18] [main/INFO] [sl.ma.fl.tr.FluidContainerTransferManager/]: Loaded 0 dynamic modifiers in 0.246528 ms[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/wax_on with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/kill_a_mob with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/bred_all_animals with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/kill_all_mobs with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/make_a_sign_glow with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/balanced_diet with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/plant_seed with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:nether/all_effects with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/wax_off with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/adventuring_time with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:nether/all_potions with 1 patches[13:50:18] [main/INFO] [supplementaries/]: Loaded 8 flute songs[13:50:20] [main/INFO] [Spartan Weaponry/]: Finished initialising Weapon Traits & Attributes! Took 11.202781ms[13:50:20] [main/INFO] [supplementaries/]: Finished additional setup in 103 ms[13:50:20] [main/WARN] [minecraft/DedicatedServerProperties]: Failed to parse level-type biomesoplenty, defaulting to minecraft:normal[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Starting minecraft server version 1.19.2[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Loading properties[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Default game type: SURVIVAL[13:50:20] [Server thread/INFO] [minecraft/MinecraftServer]: Generating keypair[13:50:21] [Server thread/INFO] [minecraft/DedicatedServer]: Starting Minecraft server on :::25983[13:50:21] [Server thread/INFO] [minecraft/ServerConnectionListener]: Using epoll channel type[13:50:21] [Thread-0/INFO] [de.ca.ca.CaveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.ca.CaveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.st.SteveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.st.SteveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.Skinstalker/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.SkinwalkerOverhaul/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.SkinwalkerOverhaul/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.go.Goatman/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.go.Goatman/]: Server configuration has been reloaded[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 glowstone[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser finished, item count: 2[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser finished, item count: 1[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 glowstone[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser finished, item count: 2[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser finished, item count: 1[13:50:21] [Server thread/INFO] [Framework/]: Loading server configs...[13:50:22] [Server thread/INFO] [terrablender/]: Initialized TerraBlender biomes for level stem minecraft:overworld[13:50:22] [Server thread/INFO] [terrablender/]: Initialized TerraBlender biomes for level stem minecraft:the_nether[13:50:22] [Server thread/INFO] [minecraft/DedicatedServer]: Preparing level "world"[13:50:35] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for dimension minecraft:overworld[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:41] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:41] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:42] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 17%[13:50:42] [Server thread/INFO] [minecraft/LoggerChunkProgressListener]: Time elapsed: 7618 ms[13:50:42] [Server thread/INFO] [minecraft/DedicatedServer]: Done (21.501s)! For help, type "help"[13:50:42] [Server thread/INFO] [minecraft/DedicatedServer]: Starting GS4 status listener[13:50:42] [Server thread/INFO] [minecraft/GenericThread]: Thread Query Listener started[13:50:42] [Query Listener #1/INFO] [minecraft/QueryThreadGs4]: Query running on :::25983[13:50:42] [Server thread/INFO] [ne.mi.se.pe.PermissionAPI/]: Successfully initialized permission handler forge:default_handler
    • The conflict arises from discrepancies between different versions of GSON. My suggestion would be to remove your dependency on GSON 2.8.6 and opt for a different approach. Instead of using the static method JsonParser.parseString, you can create a JsonParser object and then use the parse method.   JsonParser jsonParser = new JsonParser(); jsonParser.parse(jsonString)  
    • On the download page, click the button for "Show all versions", point at the little i next to the Installer link, and use the Direct Download link that pops up. That should let you download it if you have issues with the adfocus thingy.
    • I was downloading Forge's installer for the latest Minecraft version. The official Forge page led to the familiar "press skip after countdown" ad page I've gone through many times. This time, the "Skip" button just never showed up after the countdown finished. The page for the ad was clearly bugged, because it showed as a blank white page up to the rows of pixels right at the top, where I saw a sliver of the actual page 2 or so inches tall but with the width of the whole page. I tried different versions (1.20.4 latest and 1.20.2 recommended), refreshing, closing the tab and going there again, to no avail. Then this Forum's signup Security Check wouldn't let me through. I rebooted my PC and now it did work just fine. But the download still doesn't (still no Skip button), even after booting my PC. The the ad was seemingly bugged as well, because it showed as a blank white page up to the rows of pixels right at the top, 2 or so inches tall but the width of the whole page. I even manually scrolled down to its bottom and back up, but that didn't fix it either. I sent a report of the same issue to Adfoc.us, but that led to a page labeled "Just a moment..." that doesn't lead anywhere after 10mins of waiting. Refreshing the page does nothing, and there is no confirmation message in my email. So I don't even know if the report to AdFoc.us went through. I'm stumped.
    • Did some more testing and found workaround. Newest MC and Forge for it didn't have this problem, also isolated that problem is only with fullscreen, meaning there is problem with exclusive fullscreen handling when application gets moved to background/minimized. So installing this mod fixed problem for MC 1.12.2 and forge for it https://www.curseforge.com/minecraft/mc-mods/fullscreen-windowed-borderless-for-minecraft
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.