Jump to content

GUI not opening on activation.


gmod622

Recommended Posts

Hey all!

 

So my gui isnt opening when I activate the block. I cant seem to find the problem. (No Log Report)

 

GUI:

package com.lambda.PlentifulMisc.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

import com.lambda.PlentifulMisc.blocks.tile.TileEntityCoalGenerator;
import com.lambda.PlentifulMisc.blocks.container.ContainerCoalGenerator;


/**
* User: brandon3055
* Date: 06/01/2015
*
* GuiInventoryAdvanced is a gui similar to that of a furnace. It has a progress bar and a burn time indicator.
* Both indicators have mouse over text
*/
@SideOnly(Side.CLIENT)
public class GuiCoalGenerator extends GuiContainer {

// This is the resource location for the background image
private static final ResourceLocation texture = new ResourceLocation("plentifulmisc", "textures/gui/guiCoalGenerator.png");
private TileEntityCoalGenerator tileEntity;

public GuiCoalGenerator(InventoryPlayer invPlayer, TileEntityCoalGenerator tileInventoryFurnace) {
	super(new ContainerCoalGenerator(invPlayer, tileInventoryFurnace));

	// Set the width and height of the gui
	xSize = 176;
	ySize = 207;

	this.tileEntity = tileInventoryFurnace;
}


final int FLAME_XPOS = 54;
final int FLAME_YPOS = 80;
final int FLAME_ICON_U = 178;   // texture position of flame icon
final int FLAME_ICON_V = 0;
final int FLAME_WIDTH = 9;
final int FLAME_HEIGHT = 15;
final int FLAME_X_SPACING = 18;

final int ENERGY_XPOS = -12;
final int ENERGY_YPOS = 28;
final int ENERGY_ICON_U = 176;   // texture position of energy bar
final int ENERGY_ICON_V = 21;
final int ENERGY_WIDTH = 22;
final int ENERGY_HEIGHT = 80;
final int ENERGY_X_SPACING = 18;

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
	// Bind the image texture
	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
	// Draw the image
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

	// get cook progress as a double between 0 and 1


	// draw the fuel remaining bar for each fuel slot flame
		double burnRemaining = tileEntity.fractionOfFuelRemaining(0);
		int yOffset = (int)((1.0 - burnRemaining) * FLAME_HEIGHT);
		drawTexturedModalRect(guiLeft + FLAME_XPOS + FLAME_X_SPACING, guiTop + FLAME_YPOS + yOffset,
													FLAME_ICON_U, FLAME_ICON_V + yOffset, FLAME_WIDTH, FLAME_HEIGHT - yOffset);
		// draw energy bar

		double energyRemain = tileEntity.energyDP;
		int energyMax = tileEntity.energyMax;
		int yOffsetEnergy = (int)((energyRemain - energyMax) * ENERGY_HEIGHT);
		drawTexturedModalRect(guiLeft + ENERGY_XPOS + ENERGY_X_SPACING, guiTop + ENERGY_YPOS + yOffset,
													ENERGY_ICON_U, ENERGY_ICON_V + yOffset, ENERGY_WIDTH, ENERGY_HEIGHT - yOffset);
}

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	super.drawGuiContainerForegroundLayer(mouseX, mouseY);

	final int LABEL_XPOS = 5;
	final int LABEL_YPOS = 5;
	fontRendererObj.drawString(tileEntity.getDisplayName().getUnformattedText(), LABEL_XPOS, LABEL_YPOS, Color.darkGray.getRGB());

	List<String> hoveringText = new ArrayList<String>();


	// If the mouse is over one of the burn time indicator add the burn time indicator hovering text
	for (int i = 0; i < tileEntity.FUEL_SLOTS_COUNT; ++i) {
		if (isInRect(guiLeft + FLAME_XPOS + FLAME_X_SPACING * i, guiTop + FLAME_YPOS, FLAME_WIDTH, FLAME_HEIGHT, mouseX, mouseY)) {
			hoveringText.add("Fuel Time:");
			hoveringText.add(tileEntity.secondsOfFuelRemaining(i) + "s");
		}
	}
		if (isInRect(guiLeft + ENERGY_XPOS + ENERGY_X_SPACING, guiTop + ENERGY_YPOS, ENERGY_WIDTH, ENERGY_HEIGHT, mouseX, mouseY)) {
			hoveringText.add("Energy Amount:");
			hoveringText.add(tileEntity.energyDP + " DP");
		}

	// If hoveringText is not empty draw the hovering text
	if (!hoveringText.isEmpty()){
		drawHoveringText(hoveringText, mouseX - guiLeft, mouseY - guiTop, fontRendererObj);
	}
