use of net.minecraft.tileentity.TileEntityLockable in project minecolonies by Minecolonies.
the class EntityAIStructureBuilder method getItemStacksOfTileEntity.
/**
* Get itemStack of tileEntityData. Retrieve the data from the tileEntity.
*
* @param compound the tileEntity stored in a compound.
* @return the list of itemstacks.
*/
private List<ItemStack> getItemStacksOfTileEntity(final NBTTagCompound compound) {
final List<ItemStack> items = new ArrayList<>();
final TileEntity tileEntity = TileEntity.create(world, compound);
if (tileEntity instanceof TileEntityFlowerPot) {
items.add(((TileEntityFlowerPot) tileEntity).getFlowerItemStack());
} else if (tileEntity instanceof TileEntityLockable) {
for (int i = 0; i < ((TileEntityLockable) tileEntity).getSizeInventory(); i++) {
final ItemStack stack = ((TileEntityLockable) tileEntity).getStackInSlot(i);
if (stack != null) {
items.add(stack);
}
}
}
return items;
}
Aggregations