Jump to content

[1.8] Help with Gui Handler


Groghad

Recommended Posts

So I'm making a custom workbench and I've come across a problem. I have no clue how to make it so that "world.getBlockState" wouldn't come up as an error because it wants a BlockPos and inserting just x y z doesn't work. How do I fix this and is there an easier way of doing this?

 

Obviously I'm also getting an error on "new ContainerWorkingStation(player.inventory, world, BlockPos)" this block pos but i need it to be block pos ...

 

 

	@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
		int x, int y, int z) {
	TileEntity entity = world.getTileEntity(new BlockPos(x, y, z));

	if(ID == GrogsmodsBlocks.guiIDworkingStation){
		return ID == GrogsmodsBlocks.guiIDworkingStation && world.getBlockState(??) == GrogsmodsBlocks.guiIDworkingStation ? new ContainerWorkingStation(player.inventory, world, BlockPos) : null;
	}
}

Link to comment
Share on other sites

BlockState is a wrapped human-readable metadata (which is in MC since I can remember).

 

In 1.8 you no longer check for block and its meta, you get BlockState from it.

eg.

Block myBlock = new someBlockWhetever();

myBlock.getDefaultState() - this will return default (probably "zero" meta if you don't have block variations);

 

So yeah, in your world.getBlockState(?????) you will need to put BlockPos(x,y,z) and then compare it to GrogsmodsBlocks.guiIDworkingStation.getDefaultBlockState().

 

I mean, probably xD You will never know :P

1.7.10 is no longer supported by forge, you are on your own.

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.