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

Hello Guys

 

I'm currently developing a mod for forge, and I would like to execute some code whenever a block gets changed in the world (blockBreak, blockPlace, but also TileEntityChange etc.)

 

I have found out that there is a packet sent to the client if there is a blockUpdate.

(net.minecraft.network.packet.Packet53BlockChange.java)

 

Can I use/make a hook that executes my code when the packet is sent, or is there a better way to do this?

Also, will it execute if a TileEntity changes (e.g. the player takes something out of a chest)?

 

It would also be very nice, if this could be done server-side. (My code won't render anything)

  • Author

Thanks for your reply.

 

Hooking into the breakBlock and setBlock event is a good idea, but I would also like to fire the event if a Tile Entity changes.

I think of it as a "blockChangeEvent" or "ID/Metadata/TileEntity-ChangeEvent".

 

All the data I need is the xyz-coordinate of the block.

Also, I want it to always fire, not only if a player does something.

There is no way you can detect if anything in any of those changes.

in theorie you could catch some changes by hooking markBlockForUpdate serverside, since modders have to call this to propagate the changes to the clients BUT it could also be called for no reason (and no change)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

True words. But it would be unstable because you'd never know.

yeah, but in theory you could catch those, obviously you wouldn't be able to cancel those or get any relevent information out of it because it's different between every TE, but you could catch the "update" part

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

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.