use of net.minecraftforge.common.property.ExtendedBlockState 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);
}
use of net.minecraftforge.common.property.ExtendedBlockState 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);
}
use of net.minecraftforge.common.property.ExtendedBlockState 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();
}
use of net.minecraftforge.common.property.ExtendedBlockState in project ImmersiveEngineering by BluSunrize.
the class BlockIEBase method createNotTempBlockState.
protected BlockStateContainer createNotTempBlockState() {
IProperty[] array = new IProperty[1 + this.additionalProperties.length];
array[0] = this.property;
for (int i = 0; i < this.additionalProperties.length; i++) array[1 + i] = this.additionalProperties[i];
if (this.additionalUnlistedProperties.length > 0)
return new ExtendedBlockState(this, array, additionalUnlistedProperties);
return new BlockStateContainer(this, array);
}
Aggregations