Posted August 8, 201312 yr 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)
August 8, 201312 yr 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.
August 8, 201312 yr 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-
August 8, 201312 yr 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.