Jump to content

[SOLVED] GUI crash


Bedrock_Miner

Recommended Posts

Heyho Guys!

 

I created a Item which has a gui, but when I click it to open the gui, close it and click again, I get this crash report:

 

[12:16:18] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.NullPointerException
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:657) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) ~[C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) ~[C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]
... 5 more
[12:16:18] [server thread/ERROR]: This crash report has been saved to: C:\Users\Julian\git\Magicum\Magicum\.\crash-reports\crash-2014-11-29_12.16.18-server.txt
[12:16:18] [server thread/INFO]: Stopping server
[12:16:18] [server thread/INFO]: Saving players
[12:16:18] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// Oops.

Time: 29.11.14 12:16
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:657)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:657)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@6852fbac
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_60-ea, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 281729216 bytes (268 MB) / 608174080 bytes (580 MB) up to 943194112 bytes (899 MB)
JVM Flags: 0 total; 
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 5 mods loaded, 5 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
minersbasic{1.0.0} [Miner's Basic] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
magicum{pre-0.1.0} [Magicum] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['_Bedrock_Miner_'/208, l='Magicum', x=-18,54, y=70,00, z=-174,92]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[12:16:18] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-11-29_12.16.18-server.txt
[12:16:18] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
[12:16:18] [server thread/INFO]: Saving worlds
[12:16:18] [server thread/INFO]: Saving chunks for level 'Magicum'/Overworld
[12:16:18] [server thread/INFO]: Saving chunks for level 'Magicum'/Nether
[12:16:18] [server thread/INFO]: Saving chunks for level 'Magicum'/The End
[12:16:19] [server thread/INFO] [FML]: Unloading dimension 0
[12:16:19] [server thread/INFO] [FML]: Unloading dimension -1
[12:16:19] [server thread/INFO] [FML]: Unloading dimension 1
[12:16:19] [server thread/INFO] [FML]: Applying holder lookups
[12:16:19] [server thread/INFO] [FML]: Holder lookups applied
[12:16:19] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
[12:16:19] [Client thread/INFO] [FML]: Server terminated.
AL lib: (EE) alc_cleanup: 1 device not closed

 

 

Item class:

 

package com.bedrockminer.magicum.item.classes;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import com.bedrockminer.magicum.Magicum;
import com.bedrockminer.magicum.item.ModCreativeTabs;
import com.bedrockminer.magicum.network.GuiHandler;

public class ItemCodexMagicum extends Item {

public ItemCodexMagicum(String unlocalizedName) {
	this.setUnlocalizedName(unlocalizedName);
	this.setTextureName(Magicum.MODID + ":" + unlocalizedName);
	this.setCreativeTab(ModCreativeTabs.materials);
}

@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
	if (!world.isRemote)
		player.openGui(Magicum.instance, GuiHandler.IDCodexMagicum, world, (int)player.posX, (int)player.posY, (int)player.posZ);
	return stack;
}

}

 

 

GuiClass: ( I left out some code which is used for internal stuff)

 

