From f046b5c458e3ed59b910ff7ea7a142f377d0e933 Mon Sep 17 00:00:00 2001 From: Cameron Reed Date: Sun, 19 Feb 2023 20:24:54 -0700 Subject: [PATCH] Disabling sugar cane seed will now break the bottom block --- src/main/java/cmods/haxxor/client/AutoFarmer.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/cmods/haxxor/client/AutoFarmer.java b/src/main/java/cmods/haxxor/client/AutoFarmer.java index c50d049..4b88011 100644 --- a/src/main/java/cmods/haxxor/client/AutoFarmer.java +++ b/src/main/java/cmods/haxxor/client/AutoFarmer.java @@ -31,7 +31,7 @@ public class AutoFarmer { // Really just a namespace and needed to separate thin new AutoFarmerCropType(Blocks.POTATOES, Items.POTATO, GROWTH_PATTERN.BASIC, Blocks.FARMLAND), new AutoFarmerCropType(Blocks.CARROTS, Items.CARROT, GROWTH_PATTERN.BASIC, Blocks.FARMLAND), new AutoFarmerCropType(Blocks.NETHER_WART, Items.NETHER_WART, GROWTH_PATTERN.BASIC, Blocks.SOUL_SAND), - new AutoFarmerCropType(Blocks.SUGAR_CANE, null, GROWTH_PATTERN.LEAVE_BASE, null) + new AutoFarmerCropType(Blocks.SUGAR_CANE, Items.SUGAR_CANE, GROWTH_PATTERN.LEAVE_BASE, null) }; @@ -199,7 +199,11 @@ public class AutoFarmer { // Really just a namespace and needed to separate thin if (cropType.growth_pattern == GROWTH_PATTERN.LEAVE_BASE && block.isOf(cropType.crop_type) && options.crops_enabled[i].get()) { - return isSecondBlock(client.world, pos, cropType.crop_type) ? ACTION_TYPE.BREAK : ACTION_TYPE.NONE; + if (options.seeds_enabled[i].get()) { + return isSecondBlock(client.world, pos, cropType.crop_type) ? ACTION_TYPE.BREAK : ACTION_TYPE.NONE; + } else { + return isBottomBlock(client.world, pos, cropType.crop_type) ? ACTION_TYPE.BREAK : ACTION_TYPE.NONE; + } } if (cropType.seed_type != null && cropType.planted_on != null && block.isOf(cropType.planted_on) && @@ -271,6 +275,10 @@ public class AutoFarmer { // Really just a namespace and needed to separate thin !world.getBlockState(pos.down().down()).isOf(crop_type); } + private static boolean isBottomBlock(ClientWorld world, BlockPos pos, Block crop_type) { + return world.getBlockState(pos).isOf(crop_type) && !world.getBlockState(pos.down()).isOf(crop_type); + } + private static void sendStopPackets(MinecraftClient client) { if (client.world == null || client.player == null) return;