Posted February 11, 201510 yr 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; } }
February 11, 201510 yr Author I'm probably wasting your time here, but I'm new to modding and I don't quite get it that well yet. Could you explain what is what, and insert the right code maybe ?
February 11, 201510 yr 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 You will never know 1.7.10 is no longer supported by forge, you are on your own.
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.