make all blocks except some liquids non-translucent

This commit is contained in:
Sen 2025-07-25 12:22:04 +02:00
parent 1f149583d5
commit 0e179b0410
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
73 changed files with 259 additions and 479 deletions

View file

@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import client.Client;
import client.renderer.chunk.BlockLayer;
import client.renderer.texture.DynamicTexture;
import client.renderer.texture.TextureMap;
import common.block.Block;
@ -22,7 +23,6 @@ import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.init.Items;
import common.init.SoundEvent;
import common.model.BlockLayer;
import common.rng.Random;
import common.sound.PositionedSound;
import common.util.BlockPos;

View file

@ -21,7 +21,6 @@ import common.init.Blocks;
import common.item.Item;
import common.item.ItemAction;
import common.item.ItemStack;
import common.model.BlockLayer;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Vec3;
@ -110,29 +109,14 @@ public class ItemRenderer
if (this.itemRenderer.shouldRenderItemIn3D(heldStack))
{
GL11.glScalef(2.0F, 2.0F, 2.0F);
if (this.isBlockTranslucent(block))
{
GlState.depthMask(false);
}
}
this.itemRenderer.renderItemForEntity(heldStack, entityIn, third);
if (this.isBlockTranslucent(block))
{
GlState.depthMask(true);
}
GL11.glPopMatrix();
}
}
private boolean isBlockTranslucent(Block blockIn)
{
return blockIn != null && blockIn.getRenderLayer() == BlockLayer.TRANSLUCENT;
}
private void rotateArroundXAndY(float angle, float angleY)
{
GL11.glPushMatrix();

View file

@ -1,6 +1,6 @@
package client.renderer;
import common.model.BlockLayer;
import client.renderer.chunk.BlockLayer;
public class RegionRenderCacheBuilder
{

View file

@ -16,6 +16,7 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL15;
import client.Client;
import client.renderer.chunk.BlockLayer;
import client.renderer.chunk.ChunkRenderDispatcher;
import client.renderer.chunk.CompiledChunk;
import client.renderer.chunk.RenderChunk;
@ -35,7 +36,6 @@ import common.entity.Entity;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.init.Blocks;
import common.model.BlockLayer;
import common.rng.Random;
import common.sound.Sound;
import common.tileentity.TileEntity;

View file

@ -0,0 +1,17 @@
package client.renderer.chunk;
public enum BlockLayer {
SOLID("Solid"),
CUTOUT("Cutout"),
TRANSLUCENT("Translucent");
private final String name;
private BlockLayer(String name) {
this.name = name;
}
public String toString() {
return this.name;
}
}

View file

@ -13,7 +13,6 @@ import client.renderer.chunk.ChunkBuilder.ImmediateFuture;
import client.renderer.chunk.ChunkBuilder.ListenableFuture;
import client.renderer.chunk.ChunkBuilder.ListenableFutureTask;
import common.collect.Lists;
import common.model.BlockLayer;
public class ChunkRenderDispatcher
{

View file

@ -7,7 +7,6 @@ import client.renderer.chunk.ChunkBuilder.ListenableFuture;
import common.collect.Lists;
import common.entity.Entity;
import common.log.Log;
import common.model.BlockLayer;
public class ChunkRenderWorker implements Runnable
{

View file

@ -4,7 +4,6 @@ import java.util.List;
import client.renderer.RenderBuffer;
import common.collect.Lists;
import common.model.BlockLayer;
import common.tileentity.TileEntity;
import common.util.Facing;

View file

@ -24,7 +24,6 @@ import common.block.ITileEntityProvider;
import common.collect.Maps;
import common.collect.Sets;
import common.init.Blocks;
import common.model.BlockLayer;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.BoundingBox;
@ -170,11 +169,10 @@ public class RenderChunk
}
}
BlockLayer layer = block.getRenderLayer();
int idx = layer.ordinal();
if (block != Blocks.air)
{
BlockLayer layer = block.hasTransparency() ? (block.getMaterial().isLiquid() ? BlockLayer.TRANSLUCENT : BlockLayer.CUTOUT) : BlockLayer.SOLID;
int idx = layer.ordinal();
RenderBuffer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(idx);
if (!compiledchunk.isLayerStarted(layer))