From 81e45c56ceffc03e6279fdc6e5606d207672de49 Mon Sep 17 00:00:00 2001 From: Jottyfan Date: Sun, 15 Dec 2024 15:01:18 +0100 Subject: [PATCH] fixes drill harvesting bug - drills can be mined again --- gradle.properties | 2 +- .../jottyfan/quickiemod/block/BlockDrill.java | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0e4e62b..4d16e4d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.21.4+build.1 loader_version=0.16.9 # Mod Properties -mod_version=1.21.4.3 +mod_version=1.21.4.4 maven_group=de.jottyfan.quickiemod archives_base_name=quickiemod diff --git a/src/main/java/de/jottyfan/quickiemod/block/BlockDrill.java b/src/main/java/de/jottyfan/quickiemod/block/BlockDrill.java index 14335bd..668a4b7 100644 --- a/src/main/java/de/jottyfan/quickiemod/block/BlockDrill.java +++ b/src/main/java/de/jottyfan/quickiemod/block/BlockDrill.java @@ -41,10 +41,11 @@ import net.minecraft.world.World; public class BlockDrill extends FallingBlock implements BlockEntityProvider { private static final Integer MAX_FUEL = 255; public static final IntProperty FUEL = IntProperty.of("fuel", 0, MAX_FUEL); - public static final EnumProperty DIRECTION = EnumProperty.of("direction", Direction.class, Direction.values()); + public static final EnumProperty DIRECTION = EnumProperty.of("direction", Direction.class, + Direction.values()); public BlockDrill(Identifier identifier, Direction direction) { - super(AbstractBlock.Settings.create().hardness(2.5f).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier))); + super(AbstractBlock.Settings.create().hardness(0.5f).registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier))); setDefaultState(getDefaultState().with(FUEL, 0).with(DIRECTION, direction)); } @@ -68,8 +69,20 @@ public class BlockDrill extends FallingBlock implements BlockEntityProvider { @Override public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { Integer fuelLeft = state.get(FUEL); + Direction dir = state.get(DIRECTION); world.spawnEntity( new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ModItems.ITEM_CANOLABOTTLE, fuelLeft))); + Block thisBlock = ModBlocks.BLOCK_DRILL_DOWN; + if (Direction.EAST.equals(dir)) { + thisBlock = ModBlocks.BLOCK_DRILL_EAST; + } else if (Direction.SOUTH.equals(dir)) { + thisBlock = ModBlocks.BLOCK_DRILL_SOUTH; + } else if (Direction.WEST.equals(dir)) { + thisBlock = ModBlocks.BLOCK_DRILL_WEST; + } else if (Direction.NORTH.equals(dir)) { + thisBlock = ModBlocks.BLOCK_DRILL_NORTH; + } + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(thisBlock))); return super.onBreak(world, pos, state, player); }