public class GuiCodexMagicum extends GuiScreen {

private static GuiRenderer g = GuiRenderer.instance;

private static ResourceLocation codex = new ResourceLocation(Magicum.MODID, "codex/codex.png");
private static ResourceLocation icons = new ResourceLocation(Magicum.MODID, "textures/gui/gui.png");
private static ResourceLocation entrybg = new ResourceLocation(Magicum.MODID, "codex/bg/entry.png");

private static ResourceLocation overlay_craft = new ResourceLocation(Magicum.MODID, "codex/overlay/craft.png");
private static ResourceLocation overlay_magiccraft = new ResourceLocation(Magicum.MODID, "codex/overlay/magiccraft.png");

public int guiwidth = 384;
public int guiheight = 230;
public int width;
public int height;
public int scale;
public int guileft;
public int guitop;

public int current_page = Codex.pageList.get(0).getID();
public int page_scroll_pos = 0;

public int site_scroll_x;
public int site_scroll_y;
private int last_click_x;
private int last_click_y;
private boolean dragging_site;

private GuiButton b_page_scroll_left;
private GuiButton b_page_scroll_right;
private GuiButton b_page_next;
private GuiButton b_page_prev;

private boolean is_displaying_entry = false;
private int displayedEntry;
private int entry_page = 0;

private CodexEntry entry_clicked;
private long entry_click_timer = 0;
private final long ENTRY_CLICK_ROTATE_TIME = 250L;

private ItemStack tooltip_stack;
private CodexEntry tooltip_entry;
private int tooltip_x;
private int tooltip_y;

@Override
public boolean doesGuiPauseGame() {
	return false;
}

@Override
public void drawScreen(int mouseX, int mouseY, float floatValue) {
	this.drawDefaultBackground();
	g.zLevel = 0;
	g.updateScaledResolution();
	g.reset();
        g.bindTexture(this.codex);
	g.drawTexturedRect(this.guileft, this.guitop, 512, 256, 0, 0, this.guiwidth, this.guiheight);
	String title = this.is_displaying_entry ? Codex.entryList.get(this.displayedEntry).getTitle() : Codex.pageList.get(this.current_page).getTitle();
	g.zLevel = 300;
	g.drawString(title, this.guileft + 8, this.guitop + 6, Color.LIGHT_GRAY, true);
	g.zLevel = 0;
	for (int i = 0; i < 3; i ++) {
		if (this.page_scroll_pos + i < Codex.pageList.size()) {
			g.bindTexture(this.codex);
			g.reset();
			g.drawTexturedRect(this.guileft + 300 + i * 24, this.guitop, 512, 256, this.page_scroll_pos + i == this.current_page && !this.is_displaying_entry ? 38 : 14, 230, 24, 24);
			g.drawItemStack(Codex.pageList.get(this.page_scroll_pos + i).getIconItemStack(), this.guileft + 304 + i * 24, this.guitop + 4, "");
		}
	}
	g.reset();

	if (this.entry_click_timer != 0 && this.entry_click_timer < Minecraft.getSystemTime()) {
		CodexClient.get(this.entry_clicked).onEntryClicked(this.entry_clicked, this, this.mc);
		this.entry_click_timer = 0;
	}

	if (!this.is_displaying_entry) { //Normal Background with Icons
		g.bindTexture(this.getCurrentPage().getBackground());
		g.drawTexturedRect(this.guileft + 12, this.guitop + 24, this.getCurrentPage().bg_width, this.getCurrentPage().bg_height, this.site_scroll_x - this.getCurrentPage().bg_x, this.site_scroll_y - this.getCurrentPage().bg_y, 360, 194);
		GLUtil.setScissors((this.guileft + 12) * this.scale, (this.height - this.guitop - 218) * this.scale, 360 * this.scale, 194 * this.scale);
		this.tooltip_entry = null;

		for (CodexEntry entry : this.getCurrentPage().entries) {
			GLUtil.pushMatrix();
			this.renderCodexEntry(entry, mouseX, mouseY);
			GLUtil.popMatrix();
		}
		for (CodexEntry entry : this.getCurrentPage().entries) {
			GLUtil.pushMatrix();
			this.renderCodexEntryLines(entry);
			GLUtil.popMatrix();
		}

		if (this.tooltip_entry != null) {
			CodexClient.get(this.tooltip_entry).renderEntryTooltip(this.tooltip_entry, this, this.mc, this.tooltip_x, this.tooltip_y);
		}
		this.b_page_next.visible = this.b_page_prev.visible = false;
	} else { //Content of a clicked Entry
		g.bindTexture(entrybg);
		g.zLevel = 10;
		g.drawTexturedRect(this.guileft + 12, this.guitop + 24, 512, 256, 0, 0, 360, 194);
		CodexEntry page = Codex.entryList.get(this.displayedEntry);
		if (page.getPages().length > 0) {
			while (this.entry_page * 2 + 1 > page.getPages().length) {
				this.entry_page--;
			}
			this.tooltip_stack = null;
			this.drawSiteContent(page, page.getPages()[this.entry_page * 2], this.guileft + 22, this.guitop + 30, mouseX, mouseY);
			if (this.entry_page * 2 + 2 <= page.getPages().length)
				this.drawSiteContent(page, page.getPages()[this.entry_page * 2 + 1], this.guileft + 197, this.guitop + 30, mouseX, mouseY);
			if (this.tooltip_stack != null)
				g.drawTooltip(this.tooltip_stack, this.tooltip_x, this.tooltip_y);
		}
		if (page.getPages().length > this.entry_page * 2 + 2)
			this.b_page_next.visible = true;
		else
			this.b_page_next.visible = false;
		if (this.entry_page > 0)
			this.b_page_prev.visible = true;
		else
			this.b_page_prev.visible = false;
	}
	super.drawScreen(mouseX, mouseY, floatValue);
}

@SuppressWarnings("unchecked")
@Override
public void initGui() {
	g.updateScaledResolution();
        this.width = g.scale.getScaledWidth();
        this.height = g.scale.getScaledHeight();
        this.scale = g.scale.getScaleFactor();
        this.guileft = this.width / 2 - this.guiwidth / 2;
        this.guitop = this.height / 2 - this.guiheight / 2;
	this.buttonList.add(this.b_page_scroll_left = new GuiCodexButton(0, this.guileft + 291, this.guitop + 6, true, false));
	this.buttonList.add(this.b_page_scroll_right = new GuiCodexButton(1, this.guileft + 374, this.guitop + 6, false, false));
	this.buttonList.add(this.b_page_prev = new GuiCodexButton(2, this.guileft + 20, this.guitop + 195, true, true));
	this.buttonList.add(this.b_page_next = new GuiCodexButton(3, this.guileft + 341, this.guitop + 195, false, true));
	this.b_page_scroll_left.visible = this.b_page_scroll_right.visible = Codex.pageList.size() > 3;
}

public void showEntryPage(int entryID) {
	this.is_displaying_entry = true;
	this.displayedEntry = entryID;
	this.entry_page = 0;
}

@Override
protected void actionPerformed(GuiButton btn) {
	switch (btn.id) {
	case 0:
		if (this.page_scroll_pos > 0) this.page_scroll_pos --;
		break;
	case 1:
		if (this.page_scroll_pos < Codex.pageList.size() - 3) this.page_scroll_pos ++;
		break;
	case 2:
		this.entry_page--;
		break;
	case 3:
		this.entry_page++;
		break;
	}
}

@Override
protected void keyTyped(char key, int keycode) {
	if (keycode == 1) { //Escape
		if (this.is_displaying_entry) { //Exit currently displayed entry page
			this.entry_click_timer = 0;
			this.is_displaying_entry = false;
			this.entry_page = 0;
			this.displayedEntry = 0;
		} else {
			this.mc.displayGuiScreen((GuiScreen)null);
            this.mc.setIngameFocus();
		}
	}
}
}

 

 

