JimiIT92 Posted June 29, 2022 Posted June 29, 2022 (edited) I made a custom Pointed Dripstone that, when the block above is broken, it falls and on landing it spawns some dripstone drops (like vanilla dripstone does). However what if I don't want those drops but instead I just want the FallingBlockEntity that is spawned to just be destroyed? I tried this in the onFall and onBrokenAfterFall methods fallingBlockEntity.dropItem = false; but that doesn't seem to do anything. I also tried to listen for the LivingDropsEvent but since the dropped dripstone aren't technically drops, but rather ItemEntitys added to the world, that event never gets called. I even tried to listen to the EntityJoinWorldEvent and indeed I can cancel it and no dripstone will be "dropped". However there's no way that I've found to actually tell if the ItemEntity has been "spawned" by the Falling Entity or not. I can only check if it has been tossed as a drop by an entity (checking the entity owner), but I guess that's not ideal. So how can I stop the falling entity to "drop" items when it lands? Edited June 29, 2022 by JimiIT92 solved Quote Don't blame me if i always ask for your help. I just want to learn to be better
warjort Posted June 29, 2022 Posted June 29, 2022 The dropItem is only for when your block lands on say a fence and turns into a item. It doesn't stop the block getting placed otherwise. There doesn't appear to be an event where you can handle this. The one thing that behaves like you want is the Anvil and then only if the anvil's damage goes to zero from fall damage. This all hardcoded by mojang. If you use a mixin accessor to change the private field cancelDrop to true it should do what you want (that is what the anvil code does). Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
JimiIT92 Posted June 29, 2022 Author Posted June 29, 2022 Yes, this is exactly what I want to change. Not the fact that the block is placed (although it never does), but rather the "drops". I was trying to avoid using mixins as much as I can, and was rather curious about if there was a "proper" event to listen to change this behaviour Quote Don't blame me if i always ask for your help. I just want to learn to be better
warjort Posted June 29, 2022 Posted June 29, 2022 (edited) If you don't like mixins you can always use an access transformer. Edited June 29, 2022 by warjort Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
Luis_ST Posted June 29, 2022 Posted June 29, 2022 3 hours ago, warjort said: If you use a mixin accessor to change the private field cancelDrop to true it should do what you want (that is what the anvil code does). mixin is in all cases the last option you should choose, if this is possible with Reflection or an AT it should be used instead Quote
JimiIT92 Posted June 29, 2022 Author Posted June 29, 2022 I ended up using an AT to make the FallingBlockEntity constructor with the pos public, as this is what I need in the dripstone code and so I can create an extended entity that overrides the fall method and set the dropItem property to false Quote Don't blame me if i always ask for your help. I just want to learn to be better
Recommended Posts
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.