Search in sources :

Example 61 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project ForestryMC by ForestryMC.

the class ModelCamouflaged method getWorldKey.

@Override
protected Key getWorldKey(IBlockState state) {
    IExtendedBlockState stateExtended = (IExtendedBlockState) state;
    IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
    BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
    return new Key(stateExtended, world, pos, state.getBlock().getMetaFromState(state));
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IBlockAccess(net.minecraft.world.IBlockAccess) BlockPos(net.minecraft.util.math.BlockPos) UnlistedBlockPos(forestry.core.blocks.properties.UnlistedBlockPos)

Example 62 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project RFTools by McJty.

the class CamoShieldBlock method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
    IBlockState mimicBlock = getMimicBlock(world, pos);
    if (mimicBlock != null) {
        return extendedBlockState.withProperty(CAMOID, new CamoBlockId(mimicBlock));
    } else {
        return extendedBlockState;
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 63 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Binnie by ForestryMC.

the class BlockCeramicBrick method getWorldKey.

@Override
@SideOnly(Side.CLIENT)
public CeramicBrickPair getWorldKey(IBlockState state) {
    IExtendedBlockState extendedState = (IExtendedBlockState) state;
    IBlockAccess world = extendedState.getValue(UnlistedBlockAccess.BLOCKACCESS);
    BlockPos pos = extendedState.getValue(UnlistedBlockPos.POS);
    TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
    if (ceramic != null) {
        return ceramic.pair();
    }
    return CeramicBrickPair.EMPTY;
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) TileCeramicBrick(binnie.botany.tile.TileCeramicBrick) IBlockAccess(net.minecraft.world.IBlockAccess) BlockPos(net.minecraft.util.math.BlockPos) UnlistedBlockPos(forestry.core.blocks.properties.UnlistedBlockPos) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 64 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Binnie by ForestryMC.

the class ModelMutlipass method bakeModel.

@Override
protected IBakedModel bakeModel(IBlockState state, K key, B block) {
    if (key == null) {
        return null;
    }
    AABBModelBaker baker = new AABBModelBaker();
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState stateExtended = (IExtendedBlockState) state;
        IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
        BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
        baker.setModelBounds(state.getBoundingBox(world, pos));
    } else {
        baker.setModelBounds(block.getItemBoundingBox());
    }
    bakeBlock(block, key, baker, false);
    blockModel = baker.bakeModel(false);
    onCreateModel(blockModel);
    return blockModel;
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IBlockAccess(net.minecraft.world.IBlockAccess) BlockPos(net.minecraft.util.math.BlockPos) UnlistedBlockPos(forestry.core.blocks.properties.UnlistedBlockPos)

Example 65 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project Binnie by ForestryMC.

the class ModelMultiFence method getWorldKey.

@Override
protected Key getWorldKey(IBlockState state) {
    IExtendedBlockState stateExtended = (IExtendedBlockState) state;
    IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
    BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
    int meta = TileEntityMetadata.getTileMetadata(world, pos);
    return new Key(meta, state.getValue(BlockFence.WEST), state.getValue(BlockFence.EAST), state.getValue(BlockFence.NORTH), state.getValue(BlockFence.SOUTH));
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IBlockAccess(net.minecraft.world.IBlockAccess) BlockPos(net.minecraft.util.math.BlockPos) UnlistedBlockPos(forestry.core.blocks.properties.UnlistedBlockPos)

Aggregations

IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)96 IBlockState (net.minecraft.block.state.IBlockState)27 BlockPos (net.minecraft.util.math.BlockPos)24 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)17 EnumFacing (net.minecraft.util.EnumFacing)17 OBJState (net.minecraftforge.client.model.obj.OBJModel.OBJState)17 TileEntity (net.minecraft.tileentity.TileEntity)16 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)14 ArrayList (java.util.ArrayList)13 IBlockAccess (net.minecraft.world.IBlockAccess)13 UnlistedBlockPos (forestry.core.blocks.properties.UnlistedBlockPos)10 TileEntityImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConnectable)7 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)7 Block (net.minecraft.block.Block)6 ItemStack (net.minecraft.item.ItemStack)6 Nonnull (javax.annotation.Nonnull)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 Minecraft (net.minecraft.client.Minecraft)3 Vec3d (net.minecraft.util.math.Vec3d)3