|
| 1 | +package com.lambda.client.mixin.client.world; |
| 2 | + |
| 3 | +import com.lambda.client.module.modules.movement.Avoid; |
| 4 | +import net.minecraft.block.Block; |
| 5 | +import net.minecraft.block.BlockAir; |
| 6 | +import net.minecraft.block.BlockCactus; |
| 7 | +import net.minecraft.block.BlockFire; |
| 8 | +import net.minecraft.block.state.IBlockState; |
| 9 | +import net.minecraft.client.Minecraft; |
| 10 | +import net.minecraft.init.Blocks; |
| 11 | +import net.minecraft.util.math.AxisAlignedBB; |
| 12 | +import net.minecraft.util.math.BlockPos; |
| 13 | +import net.minecraft.world.IBlockAccess; |
| 14 | +import org.spongepowered.asm.mixin.Mixin; |
| 15 | +import org.spongepowered.asm.mixin.injection.At; |
| 16 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 17 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
| 18 | + |
| 19 | +//dude idk this mixin is so dumb ~Aven |
| 20 | +@Mixin({Block.class, BlockAir.class, BlockFire.class, BlockCactus.class}) |
| 21 | +public class MixinGetCollisionBB { |
| 22 | + |
| 23 | + private final Minecraft mc = Minecraft.getMinecraft(); |
| 24 | + |
| 25 | + @Inject(method = "getCollisionBoundingBox", at = @At("HEAD"), cancellable = true) |
| 26 | + private void getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos, CallbackInfoReturnable<AxisAlignedBB> cir) { |
| 27 | + if (mc.world != null && Avoid.INSTANCE.isEnabled()) { |
| 28 | + Block checkBlock = getBlock(pos); |
| 29 | + if (checkBlock.equals(Blocks.FIRE) && Avoid.INSTANCE.getFire() || |
| 30 | + checkBlock.equals(Blocks.CACTUS) && Avoid.INSTANCE.getCactus() || |
| 31 | + (!mc.world.isBlockLoaded(pos, false) || pos.getY() < 0) && Avoid.INSTANCE.getUnloaded()) { |
| 32 | + cir.cancel(); |
| 33 | + cir.setReturnValue(Block.FULL_BLOCK_AABB); |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + public Block getBlock(BlockPos var0) {return mc.world.getBlockState(var0).getBlock();} |
| 38 | +} |
0 commit comments