Write if you need more code!

Link to comment
Share on other sites

Put a breakpoint in NetHandlerPlayServer:657, and see which one of the parameters of S2FPacketSetSlot is null.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Here is the GUI Handler:

package com.bedrockminer.magicum.network;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;

import com.bedrockminer.magicum.block.tileentity.TileElementaryExtractor;
import com.bedrockminer.magicum.block.tileentity.TileMagicCrafting;
import com.bedrockminer.magicum.block.tileentity.TileMagicTable;
import com.bedrockminer.magicum.block.tileentity.TileMagicalBrewing;
import com.bedrockminer.magicum.client.gui.GuiCodexMagicum;
import com.bedrockminer.magicum.client.gui.container.ContainerElementaryExtractor;
import com.bedrockminer.magicum.client.gui.container.ContainerEmpty;
import com.bedrockminer.magicum.client.gui.container.ContainerMagicCrafting;
import com.bedrockminer.magicum.client.gui.container.ContainerMagicTable;
import com.bedrockminer.magicum.client.gui.container.ContainerMagicalBrewing;
import com.bedrockminer.magicum.client.gui.guicontainer.GuiElementaryExtractor;
import com.bedrockminer.magicum.client.gui.guicontainer.GuiMagicCrafting;
import com.bedrockminer.magicum.client.gui.guicontainer.GuiMagicTable;
import com.bedrockminer.magicum.client.gui.guicontainer.GuiMagicalBrewing;

import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

public static final int IDCodexMagicum = 0;

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == IDCodexMagicum)
		return new ContainerEmpty();

	return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == IDCodexMagicum)
		return new GuiCodexMagicum();

	return null;
}

}

 

ContainerEmpty:

package com.bedrockminer.magicum.client.gui.container;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;

public class ContainerEmpty extends Container {

@Override
public boolean canInteractWith(EntityPlayer player) {
	return true;
}

}

Link to comment
Share on other sites

If you have a Gui extending GuiScreen, you don't need an inventory at all. Just leave the

getServerGuiElement

returning null and call

player.openGui()

on the client side, instead of the server side.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.



×
×
  • Create New...

Important Information

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