EntityLivingMixin.java (1098B)
1 package ambos.oldbugs.mixin; 2 3 import net.minecraft.core.block.Block; 4 import net.minecraft.core.entity.EntityLiving; 5 import net.minecraft.core.util.helper.MathHelper; 6 import org.spongepowered.asm.mixin.Mixin; 7 import org.spongepowered.asm.mixin.injection.At; 8 import org.spongepowered.asm.mixin.injection.Inject; 9 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 10 11 import ambos.oldbugs.OldBugs; 12 13 @Mixin(value = EntityLiving.class, remap = false) 14 final class EntityLivingMixin { 15 @Inject(method = "canClimb", at = @At("HEAD"), cancellable = true) 16 public void increaseLadderCoverage(CallbackInfoReturnable<Boolean> cir) { 17 if (!OldBugs.LADDERS_GAPS) { 18 return; 19 } 20 21 EntityLiving self = ((EntityLiving) ((Object) this)); 22 23 int x = MathHelper.floor_double(self.x); 24 int y = MathHelper.floor_double(self.bb.minY); 25 int z = MathHelper.floor_double(self.z); 26 27 cir.setReturnValue(self.world.getBlockId(x, y, z) == Block.ladderOak.id || 28 self.world.getBlockId(x, y + 1, z) == Block.ladderOak.id); 29 } 30 }