net.minecraft.inventory.InventoryBasic Java Examples
The following examples show how to use
net.minecraft.inventory.InventoryBasic.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityTofunian.java From TofuCraftReload with MIT License | 5 votes |
public EntityTofunian(World worldIn) { super(worldIn); this.villagerInventory = new InventoryBasic("Items", false, 8); this.setSize(0.45F, 1.4F); ((PathNavigateGround) this.getNavigator()).setBreakDoors(true); this.setCanPickUpLoot(true); }
Example #2
Source File: NEIServerPacketHandler.java From NotEnoughItems with MIT License | 5 votes |
private void openPotionGui(EntityPlayerMP player, PacketCustom packet) { InventoryBasic b = new InventoryBasic("potionStore", true, 9); for (int i = 0; i < b.getSizeInventory(); i++) { b.setInventorySlotContents(i, packet.readItemStack()); } ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), (player1, windowId) -> { PacketCustom packet1 = new PacketCustom(channel, 24); packet1.writeByte(windowId); packet1.sendToPlayer(player1); }); }
Example #3
Source File: ContainerPotionCreator.java From NotEnoughItems with MIT License | 5 votes |
public ContainerPotionCreator(InventoryPlayer inventoryPlayer, IInventory potionStoreInv) { playerInv = inventoryPlayer; potionInv = new InventoryBasic("Potion", true, 1); this.potionStoreInv = potionStoreInv; addSlotToContainer(new SlotPotion(potionInv, 0, 25, 102)); for (int i = 0; i < 9; i++) { addSlotToContainer(new SlotPotionStore(potionStoreInv, i, 8 + i * 18, 14)); } bindPlayerInventory(inventoryPlayer, 8, 125); }
Example #4
Source File: ContainerPotionCreator.java From NotEnoughItems with MIT License | 5 votes |
public ContainerPotionCreator(InventoryPlayer inventoryPlayer, IInventory potionStoreInv) { playerInv = inventoryPlayer; potionInv = new InventoryBasic("Potion", true, 1); this.potionStoreInv = potionStoreInv; addSlotToContainer(new SlotPotion(potionInv, 0, 25, 102)); for (int i = 0; i < 9; i++) addSlotToContainer(new SlotPotionStore(potionStoreInv, i, 8 + i * 18, 14)); bindPlayerInventory(inventoryPlayer, 8, 125); }
Example #5
Source File: EntityAIHarvestTofuFarmland.java From TofuCraftReload with MIT License | 4 votes |
/** * Keep ticking a continuous task that has already been started */ public void updateTask() { super.updateTask(); this.villager.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.villager.getVerticalFaceSpeed()); if (this.getIsAboveDestination()) { World world = this.villager.world; BlockPos blockpos = this.destinationBlock.up(); IBlockState iblockstate = world.getBlockState(blockpos); Block block = iblockstate.getBlock(); if (this.currentTask == 0 && block instanceof BlockCrops && ((BlockCrops)block).isMaxAge(iblockstate)) { world.destroyBlock(blockpos, true); } else if (this.currentTask == 1 && iblockstate.getMaterial() == Material.AIR) { InventoryBasic inventorybasic = this.villager.getVillagerInventory(); for (int i = 0; i < inventorybasic.getSizeInventory(); ++i) { ItemStack itemstack = inventorybasic.getStackInSlot(i); boolean flag = false; if (!itemstack.isEmpty()) { if (itemstack.getItem() == Items.WHEAT_SEEDS) { world.setBlockState(blockpos, Blocks.WHEAT.getDefaultState(), 3); flag = true; } else if (itemstack.getItem() == Items.POTATO) { world.setBlockState(blockpos, Blocks.POTATOES.getDefaultState(), 3); flag = true; } else if (itemstack.getItem() == Items.CARROT) { world.setBlockState(blockpos, Blocks.CARROTS.getDefaultState(), 3); flag = true; } else if (itemstack.getItem() == Items.BEETROOT_SEEDS) { world.setBlockState(blockpos, Blocks.BEETROOTS.getDefaultState(), 3); flag = true; } else if (itemstack.getItem() instanceof net.minecraftforge.common.IPlantable) { if(((net.minecraftforge.common.IPlantable)itemstack.getItem()).getPlantType(world,blockpos) == net.minecraftforge.common.EnumPlantType.Crop) { world.setBlockState(blockpos, ((net.minecraftforge.common.IPlantable)itemstack.getItem()).getPlant(world,blockpos),3); flag = true; } } } if (flag) { itemstack.shrink(1); if (itemstack.isEmpty()) { inventorybasic.setInventorySlotContents(i, ItemStack.EMPTY); } break; } } } this.currentTask = -1; this.runDelay = 10; } }
Example #6
Source File: EntityTofunian.java From TofuCraftReload with MIT License | 4 votes |
public InventoryBasic getVillagerInventory() { return villagerInventory; }
Example #7
Source File: CapabilityMinecartDestination.java From Signals with GNU General Public License v3.0 | 4 votes |
public InventoryBasic getFuelInv(){ return fuelInv; }
Example #8
Source File: GuiSearcher.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
/** * Returns the creative inventory */ public InventoryBasic getInventory(){ return inventory; }
Example #9
Source File: TileRequest.java From HoloInventory with MIT License | 4 votes |
@Override public ResponseMessage onMessage(TileRequest message, MessageContext ctx) { World world = DimensionManager.getWorld(message.dim); if (world == null) return null; TileEntity te = world.getTileEntity(message.pos); if (te == null) return null; if (Helper.banned.contains(te.getClass().getCanonicalName())) return null; if (te instanceof ILockableContainer && !ctx.getServerHandler().player.canOpen(((ILockableContainer) te).getLockCode())) return null; if (te instanceof TileEntityEnderChest) { return new PlainInventory(message.pos, ctx.getServerHandler().player.getInventoryEnderChest()); } else if (te instanceof BlockJukebox.TileEntityJukebox) { InventoryBasic ib = new InventoryBasic("minecraft:jukebox", false, 1); ib.setInventorySlotContents(0, ((BlockJukebox.TileEntityJukebox) te).getRecord()); return new PlainInventory(message.pos, ib).setName(Blocks.JUKEBOX.getUnlocalizedName()); } else if (te instanceof TileEntityChest) { Block b = world.getBlockState(message.pos).getBlock(); if (b instanceof BlockChest) { IInventory i = ((BlockChest) b).getLockableContainer(world, message.pos); if (i != null) return new PlainInventory(message.pos, i); return null; } return new PlainInventory(message.pos, ((TileEntityChest) te)); } else if (te instanceof IInventory) { return new PlainInventory(message.pos, (IInventory) te); } else if (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null)) { IItemHandler iih = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); if (iih == null) { HoloInventory.getLogger().warn("Error: Block at {} (Class: {} Te: {} Block: {}) returned null after indicating the capability is available.", message.pos, te.getClass().getName(), te, te.getBlockType()); return null; } if (te instanceof INamedItemHandler) { INamedItemHandler namedHandler = (INamedItemHandler) te; return new PlainInventory(message.pos, namedHandler.getItemHandlerName(), iih); } return new PlainInventory(message.pos, te.getBlockType().getUnlocalizedName(), iih); } return null; }