diff options
3 files changed, 37 insertions, 59 deletions
diff --git a/gradle.properties b/gradle.properties index 0739bd0..22f7834 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.16.4 yarn_mappings=1.16.4+build.9 loader_version=0.11.0 # Mod Properties -mod_version=1.5.0 +mod_version=1.5.1 maven_group=com.keuin.omvm archives_base_name=oh-my-vanilla-mc # Dependencies diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java index ea3ddf8..ba872fb 100644 --- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java +++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809CactusBlockMixin.java @@ -38,25 +38,7 @@ public abstract class Mc113809CactusBlockMixin extends Block { scheduledTick(state, world, pos, random); } else { // here goes 1.16.4 version randomTick impl. - BlockPos blockPos = pos.up(); - if (world.isAir(blockPos)) { - int i; - for (i = 1; world.getBlockState(pos.down(i)).isOf(this); ++i) { - } - - if (i < 3) { - int j = (Integer) state.get(AGE); - if (j == 15) { - world.setBlockState(blockPos, this.getDefaultState()); - BlockState blockState = (BlockState) state.with(AGE, 0); - world.setBlockState(pos, blockState, 4); - blockState.neighborUpdate(world, blockPos, this, pos, false); - } else { - world.setBlockState(pos, (BlockState) state.with(AGE, j + 1), 4); - } - - } - } + realGrow(state, world, pos); } } @@ -71,24 +53,28 @@ public abstract class Mc113809CactusBlockMixin extends Block { if (!state.canPlaceAt(world, pos)) { world.breakBlock(pos, true); } else if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) { - BlockPos blockPos = pos.up(); - if (world.isAir(blockPos)) { - int i; - for (i = 1; world.getBlockState(pos.down(i)).isOf(this); ++i) { - } + realGrow(state, world, pos); + } + } - if (i < 3) { - int j = (Integer) state.get(AGE); - if (j == 15) { - world.setBlockState(blockPos, this.getDefaultState()); - BlockState blockState = (BlockState) state.with(AGE, 0); - world.setBlockState(pos, blockState, 4); - blockState.neighborUpdate(world, blockPos, this, pos, false); - } else { - world.setBlockState(pos, (BlockState) state.with(AGE, j + 1), 4); - } + private void realGrow(BlockState state, ServerWorld world, BlockPos pos) { + BlockPos blockPos = pos.up(); + if (world.isAir(blockPos)) { + int i; + for (i = 1; world.getBlockState(pos.down(i)).isOf(this); ++i) { + } + if (i < 3) { + int j = state.get(AGE); + if (j == 15) { + world.setBlockState(blockPos, this.getDefaultState()); + BlockState blockState = state.with(AGE, 0); + world.setBlockState(pos, blockState, 4); + blockState.neighborUpdate(world, blockPos, this, pos, false); + } else { + world.setBlockState(pos, state.with(AGE, j + 1), 4); } + } } } diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java index 63874cc..88f45fc 100644 --- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java +++ b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java @@ -37,19 +37,7 @@ public abstract class Mc113809SugarCaneBlockMixin extends Block { if (OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) { scheduledTick(state, world, pos, random); } else if (world.isAir(pos.up())) { // here goes 1.16.4 version randomTick impl. - int i; - for (i = 1; world.getBlockState(pos.down(i)).isOf((SugarCaneBlock) (Object) this); ++i) { - } - - if (i < 3) { - int j = state.get(AGE); - if (j == 15) { - world.setBlockState(pos.up(), this.getDefaultState()); - world.setBlockState(pos, state.with(AGE, 0), 4); - } else { - world.setBlockState(pos, state.with(AGE, j + 1), 4); - } - } + realGrow(state, world, pos); } } @@ -65,18 +53,22 @@ public abstract class Mc113809SugarCaneBlockMixin extends Block { if (!state.canPlaceAt(world, pos)) { world.breakBlock(pos, true); } else if (world.isAir(pos.up()) && OhMyVanillaMinecraft.getConfiguration().isReintroduceZeroTickFarm()) { - int i; - for (i = 1; world.getBlockState(pos.down(i)).isOf((SugarCaneBlock) (Object) this); ++i) { - } + realGrow(state, world, pos); + } + } + + private void realGrow(BlockState state, ServerWorld world, BlockPos pos) { + int i; + for (i = 1; world.getBlockState(pos.down(i)).isOf((SugarCaneBlock) (Object) this); ++i) { + } - if (i < 3) { - int j = state.get(AGE); - if (j == 15) { - world.setBlockState(pos.up(), this.getDefaultState()); - world.setBlockState(pos, state.with(AGE, 0), 4); - } else { - world.setBlockState(pos, state.with(AGE, j + 1), 4); - } + if (i < 3) { + int j = state.get(AGE); + if (j == 15) { + world.setBlockState(pos.up(), this.getDefaultState()); + world.setBlockState(pos, state.with(AGE, 0), 4); + } else { + world.setBlockState(pos, state.with(AGE, j + 1), 4); } } } |