//		// You must re bind the texture and reset the colour if you still need to use it after drawing a string
//		Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
//		GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

}

// Returns true if the given x,y coordinates are within the given rectangle
public static boolean isInRect(int x, int y, int xSize, int ySize, int mouseX, int mouseY){
	return ((mouseX >= x && mouseX <= x+xSize) && (mouseY >= y && mouseY <= y+ySize));
}
}

 

GUI Handler:

 

package com.lambda.PlentifulMisc.client.gui;

import com.lambda.PlentifulMisc.blocks.container.ContainerCoalGenerator;
import com.lambda.PlentifulMisc.blocks.container.ContainerCrate;
import com.lambda.PlentifulMisc.blocks.container.ContainerCrystallizer;
import com.lambda.PlentifulMisc.blocks.tile.TileEnityCrystallizer;
import com.lambda.PlentifulMisc.blocks.tile.TileEntityCoalGenerator;
import com.lambda.PlentifulMisc.blocks.tile.TileEntityCrate;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;


public class GuiHandler implements IGuiHandler {
private static final int GUIID_PM_223 = 223;
public static int getGuiID() {return GUIID_PM_223;}

// Gets the server side element for the given gui id- this should return a container
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID != getGuiID()) {
		System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID);
	}

	BlockPos xyz = new BlockPos(x, y, z);
	TileEntity tileEntity = world.getTileEntity(xyz);
	if (tileEntity instanceof TileEntityCrate) {
		TileEntityCrate tileEntityInventoryBasic = (TileEntityCrate) tileEntity;
		return new ContainerCrate(player.inventory, tileEntityInventoryBasic);
	}
	if (tileEntity instanceof TileEnityCrystallizer) {
		TileEnityCrystallizer tileInventoryFurnace = (TileEnityCrystallizer) tileEntity;
		return new ContainerCrystallizer(player.inventory, tileInventoryFurnace);
	}
	if (tileEntity instanceof TileEnityCrystallizer) {
		TileEntityCoalGenerator tileInventoryFurnace = (TileEntityCoalGenerator) tileEntity;
		return new ContainerCoalGenerator(player.inventory, tileInventoryFurnace);
	}
	return null;
}

// Gets the client side element for the given gui id- this should return a gui
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID != getGuiID()) {
		System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID);
	}

	BlockPos xyz = new BlockPos(x, y, z);
	TileEntity tileEntity = world.getTileEntity(xyz);
	if (tileEntity instanceof TileEntityCrate) {
		TileEntityCrate tileEntityInventoryBasic = (TileEntityCrate) tileEntity;
		return new GuiCrate(player.inventory, tileEntityInventoryBasic);
	}
	if (tileEntity instanceof TileEntity) {
		TileEnityCrystallizer tileInventoryFurnace = (TileEnityCrystallizer) tileEntity;
		return new GuiCrystallizer(player.inventory, tileInventoryFurnace);
	}
	if (tileEntity instanceof TileEntity) {
		TileEntityCoalGenerator tileInventoryFurnace = (TileEntityCoalGenerator) tileEntity;
		return new GuiCoalGenerator(player.inventory, tileInventoryFurnace);
	}
	return null;
}
}

 

