make all blocks except some liquids non-translucent
This commit is contained in:
parent
1f149583d5
commit
0e179b0410
73 changed files with 259 additions and 479 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package client.renderer;
|
||||
|
||||
import common.model.BlockLayer;
|
||||
import client.renderer.chunk.BlockLayer;
|
||||
|
||||
public class RegionRenderCacheBuilder
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
17
client/src/main/java/client/renderer/chunk/BlockLayer.java
Executable file
17
client/src/main/java/client/renderer/chunk/BlockLayer.java
Executable 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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue