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

ContainerAllocator.java (1549B)


      1 package ambos.simpletech.player.inventory;
      2 
      3 import net.minecraft.core.InventoryAction;
      4 import net.minecraft.core.entity.player.EntityPlayer;
      5 import net.minecraft.core.player.inventory.Container;
      6 import net.minecraft.core.player.inventory.IInventory;
      7 import net.minecraft.core.player.inventory.slot.Slot;
      8 
      9 import java.util.List;
     10 
     11 import ambos.simpletech.block.entity.TileEntityAllocator;
     12 
     13 public class ContainerAllocator extends Container {
     14     private final TileEntityAllocator allocator;
     15 
     16     public ContainerAllocator(IInventory playerInventory, TileEntityAllocator allocator) {
     17         this.allocator = allocator;
     18 
     19         // Adding allocator slot.
     20         this.addSlot(new Slot(allocator, 0, 80, 36));
     21 
     22         // Adding player inventory slots.
     23         for (int i = 0; i < 3; ++i) {
     24             for (int j = 0; j < 9; ++j) {
     25                 this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
     26             }
     27         }
     28 
     29         for (int i = 0; i < 9; ++i) {
     30             this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142));
     31         }
     32     }
     33 
     34     @Override
     35     public boolean isUsableByPlayer(EntityPlayer entityPlayer) {
     36         return this.allocator.canInteractWith(entityPlayer);
     37     }
     38 
     39     @Override
     40     public List<Integer> getMoveSlots(InventoryAction inventoryAction, Slot slot, int i, EntityPlayer entityPlayer) {
     41         return null;
     42     }
     43 
     44     @Override
     45     public List<Integer> getTargetSlots(InventoryAction inventoryAction, Slot slot, int i, EntityPlayer entityPlayer) {
     46         return null;
     47     }
     48 }