Search in sources :

Example 1 with TileEntityWareHouse

use of com.minecolonies.coremod.tileentities.TileEntityWareHouse in project minecolonies by Minecolonies.

the class BuildingWareHouse method getTileEntity.

/**
     * Returns the tile entity that belongs to the colony building.
     *
     * @return {@link TileEntityColonyBuilding} object of the building.
     */
@Override
public TileEntityWareHouse getTileEntity() {
    final Colony colony = getColony();
    if ((tileEntity == null || tileEntity.isInvalid()) && colony != null && colony.getWorld().getBlockState(this.getLocation()).getBlock() != null) {
        final TileEntity te = getColony().getWorld().getTileEntity(this.getLocation());
        if (te instanceof TileEntityWareHouse) {
            tileEntity = (TileEntityWareHouse) te;
            if (tileEntity.getBuilding() == null) {
                tileEntity.setColony(colony);
                tileEntity.setBuilding(this);
            }
        }
    }
    return tileEntity;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityWareHouse(com.minecolonies.coremod.tileentities.TileEntityWareHouse) Colony(com.minecolonies.coremod.colony.Colony)

Aggregations

Colony (com.minecolonies.coremod.colony.Colony)1 TileEntityWareHouse (com.minecolonies.coremod.tileentities.TileEntityWareHouse)1 TileEntity (net.minecraft.tileentity.TileEntity)1