diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java index 5b144822e..c66f22dcb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java @@ -12,6 +12,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; +import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; @@ -95,7 +96,9 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { MutableBoolean seedSubtracted = new MutableBoolean(notCropButCuttable); BlockState state = stateVisited; BlockHelper.destroyBlockAs(world, pos, null, item, effectChance, stack -> { - if (!seedSubtracted.getValue() && stack.sameItem(new ItemStack(state.getBlock()))) { + if (AllConfigs.SERVER.kinetics.harvesterReplants.get() + && !seedSubtracted.getValue() + && stack.sameItem(new ItemStack(state.getBlock()))) { stack.shrink(1); seedSubtracted.setTrue(); } @@ -108,7 +111,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { private boolean isValidCrop(World world, BlockPos pos, BlockState state) { if (state.getBlock() instanceof CropsBlock) { CropsBlock crop = (CropsBlock) state.getBlock(); - if (!crop.isMaxAge(state)) + if (!crop.isMaxAge(state) && !AllConfigs.SERVER.kinetics.harvestPartiallyGrown.get()) return false; return true; } @@ -120,9 +123,10 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { if (!property.getName() .equals(BlockStateProperties.AGE_1.getName())) continue; - if (((IntegerProperty) property).getPossibleValues() - .size() - 1 != state.getValue((IntegerProperty) property) - .intValue()) + if (!AllConfigs.SERVER.kinetics.harvestPartiallyGrown.get() + && (((IntegerProperty) property).getPossibleValues().size() - 1 + != state.getValue((IntegerProperty) property) + .intValue())) continue; return true; } @@ -161,6 +165,14 @@ public class HarvesterMovementBehaviour extends MovementBehaviour { } private BlockState cutCrop(World world, BlockPos pos, BlockState state) { + if (!AllConfigs.SERVER.kinetics.harvesterReplants.get()) { + if (state.getFluidState() + .isEmpty()) + return Blocks.AIR.defaultBlockState(); + return state.getFluidState() + .createLegacyBlock(); + } + Block block = state.getBlock(); if (block instanceof CropsBlock) { CropsBlock crop = (CropsBlock) block; diff --git a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java index 1ee7ec82c..3662cba3e 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java @@ -38,6 +38,8 @@ public class CKinetics extends ConfigBase { public ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength); public ConfigEnum spawnerMovement = e(SpawnerMovementSetting.NO_PICKUP, "movableSpawners", Comments.spawnerMovement); + public ConfigBool harvestPartiallyGrown = b(false, "harvestPartiallyGrown", Comments.harvestPartiallyGrown); + public ConfigBool harvesterReplants = b(true, "harvesterReplants", Comments.harvesterReplants); public CStress stressValues = nested(1, CStress::new, Comments.stress); @@ -74,6 +76,8 @@ public class CKinetics extends ConfigBase { static String maxPistonPoles = "Maximum amount of extension poles behind a Mechanical Piston."; static String maxRopeLength = "Max length of rope available off a Rope Pulley."; static String maxCartCouplingLength = "Maximum allowed distance of two coupled minecarts."; + static String harvestPartiallyGrown = "Whether harvesters should break crops that aren't fully grown."; + static String harvesterReplants = "Whether harvesters should replant crops after harvesting."; static String stats = "Configure speed/capacity levels for requirements and indicators."; static String rpm = "[in Revolutions per Minute]"; static String su = "[in Stress Units]";