Registry of the TE + GUI:

	GameRegistry.registerTileEntity(TileEntityCrate.class, "plentifulmisc_crate");
	GameRegistry.registerTileEntity(TileEnityCrystallizer.class, "plentifulmisc_crystallizer");
	GameRegistry.registerTileEntity(TileEntitySolarGenerator.class, "plentifulmisc_solargenerator");
	GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, "plentifulmisc_coalgenerator");


	NetworkRegistry.INSTANCE.registerGuiHandler(PlentifulMisc.instance, GuiRegistyHandler.getInstance());
	GuiRegistyHandler.getInstance().registerGuiHandler(new GuiHandler(), GuiHandler.getGuiID());

 

NOTE: All of my other GUIS work, just not this one

Not new to java >> New to modding.

Link to comment
Share on other sites

Annnnd your block code?

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

oh my bad:

package com.lambda.PlentifulMisc.blocks;

import javax.annotation.Nullable;

import com.lambda.PlentifulMisc.PlentifulMisc;
import com.lambda.PlentifulMisc.Reference;
import com.lambda.PlentifulMisc.blocks.tile.TileEntityCoalGenerator;
import com.lambda.PlentifulMisc.client.gui.GuiHandler;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockCoalGenerator extends BlockContainer {

public BlockCoalGenerator() {
	super(Material.ROCK);
	setUnlocalizedName(Reference.PlentifulMiscBlocks.COALGENERATOR.getUnlocalizedName());
	setRegistryName(Reference.PlentifulMiscBlocks.COALGENERATOR.getRegistryName());
}

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
	return new TileEntityCoalGenerator();
}

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
	// Uses the gui handler registered to your mod to open the gui for the given gui id
	// open on the server side only  (not sure why you shouldn't open client side too... vanilla doesn't, so we better not either)
	if (worldIn.isRemote) return true;

	playerIn.openGui(PlentifulMisc.instance, GuiHandler.getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ());
	return true;
}

// This is where you can do something when the block is broken. In this case drop the inventory's contents
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
	TileEntity tileEntity = worldIn.getTileEntity(pos);
	if (tileEntity instanceof IInventory) {
		InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileEntity);
	}
}

@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
	return BlockRenderLayer.SOLID;
}

// used by the renderer to control lighting and visibility of other blocks.
// set to false because this block doesn't fill the entire 1x1x1 space
@Override
public boolean isOpaqueCube(IBlockState iBlockState) {
	return false;
}

// used by the renderer to control lighting and visibility of other blocks, also by
// (eg) wall or fence to control whether the fence joins itself to this block
// set to false because this block doesn't fill the entire 1x1x1 space
@Override
public boolean isFullCube(IBlockState iBlockState) {
	return false;
}

// render using a BakedModel
  // required because the default (super method) is INVISIBLE for BlockContainers.
@Override
public EnumBlockRenderType getRenderType(IBlockState iBlockState) {
	return EnumBlockRenderType.MODEL;
}


}

Not new to java >> New to modding.

Link to comment
Share on other sites

Try not returning true on the client. Remove that line entirely.

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

NVM, had wrong name.

 

EDIT 2: Still same error :/

 

[19:52:04] [Client thread/FATAL]: Unreported exception thrown!
java.lang.ClassCastException: com.lambda.PlentifulMisc.blocks.tile.TileEntityCoalGenerator cannot be cast to com.lambda.PlentifulMisc.blocks.tile.TileEnityCrystallizer
at com.lambda.PlentifulMisc.client.gui.GuiHandler.getClientGuiElement(GuiHandler.java:59) ~[GuiHandler.class:?]
at com.lambda.PlentifulMisc.client.gui.GuiRegistyHandler.getClientGuiElement(GuiRegistyHandler.java:37) ~[GuiRegistyHandler.class:?]
at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:273) ~[NetworkRegistry.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:110) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2729) ~[EntityPlayer.class:?]
at com.lambda.PlentifulMisc.blocks.BlockCoalGenerator.onBlockActivated(BlockCoalGenerator.java:45) ~[blockCoalGenerator.class:?]
at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:442) ~[PlayerControllerMP.class:?]
at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1603) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
[19:52:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 11/21/16 7:52 PM
Description: Unexpected error

java.lang.ClassCastException: com.lambda.PlentifulMisc.blocks.tile.TileEntityCoalGenerator cannot be cast to com.lambda.PlentifulMisc.blocks.tile.TileEnityCrystallizer
at com.lambda.PlentifulMisc.client.gui.GuiHandler.getClientGuiElement(GuiHandler.java:59)
at com.lambda.PlentifulMisc.client.gui.GuiRegistyHandler.getClientGuiElement(GuiRegistyHandler.java:37)
at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:273)
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:110)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2729)
at com.lambda.PlentifulMisc.blocks.BlockCoalGenerator.onBlockActivated(BlockCoalGenerator.java:45)
at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:442)
at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1603)
at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281)
at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1846)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118)
at net.minecraft.client.Minecraft.run(Minecraft.java:406)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


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

