Shears can defuse TNT

Shears can now defuse TNT. Each world can have a configured chance for the TNT to be defused when right clicking with a set of shears and damage dealt to the shears accordingly. If the TNT is defused then it will drop the TNT item instead and the entity removed from the world no longer existing. All the interaction is handled within the net.minecraft.world.entity.item.PrimedTnt class similar to how it is handled for when sheep are sheared.

By default the option is disabled to avoid breaking any possible vanilla mechanics.
This commit is contained in:
MrFishCakes
2025-01-12 17:41:25 -08:00
committed by granny
parent 9235733eca
commit 48b276623c
3 changed files with 42 additions and 61 deletions

View File

@@ -3422,4 +3422,11 @@ public class PurpurWorldConfig {
cauldronDripstoneWaterFillChance = (float) getDouble("blocks.cauldron.fill-chances.dripstone-water", cauldronDripstoneWaterFillChance);
cauldronDripstoneLavaFillChance = (float) getDouble("blocks.cauldron.fill-chances.dripstone-lava", cauldronDripstoneLavaFillChance);
}
public float shearsCanDefuseTntChance = 0.00F;
public boolean shearsCanDefuseTnt = false;
private void shearsCanDefuseTntSettings() {
shearsCanDefuseTntChance = (float) getDouble("gameplay-mechanics.item.shears.defuse-tnt-chance", 0.00D);
shearsCanDefuseTnt = shearsCanDefuseTntChance > 0.00F;
}
}