Guest User

Untitled

a guest
Sep 20th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.14 KB | None | 0 0
  1. package melonslise.runicinscription.common.container;
  2.  
  3. import java.util.Arrays;
  4.  
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.entity.player.InventoryPlayer;
  7. import net.minecraft.inventory.Container;
  8. import net.minecraft.inventory.IInventory;
  9. import net.minecraft.inventory.InventoryCraftResult;
  10. import net.minecraft.inventory.Slot;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.world.World;
  13.  
  14. public class ContainerRuneInscription extends Container
  15. {
  16.     public boolean grid[][] = new boolean[5][7];
  17.     public IInventory craftResult;
  18.     private World worldObj;
  19.     private int posX;
  20.     private int posY;
  21.     private int posZ;
  22.    
  23.     public ContainerRuneInscription(InventoryPlayer inventoryPlayer, World world, int x, int y, int z)
  24.     {
  25.         this.craftResult = new InventoryCraftResult();
  26.         this.worldObj = world;
  27.         this.posX = x;
  28.         this.posY = y;
  29.         this.posZ = z;
  30.        
  31.         this.addSlotToContainer(new Slot(inventoryPlayer, 36, 8, 47));
  32.        
  33.         for (int i = 0; i < 3; ++i)
  34.         {
  35.             for (int k = 0; k < 9; ++k)
  36.             {
  37.                 this.addSlotToContainer(new Slot(inventoryPlayer, k + i * 9 + 9, 8 + k * 18, 124 + i * 18));
  38.             }
  39.         }
  40.        
  41.         for (int i = 0; i < 9; ++i)
  42.         {
  43.             this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 182));
  44.         }
  45.     }
  46.    
  47.     public void updateGrid(boolean[][] grid)
  48.     {
  49.         grid = this.grid;
  50.     }
  51.    
  52.     public void checkRecipes()
  53.     {
  54.        
  55.     }
  56.    
  57.     public static boolean compare2DArray(Object[][] array1, Object[][] array2)
  58.     {
  59.         for (int index = 0; index < array1.length; index ++)
  60.         {
  61.             if (!Arrays.equals(array1[index], array2[index]))
  62.             {
  63.                 return false;
  64.             }
  65.         }
  66.  
  67.         return true;
  68. }
  69.    
  70.     @Override
  71.     public ItemStack transferStackInSlot(EntityPlayer player, int fromSlot)
  72.     {
  73.         return null;
  74.        
  75.         //On shift-click
  76.     }
  77.    
  78.     public void onContainerClosed(EntityPlayer player)
  79.     {
  80.         super.onContainerClosed(player);
  81.        
  82.         for(int x = 0; x < 5; ++x)
  83.         {
  84.             for(int y = 0; y < 7; ++y)
  85.             {
  86.                 grid[x][y] = false;
  87.             }
  88.         }
  89.         //On closed
  90.     }
  91.    
  92.     @Override
  93.     public boolean canInteractWith(EntityPlayer player)
  94.     {
  95.         return true;
  96.     }
  97. }
Add Comment
Please, Sign In to add comment