Java Code Examples for net.minecraft.util.EnumBlockRenderType#INVISIBLE

The following examples show how to use net.minecraft.util.EnumBlockRenderType#INVISIBLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityBlockRenderer.java    From OpenModsLib with MIT License 6 votes vote down vote up
@Override
public void doRender(EntityBlock entity, double x, double y, double z, float yaw, float partialTicks) {
	final IBlockState blockState = entity.getBlockState();

	if (blockState.getRenderType() != EnumBlockRenderType.INVISIBLE) {
		GlStateManager.pushMatrix();
		GlStateManager.translate(x - 0.5, y, z + 0.5);
		GlStateManager.disableLighting();

		bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

		Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(blockState, entity.getBrightness());

		GlStateManager.enableLighting();
		GlStateManager.popMatrix();
		super.doRender(entity, x, y, z, yaw, partialTicks);
	}
}
 
Example 2
Source File: RenderGlobalSchematic.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder bufferBuilderIn)
{
    try
    {
        EnumBlockRenderType renderType = state.getRenderType();

        if (renderType == EnumBlockRenderType.INVISIBLE)
        {
            return false;
        }
        else
        {
            switch (renderType)
            {
                case MODEL:
                    return this.blockModelRenderer.renderModel(blockAccess, this.getModelForState(state), state, pos, bufferBuilderIn);
                case ENTITYBLOCK_ANIMATED:
                    return false;
                case LIQUID:
                    return this.fluidRenderer.renderFluid(blockAccess, state, pos, bufferBuilderIn);
                default:
                    return false;
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
        CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
        throw new ReportedException(crashreport);
    }
}
 
Example 3
Source File: RenderFallTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityFallTofu entity, double x, double y, double z, float entityYaw, float partialTicks) {

    IBlockState iblockstate = BlockLoader.tofuTerrain.getDefaultState();

    if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL) {
        World world = entity.getWorldObj();

        if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) {
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            GlStateManager.pushMatrix();
            GlStateManager.disableLighting();
            Tessellator tessellator = Tessellator.getInstance();
            BufferBuilder bufferbuilder = tessellator.getBuffer();

            if (this.renderOutlines) {
                GlStateManager.enableColorMaterial();
                GlStateManager.enableOutlineMode(this.getTeamColor(entity));
            }

            bufferbuilder.begin(7, DefaultVertexFormats.BLOCK);
            BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
            GlStateManager.translate((float) (x - (double) blockpos.getX() - 0.5D), (float) (y - (double) blockpos.getY()), (float) (z - (double) blockpos.getZ() - 0.5D));
            BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
            blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, bufferbuilder, false);
            tessellator.draw();

            if (this.renderOutlines) {
                GlStateManager.disableOutlineMode();
                GlStateManager.disableColorMaterial();
            }

            GlStateManager.enableLighting();
            GlStateManager.popMatrix();
            super.doRender(entity, x, y, z, entityYaw, partialTicks);
        }
    }

}
 
Example 4
Source File: BlockSpeedTelegraph.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example 5
Source File: BlockBetterChest.java    From BetterChests with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example 6
Source File: BlockBackpack.java    From WearableBackpacks with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.INVISIBLE; }
 
Example 7
Source File: RenderFallingBlockEU.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void doRender(EntityFallingBlockEU entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    IBlockState state = entity.getBlockState();

    if (state != null && state.getRenderType() == EnumBlockRenderType.MODEL)
    {
        World world = entity.getEntityWorld();

        if (state != world.getBlockState(new BlockPos(entity)) && state.getRenderType() != EnumBlockRenderType.INVISIBLE)
        {
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            GlStateManager.pushMatrix();
            GlStateManager.disableLighting();
            Tessellator tessellator = Tessellator.getInstance();
            BufferBuilder buffer = tessellator.getBuffer();

            if (this.renderOutlines)
            {
                GlStateManager.enableColorMaterial();
                GlStateManager.enableOutlineMode(this.getTeamColor(entity));
            }

            buffer.begin(7, DefaultVertexFormats.BLOCK);
            BlockPos pos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
            GlStateManager.translate((float)(x - pos.getX() - 0.5D), (float)(y - pos.getY()), (float)(z - pos.getZ() - 0.5D));
            BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
            dispatcher.getBlockModelRenderer().renderModel(
                world, dispatcher.getModelForState(state), state, pos, buffer, false, MathHelper.getPositionRandom(entity.getOrigin()));
            tessellator.draw();

            if (this.renderOutlines)
            {
                GlStateManager.disableOutlineMode();
                GlStateManager.disableColorMaterial();
            }

            GlStateManager.enableLighting();
            GlStateManager.popMatrix();

            super.doRender(entity, x, y, z, entityYaw, partialTicks);
        }
    }
}
 
