You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.1 KiB
Java

package net.brokenmoon.afloydironchest.mixin;
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerSP;
import net.brokenmoon.afloydironchest.tileEntities.TileEntityDiamondChest;
import net.minecraft.client.Minecraft;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.Packet100OpenWindow;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = NetClientHandler.class, remap = false)
public class MixinNetClientHandler {
@Shadow
private Minecraft mc;
@Inject(method = "handleOpenWindow", at = @At("TAIL"))
public void injectMethod(Packet100OpenWindow packet100openwindow, CallbackInfo info) {
if (packet100openwindow.inventoryType == 7) {
TileEntityDiamondChest dchest = new TileEntityDiamondChest();
((IEntityPlayerSP)this.mc.thePlayer).displayGUIDiamondChest(dchest);
this.mc.thePlayer.craftingInventory.windowId = packet100openwindow.windowId;
}
}
}