-- Head --
Thread: Client thread
Stacktrace:
at com.lambda.PlentifulMisc.client.gui.GuiHandler.getClientGuiElement(GuiHandler.java:59)
at com.lambda.PlentifulMisc.client.gui.GuiRegistyHandler.getClientGuiElement(GuiRegistyHandler.java:37)
at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:273)
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:110)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2729)
at com.lambda.PlentifulMisc.blocks.BlockCoalGenerator.onBlockActivated(BlockCoalGenerator.java:45)
at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:442)
at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1603)
at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2281)
at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2058)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player778'/299, l='MpServer', x=205.48, y=64.00, z=309.54]]
Chunk stats: MultiplayerChunkCache: 573, 573
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (32,64,256), Chunk: (at 0,4,0 in 2,16; contains blocks 32,0,256 to 47,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 99393 game time, 487 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 96 total; [EntityZombie['Zombie'/273, l='MpServer', x=220.50, y=59.00, z=232.50], EntitySpider['Spider'/274, l='MpServer', x=212.50, y=58.00, z=254.50], EntityCow['Cow'/275, l='MpServer', x=215.48, y=61.00, z=269.20], EntityZombie['Zombie'/276, l='MpServer', x=223.39, y=38.00, z=332.83], EntitySkeleton['Skeleton'/277, l='MpServer', x=221.46, y=51.00, z=351.70], EntitySheep['Sheep'/278, l='MpServer', x=216.82, y=62.49, z=371.94], EntityPig['Pig'/279, l='MpServer', x=210.13, y=63.00, z=387.16], EntityBat['Bat'/285, l='MpServer', x=228.45, y=36.87, z=245.50], EntityCow['Cow'/286, l='MpServer', x=224.53, y=59.00, z=264.82], EntityCow['Cow'/287, l='MpServer', x=238.69, y=66.00, z=261.81], EntityCow['Cow'/288, l='MpServer', x=238.59, y=70.00, z=300.82], EntitySheep['Sheep'/289, l='MpServer', x=233.58, y=63.00, z=330.45], EntitySheep['Sheep'/290, l='MpServer', x=233.52, y=63.00, z=329.23], EntitySkeleton['Skeleton'/291, l='MpServer', x=225.50, y=37.00, z=360.50], EntityZombie['Zombie'/292, l='MpServer', x=228.30, y=54.00, z=363.55], EntityZombie['Zombie'/293, l='MpServer', x=232.50, y=54.00, z=363.50], EntityZombie['Zombie'/294, l='MpServer', x=226.76, y=55.00, z=362.52], EntityZombie['Zombie'/295, l='MpServer', x=232.76, y=58.00, z=375.50], EntityZombie['Zombie'/296, l='MpServer', x=234.01, y=58.00, z=375.50], EntityCow['Cow'/341, l='MpServer', x=266.23, y=71.00, z=249.46], EntityCow['Cow'/342, l='MpServer', x=263.25, y=71.00, z=248.17], EntityCow['Cow'/343, l='MpServer', x=250.55, y=70.00, z=258.98], EntityCreeper['Creeper'/345, l='MpServer', x=246.50, y=37.00, z=255.50], EntityWitch['Witch'/346, l='MpServer', x=246.50, y=37.00, z=254.50], EntityCreeper['Creeper'/347, l='MpServer', x=242.50, y=37.00, z=248.50], EntityCreeper['Creeper'/348, l='MpServer', x=242.50, y=37.00, z=248.50], EntityCow['Cow'/349, l='MpServer', x=257.48, y=64.00, z=301.23], EntityZombie['entity.Zombie.name'/350, l='MpServer', x=252.50, y=27.00, z=314.50], EntitySheep['Sheep'/351, l='MpServer', x=252.51, y=77.00, z=316.81], EntityZombie['Zombie'/352, l='MpServer', x=279.24, y=18.00, z=278.51], EntityCreeper['Creeper'/353, l='MpServer', x=275.50, y=18.00, z=279.50], EntityCow['Cow'/354, l='MpServer', x=283.35, y=71.00, z=272.51], EntityCow['Cow'/355, l='MpServer', x=277.64, y=71.00, z=248.25], EntityCow['Cow'/356, l='MpServer', x=261.90, y=71.00, z=250.53], EntitySheep['Sheep'/361, l='MpServer', x=279.55, y=65.00, z=304.45], EntitySpider['Spider'/362, l='MpServer', x=258.50, y=20.00, z=326.50], EntityCow['Cow'/364, l='MpServer', x=257.45, y=75.00, z=315.55], EntityZombie['Zombie'/365, l='MpServer', x=247.51, y=20.00, z=333.12], EntityCow['Cow'/366, l='MpServer', x=254.45, y=62.53, z=328.37], EntitySheep['Sheep'/367, l='MpServer', x=257.49, y=77.00, z=356.74], EntitySheep['Sheep'/368, l='MpServer', x=276.67, y=70.00, z=334.20], EntitySheep['Sheep'/371, l='MpServer', x=262.18, y=80.00, z=368.22], EntitySkeleton['Skeleton'/372, l='MpServer', x=241.50, y=20.00, z=387.50], EntityCreeper['Creeper'/373, l='MpServer', x=280.50, y=45.00, z=365.50], EntityBat['Bat'/153, l='MpServer', x=123.24, y=39.01, z=294.37], EntityPlayerSP['Player778'/299, l='MpServer', x=205.48, y=64.00, z=309.54], EntityPig['Pig'/159, l='MpServer', x=127.30, y=63.00, z=366.41], EntitySkeleton['Skeleton'/168, l='MpServer', x=140.50, y=36.00, z=254.50], EntitySkeleton['Skeleton'/169, l='MpServer', x=143.50, y=36.00, z=256.50], EntityCow['Cow'/170, l='MpServer', x=135.80, y=67.00, z=257.17], EntityZombie['Zombie'/171, l='MpServer', x=136.55, y=42.00, z=281.76], EntityZombie['Zombie'/172, l='MpServer', x=139.31, y=11.00, z=299.61], EntitySkeleton['Skeleton'/173, l='MpServer', x=135.50, y=18.00, z=300.50], EntityZombie['Zombie'/174, l='MpServer', x=140.62, y=46.00, z=290.07], EntityZombie['Zombie'/175, l='MpServer', x=142.70, y=46.00, z=290.45], EntityZombie['Zombie'/176, l='MpServer', x=140.50, y=12.00, z=305.50], EntityCreeper['Creeper'/177, l='MpServer', x=142.19, y=35.00, z=314.23], EntityPig['Pig'/178, l='MpServer', x=137.29, y=65.00, z=315.23], EntityPig['Pig'/179, l='MpServer', x=135.29, y=64.00, z=309.49], EntitySheep['Sheep'/180, l='MpServer', x=133.43, y=63.00, z=344.21], EntityPig['Pig'/181, l='MpServer', x=129.49, y=63.00, z=387.76], EntityPig['Pig'/185, l='MpServer', x=158.14, y=71.00, z=267.19], EntityCow['Cow'/186, l='MpServer', x=147.13, y=73.00, z=276.14], EntityCreeper['Creeper'/187, l='MpServer', x=144.23, y=37.00, z=302.51], EntityZombie['Zombie'/188, l='MpServer', x=145.23, y=48.00, z=290.50], EntityCreeper['Creeper'/189, l='MpServer', x=151.50, y=37.00, z=305.50], EntityZombie['Zombie'/190, l='MpServer', x=153.57, y=49.00, z=305.77], EntityPig['Pig'/191, l='MpServer', x=146.79, y=65.00, z=309.49], EntityBat['Bat'/192, l='MpServer', x=164.76, y=32.40, z=346.25], EntitySpider['Spider'/198, l='MpServer', x=162.50, y=43.00, z=319.50], EntityZombie['Zombie'/199, l='MpServer', x=160.50, y=40.00, z=326.77], EntitySheep['Sheep'/200, l='MpServer', x=163.75, y=64.00, z=326.49], EntitySheep['Sheep'/201, l='MpServer', x=169.27, y=63.00, z=347.40], EntitySheep['Sheep'/202, l='MpServer', x=169.56, y=63.00, z=344.91], EntityCow['Cow'/214, l='MpServer', x=187.50, y=72.00, z=247.82], EntityCow['Cow'/215, l='MpServer', x=177.04, y=70.00, z=259.97], EntityCreeper['Creeper'/216, l='MpServer', x=189.50, y=29.00, z=327.50], EntityZombie['Zombie'/217, l='MpServer', x=186.79, y=29.00, z=329.48], EntityWitch['Witch'/218, l='MpServer', x=191.28, y=28.00, z=339.53], EntityCreeper['Creeper'/219, l='MpServer', x=189.79, y=27.00, z=341.59], EntityCow['Cow'/220, l='MpServer', x=179.82, y=64.00, z=344.62], EntitySheep['Sheep'/221, l='MpServer', x=183.45, y=64.00, z=339.35], EntityCreeper['Creeper'/222, l='MpServer', x=184.50, y=39.00, z=353.50], EntityBat['Bat'/237, l='MpServer', x=195.70, y=25.10, z=230.59], EntityZombie['Zombie'/241, l='MpServer', x=191.50, y=44.00, z=236.23], EntitySkeleton['Skeleton'/242, l='MpServer', x=195.30, y=57.00, z=236.50], EntitySkeleton['Skeleton'/243, l='MpServer', x=197.52, y=57.00, z=237.29], EntityCow['Cow'/244, l='MpServer', x=199.17, y=73.00, z=251.69], EntityItem['item.item.porkchopCooked'/245, l='MpServer', x=202.70, y=64.00, z=311.69], EntityCreeper['Creeper'/246, l='MpServer', x=193.50, y=29.00, z=324.50], EntityZombie['Zombie'/247, l='MpServer', x=198.93, y=25.41, z=350.70], EntitySheep['Sheep'/248, l='MpServer', x=195.12, y=62.37, z=347.47], EntityBat['Bat'/249, l='MpServer', x=205.43, y=23.05, z=362.03], EntityCreeper['Creeper'/250, l='MpServer', x=207.50, y=14.00, z=376.50], EntityPig['Pig'/251, l='MpServer', x=195.67, y=63.00, z=377.50], EntityPig['Pig'/252, l='MpServer', x=208.46, y=63.00, z=385.26]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:451)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2779)
at net.minecraft.client.Minecraft.run(Minecraft.java:435)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.10.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_101, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 511411824 bytes (487 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP 9.32 Powered by Forge 12.18.2.2125 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.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.2.2125.jar) 
UCHIJAAAA	Forge{12.18.2.2125} [Minecraft Forge] (forgeSrc-1.10.2-12.18.2.2125.jar) 
UCHIJAAAA	plentifulmisc{0.1a} [Plentiful Misc] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 375.70' Renderer: 'GeForce GTX 960/PCIe/SSE2'
Launched Version: 1.10.2
LWJGL: 2.9.4
OpenGL: GeForce GTX 960/PCIe/SSE2 GL version 4.5.0 NVIDIA 375.70, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: 
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 6x AMD FX(tm)-6300 Six-Core Processor 
[19:52:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: #@!@# Game crashed! Crash report saved to: #@!@# F:\Minecraft Workspace\1.10.x\Plentiful Misc Rewrite\run\.\crash-reports\crash-2016-11-21_19.52.04-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed

 

here is the updated gui

 

package com.lambda.PlentifulMisc.client.gui;

import com.lambda.PlentifulMisc.blocks.container.ContainerCoalGenerator;
import com.lambda.PlentifulMisc.blocks.container.ContainerCrate;
import com.lambda.PlentifulMisc.blocks.container.ContainerCrystallizer;
import com.lambda.PlentifulMisc.blocks.tile.TileEnityCrystallizer;
import com.lambda.PlentifulMisc.blocks.tile.TileEntityCoalGenerator;
import com.lambda.PlentifulMisc.blocks.tile.TileEntityCrate;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;


public class GuiHandler implements IGuiHandler {
private static final int GUIID_PM_223 = 223;
public static int getGuiID() {return GUIID_PM_223;}

// Gets the server side element for the given gui id- this should return a container
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID != getGuiID()) {
		System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID);
	}

	BlockPos xyz = new BlockPos(x, y, z);
	TileEntity tileEntity = world.getTileEntity(xyz);
	if (tileEntity instanceof TileEntityCrate) {
		TileEntityCrate tileEntityInventoryBasic = (TileEntityCrate) tileEntity;
		return new ContainerCrate(player.inventory, tileEntityInventoryBasic);
	}
	if (tileEntity instanceof TileEnityCrystallizer) {
		TileEnityCrystallizer tileInventoryFurnace = (TileEnityCrystallizer) tileEntity;
		return new ContainerCrystallizer(player.inventory, tileInventoryFurnace);
	}
	if (tileEntity instanceof TileEnityCrystallizer) {
		TileEntityCoalGenerator tileInventoryFurnace = (TileEntityCoalGenerator) tileEntity;
		return new ContainerCoalGenerator(player.inventory, tileInventoryFurnace);
	}
	return null;
}