Example 8
Source File: BlockLightSource.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example 9
Source File: BlockPhysicsInfuser.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example 10
Source File: BlockPhysicsInfuserDummy.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example 11
Source File: BlockDummyTelegraph.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
    return EnumBlockRenderType.INVISIBLE;
}
 
Example 12
Source File: BlockBeaconPost.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
	return state.getValue(TRANSFORMED) > 0 ? EnumBlockRenderType.INVISIBLE : EnumBlockRenderType.MODEL;
}
 
Example 13
Source File: BlockToroSpawner.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example 14
Source File: BlockLight.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example 15
Source File: BlockFakeAir.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
	return EnumBlockRenderType.INVISIBLE;
}
 
Example 16
Source File: RenderChunkSchematicVbo.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void renderBlocksAndOverlay(BlockPos pos, Set<TileEntity> tileEntities, boolean[] usedLayers, CompiledChunkSchematic data, BufferBuilderCache buffers)
{
    IBlockState stateSchematic = this.schematicWorldView.getBlockState(pos);
    IBlockState stateClient    = this.clientWorldView.getBlockState(pos);
    stateSchematic = stateSchematic.getActualState(this.schematicWorldView, pos);
    stateClient = stateClient.getActualState(this.clientWorldView, pos);
    Block blockSchematic = stateSchematic.getBlock();
    Block blockClient = stateClient.getBlock();
    boolean clientHasAir = blockClient == Blocks.AIR;
    boolean schematicHasAir = blockSchematic == Blocks.AIR;

    if (clientHasAir && schematicHasAir)
    {
        return;
    }

    // Schematic has a block, client has air
    if (clientHasAir || (stateSchematic != stateClient && this.renderColliding))
    {
        if (blockSchematic.hasTileEntity())
        {
            this.addTileEntity(pos, data, tileEntities);
        }

        BlockRenderLayer layer = this.renderAsTranslucent ? BlockRenderLayer.TRANSLUCENT : blockSchematic.getRenderLayer();
        int layerIndex = layer.ordinal();

        if (stateSchematic.getRenderType() != EnumBlockRenderType.INVISIBLE)
        {
            BufferBuilder bufferSchematic = buffers.getWorldRendererByLayerId(layerIndex);

            if (data.isLayerStarted(layer) == false)
            {
                data.setLayerStarted(layer);
                this.preRenderBlocks(bufferSchematic, this.getPosition());
            }

            usedLayers[layerIndex] |= this.renderGlobal.renderBlock(stateSchematic, pos, this.schematicWorldView, bufferSchematic);
        }
    }

    if (this.overlayEnabled)
    {
        OverlayType type = this.getOverlayType(stateSchematic, stateClient);
        Color4f overlayColor = this.getOverlayColor(type);

        if (overlayColor != null)
        {
            this.renderOverlay(pos, stateSchematic, type, overlayColor, data, buffers);
        }
    }
}
 
Example 17
Source File: BlockPortalBase.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only,
 * LIQUID for vanilla liquids, INVISIBLE to skip all rendering
 */
public EnumBlockRenderType getRenderType(IBlockState state)
{
    return EnumBlockRenderType.INVISIBLE;
}
 
Example 18
Source File: BlockPortalGlowyAir.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * The type of render function called. MODEL for mixed tesr and static model, MODELBLOCK_ANIMATED for TESR-only,
 * LIQUID for vanilla liquids, INVISIBLE to skip all rendering
 */
public EnumBlockRenderType getRenderType(IBlockState state)
{
    return EnumBlockRenderType.INVISIBLE;
}