From 1678ef3eb724e97e7815f1411c5c55c6fd1138b6 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 19 Feb 2021 13:23:46 +0800 Subject: Add sub switch for plants in zero tick farm reintroducing --- .../ohmyvanillamc/mixin/Mc113809AbstractPlantStemBlockMixin.java | 4 ++-- .../com/keuin/ohmyvanillamc/mixin/Mc113809BambooBlockMixin.java | 6 +++--- .../com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java | 4 ++-- .../keuin/ohmyvanillamc/mixin/Mc113809ChorusFlowerBlockMixin.java | 6 +++--- .../com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java | 4 ++-- .../com/keuin/ohmyvanillamc/mixin/ReintroduceLlamaItemDuping.java | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin') 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)); } } -- cgit v1.2.3