Jump to content

[1.7.10]Server crashes after changing a Gui class variable from a block class


TominoCZ

Recommended Posts

My Block class:

 

public class LobbyBlock extends Block {

public LobbyBlock(Material rock) {
	super(rock);
	this.setBlockName("LobbyBlock");
	this.setBlockTextureName(Main.MODID + ":" + "0");
	this.setCreativeTab(Tabs.CreativeTab);
	this.setLightLevel(1F);
	this.setLightOpacity(2555);
}

public TileEntity createTileEntity(World world, int metadata) {
	return new TileEntityData();
}

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
		float par8, float par9) {

	GuiLobby.blockPosX = x;
	GuiLobby.blockPosY = y;
	GuiLobby.blockPosZ = z;
	GuiLobby.player = player;
	GuiLobby.world = world;

	TileEntityData tile = (TileEntityData) world.getTileEntity(x, y, z);

	if (tile.IsGuiOpen == false) {
		tile.IsGuiOpen = true;
		FMLNetworkHandler.openGui(player, Main.instance, 0, world, x, y, z);
	}

	return true;
}
}

 

My Gui class:

 

public class GuiLobby extends GuiScreen {

public static int blockPosX;
public static int blockPosY;
public static int blockPosZ;
public static EntityPlayer player;
public static World world;

public boolean doesGuiPauseGame() {
	return false;
}

int guiWidth = 256;
int guiHeight = 168;

@Override
public void drawScreen(int x, int y, float ticks) {
	int guiX = (width - guiWidth) / 2;
	int guiY = (height - guiHeight) / 2;

	this.buttonList.clear();
	this.buttonList.add(new GuiButton(0, guiX + 5, guiY + 5, 98, 20, I18n.format("Host Game", new Object[0])));

	GL11.glColor4f(1, 1, 1, 1);
	drawDefaultBackground();
	mc.renderEngine.bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/gui/Lobby.png"));
	drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);

	super.drawScreen(x, y, ticks);
}

@Override
protected void keyTyped(char letter, int number) {
	switch (number) {
	case 1:
		this.mc.displayGuiScreen((GuiScreen) null);
		this.mc.setIngameFocus();
		TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
		tile.IsGuiOpen = false;
		break;
	}

	switch (letter) {
	case 'e':
	case 'E':
		this.mc.displayGuiScreen((GuiScreen) null);
		this.mc.setIngameFocus();
		TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
		tile.IsGuiOpen = false;
		break;
	}
}

@Override
protected void actionPerformed(GuiButton button) {
	if (button.id == 0) {

		TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
		tile.Name = player.getDisplayName();

		world.setBlock(blockPosX, blockPosY, blockPosZ, Blocks.LobbyBlock1);

		this.mc.displayGuiScreen((GuiScreen) null);
		this.mc.setIngameFocus();
	}
}

@Override
public void onGuiClosed() {
	TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
	tile.IsGuiOpen = false;
}
}

 

My Main class:

 

@Mod(modid = Main.MODID, name = Main.NAME, version = "PreAlpha 0.0.3")
public class Main {
@Instance(Main.MODID)
public static Main instance;

public static final String MODID = "PAYDAY2";
public static final String NAME = "PAYDAY 2";
public static final String VERSION = "PreAlpha 0.0.3";

public Main() {

}

@EventHandler
@SideOnly(Side.CLIENT)
public void preInit(FMLPreInitializationEvent event) {
	FMLCommonHandler.instance().bus().register(new Events());
	Events.init();
}

@EventHandler
public void Init(FMLInitializationEvent event) {
	NetworkRegistry.INSTANCE.registerGuiHandler(Main.instance, new GuiHandler());
	GameRegistry.registerTileEntity(TileEntityData.class, "Host");
	GameRegistry.registerTileEntity(TileEntityData.class, "IsGuiOpen");
	Blocks.registerBlocks();
	Items.registerItems();
	Recipes.initShapedRecipes();
	Recipes.initShalessRecipes();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}
}

 

My GuiHandler class:

 

public class GuiHandler implements IGuiHandler {

public GuiHandler() {
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID == 0) {
		return new GuiLobby();
	}
	if (ID == 1) {
		return new GuiLobbyHosted();
	}
	if (ID == 2) {
		return new GuiLobbyHost();
	}
	return null;
}

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	// TODO Auto-generated method stub
	return null;
}
}

 

And the class I register blocks with:

 

public class Blocks {
public static Block LobbyBlock = new LobbyBlock(Material.rock);
public static Block LobbyBlock1 = new LobbyBlock1(Material.rock);
public static Block LobbyBlock2 = new LobbyBlock2(Material.rock);
public static Block LobbyBlock3 = new LobbyBlock3(Material.rock);
public static Block LobbyBlock4 = new LobbyBlock4(Material.rock);
public static Block LobbyBlockHosted = new LobbyBlockHosted(Material.rock);
public static Block LobbyBlockOccupied = new LobbyBlockOccupied(Material.rock);

public static List<Block> blockList = new ArrayList<Block>();

public static void registerBlocks() {
	blockList.add(LobbyBlock.setCreativeTab(Tabs.CreativeTab));
	blockList.add(LobbyBlock1);
	blockList.add(LobbyBlock2);
	blockList.add(LobbyBlock3);
	blockList.add(LobbyBlock4);
	blockList.add(LobbyBlockHosted);
	blockList.add(LobbyBlockOccupied);

	for (Block block : blockList) {
		GameRegistry.registerBlock(block, block.getUnlocalizedName());
	}
}
}

 

What I want is to change the blockPosX, blockPosY, blockPosZ, player and world variables that are in the GuiLobby class from the LobbyBlock class ON THE SERVER.

 

Here you have the crash log:

 

---- Minecraft Crash Report ----

// Shall we play a game?

 

Time: 9.9.15 17:13

Description: Exception in server tick loop

 

java.lang.NoClassDefFoundError: com/tominocz/PAYDAY2/gui/GuiLobby

at com.tominocz.PAYDAY2.blocks.LobbyBlock.onBlockActivated(LobbyBlock.java:34)

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)

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.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

Caused by: java.lang.ClassNotFoundException: com.tominocz.PAYDAY2.gui.GuiLobby

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 12 more

Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:760)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182)

... 14 more

Caused by: java.lang.ClassNotFoundException: net.minecraft.client.gui.GuiScreen

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:101)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 18 more

 

 

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

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_60, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 929853040 bytes (886 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

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.99.99 Minecraft Forge 10.13.4.1492 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)

UCHIJAAAA Forge{10.13.4.1492} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)

UCHIJAAAA PAYDAY2{PreAlpha 0.0.3} [PAYDAY 2] (bin)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 1 / 20; [EntityPlayerMP['Player32'/365, l='world', x=128,50, y=67,00, z=246,50]]

Is Modded: Definitely; Server brand changed to 'fml,forge'

Type: Dedicated Server (map_server.txt)

 

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



×
×
  • Create New...

Important Information

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