Guest User

Untitled

a guest
Sep 22nd, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. package melonslise.runicinscription.common.inventory;
  2.  
  3. import melonslise.runicinscription.common.container.ContainerRuneInscription;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraft.init.Items;
  6. import net.minecraft.inventory.IInventory;
  7. import net.minecraft.inventory.Slot;
  8. import net.minecraft.item.ItemStack;
  9.  
  10. public class SlotRuneInscription extends Slot
  11. {  
  12.     ContainerRuneInscription containerInscription;
  13.    
  14.     public SlotRuneInscription(IInventory inventory, ContainerRuneInscription containerInscription, int index, int posX, int posY)
  15.     {
  16.         super(inventory, index, posX, posY);
  17.        
  18.         this.containerInscription = containerInscription;
  19.     }
  20.    
  21.     @Override
  22.     public boolean isItemValid(ItemStack itemStack)
  23.     {
  24.         switch (this.slotNumber)
  25.         {
  26.             case 0:
  27.                 return itemStack.getItem() == Items.dye;
  28.             case 1:
  29.                 return false;
  30.         }
  31.        
  32.         return true;
  33.     }
  34.    
  35.     @Override
  36.     public void onPickupFromSlot(EntityPlayer player, ItemStack itemStack)
  37.     {
  38.         if(this.slotNumber == 1)
  39.         {
  40.             ItemStack itemStack1 = this.inventory.getStackInSlot(0);
  41.            
  42.             if(itemStack1 != null)
  43.             {
  44.                 this.inventory.decrStackSize(0, 1);
  45.  
  46.                 for(int x = 0; x < 5; ++x)
  47.                 {
  48.                     for(int y = 0; y < 7; ++y)
  49.                     {
  50.                         this.containerInscription.grid[x][y] = true;
  51.                     }
  52.                 }
  53.             }
  54.         }
  55.     }
  56. }
Add Comment
Please, Sign In to add comment