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.
52 lines
2.7 KiB
Java
52 lines
2.7 KiB
Java
package net.brokenmoon.afloydironchest.mixin;
|
|
|
|
import com.moandjiezana.toml.Toml;
|
|
import net.brokenmoon.afloydironchest.IronChestMain;
|
|
import net.brokenmoon.afloydironchest.MixinInterfaces.IEntityPlayerMP;
|
|
import net.brokenmoon.afloydironchest.gui.ContainerWideChest;
|
|
import net.minecraft.src.*;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
|
|
@Mixin(value = EntityPlayerMP.class, remap = false)
|
|
public class MixinEntityPlayerMP implements IEntityPlayerMP {
|
|
|
|
@Shadow
|
|
private void getNextWindowId() {}
|
|
|
|
@Shadow
|
|
private int currentWindowId;
|
|
@Shadow
|
|
public NetServerHandler playerNetServerHandler;
|
|
|
|
public int ironchest_windowid = 0;
|
|
|
|
public void displayGUIIronChest(IInventory iinventory) {
|
|
this.getNextWindowId();
|
|
NetServerHandler.logger.info(((EntityPlayerMP)(Object)this).username + " interacted with chest at (" + ((EntityPlayerMP)(Object)this).posX + ", " + ((EntityPlayerMP)(Object)this).posY + ", " + ((EntityPlayerMP)(Object)this).posZ + ")");
|
|
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 0, iinventory.getInvName(), iinventory.getSizeInventory()));
|
|
((EntityPlayerMP)(Object)this).craftingInventory = new ContainerChest(((EntityPlayerMP)(Object)this).inventory, iinventory);
|
|
((EntityPlayerMP)(Object)this).craftingInventory.windowId = this.currentWindowId;
|
|
((EntityPlayerMP)(Object)this).craftingInventory.onContainerInit(((EntityPlayerMP)(Object)this));
|
|
}
|
|
|
|
public void displayGUIDiamondChest(IInventory iinventory) {
|
|
this.getNextWindowId();
|
|
NetServerHandler.logger.info(((EntityPlayerMP)(Object)this).username + " interacted with chest at (" + ((EntityPlayerMP)(Object)this).posX + ", " + ((EntityPlayerMP)(Object)this).posY + ", " + ((EntityPlayerMP)(Object)this).posZ + ")");
|
|
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, getIronchest_windowid(), iinventory.getInvName(), iinventory.getSizeInventory()));
|
|
((EntityPlayerMP)(Object)this).craftingInventory = new ContainerWideChest(((EntityPlayerMP)(Object)this).inventory, iinventory);
|
|
((EntityPlayerMP)(Object)this).craftingInventory.windowId = this.currentWindowId;
|
|
((EntityPlayerMP)(Object)this).craftingInventory.onContainerInit(((EntityPlayerMP)(Object)this));
|
|
}
|
|
|
|
public int getIronchest_windowid(){
|
|
if (ironchest_windowid != 0 ){
|
|
return ironchest_windowid;
|
|
} else{
|
|
Toml toml = new Toml().read(IronChestMain.getConfig());
|
|
ironchest_windowid = toml.getLong("ids.diamondWindowID", (long)7).intValue();
|
|
return getIronchest_windowid();
|
|
}
|
|
}
|
|
}
|