Advertisement
Raevox

ContainerVendingMachine

Feb 22nd, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.85 KB | None | 0 0
  1. import com.skcraft.creditvendor.tileentity.TileEntityVendingMachine;
  2. import net.minecraft.entity.player.EntityPlayer;
  3. import net.minecraft.entity.player.InventoryPlayer;
  4. import net.minecraft.inventory.Container;
  5. import net.minecraft.inventory.Slot;
  6. import net.minecraft.item.ItemStack;
  7.  
  8. public class ContainerVendingMachine extends Container {
  9.     public static TileEntityVendingMachine vendingMachine;
  10.  
  11.     public ContainerVendingMachine( InventoryPlayer inventoryPlayer, TileEntityVendingMachine vendingMachine ) {
  12.         this.vendingMachine = vendingMachine;
  13.  
  14.         for( int x = 0; x < 9; x++ ) {
  15.             addSlotToContainer( new Slot( inventoryPlayer, x, 8 + ( 18 * x ), 134 ) );
  16.         }
  17.         for( int y = 0; y < 3; y++ ) {
  18.             for( int x = 0; x < 9; x++ ) {
  19.                 addSlotToContainer( new Slot( inventoryPlayer, x + ( y * 9 ) + 9, 8 + ( 18 * x ), 76 + ( y * 18 ) ) );
  20.             }
  21.         }
  22.         for( int y = 0; y < 3; y++ ) {
  23.             for( int x = 0; x < 3; x ++ ) {
  24.                 addSlotToContainer( new SlotVendingMachine( vendingMachine, x + ( y * 3 ), 8 + ( 18 * x ), 18 + ( y * 18 ) ) );
  25.             }
  26.         }
  27.         for( int y = 0; y < 3; y++ ) {
  28.             for( int x = 0; x < 3; x ++ ) {
  29.                 addSlotToContainer( new SlotVendingMachine( vendingMachine, x + ( y * 3 ) + 9, 116 + ( 18 * x ), 18 + ( y * 18 ) ) );
  30.             }
  31.         }
  32.  
  33.         addSlotToContainer( new SlotVendingMachine( vendingMachine, 18, 66, 18 ) );
  34.         addSlotToContainer( new SlotVendingMachine( vendingMachine, 19, 94, 54 ) );
  35.     }
  36.  
  37.     @Override
  38.     public boolean canInteractWith( EntityPlayer entityPlayer ) {
  39.         return vendingMachine.isUseableByPlayer( entityPlayer );
  40.     }
  41.  
  42.     @Override
  43.     public ItemStack transferStackInSlot( EntityPlayer entityPlayer, int slot ) {
  44.         return null;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement