Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param entity the entity to check
- * @param poppet the poppet variant to find
- * @return false always, poppets are not currently in the mod
- */
- public static boolean hasPoppet(EntityPlayer entity, Item poppet) {
- World world = entity.getEntityWorld();
- ExtendedWorld ext = ExtendedWorld.get(world);
- for (int i = 0; i < entity.inventory.getSizeInventory(); i++) {
- ItemStack stack = entity.inventory.getStackInSlot(i);
- if (stack.getItem() == poppet) {
- String uuid = stack.getTagCompound().getString("boundId");
- if(entity.getUniqueID().toString().equals(uuid)) {
- if (stack.getItemDamage() == 0)
- stack.damageItem(2, entity);
- else stack.damageItem(1, entity);
- return true;
- }
- }
- }
- for (NBTTagCompound poppetShelves : ext.storedPoppetShelves) {
- BlockPos pos = BlockPos.fromLong(poppetShelves.getLong("position"));
- if (world.getTileEntity(pos) instanceof TileEntityPoppetShelf) {
- TileEntityPoppetShelf te = (TileEntityPoppetShelf) world.getTileEntity(pos);
- if (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)) {
- IItemHandler handler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
- for (int slot = 0; slot < handler.getSlots(); slot++) {
- ItemStack itemStack = handler.getStackInSlot(slot);
- if (itemStack.getItem() == poppet) {
- String uuid = itemStack.getTagCompound().getString("boundId");
- if(entity.getUniqueID().toString().equals(uuid)) {
- te.damageSlot(entity, slot);
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment