Java Code Examples for net.minecraft.util.BlockRenderLayer#TRANSLUCENT

The following examples show how to use net.minecraft.util.BlockRenderLayer#TRANSLUCENT . 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: BlockRenderLayerDeserializer.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public BlockRenderLayer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
    if (json.isJsonPrimitive())
    {
        JsonPrimitive primitive = json.getAsJsonPrimitive();
        if (primitive.isString())
        {
            String string = primitive.getAsString();
            if (string.equals("solid"))
                return BlockRenderLayer.SOLID;
            if (string.equals("mippedCutout"))
                return BlockRenderLayer.CUTOUT_MIPPED;
            if (string.equals("cutout"))
                return BlockRenderLayer.CUTOUT;
            if (string.equals("translucent"))
                return BlockRenderLayer.TRANSLUCENT;
        }
    }

    throw new JsonParseException("Invalid block render layer: " + json);
}
 
Example 2
Source File: RenderChunkSchematicVbo.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void postRenderBlocks(BlockRenderLayer layer, float x, float y, float z, BufferBuilder buffer, CompiledChunkSchematic compiledChunk)
{
    if (layer == BlockRenderLayer.TRANSLUCENT && compiledChunk.isLayerEmpty(layer) == false)
    {
        buffer.sortVertexData(x, y, z);
        compiledChunk.setBlockBufferState(layer, buffer.getVertexState());
    }

    buffer.finishDrawing();
}
 
Example 3
Source File: BlockCreativeManaBattery.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
	return layer == BlockRenderLayer.TRANSLUCENT;
}
 
Example 4
Source File: BlockPhasing.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public BlockRenderLayer getRenderLayer()
{
    return BlockRenderLayer.TRANSLUCENT;
}
 
Example 5
Source File: BlockWaterPad.java    From AgriCraft with MIT License 4 votes vote down vote up
@Override
public BlockRenderLayer getBlockLayer() {
    return BlockRenderLayer.TRANSLUCENT;
}
 
Example 6
Source File: BlockPortal.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
	return BlockRenderLayer.TRANSLUCENT;
}
 
Example 7
Source File: BlockForceField.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
    return BlockRenderLayer.TRANSLUCENT;
}
 
Example 8
Source File: BlockPhasing.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
{
    boolean phased = this.isBlockNormalCube(state) == false;
    return (phased && layer == BlockRenderLayer.TRANSLUCENT) || (phased == false && layer == BlockRenderLayer.SOLID);
}
 
Example 9
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 4 votes vote down vote up
private boolean isBlockTranslucent(@Nullable Block blockIn)
{
	return blockIn != null && blockIn.getBlockLayer() == BlockRenderLayer.TRANSLUCENT;
}
 
Example 10
Source File: BlockManaBattery.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
	return layer == BlockRenderLayer.TRANSLUCENT;
}
 
Example 11
Source File: BlockCloud.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public BlockRenderLayer getRenderLayer() {
	return BlockRenderLayer.TRANSLUCENT;
}
 
Example 12
Source File: BlockEnderUtilitiesPortal.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public BlockRenderLayer getRenderLayer()
{
    return BlockRenderLayer.TRANSLUCENT;
}
 
Example 13
Source File: RenderGlobalSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public int renderBlockLayer(BlockRenderLayer blockLayerIn, double partialTicks, Entity entityIn)
{
    this.world.profiler.startSection("render_block_layer_" + blockLayerIn);

    RenderUtils.disableItemLighting();

    if (blockLayerIn == BlockRenderLayer.TRANSLUCENT)
    {
        this.world.profiler.startSection("translucent_sort");
        double diffX = entityIn.posX - this.prevRenderSortX;
        double diffY = entityIn.posY - this.prevRenderSortY;
        double diffZ = entityIn.posZ - this.prevRenderSortZ;

        if (diffX * diffX + diffY * diffY + diffZ * diffZ > 1.0D)
        {
            this.prevRenderSortX = entityIn.posX;
            this.prevRenderSortY = entityIn.posY;
            this.prevRenderSortZ = entityIn.posZ;
            int i = 0;

            for (RenderChunkSchematicVbo renderChunk : this.renderInfos)
            {
                if ((renderChunk.getChunkRenderData().isLayerStarted(blockLayerIn) ||
                    (renderChunk.getChunkRenderData() != CompiledChunk.DUMMY && renderChunk.hasOverlay())) && i++ < 15)
                {
                    this.renderDispatcher.updateTransparencyLater(renderChunk);
                }
            }
        }

        this.world.profiler.endSection();
    }

    this.world.profiler.startSection("filter_empty");
    boolean reverse = blockLayerIn == BlockRenderLayer.TRANSLUCENT;
    int startIndex = reverse ? this.renderInfos.size() - 1 : 0;
    int stopIndex = reverse ? -1 : this.renderInfos.size();
    int increment = reverse ? -1 : 1;
    int count = 0;

    for (int i = startIndex; i != stopIndex; i += increment)
    {
        RenderChunkSchematicVbo renderchunk = this.renderInfos.get(i);

        if (renderchunk.getChunkRenderData().isLayerEmpty(blockLayerIn) == false)
        {
            ++count;
            this.renderContainer.addRenderChunk(renderchunk, blockLayerIn);
        }
    }

    this.world.profiler.endStartSection("render");

    this.renderBlockLayer(blockLayerIn);

    this.world.profiler.endSection();
    this.world.profiler.endSection();

    return count;
}
 
Example 14
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 15
Source File: BlockPuzzle.java    From YouTubeModdingTutorial with MIT License 4 votes vote down vote up
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
    return layer == BlockRenderLayer.TRANSLUCENT || layer == BlockRenderLayer.SOLID;
}
 
Example 16
Source File: SolarGlass.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
    return BlockRenderLayer.TRANSLUCENT;
}
 
Example 17
Source File: ClearPlasticBlock.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
  return BlockRenderLayer.TRANSLUCENT;
}
 
Example 18
Source File: AquaponicGlass.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
  return BlockRenderLayer.TRANSLUCENT;
}
 
Example 19
Source File: BlockSoulGlass.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer()
{
	return BlockRenderLayer.TRANSLUCENT;
}
 
Example 20
Source File: BlockTofuPortal.java    From TofuCraftReload with MIT License 3 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {

    return BlockRenderLayer.TRANSLUCENT;

}