simple-tech

Minecraft: Better than Adventure! mod that adds simple blocks to automate tasks
git clone git://memoryshards.xyz/simple-tech.git
Log | Files | Refs | README | LICENSE

EntityPlayerMPMixin.java (1502B)


      1 package ambos.simpletech.mixin;
      2 
      3 import net.minecraft.core.entity.player.EntityPlayer;
      4 import net.minecraft.core.net.packet.Packet100OpenWindow;
      5 import net.minecraft.core.world.World;
      6 import net.minecraft.server.entity.player.EntityPlayerMP;
      7 import net.minecraft.server.net.handler.NetServerHandler;
      8 import org.spongepowered.asm.mixin.Mixin;
      9 import org.spongepowered.asm.mixin.Shadow;
     10 
     11 import ambos.simpletech.IPlayerDisplayer;
     12 import ambos.simpletech.SimpleTech;
     13 import ambos.simpletech.block.entity.TileEntityAllocator;
     14 import ambos.simpletech.player.inventory.ContainerAllocator;
     15 
     16 @Mixin(value = EntityPlayerMP.class, remap = false)
     17 public abstract class EntityPlayerMPMixin extends EntityPlayer implements IPlayerDisplayer {
     18     @Shadow protected abstract void getNextWindowId();
     19 
     20     @Shadow public NetServerHandler playerNetServerHandler;
     21 
     22     @Shadow private int currentWindowId;
     23 
     24     public EntityPlayerMPMixin(World world) {
     25         super(world);
     26     }
     27 
     28     @Override
     29     public void simple_tech$displayGUIAllocator(TileEntityAllocator allocator) {
     30         this.getNextWindowId();
     31         this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, SimpleTech.ALLOCATOR_GUI_ID, allocator.getInvName(), allocator.getSizeInventory()));
     32         this.craftingInventory = new ContainerAllocator(this.inventory, allocator);
     33         this.craftingInventory.windowId = this.currentWindowId;
     34         this.craftingInventory.onContainerInit((EntityPlayerMP)(Object)this);
     35     }
     36 }