Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.