Open Parties and Claims

Open Parties and Claims

25M Downloads

[1.19.2] Block breaking by world.destroyBlock(belowBlockPos, false, player); is not blocked by claims mod

TelepathicGrunt opened this issue · 5 comments

commented

Hello, I am the dev for Bumblezone and in my mod, I have some boots that will automine certain blocks that the player is crouching on. However, I just got a report from a user that this claims mod is not preventing the blocks from being broken on Fabric 1.19.2 with the Better Minecraft modpack.

However, I am not sure why the claims mod is not working. I chose to call world.destroyBlock(belowBlockPos, false, player); because it has the player passed in and in theory, claim mods of any kind should be able to block this block breaking.
https://github.com/TelepathicGrunt/Bumblezone/blob/e80760a9fd2d3412f86b5de47514c9f4bd172d0a/src/main/java/com/telepathicgrunt/the_bumblezone/items/CarpenterBeeBoots.java#L92

Would you be able to update the claims mod to run that method through your claim's code? It may help against other mods that also call this method.

If not, what is the alternative method that would work with this claims mod?

commented

I'll look into it.
Right now, I think I'm only using the Fabric API events for block breaking protection. I can add injections too though.
This could in theory cause issues if some mod simply assumes that a block is broken after calling destroyBlock and gives something to the player. I assume it's a void method. So, ideally, mods should fire the block break event, but I know I can't really expect that.

commented

Ah I did not know about the fabric event. As for the world.destroyBlock method, it is actually a boolean return on whether it succeeded in breaking the block or not. I check the return to see if it was broken or not for keeping track of what the player breaks. So if someone uses the destroyBlock method, they should check the return before doing anything based on destruction of the block

though I do need to move some more of my code to only run when block is actually broken…

commented

Oh, alright, I was hoping it wasn't a void. That makes things easier!

commented

I took a closer look and on forge as well. Looks like neither forge nor fabric fires any block break events for world.destroyBlock. So I am going to manually fire their block break events for my boots which should work with your claims mod. I'll take the L for this issue lol. You can close if this if you want to

commented

That'd be great, thanks. I think I'll still make the additional injection for other mods though.