Search in sources :

Example 1 with IUnlistedProperty

use of net.minecraftforge.common.property.IUnlistedProperty in project ImmersiveEngineering by BluSunrize.

the class BlockMetalDevice1 method createBlockState.

@Override
protected BlockStateContainer createBlockState() {
    BlockStateContainer base = super.createBlockState();
    IUnlistedProperty[] unlisted = (base instanceof ExtendedBlockState) ? ((ExtendedBlockState) base).getUnlistedProperties().toArray(new IUnlistedProperty[0]) : new IUnlistedProperty[0];
    unlisted = Arrays.copyOf(unlisted, unlisted.length + 1);
    unlisted[unlisted.length - 1] = IEProperties.CONNECTIONS;
    return new ExtendedBlockState(this, base.getProperties().toArray(new IProperty[0]), unlisted);
}
Also used : IUnlistedProperty(net.minecraftforge.common.property.IUnlistedProperty) IProperty(net.minecraft.block.properties.IProperty) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) ExtendedBlockState(net.minecraftforge.common.property.ExtendedBlockState) BlockStateContainer(net.minecraft.block.state.BlockStateContainer)

Example 2 with IUnlistedProperty

use of net.minecraftforge.common.property.IUnlistedProperty in project ImmersiveEngineering by BluSunrize.

the class BlockConnector method createBlockState.

@Override
protected BlockStateContainer createBlockState() {
    BlockStateContainer base = super.createBlockState();
    IUnlistedProperty[] unlisted = (base instanceof ExtendedBlockState) ? ((ExtendedBlockState) base).getUnlistedProperties().toArray(new IUnlistedProperty[0]) : new IUnlistedProperty[0];
    unlisted = Arrays.copyOf(unlisted, unlisted.length + 1);
    unlisted[unlisted.length - 1] = IEProperties.CONNECTIONS;
    return new ExtendedBlockState(this, base.getProperties().toArray(new IProperty[0]), unlisted);
}
Also used : IUnlistedProperty(net.minecraftforge.common.property.IUnlistedProperty) IProperty(net.minecraft.block.properties.IProperty) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) ExtendedBlockState(net.minecraftforge.common.property.ExtendedBlockState) BlockStateContainer(net.minecraft.block.state.BlockStateContainer)

Example 3 with IUnlistedProperty

use of net.minecraftforge.common.property.IUnlistedProperty in project Railcraft by Railcraft.

the class FluidModelRenderer method renderFluid.

/**
     * @param level Ranges from 1 to 16 inclusively, 0 will crash
     */
public void renderFluid(FluidStack fluidStack, int level) {
    IBakedModel bakedModel = new FluidModel(fluidStack, false).bake(TRSRTransformation.identity(), DefaultVertexFormats.BLOCK, RenderTools::getTexture);
    Minecraft mc = Minecraft.getMinecraft();
    mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
    Tessellator tess = Tessellator.getInstance();
    VertexBuffer buffer = tess.getBuffer();
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    IExtendedBlockState state = (IExtendedBlockState) new ExtendedBlockState(Blocks.WATER, new IProperty[] { BlockFluidBase.LEVEL }, BlockFluidBase.FLUID_RENDER_PROPS.toArray(new IUnlistedProperty<?>[0])).getBaseState();
    for (int i = 0; i < 4; i++) state = state.withProperty(BlockFluidBase.LEVEL_CORNERS[i], level / 16F);
    state = (IExtendedBlockState) state.withProperty(BlockFluidBase.LEVEL, level - 1);
    state = state.withProperty(BlockFluidBase.FLOW_DIRECTION, -1000F);
    putQuads(buffer, bakedModel.getQuads(state, null, 1234));
    for (EnumFacing side : EnumFacing.VALUES) {
        putQuads(buffer, bakedModel.getQuads(state, side, 1234));
    }
    tess.draw();
    mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) IUnlistedProperty(net.minecraftforge.common.property.IUnlistedProperty) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) ExtendedBlockState(net.minecraftforge.common.property.ExtendedBlockState) EnumFacing(net.minecraft.util.EnumFacing) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) RenderTools(mods.railcraft.client.render.tools.RenderTools) Minecraft(net.minecraft.client.Minecraft)

Aggregations

ExtendedBlockState (net.minecraftforge.common.property.ExtendedBlockState)3 IExtendedBlockState (net.minecraftforge.common.property.IExtendedBlockState)3 IUnlistedProperty (net.minecraftforge.common.property.IUnlistedProperty)3 IProperty (net.minecraft.block.properties.IProperty)2 BlockStateContainer (net.minecraft.block.state.BlockStateContainer)2 RenderTools (mods.railcraft.client.render.tools.RenderTools)1 Minecraft (net.minecraft.client.Minecraft)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 EnumFacing (net.minecraft.util.EnumFacing)1