Search in sources :

Example 1 with TileFarm

use of forestry.farming.tiles.TileFarm in project ForestryMC by ForestryMC.

the class BlockFarm method onBlockPlacedBy.

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
    super.onBlockPlacedBy(world, pos, state, placer, stack);
    if (stack.getTagCompound() == null) {
        return;
    }
    TileFarm tile = TileUtil.getTile(world, pos, TileFarm.class);
    if (tile != null) {
        tile.setFarmBlockTexture(EnumFarmBlockTexture.getFromCompound(stack.getTagCompound()));
    }
}
Also used : TileFarm(forestry.farming.tiles.TileFarm)

Example 2 with TileFarm

use of forestry.farming.tiles.TileFarm in project ForestryMC by ForestryMC.

the class ModelFarmBlock method getWorldKey.

@Override
protected Key getWorldKey(IBlockState state) {
    IExtendedBlockState stateExtended = (IExtendedBlockState) state;
    IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
    BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
    TileFarm farm = TileUtil.getTile(world, pos, TileFarm.class);
    EnumFarmBlockTexture texture = EnumFarmBlockTexture.BRICK;
    EnumFarmBlockType type = EnumFarmBlockType.PLAIN;
    if (farm != null) {
        texture = farm.getFarmBlockTexture();
        type = farm.getFarmBlockType();
    }
    return new Key(texture, type);
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) TileFarm(forestry.farming.tiles.TileFarm) IBlockAccess(net.minecraft.world.IBlockAccess) BlockPos(net.minecraft.util.math.BlockPos) UnlistedBlockPos(forestry.core.blocks.properties.UnlistedBlockPos) EnumFarmBlockType(forestry.farming.blocks.EnumFarmBlockType)

Aggregations

TileFarm (forestry.farming.tiles.TileFarm)2 UnlistedBlockPos (forestry.core.blocks.properties.UnlistedBlockPos)1 EnumFarmBlockType (forestry.farming.blocks.EnumFarmBlockType)1 BlockPos (net.minecraft.util.math.BlockPos)1 IBlockAccess (net.minecraft.world.IBlockAccess)1 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)1