Skip to content

Commit

Permalink
Made graves indestructible to a lot of ways they could be destroyed b…
Browse files Browse the repository at this point in the history
…y previously
  • Loading branch information
B1n-ry committed Nov 29, 2024
1 parent 6cb3e32 commit 07fd639
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/b1n_ry/yigd/Yigd.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<GraveBlockEntity> GRAVE_BLOCK_ENTITY;


Expand Down
9 changes: 6 additions & 3 deletions src/main/java/com/b1n_ry/yigd/block/GraveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 07fd639

Please sign in to comment.