Jump to content

Recommended Posts

Posted

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 :)

Posted

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.

Posted

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.

Posted

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.

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.

Announcements



×
×
  • Create New...

Important Information

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