EntityMixin.java (1417B)
1 package ambos.oldbugs.mixin; 2 3 import net.minecraft.core.block.material.Material; 4 import net.minecraft.core.entity.Entity; 5 import net.minecraft.core.util.phys.AABB; 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 = Entity.class, remap = false) 14 final class EntityMixin { 15 @Inject(method = "checkAndHandleWater", at = @At("HEAD"), cancellable = true) 16 private void onCheckAndHandleWater(CallbackInfoReturnable<Boolean> cir) { 17 if (!OldBugs.SOUTH_WEST_RULE_LIQUIDS) { 18 return; 19 } 20 21 Entity self = ((Entity) ((Object) this)); 22 AABB aabb = self.bb.expand(0.0, -0.4000000059604645, 0.0); 23 boolean res = self.world.handleMaterialAcceleration(aabb, Material.water, self); 24 cir.setReturnValue(res); 25 } 26 27 @Inject(method = "isInLava", at = @At("HEAD"), cancellable = true) 28 private void lavaInject(CallbackInfoReturnable<Boolean> cir){ 29 if (!OldBugs.SOUTH_WEST_RULE_LIQUIDS) { 30 return; 31 } 32 33 Entity self = ((Entity) ((Object) this)); 34 AABB aabb = self.bb.expand(0.0, -0.4000000059604645, 0.0); 35 boolean res = self.world.isMaterialInBB(aabb, Material.lava); 36 cir.setReturnValue(res); 37 } 38 }