diff options
Diffstat (limited to 'src/main/java/com/ambientaddons/mixin/MixinPlayerControllerMP.java')
-rw-r--r-- | src/main/java/com/ambientaddons/mixin/MixinPlayerControllerMP.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/ambientaddons/mixin/MixinPlayerControllerMP.java b/src/main/java/com/ambientaddons/mixin/MixinPlayerControllerMP.java new file mode 100644 index 0000000..e62f340 --- /dev/null +++ b/src/main/java/com/ambientaddons/mixin/MixinPlayerControllerMP.java @@ -0,0 +1,24 @@ +package com.ambientaddons.mixin; + +import com.ambientaddons.events.GuiContainerEvent; +import com.ambientaddons.events.HitBlockEvent; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.inventory.Slot; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.MinecraftForge; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(PlayerControllerMP.class) +public abstract class MixinPlayerControllerMP { + + @Inject(method = "clickBlock", at = @At("HEAD"), cancellable = true) + private void onClickBlock(BlockPos loc, EnumFacing face, CallbackInfoReturnable<Boolean> cir) { + if (MinecraftForge.EVENT_BUS.post(new HitBlockEvent(loc, face))) { + cir.setReturnValue(false); + } + } +} |