// Gets the client side element for the given gui id- this should return a gui
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if (ID != getGuiID()) {
		System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID);
	}

	BlockPos xyz = new BlockPos(x, y, z);
	TileEntity tileEntity = world.getTileEntity(xyz);
	if (tileEntity instanceof TileEntityCrate) {
		TileEntityCrate tileEntityInventoryBasic = (TileEntityCrate) tileEntity;
		return new GuiCrate(player.inventory, tileEntityInventoryBasic);
	}
	if (tileEntity instanceof TileEntity) {
		TileEnityCrystallizer tileInventoryFurnace = (TileEnityCrystallizer) tileEntity;
		return new GuiCrystallizer(player.inventory, tileInventoryFurnace);
	}
	if (tileEntity instanceof TileEntity) {
		TileEntityCoalGenerator tileEntityCoalFurnace = (TileEntityCoalGenerator) tileEntity;
		return new GuiCoalGenerator(player.inventory, tileEntityCoalFurnace);
	}
	return null;
}
}

Not new to java >> New to modding.

Link to comment
Share on other sites

if (tileEntity instanceof TileEnityCrystallizer) {

TileEntityCoalGenerator tileInventoryFurnace = (TileEntityCoalGenerator) tileEntity;

 

if (tileEntity instanceof TileEntity) {

TileEnityCrystallizer tileInventoryFurnace = (TileEnityCrystallizer) tileEntity;

return new GuiCrystallizer(player.inventory, tileInventoryFurnace);

}

if (tileEntity instanceof TileEntity) {

TileEntityCoalGenerator tileEntityCoalFurnace = (TileEntityCoalGenerator) tileEntity;

return new GuiCoalGenerator(player.inventory, tileEntityCoalFurnace);

}

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.



×
×
  • Create New...

Important Information

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