From 07fd6392d34d3d86a4c816c298249f933951295b Mon Sep 17 00:00:00 2001 From: B1n_ry Date: Sat, 30 Nov 2024 00:46:49 +0100 Subject: [PATCH] Made graves indestructible to a lot of ways they could be destroyed by previously --- CHANGELOG.md | 1 + src/main/java/com/b1n_ry/yigd/Yigd.java | 2 +- src/main/java/com/b1n_ry/yigd/block/GraveBlock.java | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc7670cb..86d16aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Item loss can now optionally be applied to modded inventories ### Fixes +* Made graves indestructible to a lot of ways they could be destroyed by previously * Item loss will now not try and remove the same item twice, and count it as 2 items (more reliable how much is lost) * Running the /clear command after retrieving items from a grave no longer clears diff --git a/src/main/java/com/b1n_ry/yigd/Yigd.java b/src/main/java/com/b1n_ry/yigd/Yigd.java index d4054e69..61128858 100644 --- a/src/main/java/com/b1n_ry/yigd/Yigd.java +++ b/src/main/java/com/b1n_ry/yigd/Yigd.java @@ -40,7 +40,7 @@ public class Yigd implements ModInitializer { public static Logger LOGGER = LoggerFactory.getLogger("YIGD"); - public static GraveBlock GRAVE_BLOCK = new GraveBlock(FabricBlockSettings.create().strength(0.8f, 3600000.0f).nonOpaque()); + public static GraveBlock GRAVE_BLOCK = new GraveBlock(FabricBlockSettings.create().strength(-1.0f, 3600000.0f).nonOpaque()); public static BlockEntityType GRAVE_BLOCK_ENTITY; diff --git a/src/main/java/com/b1n_ry/yigd/block/GraveBlock.java b/src/main/java/com/b1n_ry/yigd/block/GraveBlock.java index 47ce57ab..ea7e3deb 100644 --- a/src/main/java/com/b1n_ry/yigd/block/GraveBlock.java +++ b/src/main/java/com/b1n_ry/yigd/block/GraveBlock.java @@ -264,9 +264,12 @@ public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockStat @Override @SuppressWarnings("deprecation") public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) { - if (world.getBlockEntity(pos) instanceof GraveBlockEntity grave && grave.isUnclaimed() - && !YigdConfig.getConfig().graveConfig.retrieveMethods.onBreak) { - return 0; + if (!(world.getBlockEntity(pos) instanceof GraveBlockEntity grave) || grave.isUnclaimed() + || YigdConfig.getConfig().graveConfig.retrieveMethods.onBreak) { + // Same calculations as done for "normal" blocks, except with the overwritten destroy speed of 0.8 + float f = 0.8f; + int i = player.canHarvest(state) ? 30 : 100; + return player.getBlockBreakingSpeed(state) / f / (float)i; } return super.calcBlockBreakingDelta(state, player, world, pos); }