Posted July 13, 201411 yr Hi I'm currently search how to get the placed TileEntityChest when a player place Chest. To do it, I use PlayerInteractEvent, but I think the TileEntityChest is created after PlayerInteractEvent. I see a very helpfull event list here : https://dl.dropboxusercontent.com/s/h777x7ugherqs0w/forgeevents.html when I search about similar problem in this forum, but I don't find how to solve my problem Currently I calculate the placed block with event.x/y/z and event.face. Coordinates are good, but I have always a null TileEntity and a Air block. Have you got any ideas about how could I solve my problem ? Thanks a lot
July 13, 201411 yr Use onBlockActivated() and the following line to get your data out of your TileEntity: ((TileEntityChest)par1World.getTileEntity(x, y, z)).datayouwant But be careful TileEntity can be null and if you are trying to get a null TileEntity it will crash. But in onBlockActivated() that shouldn't happend.
July 13, 201411 yr Kriki, what are you on about??? You do realize you can't add that into the pre-existing blocks, right? So can you please elaborate? We all stuff up sometimes... But I seem to be at the bottom of that pot.
July 13, 201411 yr Well, if there is a PlayerPlaceBlockEvent or something along those lines, you could check to see if the placed block was an instance of BlockChest and then retrieve the tile entity at the coordinates of the placed block (this would only work with a place block event that is called when the player has FINISHED placing the block). We all stuff up sometimes... But I seem to be at the bottom of that pot.
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.