diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/ambientaddons/mixin/MixinGuiContainer.java | 1 | ||||
-rw-r--r-- | src/main/java/com/ambientaddons/mixin/MixinPlayerControllerMP.java | 24 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/main/java/com/ambientaddons/mixin/MixinGuiContainer.java b/src/main/java/com/ambientaddons/mixin/MixinGuiContainer.java index 88e9048..4f7475d 100644 --- a/src/main/java/com/ambientaddons/mixin/MixinGuiContainer.java +++ b/src/main/java/com/ambientaddons/mixin/MixinGuiContainer.java @@ -29,7 +29,6 @@ public abstract class MixinGuiContainer extends GuiScreen { @Inject(method = "handleMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;windowClick(IIIILnet/minecraft/entity/player/EntityPlayer;)Lnet/minecraft/item/ItemStack;"), cancellable = true) private void onMouseClick(Slot slot, int slotId, int clickedButton, int clickType, CallbackInfo ci) { - System.out.println("Slot click"); if (MinecraftForge.EVENT_BUS.post(new GuiContainerEvent.SlotClickEvent(inventorySlots, gui, slot, slotId))) { ci.cancel(); } 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); + } + } +} |