Skip to content

Commit

Permalink
Fixed incompatibility with Bleachhack420
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrannus00 authored and MineGame159 committed Jun 6, 2024
1 parent 3e49a94 commit 580ad3f
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.world.CollisionShapeEvent;
import net.minecraft.block.BlockState;
Expand All @@ -17,16 +19,22 @@
import net.minecraft.world.BlockView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(BlockCollisionSpliterator.class)
public abstract class BlockCollisionSpliteratorMixin {
@Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"))
private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
VoxelShape shape = state.getCollisionShape(world, pos, context);

if (world != MinecraftClient.getInstance().world)
@WrapOperation(method = "computeNext",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;"
)
)
private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context, Operation<VoxelShape> original) {
VoxelShape shape = original.call(state, world, pos, context);

if (world != MinecraftClient.getInstance().world) {
return shape;
}

CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, shape));
return event.isCancelled() ? VoxelShapes.empty() : event.shape;
Expand Down

0 comments on commit 580ad3f

Please sign in to comment.