Posted October 28, 201410 yr I want to render my TileEntity in a special way, so when there is an Item in a specific slot I want to render a cube representing that item in the model. When checking for the item using the following function: public boolean getHasItemInSlot(int slot) { return itemStacks[slot] != null && (itemStacks[slot].stackSize > 0); } it always returns false. Even when taking the coordinates from the tileEntity (which ARE valid) it ALWAYS returns false. TileEntitySpecialRenderer class: https://github.com/rhbvkleef/requiredstuffz/blob/master/src/main/java/tk/yteditors/requiredstuffz/renderer/TileEntityOvenRenderer.java TileEntity class: https://github.com/rhbvkleef/requiredstuffz/blob/master/src/main/java/tk/yteditors/requiredstuffz/tileEntity/TileEntityOven.java Github repo: https://github.com/rhbvkleef/requiredstuffz Check out my mod!
October 28, 201410 yr Do you have a container or something that puts the item in the tileentity? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
October 29, 201410 yr If your inventory is not being access via a Container, then you must notify the client manually of any changes to your TileEntity's data state; this is most easily done by using the combination of your TE's read/write NBT methods (provided you implemented them correctly) and overriding getDescriptionPacket and onDataPacket: @Override public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); this.writeToNBT(tag); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { readFromNBT(packet.func_148857_g()); } If your TileEntity has a lot of data being saved to NBT, then you should consider only sending the information you require, e.g. writing only the one ItemStack to the tag compound being sent in the packet, and adjusting onDataPacket accordingly. http://i.imgur.com/NdrFdld.png[/img]
October 29, 201410 yr Author Adding the functions onDataPacket and getDescriptionPacket and adding the code you showed into them, it still does not work, and I still get a FALSE return. After adding some loggers, it looks like the functions onDataPacket and getDescriptionPacket are never called. After restarting the world, the model renders correctly. Check out my mod!
October 29, 201410 yr Author Since this tile-entity only has 2 slots, 2 integers and 1 boolean stored in NBT, I think it is fair to send all of these values to the client, since I am checking 1 slot and 1 boolean for the rendering. The block now renders properly as well Check out my mod!
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.