Java Code Examples for net.minecraft.tileentity.TileEntityHopper#func_145889_a()
The following examples show how to use
net.minecraft.tileentity.TileEntityHopper#func_145889_a() .
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: TileEntityTreeFarm.java From AdvancedMod with GNU General Public License v3.0 | 7 votes |
private void cutTree(){ if(inventory != null) { Block block = worldObj.getBlock(xCoord, yCoord + 2, zCoord); int offsetY = yCoord + 2; while(block.getMaterial() == Material.wood) { List<ItemStack> items = block.getDrops(worldObj, xCoord, offsetY, zCoord, worldObj.getBlockMetadata(xCoord, offsetY, zCoord), 0); for(ItemStack item : items) { ItemStack remainder = TileEntityHopper.func_145889_a(inventory, item, 0); if(remainder != null) { worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord + 0.5, yCoord + 2.5, zCoord + 0.5, remainder)); } } worldObj.setBlock(xCoord, offsetY, zCoord, Blocks.air); offsetY++; block = worldObj.getBlock(xCoord, offsetY, zCoord); } } }
Example 2
Source File: BlockElevatorBase.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public void onNeighborBlockChange(World world, int x, int y, int z, Block block){ super.onNeighborBlockChange(world, x, y, z, block); TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityElevatorBase) { TileEntityElevatorBase thisTe = (TileEntityElevatorBase)te; if(thisTe.isCoreElevator()) { TileEntityElevatorBase teAbove = getCoreTileEntity(world, x, y, z); if(teAbove != null && teAbove != thisTe) { for(int i = 0; i < thisTe.getSizeInventory(); i++) { ItemStack item = thisTe.getStackInSlot(i); if(item != null) { ItemStack leftover = TileEntityHopper.func_145889_a(teAbove, item, 0); thisTe.setInventorySlotContents(i, null); if(leftover != null) { EntityItem entity = new EntityItem(world, teAbove.xCoord + 0.5, teAbove.yCoord + 1.5, teAbove.zCoord + 0.5, leftover); world.spawnEntityInWorld(entity); } } } } } } }
Example 3
Source File: PneumaticCraftUtils.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public static ItemStack exportStackToInventory(TileEntity te, ItemStack stack, ForgeDirection side){ if(te instanceof IInventory) { return TileEntityHopper.func_145889_a((IInventory)te, stack, side.ordinal()); } else { stack = ModInteractionUtils.getInstance().exportStackToTEPipe(te, stack, side); stack = ModInteractionUtils.getInstance().exportStackToBCPipe(te, stack, side); return stack; } }
Example 4
Source File: PneumaticCraftUtils.java From PneumaticCraft with GNU General Public License v3.0 | 2 votes |
/** * Transfers the given stack to the given inventory. The returned stack is the leftover if there is any. * @param inv * @param stack * @return */ public static ItemStack exportStackToInventory(IInventory inv, ItemStack stack, ForgeDirection side){ return TileEntityHopper.func_145889_a(inv, stack, side.ordinal()); }