summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-02-19 13:23:46 +0800
committerkeuin <[email protected]>2021-02-19 17:30:04 +0800
commit1678ef3eb724e97e7815f1411c5c55c6fd1138b6 (patch)
tree3d963e147ee490786251386e52cb29f0390f8ee8 /src/main/java/com
parent50c35e926fe3abea73695b9f9ba65e6041e81d3b (diff)
Add sub switch for plants in zero tick farm reintroducingHEAD1.16.4
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java2
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java13
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java84
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809AbstractPlantStemBlockMixin.java4
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809BambooBlockMixin.java6
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java4
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809ChorusFlowerBlockMixin.java6
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java4
-rw-r--r--src/main/java/com/keuin/ohmyvanillamc/mixin/ReintroduceLlamaItemDuping.java2
9 files changed, 102 insertions, 23 deletions
diff --git a/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java b/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java
index 04cc62a..2cdad10 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/OhMyVanillaMinecraft.java
@@ -36,7 +36,7 @@ public class OhMyVanillaMinecraft implements ModInitializer {
private static final Logger LOGGER = Logger.getLogger("OhMyVanillaMinecraft");
private static final OmvmConfiguration defaultConfiguration =
- new ImmutableOmvmConfiguration(true, true, true, true, true, true);
+ new ImmutableOmvmConfiguration();
private static OmvmConfiguration configuration = null;
public static OmvmConfiguration getConfiguration() {
diff --git a/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java b/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java
index e5a34e1..4ed9d65 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/config/ImmutableOmvmConfiguration.java
@@ -3,14 +3,23 @@ package com.keuin.ohmyvanillamc.config;
public class ImmutableOmvmConfiguration extends OmvmConfiguration {
public ImmutableOmvmConfiguration() {
+ super();
}
public ImmutableOmvmConfiguration(OmvmConfiguration omvmConfiguration) {
super(omvmConfiguration);
}
- public ImmutableOmvmConfiguration(boolean fixEntityTrackerEntrySpamming, boolean disableFishSchooling, boolean disablePhantomSpawning, boolean disableWanderingTraderSpawning, boolean reintroduceLlamaItemDuplicating, boolean reintroduceZeroTickFarm) {
- super(fixEntityTrackerEntrySpamming, disableFishSchooling, disablePhantomSpawning, disableWanderingTraderSpawning, reintroduceLlamaItemDuplicating, reintroduceZeroTickFarm);
+ public ImmutableOmvmConfiguration(boolean fixEntityTrackerEntrySpamming, boolean disableFishSchooling,
+ boolean disablePhantomSpawning, boolean disableWanderingTraderSpawning,
+ boolean reintroduceLlamaItemDuplicating, boolean reintroduceZeroTickFarm,
+ boolean enableStemForceRipening, boolean enableBambooForceRipening,
+ boolean enableCactusForceRipening, boolean enableChorusFlowerForceRipening,
+ boolean enableSugarCaneForceRipening) {
+ super(fixEntityTrackerEntrySpamming, disableFishSchooling, disablePhantomSpawning,
+ disableWanderingTraderSpawning, reintroduceLlamaItemDuplicating, reintroduceZeroTickFarm,
+ enableStemForceRipening, enableBambooForceRipening, enableCactusForceRipening,
+ enableChorusFlowerForceRipening, enableSugarCaneForceRipening);
}
@Override
diff --git a/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java b/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java
index 70ce1a7..8f95b15 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/config/OmvmConfiguration.java
@@ -10,9 +10,14 @@ public class OmvmConfiguration {
private boolean disableWanderingTraderSpawning;
private boolean reintroduceLlamaItemDuplicating;
private boolean reintroduceZeroTickFarm;
+ private boolean enableStemForceRipening;
+ private boolean enableBambooForceRipening;
+ private boolean enableCactusForceRipening;
+ private boolean enableChorusFlowerForceRipening;
+ private boolean enableSugarCaneForceRipening;
public OmvmConfiguration() {
- this(true, false, false, false, false, false);
+ this(true, false, false, false, false, false, true, true, true, true, true);
}
public OmvmConfiguration(OmvmConfiguration omvmConfiguration) {
@@ -22,15 +27,30 @@ public class OmvmConfiguration {
this.disableWanderingTraderSpawning = omvmConfiguration.disableWanderingTraderSpawning;
this.reintroduceLlamaItemDuplicating = omvmConfiguration.reintroduceLlamaItemDuplicating;
this.reintroduceZeroTickFarm = omvmConfiguration.reintroduceZeroTickFarm;
- }
-
- public OmvmConfiguration(boolean fixEntityTrackerEntrySpamming, boolean disableFishSchooling, boolean disablePhantomSpawning, boolean disableWanderingTraderSpawning, boolean reintroduceLlamaItemDuplicating, boolean reintroduceZeroTickFarm) {
+ this.enableStemForceRipening = omvmConfiguration.enableStemForceRipening;
+ this.enableBambooForceRipening = omvmConfiguration.enableBambooForceRipening;
+ this.enableCactusForceRipening = omvmConfiguration.enableCactusForceRipening;
+ this.enableChorusFlowerForceRipening = omvmConfiguration.enableChorusFlowerForceRipening;
+ this.enableSugarCaneForceRipening = omvmConfiguration.enableSugarCaneForceRipening;
+ }
+
+ public OmvmConfiguration(boolean fixEntityTrackerEntrySpamming, boolean disableFishSchooling
+ , boolean disablePhantomSpawning, boolean disableWanderingTraderSpawning
+ , boolean reintroduceLlamaItemDuplicating, boolean reintroduceZeroTickFarm
+ , boolean enableStemForceRipening, boolean enableBambooForceRipening
+ , boolean enableCactusForceRipening, boolean enableChorusFlowerForceRipening
+ , boolean enableSugarCaneForceRipening) {
this.fixEntityTrackerEntrySpamming = fixEntityTrackerEntrySpamming;
this.disableFishSchooling = disableFishSchooling;
this.disablePhantomSpawning = disablePhantomSpawning;
this.disableWanderingTraderSpawning = disableWanderingTraderSpawning;
this.reintroduceLlamaItemDuplicating = reintroduceLlamaItemDuplicating;
this.reintroduceZeroTickFarm = reintroduceZeroTickFarm;
+ this.enableStemForceRipening = enableStemForceRipening;
+ this.enableBambooForceRipening = enableBambooForceRipening;
+ this.enableCactusForceRipening = enableCactusForceRipening;
+ this.enableChorusFlowerForceRipening = enableChorusFlowerForceRipening;
+ this.enableSugarCaneForceRipening = enableSugarCaneForceRipening;
}
public boolean isFixEntityTrackerEntrySpamming() {
@@ -57,6 +77,46 @@ public class OmvmConfiguration {
return reintroduceZeroTickFarm;
}
+ public boolean isEnableStemForceRipening() {
+ return enableStemForceRipening;
+ }
+
+ public void setEnableStemForceRipening(boolean enableStemForceRipening) {
+ this.enableStemForceRipening = enableStemForceRipening;
+ }
+
+ public boolean isEnableBambooForceRipening() {
+ return enableBambooForceRipening;
+ }
+
+ public void setEnableBambooForceRipening(boolean enableBambooForceRipening) {
+ this.enableBambooForceRipening = enableBambooForceRipening;
+ }
+
+ public boolean isEnableCactusForceRipening() {
+ return enableCactusForceRipening;
+ }
+
+ public void setEnableCactusForceRipening(boolean enableCactusForceRipening) {
+ this.enableCactusForceRipening = enableCactusForceRipening;
+ }
+
+ public boolean isEnableChorusFlowerForceRipening() {
+ return enableChorusFlowerForceRipening;
+ }
+
+ public void setEnableChorusFlowerForceRipening(boolean enableChorusFlowerForceRipening) {
+ this.enableChorusFlowerForceRipening = enableChorusFlowerForceRipening;
+ }
+
+ public boolean isEnableSugarCaneForceRipening() {
+ return enableSugarCaneForceRipening;
+ }
+
+ public void setEnableSugarCaneForceRipening(boolean enableSugarCaneForceRipening) {
+ this.enableSugarCaneForceRipening = enableSugarCaneForceRipening;
+ }
+
public void setFixEntityTrackerEntrySpamming(boolean fixEntityTrackerEntrySpamming) {
this.fixEntityTrackerEntrySpamming = fixEntityTrackerEntrySpamming;
}
@@ -91,12 +151,17 @@ public class OmvmConfiguration {
disablePhantomSpawning == that.disablePhantomSpawning &&
disableWanderingTraderSpawning == that.disableWanderingTraderSpawning &&
reintroduceLlamaItemDuplicating == that.reintroduceLlamaItemDuplicating &&
- reintroduceZeroTickFarm == that.reintroduceZeroTickFarm;
+ reintroduceZeroTickFarm == that.reintroduceZeroTickFarm &&
+ enableStemForceRipening == that.enableStemForceRipening &&
+ enableBambooForceRipening == that.enableBambooForceRipening &&
+ enableCactusForceRipening == that.enableCactusForceRipening &&
+ enableChorusFlowerForceRipening == that.enableChorusFlowerForceRipening &&
+ enableSugarCaneForceRipening == that.enableSugarCaneForceRipening;
}
@Override
public int hashCode() {
- return Objects.hash(fixEntityTrackerEntrySpamming, disableFishSchooling, disablePhantomSpawning, disableWanderingTraderSpawning, reintroduceLlamaItemDuplicating, reintroduceZeroTickFarm);
+ return Objects.hash(fixEntityTrackerEntrySpamming, disableFishSchooling, disablePhantomSpawning, disableWanderingTraderSpawning, reintroduceLlamaItemDuplicating, reintroduceZeroTickFarm, enableStemForceRipening, enableBambooForceRipening, enableCactusForceRipening, enableChorusFlowerForceRipening, enableSugarCaneForceRipening);
}
@Override
@@ -107,7 +172,12 @@ public class OmvmConfiguration {
s += "(Exotic Feature) Disable Phantom Spawning: " + disablePhantomSpawning + "\n";
s += "(Exotic Feature) Disable Wandering Trader Spawning: " + disableWanderingTraderSpawning + "\n";
s += "(Obsolete Vanilla Feature) Reintroduce Llama Item Duplicating: " + reintroduceLlamaItemDuplicating + "\n";
- s += "(Obsolete Vanilla Feature) Reintroduce 0-tick Plants Farm: " + reintroduceZeroTickFarm;
+ s += "(Obsolete Vanilla Feature) Reintroduce 0-tick Plants Farm: " + reintroduceZeroTickFarm + "\n";
+ s += "(Zero Tick Farm) Enable Stem Force Ripening: " + enableStemForceRipening + "\n";
+ s += "(Zero Tick Farm) Enable Bamboo Force Ripening: " + enableBambooForceRipening + "\n";
+ s += "(Zero Tick Farm) Enable Cactus Force Ripening: " + enableCactusForceRipening + "\n";
+ s += "(Zero Tick Farm) Enable Chorus Flower Force Ripening: " + enableCactusForceRipening + "\n";
+ s += "(Zero Tick Farm) Enable Sugar Cane Force Ripening: " + enableSugarCaneForceRipening + "\n";
return s;
}
}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809AbstractPlantStemBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809AbstractPlantStemBlockMixin.java
index 1571981..47e2167 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809AbstractPlantStemBlockMixin.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809AbstractPlantStemBlockMixin.java
@@ -53,7 +53,7 @@ public abstract class Mc113809AbstractPlantStemBlockMixin extends AbstractPlantP
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (!state.canPlaceAt(world, pos)) {
world.breakBlock(pos, true);
- } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableStemForceRipening()) {
realGrow(state, world, pos, random);
}
}
@@ -67,7 +67,7 @@ public abstract class Mc113809AbstractPlantStemBlockMixin extends AbstractPlantP
*/
@Overwrite
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
- if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableStemForceRipening()) {
scheduledTick(state, world, pos, random);
} else {
realGrow(state, world, pos, random);
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809BambooBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809BambooBlockMixin.java
index 07db52f..7e25bf1 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809BambooBlockMixin.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809BambooBlockMixin.java
@@ -41,7 +41,7 @@ public abstract class Mc113809BambooBlockMixin extends Block {
*/
@Overwrite
public boolean hasRandomTicks(BlockState state) {
- boolean zf = OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm();
+ boolean zf = OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableBambooForceRipening();
return ((state.get(STAGE) == 0) && !zf) || (randomTicks && zf);
}
@@ -54,7 +54,7 @@ public abstract class Mc113809BambooBlockMixin extends Block {
*/
@Overwrite
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
- if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableBambooForceRipening()) {
scheduledTick(state, world, pos, random);
} else {
realGrow(state, world, pos, random);
@@ -71,7 +71,7 @@ public abstract class Mc113809BambooBlockMixin extends Block {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (!state.canPlaceAt(world, pos)) {
world.breakBlock(pos, true);
- } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableBambooForceRipening()) {
realGrow(state, world, pos, random);
}
}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java
index ba872fb..f2381c2 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java
@@ -34,7 +34,7 @@ public abstract class Mc113809CactusBlockMixin extends Block {
*/
@Overwrite
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
- if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableCactusForceRipening()) {
scheduledTick(state, world, pos, random);
} else {
// here goes 1.16.4 version randomTick impl.
@@ -52,7 +52,7 @@ public abstract class Mc113809CactusBlockMixin extends Block {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (!state.canPlaceAt(world, pos)) {
world.breakBlock(pos, true);
- } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableCactusForceRipening()) {
realGrow(state, world, pos);
}
}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809ChorusFlowerBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809ChorusFlowerBlockMixin.java
index 0a80eb5..9f929ba 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809ChorusFlowerBlockMixin.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809ChorusFlowerBlockMixin.java
@@ -56,7 +56,7 @@ public abstract class Mc113809ChorusFlowerBlockMixin extends Block {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (!state.canPlaceAt(world, pos)) {
world.breakBlock(pos, true);
- } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableChorusFlowerForceRipening()) {
realGrow(state, world, pos, random);
}
@@ -70,7 +70,7 @@ public abstract class Mc113809ChorusFlowerBlockMixin extends Block {
*/
@Overwrite
public boolean hasRandomTicks(BlockState state) {
- boolean zf = OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm();
+ boolean zf = OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableChorusFlowerForceRipening();
return ((state.get(AGE) < 5) && !zf) || (randomTicks && zf);
}
@@ -83,7 +83,7 @@ public abstract class Mc113809ChorusFlowerBlockMixin extends Block {
*/
@Overwrite
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
- if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableChorusFlowerForceRipening()) {
scheduledTick(state, world, pos, random);
} else {
realGrow(state, world, pos, random);
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java
index 88f45fc..62b08b6 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java
@@ -34,7 +34,7 @@ public abstract class Mc113809SugarCaneBlockMixin extends Block {
*/
@Overwrite
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
- if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableSugarCaneForceRipening()) {
scheduledTick(state, world, pos, random);
} else if (world.isAir(pos.up())) { // here goes 1.16.4 version randomTick impl.
realGrow(state, world, pos);
@@ -52,7 +52,7 @@ public abstract class Mc113809SugarCaneBlockMixin extends Block {
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (!state.canPlaceAt(world, pos)) {
world.breakBlock(pos, true);
- } else if (world.isAir(pos.up()) && OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) {
+ } else if (world.isAir(pos.up()) && OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm() && OhMyVanillaMinecraft.getConfiguration().isEnableSugarCaneForceRipening()) {
realGrow(state, world, pos);
}
}
diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/ReintroduceLlamaItemDuping.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/ReintroduceLlamaItemDuping.java
index f3c0b60..fff7aff 100644
--- a/src/main/java/com/keuin/ohmyvanillamc/mixin/ReintroduceLlamaItemDuping.java
+++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/ReintroduceLlamaItemDuping.java
@@ -100,6 +100,6 @@ public abstract class ReintroduceLlamaItemDuping {
this.advancementTrackers.remove(uUID);
}
- this.sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.REMOVE_PLAYER, new ServerPlayerEntity[]{player}));
+ this.sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.REMOVE_PLAYER, player));
}
}