Search in sources :

Example 1 with EnumFarmBlockType

use of forestry.farming.blocks.EnumFarmBlockType 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)

Example 2 with EnumFarmBlockType

use of forestry.farming.blocks.EnumFarmBlockType in project ForestryMC by ForestryMC.

the class ModelFarmBlock method getInventoryKey.

@Override
protected Key getInventoryKey(ItemStack stack) {
    EnumFarmBlockTexture texture = EnumFarmBlockTexture.getFromCompound(stack.getTagCompound());
    EnumFarmBlockType type = EnumFarmBlockType.VALUES[stack.getItemDamage()];
    return new Key(texture, type);
}
Also used : EnumFarmBlockType(forestry.farming.blocks.EnumFarmBlockType)

Aggregations

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