Stoutscientist Posted September 13, 2022 Share Posted September 13, 2022 (edited) I would like to edit say the hardness of stone using ObfuscationReflectionHelper, what's the best way to go about this? Edited September 13, 2022 by Stoutscientist edit Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted September 14, 2022 Share Posted September 14, 2022 How are you defining hardness? Are you referring to how long it takes to destroy the block? Or are you talking about the explosion resistance of the block? I would avoid performing vanilla manipulation except through the Forge API and to suggest and PR new API instead of using reflection. Quote Link to comment Share on other sites More sharing options...
Stoutscientist Posted September 14, 2022 Author Share Posted September 14, 2022 51 minutes ago, ChampionAsh5357 said: How are you defining hardness? Are you referring to how long it takes to destroy the block? Or are you talking about the explosion resistance of the block? I would avoid performing vanilla manipulation except through the Forge API and to suggest and PR new API instead of using reflection. I mean how fast the block breaks, and what does PR mean? Thanks! Quote Link to comment Share on other sites More sharing options...
warjort Posted September 14, 2022 Share Posted September 14, 2022 Just use an access transformer to make the destroySpeed a public non-final field in BlockStateBase. https://forge.gemwire.uk/wiki/Access_Transformers NOTE: There a separate explosionResistance in BlockBehaviour PR is a pull request: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests 1 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. Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted September 14, 2022 Share Posted September 14, 2022 8 hours ago, warjort said: Just use an access transformer to make the destroySpeed a public non-final field in BlockStateBase. There is no need for this. Use `PlayerEvent$BreakSpeed`. Reflection is not needed here. Quote Link to comment Share on other sites More sharing options...
Stoutscientist Posted September 14, 2022 Author Share Posted September 14, 2022 2 hours ago, ChampionAsh5357 said: There is no need for this. Use `PlayerEvent$BreakSpeed`. Reflection is not needed here. like this? @SubscribeEvent public void onBlockStartBreak(PlayerEvent.BreakSpeed event){ event.newSpeed = 5; } and will it also allow me to only do it for a specific block? Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted September 14, 2022 Share Posted September 14, 2022 If that's how you register the event listener, yes. And you are given the BlockState which holds the block context of what the player is mining, so yes. Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted September 15, 2022 Share Posted September 15, 2022 23 hours ago, Stoutscientist said: event.newSpeed = 5; How are you be able to compile this? You should use the public setter PlayerEvent$BreakSpeed#setNewSpeed. Quote Link to comment Share on other sites More sharing options...
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.