Example usage for net.minecraftforge.common.property Properties StaticProperty

List of usage examples for net.minecraftforge.common.property Properties StaticProperty

Introduction

In this page you can find the example usage for net.minecraftforge.common.property Properties StaticProperty.

Prototype

BooleanProperty StaticProperty

To view the source code for net.minecraftforge.common.property Properties StaticProperty.

Click Source Link

Document

Property indicating if the model should be rendered in the static renderer or in the TESR.

Usage

From source file:appeng.client.render.tesr.SkyCompassTESR.java

License:Open Source License

@Override
public void renderTileEntityFast(TileSkyCompass te, double x, double y, double z, float partialTicks,
        int destroyStage, VertexBuffer buffer) {

    if (!te.hasWorldObj()) {
        return;//  w  ww. j  av a2  s  .c o m
    }

    if (blockRenderer == null) {
        blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    }

    BlockPos pos = te.getPos();
    IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
    IBlockState state = world.getBlockState(pos);
    if (state.getPropertyNames().contains(Properties.StaticProperty)) {
        state = state.withProperty(Properties.StaticProperty, false);
    }

    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState exState = (IExtendedBlockState) state.getBlock().getExtendedState(state, world,
                pos);

        IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
        exState = exState.withProperty(BlockSkyCompass.ROTATION, getRotation(te));

        // Flip forward/up for rendering, the base model is facing up without any rotation
        EnumFacing forward = exState.getValue(AEBaseTileBlock.FORWARD);
        EnumFacing up = exState.getValue(AEBaseTileBlock.UP);
        // This ensures the needle isn't flipped by the model rotator. Since the model is symmetrical, this should not affect the appearance
        if (forward == EnumFacing.UP || forward == EnumFacing.DOWN) {
            up = EnumFacing.NORTH;
        }
        exState = exState.withProperty(AEBaseTileBlock.FORWARD, up).withProperty(AEBaseTileBlock.UP, forward);

        buffer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());

        blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, buffer, false);
    }
}

From source file:vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube.java

License:Open Source License

private void renderAnimatedModel(TileCorporeaCrystalCube te, double x, double y, double z, float partialTick) {
    // From FastTESR.renderTileEntityAt
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer worldRenderer = tessellator.getBuffer();
    bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableBlend();//from   w  ww .java2  s.c  o m
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    } else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }

    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

    // Inlined AnimationTESR.renderTileEntityFast
    if (!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)) {
        return;
    }
    if (blockRenderer == null)
        blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockPos pos = te.getPos();
    IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
    IBlockState state = world.getBlockState(pos);
    if (state.getPropertyNames().contains(Properties.StaticProperty)) {
        state = state.withProperty(Properties.StaticProperty, false);
    }
    if (state instanceof IExtendedBlockState) {
        IExtendedBlockState exState = (IExtendedBlockState) state;
        if (exState.getUnlistedNames().contains(Properties.AnimationProperty)) {
            float time = Animation.getWorldTime(getWorld(), partialTick);
            Pair<IModelState, Iterable<Event>> pair = te
                    .getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);
            // handleEvents(te, time, pair.getRight());

            IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
            exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft());

            worldRenderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());

            blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, worldRenderer, false);
        }
    }
    // End inline AnimationTESR.renderTileEntityFast

    worldRenderer.setTranslation(0, 0, 0);

    tessellator.draw();

    RenderHelper.enableStandardItemLighting();
}

From source file:vazkii.botania.common.block.corporea.BlockCorporeaCrystalCube.java

License:Open Source License

@Nonnull
@Override//w w  w  .ja v a 2  s . co  m
public BlockStateContainer createBlockState() {
    return new ExtendedBlockState(this, new IProperty[] { Properties.StaticProperty },
            new IUnlistedProperty[] { Properties.AnimationProperty });
}

From source file:vazkii.botania.common.block.corporea.BlockCorporeaCrystalCube.java

License:Open Source License

@Override
protected IBlockState pickDefaultState() {
    return blockState.getBaseState().withProperty(Properties.StaticProperty, true);
}

From source file:vazkii.botania.common.block.corporea.BlockCorporeaCrystalCube.java

License:Open Source License

@Nonnull
@Override
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
    return state.withProperty(Properties.StaticProperty, true);
}