Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. package com.nitrodev.constructio.inventory;
  2.  
  3. import com.nitrodev.constructio.gui.ContainerBag;
  4. import com.nitrodev.constructio.utils.NBTUtils;
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.inventory.IInventory;
  7. import net.minecraft.inventory.Slot;
  8. import net.minecraft.item.ItemStack;
  9.  
  10. import java.util.UUID;
  11.  
  12. public class CustomSlot extends Slot {
  13.  
  14.     ContainerBag container;
  15.  
  16.     public CustomSlot(IInventory inv, int slot, int posX, int posY, ContainerBag container) {
  17.         super(inv, slot, posX, posY);
  18.         this.container = container;
  19.     }
  20.  
  21.     @Override
  22.     public boolean canTakeStack(EntityPlayer player) {
  23.         ItemStack stack = this.inventory.getStackInSlot(this.slotNumber);
  24.         UUID uuid = NBTUtils.getUUIDFromItemStack(stack, "UUID", false);
  25.         return uuid == null || uuid.equals(this.container.containerUUID) == false;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement