public AdaptorItemHandlerPlayerInv( final EntityPlayer playerInv ) { super( new PlayerMainInvWrapper( playerInv.inventory ) ); }
@Nullable @Override public Object getTransferLocation(@Nonnull EntityPlayer object, @Nonnull String key) { if (key.equals("inventory")) return new PlayerMainInvWrapper(object.inventory); if (key.equals("ender_chest")) return new InvWrapper(object.getInventoryEnderChest()); return null; }
IItemHandler inv = new PlayerMainInvWrapper( player.inventory );
public Builder bindPlayerHotbar(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) { for (int slot = 0; slot < 9; slot++) { this.widget(new SlotWidget(new PlayerMainInvWrapper(inventoryPlayer), slot, x + slot * 18, y) .setBackgroundTexture(imageLocation) .markAsPlayerInventory()); } return this; }
public static ItemStack addStackToPlayerInventory(EntityPlayer player, ItemStack stack, boolean simulate) { if (stack == null || stack.isEmpty()) return ItemStack.EMPTY; return ItemHandlerUtil.insert(new PlayerMainInvWrapper(player.inventory), stack, simulate); }
public Builder bindPlayerInventory(InventoryPlayer inventoryPlayer, TextureArea imageLocation, int x, int y) { for (int row = 0; row < 3; row++) { for (int col = 0; col < 9; col++) { this.widget(new SlotWidget(new PlayerMainInvWrapper(inventoryPlayer), col + (row + 1) * 9, x + col * 18, y + row * 18) .setBackgroundTexture(imageLocation) .markAsPlayerInventory()); } } return bindPlayerHotbar(inventoryPlayer, imageLocation, x, y + 58); }
@SubtargetedModuleObjectMethod.Inject( module = PlethoraModules.INTROSPECTION_S, target = EntityIdentifier.Player.class, worldThread = false, doc = "function():table -- Get this player's inventory" ) public static Object[] getInventory(EntityIdentifier.Player player, @Nonnull IContext<IModuleContainer> context, @Nonnull Object[] args) throws LuaException { IItemHandler inventory = new PlayerMainInvWrapper(player.getPlayer().inventory); return new Object[]{context.makeChildId(inventory).getObject()}; }
public static boolean canPlayerSeeDemonWill(EntityPlayer player) { IItemHandler inventory = new PlayerMainInvWrapper(player.inventory); for (int i = 0; i < inventory.getSlots(); i++) { ItemStack stack = inventory.getStackInSlot(i); if (stack.isEmpty()) { continue; } if (stack.getItem() instanceof IDemonWillViewer && ((IDemonWillViewer) stack.getItem()).canSeeDemonWillAura(player.getEntityWorld(), stack, player)) { return true; } } return false; }
public static int getDemonWillResolution(EntityPlayer player) { IItemHandler inventory = new PlayerMainInvWrapper(player.inventory); for (int i = 0; i < inventory.getSlots(); i++) { ItemStack stack = inventory.getStackInSlot(i); if (stack.isEmpty()) { continue; } if (stack.getItem() instanceof IDemonWillViewer && ((IDemonWillViewer) stack.getItem()).canSeeDemonWillAura(player.getEntityWorld(), stack, player)) { return ((IDemonWillViewer) stack.getItem()).getDemonWillAuraResolution(player.getEntityWorld(), stack, player); } } return 1; }