From 94f092015a05d0179e307468c717ad391e455742 Mon Sep 17 00:00:00 2001 From: Merrg1n <22628584+Merrg1n@users.noreply.github.com> Date: Sat, 13 Aug 2022 22:36:35 +0800 Subject: carpet ext --- .../mixin/Mc113809SugarCaneBlockMixin.java | 75 ---------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java (limited to 'src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java') diff --git a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java b/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java deleted file mode 100644 index 62b08b6..0000000 --- a/src/main/java/com/keuin/ohmyvanillamc/mixin/Mc113809SugarCaneBlockMixin.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.keuin.ohmyvanillamc.mixin; - -import com.keuin.ohmyvanillamc.OhMyVanillaMinecraft; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SugarCaneBlock; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.property.IntProperty; -import net.minecraft.util.math.BlockPos; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Random; - -@Mixin(SugarCaneBlock.class) -public abstract class Mc113809SugarCaneBlockMixin extends Block { - - public Mc113809SugarCaneBlockMixin(Settings settings) { - super(settings); - } - - @Shadow - @Final - public static IntProperty AGE; - - /** - * Revert to base class (Block) implementation of randomTick: just simply call scheduledTick. - * (both 1.15.2 and 1.16.4 are the same) - * - * @author trueKeuin - * @reason revert to the base class `Block` implementation. - */ - @Overwrite - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - 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); - } - - } - - /** - * Reintroduce the MC-113809 glitch for sugar cane. The implementation is identical to Minecraft 1.15.2. - * - * @author trueKeuin - * @reason reintroduce MC-113809 for sugar cane. - */ - @Overwrite - 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() && OhMyVanillaMinecraft.getConfiguration().isEnableSugarCaneForceRipening()) { - 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); - } - } - } -} -- cgit v1.2.3