mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
Add config options for harvesters
This commit is contained in:
parent
86b0d80c1b
commit
576a5922b4
2 changed files with 21 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -38,6 +38,8 @@ public class CKinetics extends ConfigBase {
|
|||
public ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength);
|
||||
public ConfigEnum<SpawnerMovementSetting> 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]";
|
||||
|
|
Loading…
Reference in a new issue