Search in sources :

Example 56 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project YABBA by LatvianModder.

the class BakedBarrelBlockModel method getQuads.

@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState statex = (IExtendedBlockState) state;
        BarrelLook look = statex.getValue(BlockAdvancedBarrelBase.LOOK);
        if (look == null) {
            look = BarrelLook.DEFAULT;
        }
        BarrelModel model = look.getModel();
        BarrelSkin skin = look.getSkin();
        if (MinecraftForgeClient.getRenderLayer() == ClientUtils.getStrongest(model.layer, skin.layer)) {
            return get(BarrelLook.get(model.id, skin.id)).getQuads(state.getValue(BlockAdvancedBarrelBase.ROTATION).getModelRotationIndexFromFacing(state.getValue(BlockHorizontal.FACING)));
        }
    }
    return Collections.emptyList();
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) BarrelLook(com.latmod.yabba.util.BarrelLook) BarrelSkin(com.latmod.yabba.api.BarrelSkin)

Example 57 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project HorsePower by GoryMoon.

the class BlockHPChoppingBase method getExtendedState.

@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
    IExtendedBlockState extendedState = (IExtendedBlockState) state;
    TileEntityHPBase tile = getTileEntity(world, pos);
    if (tile != null) {
        return getExtendedState(tile, tile.getExtendedState(extendedState));
    }
    return super.getExtendedState(state, world, pos);
}
Also used : TileEntityHPBase(se.gory_moon.horsepower.tileentity.TileEntityHPBase) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState)

Example 58 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState in project HorsePower by GoryMoon.

the class BlockHandGrindstone method onBlockPlacedBy.

public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
    worldIn.setBlockState(pos, ((IExtendedBlockState) state).withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(PART, HandGrindstoneModels.BASE), 2);
    TileEntityHandGrindstone tile = getTileEntity(worldIn, pos);
    if (tile == null)
        return;
    tile.setForward(placer.getAdjustedHorizontalFacing().getOpposite());
}
Also used : IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) TileEntityHandGrindstone(se.gory_moon.horsepower.tileentity.TileEntityHandGrindstone)

Example 59 with IExtendedBlockState

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

the class ModelBlockCustom method bakeModel.

protected IBakedModel bakeModel(IBlockState state, K key, B block) {
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState stateExtended = (IExtendedBlockState) state;
        IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
        BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
    }
    return blockModel = bakeBlock(block, key, false);
}
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 60 with IExtendedBlockState

use of net.minecraftforge.common.property.IExtendedBlockState 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

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