1
0
Fork 0

revert some improved rendering

This commit is contained in:
Sen 2025-08-31 11:23:30 +02:00
parent 0e003971bc
commit 9d31588d8d
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
88 changed files with 735 additions and 608 deletions

View file

@ -311,12 +311,6 @@ public class Client implements IThreadListener {
Client.CLIENT.setMidiDebug();
}
}
public static class MaxLightFunction implements IntFunction {
public void apply(IntVar cv, int value) {
Client.CLIENT.lightSetup();
}
}
public static class TextureBoolFunction implements BoolFunction {
public void apply(BoolVar cv, boolean value) {
@ -727,7 +721,7 @@ public class Client implements IThreadListener {
@Variable(name = "gl_dynlight_viewdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Licht Kamera")
public float lightDistCam = 256.0f;
@Variable(name = "gl_dynlight_max", category = CVarCategory.RENDER, min = 0, max = 112, display = "Max. Dyn. Lichtquellen", callback = MaxLightFunction.class)
@Variable(name = "gl_dynlight_max", category = CVarCategory.RENDER, min = 0, max = 112, display = "Max. Dyn. Lichtquellen")
public int lightMaximum = 64;
@Variable(name = "gl_dynlight_chunkrange", category = CVarCategory.RENDER, min = 0, max = 64, display = "Lichtq. Sichtweite")
public int lightDistance = 8;
@ -741,6 +735,8 @@ public class Client implements IThreadListener {
public boolean specularColors = true;
@Variable(name = "gl_flat_shading", category = CVarCategory.RENDER, display = "Flaches Shading")
public boolean flatShading = false;
@Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
public boolean useShader = true;
public static final Client CLIENT = new Client();
@ -3875,14 +3871,6 @@ public class Client implements IThreadListener {
return this.tiles;
}
public void lightSetup() {
Shader.WORLD.update();
// if(win->world) {
// glNamedBufferData(win->world->light_buf, LIGHT_SSIZE * gdr.light_max, NULL, GL_DYNAMIC_DRAW);
// light_calc(win->world);
// }
}
public void updateTexture() {
this.textureManager.bindTexture(TextureMap.BLOCKS);
TextureUtil.setParams(this.textureFiltering, this.mipmapType != MipmapType.NONE, this.mipmapType == MipmapType.LINEAR, Math.min(this.anisotopicFiltering, this.anisotropyMax));

View file

@ -27,11 +27,12 @@ public class GuiGraphics extends GuiOptions {
this.addSelector("gl_dynlight_viewdist", 0, 200, 240, 0);
this.addSelector("gl_dynlight_maxdist", 242, 200, 240, 0);
this.addSelector("gl_light_blend", 0, 220, 240, 0);
this.addSelector("gl_specular", 242, 220, 240, 0);
this.addSelector("gl_flat_shading", 0, 240, 240, 0);
this.addSelector("gl_use_shader", 0, 220, 240, 0);
this.addSelector("gl_light_blend", 242, 220, 240, 0);
this.addSelector("gl_specular", 0, 240, 240, 0);
this.addSelector("gl_flat_shading", 242, 240, 240, 0);
this.addSelector("gl_tex_filter", 0, 260, 240, 0);
this.addSelector("gl_tex_mipmaps", 242, 260, 240, 0);

View file

@ -24,9 +24,9 @@ public class DefaultVertexFormats
static
{
BLOCK.addElement(POSITION_3F);
BLOCK.addElement(NORMAL_4B);
BLOCK.addElement(TEX_2F);
BLOCK.addElement(COLOR_4UB);
BLOCK.addElement(TEX_2F);
BLOCK.addElement(TEX_2S);
ITEM.addElement(POSITION_3F);
ITEM.addElement(COLOR_4UB);
ITEM.addElement(TEX_2F);

View file

@ -169,6 +169,11 @@ public class RenderBuffer
return this;
}
public RenderBuffer lightmap(int light)
{
return this.lightmap(light >> 16 & 65535, light & 65535);
}
public void putBrightness4(int p_178962_1_, int p_178962_2_, int p_178962_3_, int p_178962_4_)
{
int i = (this.vertexCount - 4) * this.vertexFormat.getIntegerSize() + this.vertexFormat.getUvOffsetById(1) / 4;
@ -251,11 +256,6 @@ public class RenderBuffer
return this.color(color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255);
}
public RenderBuffer lightColor(int light)
{
return this.color(light & 255, light >> 8 & 255, light >> 16 & 255, light >> 24 & 255);
}
public RenderBuffer lightNormal(int data)
{
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
@ -328,6 +328,15 @@ public class RenderBuffer
this.vertexCount += vertexData.length / this.vertexFormat.getIntegerSize();
}
public void addVertexData(int[] vertexData, int len)
{
this.growBuffer(len);
this.rawIntBuffer.position(this.getBufferSize());
this.rawIntBuffer.put(vertexData);
this.vertexCount += len / this.vertexFormat.getIntegerSize();
this.rawIntBuffer.position(this.getBufferSize());
}
public void endVertex()
{
++this.vertexCount;

View file

@ -41,7 +41,6 @@ import common.block.artificial.BlockSlab;
import common.block.liquid.BlockDynamicLiquid;
import common.block.liquid.BlockLiquid;
import common.block.liquid.BlockStaticLiquid;
import common.block.tech.BlockAnvil;
import common.collect.Lists;
import common.collect.Maps;
import common.collect.Sets;
@ -62,7 +61,6 @@ import common.sound.Sound;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Clientside;
import common.util.ExtMath;
import common.util.Facing;
import common.util.HitPosition;
@ -74,7 +72,6 @@ import common.util.ParticleType;
import common.util.Vec3;
import common.util.Vec3i;
import common.util.Vector3f;
import common.world.Chunk;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.State;
@ -2547,7 +2544,7 @@ public class Renderer {
private int renderChunks()
{
ItemRenderer.disableStandardItemLighting();
ItemRenderer.disableStandardItemLighting();
int l = 0;
int i = this.renderInfos.size();
for (int j = 0; j < i; j++)
@ -2559,66 +2556,144 @@ public class Renderer {
this.renderChunks.add(renderchunk);
}
}
GlState.setActiveTexture(GL46.GL_TEXTURE1);
GL46.glMatrixMode(GL46.GL_TEXTURE);
GL46.glLoadIdentity();
GL46.glMatrixMode(GL46.GL_MODELVIEW);
this.gm.getTextureManager().bindTexture(TEX_LIGHTMAP);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, GL46.GL_LINEAR);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_LINEAR);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_CLAMP);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_CLAMP);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.enableTexture2D();
GlState.setActiveTexture(GL46.GL_TEXTURE0);
if (this.initialized)
{
ShaderContext context = Shader.WORLD.use();
context.bool("sky_light", this.skyLight);
context.bool("moon_light", this.moonLight);
for (RenderChunk renderchunk : this.renderChunks)
if(this.gm.useShader && this.gm.dimensionName.equals("cyberspace")) {
GlState.setActiveTexture(GL46.GL_TEXTURE1);
GL46.glMatrixMode(GL46.GL_TEXTURE);
GL46.glLoadIdentity();
GL46.glMatrixMode(GL46.GL_MODELVIEW);
this.gm.getTextureManager().bindTexture(TEX_LIGHTMAP);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, GL46.GL_LINEAR);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_LINEAR);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_CLAMP);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_CLAMP);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.enableTexture2D();
GlState.setActiveTexture(GL46.GL_TEXTURE0);
if (this.initialized)
{
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
BlockPos blockpos = renderchunk.getPosition();
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
// Vec3 cam = MatrixState.project(Client.CLIENT.getRenderViewEntity(), Client.CLIENT.getTickFraction());
context.vec("cam_pos", (float)this.viewEntityX, (float)this.viewEntityY + this.gm.player.getEyeHeight(), (float)this.viewEntityZ);
context.matrix("model", renderchunk.getModelviewMatrix());
context.integer("chunk_x", blockpos.getX());
context.integer("chunk_y", blockpos.getY());
context.integer("chunk_z", blockpos.getZ());
vertexbuffer.bindBuffer();
ShaderContext context = Shader.GRID.use();
for (RenderChunk renderchunk : this.renderChunks)
{
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
BlockPos blockpos = renderchunk.getPosition();
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
context.matrix("model", renderchunk.getModelviewMatrix());
context.integer("chunk_x", blockpos.getX());
context.integer("chunk_y", blockpos.getY());
context.integer("chunk_z", blockpos.getZ());
vertexbuffer.bindBuffer();
GL46.glVertexAttribPointer(0, 3, GL46.GL_FLOAT, false, 28, 0L);
GL46.glEnableVertexAttribArray(0);
GL46.glVertexAttribPointer(1, 4, GL46.GL_BYTE, true, 28, 12L);
GL46.glEnableVertexAttribArray(1);
GL46.glVertexAttribPointer(2, 2, GL46.GL_FLOAT, false, 28, 16L);
GL46.glEnableVertexAttribArray(2);
GL46.glVertexAttribPointer(3, 4, GL46.GL_UNSIGNED_BYTE, true, 28, 24L);
GL46.glEnableVertexAttribArray(3);
vertexbuffer.drawArrays(GL46.GL_QUADS);
GL46.glVertexAttribPointer(0, 3, GL46.GL_FLOAT, false, 28, 0L);
GL46.glEnableVertexAttribArray(0);
GL46.glVertexAttribPointer(1, 4, GL46.GL_BYTE, true, 28, 12L);
GL46.glEnableVertexAttribArray(1);
GL46.glVertexAttribPointer(2, 2, GL46.GL_FLOAT, false, 28, 16L);
GL46.glEnableVertexAttribArray(2);
GL46.glVertexAttribPointer(3, 4, GL46.GL_UNSIGNED_BYTE, true, 28, 24L);
GL46.glEnableVertexAttribArray(3);
vertexbuffer.drawArrays(GL46.GL_QUADS);
GL46.glDisableVertexAttribArray(0);
GL46.glDisableVertexAttribArray(1);
GL46.glDisableVertexAttribArray(2);
GL46.glDisableVertexAttribArray(3);
GL46.glDisableVertexAttribArray(0);
GL46.glDisableVertexAttribArray(1);
GL46.glDisableVertexAttribArray(2);
GL46.glDisableVertexAttribArray(3);
}
context.finish();
GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0);
GlState.resetColor();
this.renderChunks.clear();
}
context.finish();
}
else {
this.gm.renderer.enableLightmap();
GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0);
GlState.resetColor();
this.renderChunks.clear();
GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
GL46.glEnableClientState(GL46.GL_TEXTURE_COORD_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE1);
GL46.glEnableClientState(GL46.GL_TEXTURE_COORD_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
GL46.glEnableClientState(GL46.GL_COLOR_ARRAY);
if (this.initialized)
{
for (RenderChunk renderchunk : this.renderChunks)
{
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
GL46.glPushMatrix();
this.preRenderChunk(renderchunk);
GL46.glMultMatrixf(renderchunk.getModelviewMatrix());
vertexbuffer.bindBuffer();
this.setupArrayPointers();
vertexbuffer.drawArrays(GL46.GL_QUADS);
GL46.glPopMatrix();
}
GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0);
GlState.resetColor();
this.renderChunks.clear();
}
for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements())
{
VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.usage();
int s = vertexformatelement.index();
switch (vertexformatelement$enumusage)
{
case POSITION:
GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY);
break;
case UV:
GL46.glClientActiveTexture(GL46.GL_TEXTURE0 + s);
GL46.glDisableClientState(GL46.GL_TEXTURE_COORD_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
break;
case COLOR:
GL46.glDisableClientState(GL46.GL_COLOR_ARRAY);
GlState.resetColor();
}
}
}
this.gm.renderer.disableLightmap();
return l;
}
// private void setupArrayPointers()
// {
// GL46.nglVertexPointer(3, GL46.GL_FLOAT, 32, 0L);
// GL46.glTexCoordPointer(2, GL46.GL_FLOAT, 32, 16L);
// GL46.nglColorPointer(4, GL46.GL_UNSIGNED_BYTE, 32, 24L);
// GL46.glClientActiveTexture(GL46.GL_TEXTURE1);
// GL46.glTexCoordPointer(2, GL46.GL_SHORT, 32, 28L);
// GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
// }
private void setupArrayPointers()
{
GL46.nglVertexPointer(3, GL46.GL_FLOAT, 28, 0L);
GL46.nglColorPointer(4, GL46.GL_UNSIGNED_BYTE, 28, 12L);
GL46.glTexCoordPointer(2, GL46.GL_FLOAT, 28, 16L);
GL46.glClientActiveTexture(GL46.GL_TEXTURE1);
GL46.glTexCoordPointer(2, GL46.GL_SHORT, 28, 24L);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
}
private void preRenderChunk(RenderChunk renderChunkIn)
{
BlockPos blockpos = renderChunkIn.getPosition();
GL46.glTranslatef((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
}
private void renderSkyBox(String texture)
{
GlState.disableFog();
@ -3285,6 +3360,26 @@ public class Renderer {
}
return 0xff000000 | (int)(Math.min(directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(directB, 1.0f) * 255.0f);
}
public int getWorldColor(BlockPos pos, Facing side, int light, boolean flip) {
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
max = sky * (1.0f - max * this.gm.lightBlend);
float directR = ((float)(light >> 16 & 0xff) / 255.0f + max) * shading;
float directG = ((float)(light >> 8 & 0xff) / 255.0f + max) * shading;
float directB = ((float)(light & 0xff) / 255.0f + max) * shading;
return 0xff000000 | (int)(Math.min(flip ? directB : directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(flip ? directR : directB, 1.0f) * 255.0f);
}
public int getSkyBrightness(BlockPos pos) {
int light = this.getCombinedLight(pos);
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
max = sky * (1.0f - max * this.gm.lightBlend);
light = (int)(max * 255.0f) / 16;
return light << 20 | 1 << 4;
}
public int getCombinedBrightness(BlockPos pos) {
int light = this.getLightColor(pos, null);
@ -3320,29 +3415,26 @@ public class Renderer {
if(!list.isEmpty()) {
BlockPos bpos = pos.offset(side);
if(!checkSides || block.canRender(world, bpos, side)) {
int light = getLightmapValue(world, bpos);
this.renderModelStandardQuads(world, block, pos, side, light, false, rb, list, bounds);
int light = this.getLightmapValue(world, bpos, side);
int sky = this.getSkyBrightness(bpos);
this.renderModelStandardQuads(world, block, pos, side, light, sky, false, rb, list, bounds);
rendered = true;
}
}
}
List<BakedQuad> list = model.getQuads();
if(list.size() > 0) {
this.renderModelStandardQuads(world, block, pos, null, 0xffffffff, true, rb, list, bounds);
this.renderModelStandardQuads(world, block, pos, null, 0xffffffff, 0xffffffff, true, rb, list, bounds);
rendered = true;
}
return rendered;
}
public static int getLightColor(int light) {
return Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) << 24 | (light & 0x00ff00) | ((light >> 16) & 0xff) | ((light & 0xff) << 16);
}
public static int componentMax(int lightA, int lightB) {
return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff);
}
private int getLightmapValue(IWorldAccess world, BlockPos pos) {
private int getLightmapValue(IWorldAccess world, BlockPos pos, Facing side) {
Block block = world.getState(pos).getBlock();
int light = componentMax(world.getCombinedLight(pos), block.getLight());
if(light == 0 && block instanceof BlockSlab) {
@ -3350,16 +3442,16 @@ public class Renderer {
block = world.getState(pos).getBlock();
light = componentMax(world.getCombinedLight(pos), block.getLight());
}
return getLightColor(light);
return getWorldColor(pos, side, light, true);
}
private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos) {
private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos, Facing side) {
int light = world.getCombinedLight(pos);
int up = world.getCombinedLight(pos.up());
return getLightColor(componentMax(light, up));
return getWorldColor(pos, side, componentMax(light, up), false);
}
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
{
double d0 = (double)blockPosIn.getX();
double d1 = (double)blockPosIn.getY();
@ -3370,11 +3462,13 @@ public class Renderer {
if (ownLight)
{
this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags);
light = boundsFlags.get(0) ? getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : getLightmapValue(blockAccessIn, blockPosIn);
light = boundsFlags.get(0) ? this.getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace()), bakedquad.getFace()) : this.getLightmapValue(blockAccessIn, blockPosIn, bakedquad.getFace());
sky = this.getSkyBrightness(boundsFlags.get(0) ? blockPosIn.offset(bakedquad.getFace()) : blockPosIn);
}
worldRendererIn.addVertexData(bakedquad.getVertexData());
worldRendererIn.putColor4Light(light, light, light, light);
worldRendererIn.putBrightness4(sky, sky, sky, sky);
worldRendererIn.putPosition(d0, d1, d2);
}
}
@ -3529,19 +3623,19 @@ public class Renderer {
f20 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f22 - f21) * 16.0F));
}
int light = getLightmapValueLiquid(blockAccess, blockPosIn);
int norm = FaceBakery.getFaceNormal(shine, Facing.UP);
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).lightNormal(norm).tex((double)f13, (double)f17).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).lightNormal(norm).tex((double)f14, (double)f18).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).lightNormal(norm).tex((double)f15, (double)f19).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).lightNormal(norm).tex((double)f16, (double)f20).lightColor(light).endVertex();
int light = this.getLightmapValueLiquid(blockAccess, blockPosIn, Facing.UP);
int sky = this.getSkyBrightness(blockPosIn);
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(light).tex((double)f13, (double)f17).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(light).tex((double)f14, (double)f18).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(light).tex((double)f15, (double)f19).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(light).tex((double)f16, (double)f20).lightmap(sky).endVertex();
if (blockliquid.shouldRenderSides(blockAccess, blockPosIn.up()))
{
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).lightNormal(norm).tex((double)f13, (double)f17).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).lightNormal(norm).tex((double)f16, (double)f20).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).lightNormal(norm).tex((double)f15, (double)f19).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).lightNormal(norm).tex((double)f14, (double)f18).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(light).tex((double)f13, (double)f17).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(light).tex((double)f16, (double)f20).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(light).tex((double)f15, (double)f19).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(light).tex((double)f14, (double)f18).lightmap(sky).endVertex();
}
}
@ -3551,12 +3645,12 @@ public class Renderer {
float f36 = atextureatlassprite[0].getMaxU();
float f37 = atextureatlassprite[0].getMinV();
float f38 = atextureatlassprite[0].getMaxV();
int light = getLightmapValueLiquid(blockAccess, blockPosIn.down());
int norm = FaceBakery.getFaceNormal(shine, Facing.DOWN);
worldRendererIn.pos(d0, d1, d2 + 1.0D).lightNormal(norm).tex((double)f35, (double)f38).lightColor(light).endVertex();
worldRendererIn.pos(d0, d1, d2).lightNormal(norm).tex((double)f35, (double)f37).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).lightNormal(norm).tex((double)f36, (double)f37).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).lightNormal(norm).tex((double)f36, (double)f38).lightColor(light).endVertex();
int light = this.getLightmapValueLiquid(blockAccess, blockPosIn.down(), Facing.DOWN);
int sky = this.getSkyBrightness(blockPosIn.down());
worldRendererIn.pos(d0, d1, d2 + 1.0D).color(light).tex((double)f35, (double)f38).lightmap(sky).endVertex();
worldRendererIn.pos(d0, d1, d2).color(light).tex((double)f35, (double)f37).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).color(light).tex((double)f36, (double)f37).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(light).tex((double)f36, (double)f38).lightmap(sky).endVertex();
rendered = true;
}
@ -3640,16 +3734,16 @@ public class Renderer {
float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F * 0.5F));
float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F));
float f30 = textureatlassprite1.getInterpolatedV(8.0D);
int light = getLightmapValueLiquid(blockAccess, blockpos);
int norm = FaceBakery.getFaceNormal(shine, np == 0 ? Facing.NORTH : (np == 1 ? Facing.SOUTH : (np == 2 ? Facing.WEST : Facing.EAST)));
worldRendererIn.pos(d3, d1 + (double)f39, d4).lightNormal(norm).tex((double)f41, (double)f28).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).lightNormal(norm).tex((double)f27, (double)f29).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).lightNormal(norm).tex((double)f27, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).lightNormal(norm).tex((double)f41, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).lightNormal(norm).tex((double)f41, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).lightNormal(norm).tex((double)f27, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).lightNormal(norm).tex((double)f27, (double)f29).lightColor(light).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).lightNormal(norm).tex((double)f41, (double)f28).lightColor(light).endVertex();
int light = this.getLightmapValueLiquid(blockAccess, blockpos, np == 0 ? Facing.NORTH : (np == 1 ? Facing.SOUTH : (np == 2 ? Facing.WEST : Facing.EAST)));
int sky = this.getSkyBrightness(blockpos);
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(light).tex((double)f41, (double)f28).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(light).tex((double)f27, (double)f29).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(light).tex((double)f27, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(light).tex((double)f41, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(light).tex((double)f41, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(light).tex((double)f27, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(light).tex((double)f27, (double)f29).lightmap(sky).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(light).tex((double)f41, (double)f28).lightmap(sky).endVertex();
}
}
@ -3752,12 +3846,12 @@ public class Renderer {
f16 = f15;
f20 = f17;
int light = getLightmapValueLiquid(blockAccess, blockPosIn);
int norm = FaceBakery.getFaceNormal(shine, Facing.UP);
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).lightNormal(norm).tex((double)f13, (double)f17).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).lightNormal(norm).tex((double)f14, (double)f18).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).lightNormal(norm).tex((double)f15, (double)f19).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).lightNormal(norm).tex((double)f16, (double)f20).lightColor(light).endVertex();
int light = this.getLightmapValueLiquid(blockAccess, blockPosIn, Facing.UP);
int sky = this.getSkyBrightness(blockPosIn);
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(light).tex((double)f13, (double)f17).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(light).tex((double)f14, (double)f18).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(light).tex((double)f15, (double)f19).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(light).tex((double)f16, (double)f20).lightmap(sky).endVertex();
//
// if (block.shouldRenderSides(blockAccess, blockPosIn.up()))
// {
@ -3774,12 +3868,12 @@ public class Renderer {
float f36 = textureatlassprite.getMaxU();
float f37 = textureatlassprite.getMinV();
float f38 = textureatlassprite.getMaxV();
int light = getLightmapValueLiquid(blockAccess, blockPosIn.down());
int norm = FaceBakery.getFaceNormal(shine, Facing.DOWN);
worldRendererIn.pos(d0, d1, d2 + 1.0D).lightNormal(norm).tex((double)f35, (double)f38).lightColor(light).endVertex();
worldRendererIn.pos(d0, d1, d2).lightNormal(norm).tex((double)f35, (double)f37).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).lightNormal(norm).tex((double)f36, (double)f37).lightColor(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).lightNormal(norm).tex((double)f36, (double)f38).lightColor(light).endVertex();
int light = this.getLightmapValueLiquid(blockAccess, blockPosIn.down(), Facing.DOWN);
int sky = this.getSkyBrightness(blockPosIn.down());
worldRendererIn.pos(d0, d1, d2 + 1.0D).color(light).tex((double)f35, (double)f38).lightmap(sky).endVertex();
worldRendererIn.pos(d0, d1, d2).color(light).tex((double)f35, (double)f37).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).color(light).tex((double)f36, (double)f37).lightmap(sky).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(light).tex((double)f36, (double)f38).lightmap(sky).endVertex();
rendered = true;
}
@ -3863,16 +3957,16 @@ public class Renderer {
float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F));
float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F));
float f30 = textureatlassprite1.getInterpolatedV(16.0D);
int light = getLightmapValueLiquid(blockAccess, blockpos);
int norm = FaceBakery.getFaceNormal(shine, np == 0 ? Facing.NORTH : (np == 1 ? Facing.SOUTH : (np == 2 ? Facing.WEST : Facing.EAST)));
worldRendererIn.pos(d3, d1 + (double)f39, d4).lightNormal(norm).tex((double)f41, (double)f28).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).lightNormal(norm).tex((double)f27, (double)f29).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).lightNormal(norm).tex((double)f27, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).lightNormal(norm).tex((double)f41, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).lightNormal(norm).tex((double)f41, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).lightNormal(norm).tex((double)f27, (double)f30).lightColor(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).lightNormal(norm).tex((double)f27, (double)f29).lightColor(light).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).lightNormal(norm).tex((double)f41, (double)f28).lightColor(light).endVertex();
int light = this.getLightmapValueLiquid(blockAccess, blockpos, np == 0 ? Facing.NORTH : (np == 1 ? Facing.SOUTH : (np == 2 ? Facing.WEST : Facing.EAST)));
int sky = this.getSkyBrightness(blockpos);
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(light).tex((double)f41, (double)f28).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(light).tex((double)f27, (double)f29).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(light).tex((double)f27, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(light).tex((double)f41, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(light).tex((double)f41, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(light).tex((double)f27, (double)f30).lightmap(sky).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(light).tex((double)f27, (double)f29).lightmap(sky).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(light).tex((double)f41, (double)f28).lightmap(sky).endVertex();
}
}
@ -3906,7 +4000,7 @@ public class Renderer {
if (!material.isNonBlock()) // material != block
{
if (!material.canConnectNonBlock())
if (material == Blocks.air)
{
++a;
f += 4;

View file

@ -15,7 +15,6 @@ import client.Client;
import client.util.FileUtils;
import common.collect.Maps;
import common.log.Log;
import common.util.ExtMath;
import common.util.Matrix4f;
import common.util.Util;
import common.util.Vec3;
@ -23,56 +22,18 @@ import common.util.Vector3f;
import common.util.Vector4f;
public enum Shader {
WORLD("world", "world", context -> {context.integer("tex", 0); /* GL46.glUniformBlockBinding(context.getProgram(), GL46.glGetUniformBlockIndex(context.getProgram(), "light_block"), 0); */}, context -> {
context.vec("clip_near", Client.CLIENT.renderer.getNearPlane());
context.vec("clip_far", Client.CLIENT.renderer.getFarPlane());
context.vec("screen", (float)Client.CLIENT.fbRawX, (float)Client.CLIENT.fbRawY);
GRID("grid", "grid", context -> {context.integer("tex", 0);}, context -> {
context.matrix("view", MatrixState.getModelView());
context.matrix("projection", MatrixState.getProjection());
context.vec("time", (float)Util.ftime());
float angle = -90.0f + Client.CLIENT.renderer.getCelestialAngle(Client.CLIENT.getTickFraction());
float sunX = !Client.CLIENT.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos(angle / 180.0f * (float)Math.PI);
float sunY = !Client.CLIENT.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin(angle / 180.0f * (float)Math.PI);
context.vec("sun_direction", sunX, sunY, 0.0f);
float moonX = !Client.CLIENT.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos((180.0f + angle) / 180.0f * (float)Math.PI);
float moonY = !Client.CLIENT.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin((180.0f + angle) / 180.0f * (float)Math.PI);
context.vec("moon_direction", moonX, moonY, 0.0f);
float sunRed = Client.CLIENT.renderer.getSunColorRed();
float sunGreen = Client.CLIENT.renderer.getSunColorGreen();
float sunBlue = Client.CLIENT.renderer.getSunColorBlue();
context.vec("sun_ambient", sunRed, sunGreen, sunBlue);
float moonRed = Client.CLIENT.renderer.getMoonColorRed();
float moonGreen = Client.CLIENT.renderer.getMoonColorGreen();
float moonBlue = Client.CLIENT.renderer.getMoonColorBlue();
context.vec("moon_ambient", moonRed, moonGreen, moonBlue);
context.vec("light_factor", Client.CLIENT.lightBlend);
context.vec("max_vert_dist", Client.CLIENT.lightDistVert);
context.vec("max_cam_dist", Client.CLIENT.lightDistCam);
context.integer("n_lights", 0);
context.color3("specular", Client.CLIENT.specularColors && !Client.CLIENT.setGamma && !Client.CLIENT.xrayActive ? 0xffffff : 0x000000);
context.bool("shade", Client.CLIENT.flatShading || Client.CLIENT.setGamma || Client.CLIENT.xrayActive);
GlState.setActiveTexture(GL46.GL_TEXTURE0);
// glBindBufferBase(GL_UNIFORM_BUFFER, 0, world->light_buf);
}, "MAX_LIGHTS", (Supplier<Integer>)() -> Client.CLIENT.lightMaximum),
context.vec("tex_mul", (float)Client.CLIENT.getTextureMapBlocks().getWidth() / 16.0f, (float)Client.CLIENT.getTextureMapBlocks().getHeight() / 16.0f);
}),
VIS("vis", "vis", null, context -> {
context.matrix("view", MatrixState.getModelView());
context.matrix("projection", MatrixState.getProjection());
});
// BLIT("blit", "blit", context -> context.integer("tex", 0), context -> {
// GL46.glBindVertexArray(QUAD);
// GlState.setActiveTexture(GL46.GL_TEXTURE0);
// });
public class ShaderContext {
private final int program;
@ -314,13 +275,4 @@ public enum Shader {
if(this.program != 0 && !this.load())
Log.RENDER.error("Konnte Shader-Programm '%s' nicht neu laden", this.name());
}
// void shd_setint(int *pos, const char *vardef, int value) {
// *pos += sprintf(&gdr.shd_include[*pos], "#define %s %d\n", vardef, value);
// }
//
// void shd_setvars() {
// int pos = 0;
// shd_setint(&pos, "MAX_LIGHTS", gdr.light_max < 1 ? 1 : gdr.light_max);
// }
}

View file

@ -33,6 +33,9 @@ public class TextureMap extends Texture
private final Map<String, TextureCreator> tickedTextures;
private final Map<String, Integer> animTextures;
private final Sprite missingImage;
private int width;
private int height;
public TextureMap()
{
@ -62,6 +65,14 @@ public class TextureMap extends Texture
map.clear();
anim.clear();
}
public int getWidth() {
return this.width;
}
public int getHeight() {
return this.height;
}
private void initMissingImage()
{
@ -146,7 +157,7 @@ public class TextureMap extends Texture
}
Log.RENDER.info("Textur-Atlas in Größe " + stitcher.getCurrentWidth() + "x" + stitcher.getCurrentHeight() + " erstellt");
TextureUtil.allocateTexture(this.getGlTextureId(), stitcher.getCurrentWidth(), stitcher.getCurrentHeight());
TextureUtil.allocateTexture(this.getGlTextureId(), this.width = stitcher.getCurrentWidth(), this.height = stitcher.getCurrentHeight());
Map<String, Sprite> map = Maps.<String, Sprite>newHashMap(this.mapRegisteredSprites);
for (Sprite textureatlassprite2 : stitcher.getStichSlots())

View file

@ -0,0 +1,40 @@
#define GLM_PI 3.14159265358979323846264338327950288
#define GLM_SQRT2 1.41421356237309504880168872420969808
#define vis_div 24.0
out vec4 FragColor;
in vec3 vertex;
in vec2 tex_coord;
uniform vec2 tex_mul;
uniform float time;
float v2rand(vec2 uv) {
return fract(sin(dot(uv, vec2(12.9898,78.233))) * 43758.5453123);
}
float avg(vec4 v) {
return ((v.r + v.g + v.b) / 3.0) * v.a;
}
float gauss(float v, float b, float c) {
return (1.0 / (c * sqrt(2.0 * GLM_PI))) * exp(-(pow(v - b, 2.0) / (2.0 * pow(c, 2.0))));
}
float dgauss(float v, float b, float c) {
return b + v * c;
}
float inside(vec2 vec, vec2 offs, float a, float b, float scale, float x1, float x2, float y1, float y2) {
vec2 cscaled = (mod(vec + offs + 1.0, 1.0)) * scale;
return (x2 < x1 ? (cscaled.x >= x1 || cscaled.x <= x2) : (cscaled.x >= x1 && cscaled.x <= x2)) || (y2 < y1 ? (cscaled.y >= y1 || cscaled.y <= y2) : (cscaled.y >= y1 && cscaled.y <= y2)) || (abs(cscaled.y - (cscaled.x - (x2 < x1 ? (x1 - x2) : (x2 - x1)) * GLM_SQRT2 * (x2 < x1 ? 0.0 : (x1 < scale / 2.0 ? x1 : (x2 - scale))))) < GLM_SQRT2) ? b : a;
}
void main() {
vec2 coord = fract(tex_coord * tex_mul) * vis_div;
vec2 shift = vec2(v2rand(coord + fract(time)) * 2.0 - 1.0, v2rand(coord + 0.5 + fract(time)) * 2.0 - 1.0);
shift = vec2(dgauss(shift.x, 0.0, 1.0), dgauss(shift.y, 0.0, 1.0)) * 0.015;
vec3 cl = vec3(inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 1.0, 3.0, 1.0, 3.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 63.0, 1.0, 63.0, 1.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 61.0, 63.0, 61.0, 63.0));
FragColor = vec4(mix(vec3(0.0, 0.0, clamp(0.1 + 0.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0)), cl, clamp(cl.x + cl.y + cl.z, 0.0, 1.0)), 1.0);
}

View file

@ -1,14 +1,10 @@
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 norm;
layout (location = 1) in vec4 color;
layout (location = 2) in vec2 coord;
layout (location = 3) in vec4 light;
out vec3 vertex;
out vec3 normal;
out vec2 tex_coord;
out vec4 light_color;
out float shine;
out float shading;
uniform mat4 model;
uniform mat4 view;
@ -17,15 +13,10 @@ uniform vec3 offset;
uniform int chunk_x;
uniform int chunk_y;
uniform int chunk_z;
uniform bool shade;
void main() {
vec3 nvertex = vec3(model * vec4(pos, 1.0));
vertex = vec3(float(chunk_x) + pos.x, float(chunk_y) + pos.y, float(chunk_z) + pos.z);
shading = shade ? (norm.x != 0.0 ? 0.6 : (norm.z != 0.0 ? 0.8 : (norm.y < 0.0 ? 0.5 : 1.0))) : 1.0;
normal = mat3(transpose(inverse(model))) * norm.xyz;
shine = norm.a * 32.0;
tex_coord = coord;
light_color = light;
gl_Position = projection * view * vec4(offset + nvertex, 1.0);
}

View file

@ -1,128 +0,0 @@
#define GLM_PI 3.14159265358979323846264338327950288
#define GLM_SQRT2 1.41421356237309504880168872420969808
#define vis_div 24.0
out vec4 FragColor;
struct light_t {
vec4 position;
vec4 ambient; // constant
vec4 diffuse; // linear
vec4 specular; // quadratic
vec4 range;
};
in vec3 vertex;
in vec3 normal;
in vec2 tex_coord;
in vec4 light_color;
in float shine;
in float shading;
uniform vec3 cam_pos;
uniform sampler2D tex;
uniform vec3 specular;
uniform float max_vert_dist;
uniform float max_cam_dist;
uniform float light_factor;
uniform vec3 sun_direction;
uniform vec3 sun_ambient;
uniform vec3 moon_direction;
uniform vec3 moon_ambient;
uniform int n_lights;
uniform bool sky_light;
uniform bool moon_light;
uniform float time;
uniform light_block {
light_t lights[MAX_LIGHTS];
};
float v2rand(vec2 uv) {
return fract(sin(dot(uv, vec2(12.9898,78.233))) * 43758.5453123);
}
float avg(vec4 v) {
return ((v.r + v.g + v.b) / 3.0) * v.a;
}
float gauss(float v, float b, float c) {
return (1.0 / (c * sqrt(2.0 * GLM_PI))) * exp(-(pow(v - b, 2.0) / (2.0 * pow(c, 2.0))));
}
float dgauss(float v, float b, float c) {
return b + v * c;
}
float inside(vec2 vec, vec2 offs, float a, float b, float scale, float x1, float x2, float y1, float y2) {
vec2 cscaled = (mod(vec + offs + 1.0, 1.0)) * scale;
return (x2 < x1 ? (cscaled.x >= x1 || cscaled.x <= x2) : (cscaled.x >= x1 && cscaled.x <= x2)) || (y2 < y1 ? (cscaled.y >= y1 || cscaled.y <= y2) : (cscaled.y >= y1 && cscaled.y <= y2)) || (abs(cscaled.y - (cscaled.x - (x2 < x1 ? (x1 - x2) : (x2 - x1)) * GLM_SQRT2 * (x2 < x1 ? 0.0 : (x1 < scale / 2.0 ? x1 : (x2 - scale))))) < GLM_SQRT2) ? b : a;
}
/*
vec4 pcf_sample(sampler2D stex, vec2 pos) {
vec4 avg = vec4(0.0);
vec2 texel = 1.0 / textureSize(stex, 0);
for(int x = -1; x <= 1; x++) {
for(int y = -1; y <= 1; y++) {
avg += texture(stex, pos + vec2(x, y) * texel);
}
}
return avg /= 9.0;
}
*/
vec3 calc_dir_light(vec3 norm, vec3 dir, vec3 rgb, vec3 direction, vec3 color) {
if(shine <= -2.0)
return color * rgb;
vec3 ldir = normalize(-direction);
float diff = max(dot(norm, ldir), 0.0);
vec3 rdir = reflect(-ldir, norm);
float spec = shine <= 0.0 ? 0.0 : pow(max(dot(dir, rdir), 0.0), shine) * (shine < 1.0 ? shine : 1.0);
vec3 ambient = color * rgb; // + clamp(vec3(0.0), 0.0, 1.0);
vec3 diffuse = color * 0.125 * diff * rgb;
vec3 speculars = color * 1.25 * spec * specular * rgb;
return (ambient + diffuse + speculars);
}
vec3 calc_point_light(light_t light, vec3 norm, vec3 dir, vec3 rgb) {
rgb = clamp(rgb + light_factor, 0.0, 1.0);
vec3 ldir = normalize(light.position.xyz - vertex);
float diff = shine <= -3.0 ? 0.0 : max(dot(norm, ldir), 0.0);
vec3 rdir = reflect(-ldir, norm);
float spec = shine <= -1.0 ? 0.0 : pow(max(dot(dir, rdir), 0.0), shine) * (shine < 1.0 ? shine : 1.0);
float distance = length((light.position.xyz - vertex) / light.range.xyz);
float attenuation = 1.0 / (light.ambient.w + light.diffuse.w * distance + light.specular.w * (distance * distance));
vec3 ambient = light.ambient.xyz * rgb;
vec3 diffuse = light.diffuse.xyz * diff * rgb;
vec3 speculars = light.specular.xyz * spec * specular * rgb;
ambient *= attenuation;
diffuse *= attenuation;
speculars *= attenuation;
return (ambient + diffuse + speculars);
}
void main() {
if(shine <= -16.0) {
vec2 coord = fract(tex_coord * textureSize(tex, 0) / 256.0) * vis_div; // vertex.xz + vec2(0.25, 0.5)) * 24.0 / 2.0;
vec2 shift = vec2(v2rand(coord + fract(time)) * 2.0 - 1.0, v2rand(coord + 0.5 + fract(time)) * 2.0 - 1.0);
shift = vec2(dgauss(shift.x, 0.0, 1.0), dgauss(shift.y, 0.0, 1.0)) * 0.015;
vec3 cl = vec3(inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 1.0, 3.0, 1.0, 3.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 63.0, 1.0, 63.0, 1.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 61.0, 63.0, 61.0, 63.0));
FragColor = vec4(mix(vec3(0.0, 0.0, clamp(0.1 + 0.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0)), cl, clamp(cl.x + cl.y + cl.z, 0.0, 1.0)), 1.0);
return;
}
vec3 norm = normalize(normal);
vec3 dir = normalize(cam_pos - vertex);
vec4 texel = texture(tex, tex_coord);
float sky = sky_light ? vertex.y < 0.0 ? 0.0 : (vertex.y < 64.0 ? vertex.y / 64.0 : 1.0) : 1.0;
vec3 rgb = texel.rgb * shading;
vec3 direct = rgb * sky * (1.0 - light_color.a * light_factor);
vec3 result = rgb * light_color.rgb + calc_dir_light(norm, dir, direct, sun_direction, sun_ambient);
if(moon_light)
result += calc_dir_light(norm, dir, direct, moon_direction, moon_ambient);
for(int z = 0; z < n_lights; z++) {
if(distance(vertex, lights[z].position.xyz) <= max_vert_dist && distance(cam_pos, lights[z].position.xyz) <= max_cam_dist)
result += calc_point_light(lights[z], norm, dir, rgb);
}
FragColor = vec4(result, texel.a);
}

View file

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 171 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 540 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 320 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 496 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 823 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 735 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 638 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -1034,6 +1034,16 @@ public class Block {
public void getModifiers(Map<Attribute, Float> map) {
}
// @Clientside
// public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) {
// return side == Facing.DOWN && this.minY > 0.0D ? true
// : (side == Facing.UP && this.maxY < 1.0D ? true
// : (side == Facing.NORTH && this.minZ > 0.0D ? true
// : (side == Facing.SOUTH && this.maxZ < 1.0D ? true
// : (side == Facing.WEST && this.minX > 0.0D ? true
// : (side == Facing.EAST && this.maxX < 1.0D ? true
// : !world.getState(pos).getBlock().isOpaqueCube())))));
// }
@Clientside
public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) {
return side == Facing.DOWN && this.minY > 0.0D ? true
@ -1045,6 +1055,12 @@ public class Block {
: !world.getState(pos).getBlock().isOpaqueCube() && (!this.isNonBlock() || !world.getState(pos).getBlock().isNonBlock() || !world.getState(pos).getBlock().isVisuallyOpaque()))))));
}
@Clientside
public BoundingBox getSelectionBox(World world, BlockPos pos) {
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ,
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
}
@Clientside
public boolean isXrayVisible() {
return false;
@ -1066,7 +1082,7 @@ public class Block {
@Clientside
public float getShinyness() {
return 0.75f;
return 1.0f;
}
@Clientside

View file

@ -1,7 +1,6 @@
package common.block;
import common.block.natural.BlockFire;
import common.block.natural.BlockNonBlock;
import common.entity.item.EntityFalling;
import common.init.Blocks;
import common.rng.Random;
@ -11,7 +10,7 @@ import common.world.State;
import common.world.World;
import common.world.AWorldServer;
public class BlockFalling extends BlockNonBlock {
public class BlockFalling extends Block {
public static boolean fallInstantly;
public static boolean canFallInto(World world, BlockPos pos) {

View file

@ -1,8 +1,6 @@
package common.block;
import common.block.natural.BlockNonBlock;
public class BlockTreasure extends BlockNonBlock {
public class BlockTreasure extends Block {
public BlockTreasure(Material material) {
super(material);
}

View file

@ -94,6 +94,12 @@ public class BlockDoor extends Block implements Rotatable {
return false;
}
@Clientside
public BoundingBox getSelectionBox(World world, BlockPos pos) {
this.setBlockBounds(world, pos);
return super.getSelectionBox(world, pos);
}
public BoundingBox getCollisionBox(World world, BlockPos pos, State state) {
this.setBlockBounds(world, pos);
return super.getCollisionBox(world, pos, state);

View file

@ -33,6 +33,12 @@ public class BlockLadder extends Block implements Rotatable
return super.getCollisionBox(worldIn, pos, state);
}
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
{
this.setBlockBounds(worldIn, pos);
return super.getSelectionBox(worldIn, pos);
}
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
{
State iblockstate = worldIn.getState(pos);

View file

@ -17,7 +17,6 @@ import common.model.Model.ModelProvider;
import common.properties.Property;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Clientside;
import common.util.Facing;
import common.util.Facing.Axis;
import common.world.IWorldAccess;
@ -30,12 +29,22 @@ public class BlockSlab extends Block implements Directional {
private final Block base;
private final String textureTop;
private final String textureBottom;
private final String textureSide;
private final String textureOverlay;
public BlockSlab(Block base) {
this(base, null, null);
}
public BlockSlab(Block base, String bottom, String top) {
this(base, bottom, top, null);
}
public BlockSlab(Block base, String bottom, String top, String side) {
this(base, bottom, top, side, null);
}
public BlockSlab(Block base, String bottom, String top, String side, String overlay) {
super(base.getMaterial());
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.DOWN));
this.setTab(base.getTab());
@ -49,6 +58,8 @@ public class BlockSlab extends Block implements Directional {
this.setSound(this.base.getSound());
this.textureTop = top;
this.textureBottom = bottom;
this.textureSide = side;
this.textureOverlay = overlay;
SLABS.add(this);
}
@ -157,7 +168,9 @@ public class BlockSlab extends Block implements Directional {
public Model getModel(ModelProvider provider, String name, State state) {
String primary = this.base.getModel(provider, BlockRegistry.getName(this.base), this.base.getState()).getPrimary();
Model model = makeSlabModel(provider.getModel(primary), this.textureBottom != null ? this.textureBottom : primary, this.textureTop != null ? this.textureTop : primary, state.getValue(FACING));
Model model = makeSlabModel(provider.getModel(this.textureSide != null ? this.textureSide : primary), this.textureBottom != null ? this.textureBottom : primary, this.textureTop != null ? this.textureTop : primary, state.getValue(FACING));
if(this.textureOverlay != null)
makeSlabModel(model, this.textureOverlay, null, state.getValue(FACING));
return model;
}
@ -192,9 +205,4 @@ public class BlockSlab extends Block implements Directional {
public int getFuelAmount() {
return this.material == Material.WOOD ? 150 : 0;
}
@Clientside
public float getShinyness() {
return this.base.getShinyness();
}
}

View file

@ -16,7 +16,6 @@ import common.properties.Property;
import common.properties.PropertyEnum;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Clientside;
import common.util.Facing;
import common.util.HitPosition;
import common.util.Identifyable;
@ -34,6 +33,7 @@ public class BlockStairs extends Block implements Rotatable
private final Block base;
private final String downTex;
private final String upTex;
private final String sideTex;
private boolean hasRaytraced;
private int rayTracePass;
@ -43,6 +43,11 @@ public class BlockStairs extends Block implements Rotatable
}
public BlockStairs(Block base, String down, String up)
{
this(base, down, up, null);
}
public BlockStairs(Block base, String down, String up, String side)
{
super(base.getMaterial());
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT));
@ -54,6 +59,7 @@ public class BlockStairs extends Block implements Rotatable
this.setTab(base.getTab());
this.downTex = down;
this.upTex = up;
this.sideTex = side;
}
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
@ -677,7 +683,7 @@ public class BlockStairs extends Block implements Rotatable
public Model getModel(ModelProvider provider, String name, State state) {
String primary = this.base.getModel(provider, BlockRegistry.getName(this.base), this.base.getState()).getPrimary();
return makeModel(provider.getModel(primary), state.getValue(HALF) == EnumHalf.TOP, state.getValue(SHAPE) == EnumShape.INNER_RIGHT ||
return makeModel(provider.getModel(this.sideTex != null ? this.sideTex : primary), state.getValue(HALF) == EnumHalf.TOP, state.getValue(SHAPE) == EnumShape.INNER_RIGHT ||
state.getValue(SHAPE) == EnumShape.INNER_LEFT, state.getValue(SHAPE) == EnumShape.OUTER_RIGHT ||
state.getValue(SHAPE) == EnumShape.OUTER_LEFT, state.getValue(SHAPE) == EnumShape.INNER_LEFT ||
state.getValue(SHAPE) == EnumShape.OUTER_LEFT, state.getValue(FACING),
@ -697,11 +703,6 @@ public class BlockStairs extends Block implements Rotatable
return new Property[] {SHAPE};
}
@Clientside
public float getShinyness() {
return this.base.getShinyness();
}
public static enum EnumHalf implements Identifyable
{
TOP("top"),

View file

@ -67,6 +67,12 @@ public class BlockTrapDoor extends Block implements Rotatable
return !((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue();
}
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
{
this.setBlockBounds(worldIn, pos);
return super.getSelectionBox(worldIn, pos);
}
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
{
this.setBlockBounds(worldIn, pos);

View file

@ -14,7 +14,6 @@ import common.properties.Property;
import common.properties.PropertyBool;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Clientside;
import common.util.Facing;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
@ -304,9 +303,4 @@ public class BlockWall extends Block
protected Property[] getUnsavedProperties() {
return new Property[] {NORTH, SOUTH, UP, WEST, EAST};
}
@Clientside
public float getShinyness() {
return this.base.getShinyness();
}
}

View file

@ -5,17 +5,20 @@ import common.block.Material;
import common.init.Blocks;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.rng.Random;
import common.util.BlockPos;
import common.vars.Vars;
import common.world.State;
import common.world.AWorldServer;
public class BlockBlackenedSoil extends BlockSnowable
public class BlockBlackenedSoil extends Block
{
public BlockBlackenedSoil(boolean snowy)
public BlockBlackenedSoil()
{
super(Material.LOOSE, snowy);
super(Material.LOOSE);
this.setTicked();
this.setTab(CheatTab.NATURE);
}
@ -26,22 +29,19 @@ public class BlockBlackenedSoil extends BlockSnowable
if(Vars.darkSoilDecay)
worldIn.setState(pos, Blocks.blackened_dirt.getState());
}
else {
if (Vars.darkSoilSpread)
{
for (int i = 0; i < 4; i++)
{
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
Block block = worldIn.getState(blockpos.up()).getBlock();
State iblockstate = worldIn.getState(blockpos);
if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.swamp || iblockstate.getBlock() == Blocks.blackened_dirt) && block.getLightOpacity() <= 6)
{
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
}
}
}
super.tick(worldIn, pos, state, rand);
else if (Vars.darkSoilSpread)
{
for (int i = 0; i < 4; i++)
{
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
Block block = worldIn.getState(blockpos.up()).getBlock();
State iblockstate = worldIn.getState(blockpos);
if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.swamp || iblockstate.getBlock() == Blocks.blackened_dirt) && block.getLightOpacity() <= 6)
{
worldIn.setState(blockpos, Blocks.blackened_soil.getState());
}
}
}
}
@ -49,4 +49,8 @@ public class BlockBlackenedSoil extends BlockSnowable
{
return Blocks.blackened_dirt.getDrop(Blocks.blackened_dirt.getState(), rand, fortune);
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel("blackened_dirt").add().d().u("blackened_soil_top").nswe("blackened_soil_side");
}
}

View file

@ -67,7 +67,7 @@ public class BlockBlueShroom extends BlockBush
protected boolean canPlaceBlockOn(Block ground)
{
return ground.isFullBlock() || ground.isNonBlock();
return ground.isFullBlock();
}
public boolean canBlockStay(World worldIn, BlockPos pos, State state)

View file

@ -69,6 +69,12 @@ public class BlockCactus extends Block
return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)(pos.getY() + 1) - f), (double)((float)(pos.getZ() + 1) - f));
}
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
{
float f = 0.0625F;
return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)(pos.getY() + 1), (double)((float)(pos.getZ() + 1) - f));
}
public boolean isFullCube()
{
return false;

View file

@ -5,21 +5,36 @@ import common.block.Material;
import common.init.Blocks;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
public class BlockGrass extends BlockSnowable implements IGrowable
public class BlockGrass extends Block implements IGrowable
{
public BlockGrass(boolean snowy)
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockGrass()
{
super(Material.LOOSE, snowy);
super(Material.LOOSE);
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTicked();
this.setTab(CheatTab.NATURE);
}
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
{
Block block = worldIn.getState(pos.up()).getBlock();
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
{
if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 2)
@ -27,14 +42,9 @@ public class BlockGrass extends BlockSnowable implements IGrowable
if(Vars.grassDecay)
worldIn.setState(pos, Blocks.dirt.getState());
}
else if(worldIn.getTemperatureC(pos) >= 50.0f) {
if(Vars.grassDry)
worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() :
Blocks.dirt.getState());
}
else
else if(worldIn.getTemperatureC(pos) < 50.0f)
{
if (Vars.grassSpread)
if (Vars.grassSpread)
{
for (int i = 0; i < 4; ++i)
{
@ -48,7 +58,11 @@ public class BlockGrass extends BlockSnowable implements IGrowable
}
}
}
super.tick(worldIn, pos, state, rand);
}
else {
if(Vars.grassDry)
worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() :
Blocks.dirt.getState());
}
}
@ -71,4 +85,20 @@ public class BlockGrass extends BlockSnowable implements IGrowable
{
worldIn.growGrass(pos, state, rand);
}
protected Property[] getProperties()
{
return new Property[] {SNOWY};
}
public Model getModel(ModelProvider provider, String name, State state) {
if(state.getValue(SNOWY))
return provider.getModel("dirt").add().d().u("snow").nswe().add().nswe("soil_snowed");
else
return provider.getModel("dirt").add().d().u("grass_top").nswe().add().nswe("grass_side");
}
protected Property[] getUnsavedProperties() {
return new Property[] {SNOWY};
}
}

View file

@ -2,9 +2,8 @@ package common.block.foliage;
import common.block.Block;
import common.block.Material;
import common.block.natural.BlockNonBlock;
public class BlockLeavesBase extends BlockNonBlock
public class BlockLeavesBase extends Block
{
// public static final List<BlockLeavesBase> BASE_LEAVES = Lists.newArrayList();

View file

@ -70,7 +70,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
*/
protected boolean canPlaceBlockOn(Block ground)
{
return ground.isFullBlock() || ground.isNonBlock();
return ground.isFullBlock();
}
public boolean canBlockStay(World worldIn, BlockPos pos, State state)

View file

@ -5,22 +5,41 @@ import common.block.Material;
import common.init.Blocks;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
public class BlockMycelium extends BlockSnowable
public class BlockMycelium extends Block
{
public BlockMycelium(boolean snowy)
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockMycelium()
{
super(Material.LOOSE, snowy);
super(Material.LOOSE);
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTicked();
this.setTab(CheatTab.NATURE);
}
/**
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
* metadata, such as fence connections.
*/
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
{
Block block = worldIn.getState(pos.up()).getBlock();
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
{
// if (!worldIn.client)
@ -30,23 +49,20 @@ public class BlockMycelium extends BlockSnowable
if(Vars.mycelDecay)
worldIn.setState(pos, Blocks.dirt.getState());
}
else {
if(Vars.mycelSpread)
{
for (int i = 0; i < 4; ++i)
{
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
State iblockstate = worldIn.getState(blockpos);
Block block = worldIn.getState(blockpos.up()).getBlock();
else if(Vars.mycelSpread)
{
for (int i = 0; i < 4; ++i)
{
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
State iblockstate = worldIn.getState(blockpos);
Block block = worldIn.getState(blockpos.up()).getBlock();
if (iblockstate.getBlock() == Blocks.dirt && block.getLightOpacity() <= 2)
{
worldIn.setState(blockpos, this.getState());
}
if (iblockstate.getBlock() == Blocks.dirt && block.getLightOpacity() <= 2)
{
worldIn.setState(blockpos, this.getState());
}
}
super.tick(worldIn, pos, state, rand);
}
}
}
// }
}
@ -67,4 +83,20 @@ public class BlockMycelium extends BlockSnowable
{
return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune);
}
protected Property[] getProperties()
{
return new Property[] {SNOWY};
}
public Model getModel(ModelProvider provider, String name, State state) {
if(state.getValue(SNOWY))
return provider.getModel("dirt").add().d().u("snow").nswe().add().nswe("soil_snowed");
else
return provider.getModel("dirt").add().d().u("mycelium_top").nswe().add().nswe("mycelium_side");
}
protected Property[] getUnsavedProperties() {
return new Property[] {SNOWY};
}
}

View file

@ -1,31 +0,0 @@
package common.block.foliage;
import common.block.Material;
import common.block.natural.BlockNonBlock;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
import common.world.AWorldServer;
public class BlockSnowable extends BlockNonBlock {
private final boolean snowy;
private BlockSnowable other;
public BlockSnowable(Material material, boolean snowy) {
super(material);
this.setTicked();
this.snowy = snowy;
}
public BlockSnowable setOther(BlockSnowable other) {
this.other = other;
other.other = this;
return this;
}
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
if(this.snowy ? !worldIn.canFreezeAt(pos) : (worldIn.isRaining() || !worldIn.dimension.hasWeather()) && worldIn.canFreezeAt(pos) && worldIn.getPrecipitationHeight(pos).getY() - 1 <= pos.getY())
worldIn.setState(pos, this.other.getState());
}
}

View file

@ -1,25 +1,41 @@
package common.block.foliage;
import common.block.Block;
import common.block.Material;
import common.entity.Entity;
import common.init.Blocks;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.vars.Vars;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
public class BlockSwamp extends BlockSnowable
public class BlockSwamp extends Block
{
public BlockSwamp(boolean snowy)
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockSwamp()
{
super(Material.LOOSE, snowy);
super(Material.LOOSE);
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTicked();
this.setTab(CheatTab.NATURE);
}
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
{
Block block = worldIn.getState(pos.up()).getBlock();
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
{
@ -33,6 +49,22 @@ public class BlockSwamp extends BlockSnowable
entityIn.motionZ *= 0.6D;
}
public Model getModel(ModelProvider provider, String name, State state) {
if(state.getValue(SNOWY))
return provider.getModel("dirt").add().d().u("snow").nswe().add().nswe("soil_snowed");
else
return provider.getModel("dirt").add().d().u("swamp_top").nswe().add().nswe("swamp_side");
}
protected Property[] getProperties()
{
return new Property[] {SNOWY};
}
protected Property[] getUnsavedProperties() {
return new Property[] {SNOWY};
}
public Item getDrop(State state, Random rand, int fortune)
{
return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune);
@ -45,16 +77,11 @@ public class BlockSwamp extends BlockSnowable
if(Vars.swampDecay)
worldIn.setState(pos, Blocks.dirt.getState());
}
else {
if(Vars.swampDry) {
float temp = worldIn.getTemperatureC(pos);
if(temp >= 38.0f) {
worldIn.setState(pos, temp >= 50.0f ? (worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() :
Blocks.dirt.getState()) : Blocks.grass.getState());
return;
}
}
super.tick(worldIn, pos, state, rand);
else if(Vars.swampDry) {
float temp = worldIn.getTemperatureC(pos);
if(temp >= 38.0f)
worldIn.setState(pos, temp >= 50.0f ? (worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() :
Blocks.dirt.getState()) : Blocks.grass.getState());
}
}
}

View file

@ -1,22 +1,54 @@
package common.block.foliage;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.world.IWorldAccess;
import common.world.State;
public class BlockTianSoil extends BlockSnowable
public class BlockTianSoil extends Block
{
public BlockTianSoil(boolean snowy)
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockTianSoil()
{
super(Material.SOLID, snowy);
super(Material.SOLID);
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTab(CheatTab.NATURE);
}
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
{
Block block = worldIn.getState(pos.up()).getBlock();
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
public Item getDrop(State state, Random rand, int fortune)
{
return Blocks.tian.getDrop(Blocks.tian.getState(), rand, fortune);
}
protected Property[] getProperties()
{
return new Property[] {SNOWY};
}
public Model getModel(ModelProvider provider, String name, State state) {
if(state.getValue(SNOWY))
return provider.getModel("tian").add().d().u("snow").nswe().add().nswe("tian_soil_snowed");
else
return provider.getModel("tian").add().d().u("tian_soil_top").nswe().add().nswe("tian_soil_side");
}
protected Property[] getUnsavedProperties() {
return new Property[] {SNOWY};
}
}

View file

@ -42,10 +42,10 @@ public class BlockDynamicLiquid extends BlockLiquid
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
{
if(this.material == Material.WATER && !worldIn.getState(pos.up()).getBlock().isOpaqueCube() && worldIn.canBlockFreeze(pos, true) && rand.chance(25)) {
worldIn.setState(pos, Blocks.ice.getState());
return;
}
if(this.material == Material.WATER && !worldIn.getState(pos.up()).getBlock().isOpaqueCube() && worldIn.canBlockFreeze(pos, true) && rand.chance(25)) {
worldIn.setState(pos, Blocks.ice.getState());
return;
}
if(!Vars.liquidPhysics)
return;
int i = ((Integer)state.getValue(LEVEL)).intValue();

View file

@ -105,7 +105,7 @@ public abstract class BlockLiquid extends Block
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
{
Block block = worldIn.getState(pos).getBlock();
Block block = worldIn.getState(pos).getBlock();
Material material = block.getMaterial();
return material.isLiquid() && (material.isColdLiquid() == this.material.isColdLiquid()) ? false : (side == Facing.UP ? true : !block.isNonBlock() && super.canRender(worldIn, pos, side));
}
@ -324,6 +324,11 @@ public abstract class BlockLiquid extends Block
{
return new Property[] {LEVEL};
}
public boolean isXrayVisible()
{
return true;
}
protected boolean hasRegisteredItem() {
return false;

View file

@ -93,9 +93,8 @@ public class BlockStaticLiquid extends BlockLiquid
}
}
}
if(this.material == Material.WATER && !worldIn.getState(pos.up()).getBlock().isOpaqueCube() && worldIn.canBlockFreeze(pos, true))
worldIn.setState(pos, Blocks.ice.getState());
if(this.material == Material.WATER && !worldIn.getState(pos.up()).getBlock().isOpaqueCube() && worldIn.canBlockFreeze(pos, true))
worldIn.setState(pos, Blocks.ice.getState());
}
protected boolean isSurroundingBlockFlammable(World worldIn, BlockPos pos)

View file

@ -8,7 +8,7 @@ import common.util.ParticleType;
import common.world.State;
import common.world.World;
public class BlockBedrock extends BlockNonBlock {
public class BlockBedrock extends Block {
public BlockBedrock() {
super(Material.SOLID);
}

View file

@ -10,7 +10,7 @@ import common.vars.Vars;
import common.world.State;
import common.world.AWorldServer;
public class BlockBlackenedDirt extends BlockNonBlock
public class BlockBlackenedDirt extends Block
{
public BlockBlackenedDirt()
{

View file

@ -8,7 +8,7 @@ import common.item.Item;
import common.rng.Random;
import common.world.State;
public class BlockBlackenedStone extends BlockNonBlock {
public class BlockBlackenedStone extends Block {
public BlockBlackenedStone() {
super(Material.SOLID);
this.setTab(CheatTab.ROCK);

View file

@ -8,7 +8,7 @@ import common.item.Item;
import common.rng.Random;
import common.world.State;
public class BlockClay extends BlockNonBlock
public class BlockClay extends Block
{
public BlockClay()
{

View file

@ -8,7 +8,7 @@ import common.model.Model.ModelProvider;
import common.util.Color;
import common.world.State;
public class BlockColoredClay extends BlockNonBlock {
public class BlockColoredClay extends Block {
public static final BlockColoredClay[] CLAY = new BlockColoredClay[Color.values().length];
private final Color color;

View file

@ -1,11 +1,12 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.block.SoundType;
import common.item.CheatTab;
import common.util.Clientside;
public class BlockCyber extends BlockNonBlock {
public class BlockCyber extends Block {
public BlockCyber() {
super(Material.SOLID);
this.setTab(CheatTab.ROCK);
@ -17,6 +18,16 @@ public class BlockCyber extends BlockNonBlock {
@Clientside
public float getShinyness() {
return -32.0f;
return 0.0f;
}
@Clientside
public boolean isNonBlock() {
return true;
}
@Clientside
public boolean isOpaqueCube() {
return true;
}
}

View file

@ -13,7 +13,7 @@ import common.util.Serverside;
import common.world.AWorldServer;
import common.world.State;
public class BlockGlowstone extends BlockNonBlock
public class BlockGlowstone extends Block
{
public BlockGlowstone(Material materialIn)
{

View file

@ -1,9 +1,10 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.item.CheatTab;
public class BlockHardenedClay extends BlockNonBlock
public class BlockHardenedClay extends Block
{
public BlockHardenedClay()
{

View file

@ -4,7 +4,7 @@ import common.block.Block;
import common.block.Material;
import common.item.CheatTab;
public class BlockHellRock extends BlockNonBlock
public class BlockHellRock extends Block
{
public BlockHellRock()
{

View file

@ -16,7 +16,7 @@ import common.world.World;
import common.world.AWorldServer;
import common.world.IWorldAccess;
public class BlockIce extends BlockNonBlock {
public class BlockIce extends Block {
public BlockIce() {
super(Material.LOOSE);
this.setSlipperiness(0.98F);

View file

@ -1,19 +0,0 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
public class BlockNonBlock extends Block {
public BlockNonBlock(Material material) {
super(material);
this.setOpacity(255);
}
public boolean isOpaqueCube() {
return false;
}
public boolean isNonBlock() {
return true;
}
}

View file

@ -1,15 +1,34 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.rng.Random;
import common.world.State;
public class BlockObsidian extends BlockNonBlock {
public BlockObsidian() {
super(Material.SOLID);
this.setTab(CheatTab.ROCK);
}
public class BlockObsidian extends Block
{
public BlockObsidian()
{
super(Material.SOLID);
this.setTab(CheatTab.ROCK);
}
// public Item getDrop(State state, Random rand, int fortune) {
// return Items.obsidian;
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getDrop(State state, Random rand, int fortune)
{
return Items.obsidian;
}
// /**
// * Get the MapColor for this Block and the given BlockState
// */
// public MapColor getMapColor(IBlockState state)
// {
// return MapColor.blackColor;
// }
}

View file

@ -1,5 +1,6 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.item.CheatTab;
import common.item.Item;
@ -10,7 +11,7 @@ import common.vars.Vars;
import common.world.State;
import common.world.World;
public class BlockOre extends BlockNonBlock
public class BlockOre extends Block
{
private ItemStack smeltItem;
private ItemStack dropItem;

View file

@ -5,7 +5,7 @@ import common.block.Material;
import common.item.CheatTab;
import common.rng.Random;
public class BlockPackedIce extends BlockNonBlock
public class BlockPackedIce extends Block
{
public BlockPackedIce()
{

View file

@ -1,20 +1,50 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockSnowable;
import common.init.Blocks;
import common.init.Items;
import common.item.CheatTab;
import common.item.Item;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.properties.Property;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
import common.world.IWorldAccess;
import common.world.State;
public class BlockPodzol extends BlockSnowable {
public BlockPodzol(boolean snowy) {
super(Material.LOOSE, snowy);
public class BlockPodzol extends Block {
public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockPodzol() {
super(Material.LOOSE);
this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)));
this.setTab(CheatTab.NATURE);
}
public State getState(State state, IWorldAccess worldIn, BlockPos pos) {
Block block = worldIn.getState(pos.up()).getBlock();
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
}
protected Property[] getProperties() {
return new Property[] {SNOWY};
}
public Item getDrop(State state, Random rand, int fortune) {
return Items.dirt;
}
public Model getModel(ModelProvider provider, String name, State state) {
if(state.getValue(SNOWY))
return provider.getModel("dirt").add().d().u("snow").nswe().add().nswe("soil_snowed");
else
return provider.getModel("dirt").add().d().u("podzol_top").nswe().add().nswe("podzol_side");
}
protected Property[] getUnsavedProperties() {
return new Property[] {SNOWY};
}
}

View file

@ -1,11 +1,22 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.item.CheatTab;
import common.model.Model;
import common.model.Model.ModelProvider;
import common.world.State;
public class BlockSandStone extends BlockNonBlock {
public BlockSandStone() {
public class BlockSandStone extends Block {
private final String texture;
public BlockSandStone(String texture) {
super(Material.SOLID);
this.texture = texture;
this.setTab(CheatTab.ROCK);
}
public Model getModel(ModelProvider provider, String name, State state) {
return provider.getModel("sandstone_" + this.texture).add().nswe().d("sandstone_bottom").u("sandstone_all");
}
}

View file

@ -7,7 +7,7 @@ import common.item.CheatTab;
import common.util.BlockPos;
import common.world.World;
public class BlockSlime extends BlockNonBlock {
public class BlockSlime extends Block {
public BlockSlime() {
super(Material.LOOSE);
this.setTab(CheatTab.NATURE);

View file

@ -80,7 +80,7 @@ public class BlockSnow extends Block
{
State iblockstate = worldIn.getState(pos.down());
Block block = iblockstate.getBlock();
return block != Blocks.ice && block != Blocks.packed_ice ? (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.getMaterial().blocksMovement()) : false;
return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.LEAVES ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.getMaterial().blocksMovement())) : false;
}
/**

View file

@ -11,7 +11,7 @@ import common.vars.Vars;
import common.world.State;
import common.world.AWorldServer;
public class BlockSnowBlock extends BlockNonBlock {
public class BlockSnowBlock extends Block {
public BlockSnowBlock() {
super(Material.DIGGABLE);
this.setTicked();

View file

@ -1,5 +1,6 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.entity.Entity;
import common.item.CheatTab;
@ -8,7 +9,7 @@ import common.util.BoundingBox;
import common.world.State;
import common.world.World;
public class BlockSoulSand extends BlockNonBlock
public class BlockSoulSand extends Block
{
public BlockSoulSand()
{

View file

@ -1,5 +1,6 @@
package common.block.natural;
import common.block.Block;
import common.block.Material;
import common.init.Items;
import common.item.CheatTab;
@ -7,7 +8,7 @@ import common.item.Item;
import common.rng.Random;
import common.world.State;
public class BlockStone extends BlockNonBlock {
public class BlockStone extends Block {
public BlockStone() {
super(Material.SOLID);
this.setTab(CheatTab.ROCK);

View file

@ -50,9 +50,13 @@ public class BlockAnvil extends BlockFalling implements Rotatable
return false;
}
public boolean isNonBlock() {
return false;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
public boolean isOpaqueCube()
{
return false;
}
public boolean isMagnetic() {
return true;

View file

@ -80,6 +80,12 @@ public abstract class BlockDisplay extends Block implements Rotatable
return super.getCollisionBox(worldIn, pos, state);
}
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
{
this.setBlockBounds(worldIn, pos);
return super.getSelectionBox(worldIn, pos);
}
public boolean isFullCube()
{
return false;

View file

@ -50,6 +50,12 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable
return null;
}
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
{
this.setBlockBounds(worldIn, pos);
return super.getSelectionBox(worldIn, pos);
}
public boolean isFullCube()
{
return false;

View file

@ -132,23 +132,24 @@ public abstract class BlockRegistry {
Block stone = register("stone", (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Stein"));
Block bedrock = register("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setSound(SoundType.STONE)
.setDisplay("Grundgestein").setTab(CheatTab.ROCK).setMiningTool(Equipment.PICKAXE, 6));
Block rock = register("rock", (new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.ROCK));
Block smooth_rock = register("smooth_rock", (new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.ROCK));
Block rock = register("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.ROCK));
Block smooth_rock = register("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.ROCK));
Block hellrock = register("hellrock", (new BlockHellRock()).setHardness(0.4F).setSound(SoundType.STONE).setDisplay("Höllenstein"));
Block cell_rock = register("cell_rock", (new BlockNonBlock(Material.LOOSE)).setHardness(1.0F).setResistance(3.0F)
Block cell_rock = register("cell_rock", (new Block(Material.LOOSE)).setHardness(1.0F).setResistance(3.0F)
.setSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.ROCK));
Block moon_rock = register("moon_rock", (new BlockNonBlock(Material.SOLID)).setHardness(2.5F).setResistance(10.0F)
Block moon_rock = register("moon_rock", (new Block(Material.SOLID)).setHardness(2.5F).setResistance(10.0F)
.setSound(SoundType.STONE).setDisplay("Mondgestein").setTab(CheatTab.ROCK));
Block cobblestone = (new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
.setDisplay("Bruchstein").setTab(CheatTab.ROCK);
register("cobblestone", cobblestone);
Block mossy_cobblestone = (new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
Block mossy_cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
.setDisplay("Bemooster Bruchstein").setTab(CheatTab.ROCK);
register("mossy_cobblestone", mossy_cobblestone);
Block sandstone = (new BlockSandStone()).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein");
Block sandstone = (new BlockSandStone("normal")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein");
register("sandstone", sandstone);
Block smooth_sandstone;
register("smooth_sandstone", (smooth_sandstone = new BlockSandStone()).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein"));
register("smooth_sandstone", (smooth_sandstone = new BlockSandStone("smooth")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein"));
register("carved_sandstone", (new BlockSandStone("carved")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein"));
Block obsidian = register("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setSound(SoundType.STONE)
.setDisplay("Obsidian").setMiningTool(Equipment.PICKAXE, 3));
Block clay = register("clay", (new BlockClay()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ton").setMiningTool(Equipment.SHOVEL));
@ -173,7 +174,7 @@ public abstract class BlockRegistry {
register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(0xffff3f)
.setDisplay("Glowstone"));
Block blackened_stone = register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Schwarzstein"));
Block blackened_cobble = register("blackened_cobble", (new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
Block blackened_cobble = register("blackened_cobble", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
.setDisplay("Schwarzbruchstein").setTab(CheatTab.ROCK));
@ -211,38 +212,27 @@ public abstract class BlockRegistry {
Block dirt;
register("dirt", (dirt = new BlockNonBlock(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
BlockSnowable grass;
register("grass", (grass = new BlockGrass(false)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setMiningTool(Equipment.SHOVEL));
BlockSnowable snowy_grass;
register("snowy_grass", (snowy_grass = new BlockGrass(true).setOther(grass)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Beschneites Gras").setMiningTool(Equipment.SHOVEL));
register("dirt", (dirt = new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
Block grass;
register("grass", (grass = new BlockGrass()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setMiningTool(Equipment.SHOVEL));
Block coarse_dirt;
register("coarse_dirt", (coarse_dirt = new BlockNonBlock(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
BlockSnowable podzol;
register("podzol", (podzol = new BlockPodzol(false)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Podsol").setMiningTool(Equipment.SHOVEL));
BlockSnowable snowy_podzol;
register("snowy_podzol", (snowy_podzol = new BlockPodzol(true).setOther(podzol)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Beschneiter Podsol").setMiningTool(Equipment.SHOVEL));
BlockSnowable mycelium;
register("mycelium", (mycelium = new BlockMycelium(false)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Myzel").setMiningTool(Equipment.SHOVEL));
BlockSnowable snowy_mycelium;
register("snowy_mycelium", (snowy_mycelium = new BlockMycelium(true).setOther(mycelium)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Beschneites Myzel").setMiningTool(Equipment.SHOVEL));
BlockSnowable swamp;
register("swamp", (swamp = new BlockSwamp(false)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Sumpf").setMiningTool(Equipment.SHOVEL));
BlockSnowable snowy_swamp;
register("snowy_swamp", (snowy_swamp = new BlockSwamp(true).setOther(swamp)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Beschneiter Sumpf").setMiningTool(Equipment.SHOVEL));
register("coarse_dirt", (coarse_dirt = new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
Block podzol;
register("podzol", (podzol = new BlockPodzol()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Podsol").setMiningTool(Equipment.SHOVEL));
Block mycelium;
register("mycelium", (mycelium = new BlockMycelium()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Myzel").setMiningTool(Equipment.SHOVEL));
Block swamp;
register("swamp", (swamp = new BlockSwamp()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Sumpf").setMiningTool(Equipment.SHOVEL));
Block tian;
register("tian", (tian = new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
register("tian", (tian = new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
.setDisplay("Tian").setTab(CheatTab.NATURE));
BlockSnowable tian_soil;
register("tian_soil", (tian_soil = new BlockTianSoil(false)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Tianerde").setTab(CheatTab.NATURE));
BlockSnowable snowy_tian_soil;
register("snowy_tian_soil", (snowy_tian_soil = new BlockTianSoil(true).setOther(tian_soil)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Beschneite Tianerde").setTab(CheatTab.NATURE));
Block tian_soil;
register("tian_soil", (tian_soil = new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE)
.setDisplay("Tianerde").setTab(CheatTab.NATURE));
Block blackened_dirt;
register("blackened_dirt", (blackened_dirt = new BlockBlackenedDirt()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setMiningTool(Equipment.SHOVEL));
BlockSnowable blackened_soil;
register("blackened_soil", (blackened_soil = new BlockBlackenedSoil(false)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Schwarzgrund").setMiningTool(Equipment.SHOVEL));
BlockSnowable snowy_blackened_soil;
register("snowy_blackened_soil", (snowy_blackened_soil = new BlockBlackenedSoil(true).setOther(blackened_soil)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Beschneiter Schwarzgrund").setMiningTool(Equipment.SHOVEL));
Block blackened_soil;
register("blackened_soil", (blackened_soil = new BlockBlackenedSoil()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Schwarzgrund").setMiningTool(Equipment.SHOVEL));
Block slime_block;
register("slime_block", (slime_block = new BlockSlime()).setDisplay("Schleimblock").setSound(SoundType.SLIME));
Block cheese;
@ -436,11 +426,11 @@ public abstract class BlockRegistry {
register("mossy_cobblestone_stairs", (new BlockStairs(mossy_cobblestone)).setDisplay("Bemooste Bruchsteintreppe"));
register("mossy_cobblestone_wall", (new BlockWall(mossy_cobblestone)).setDisplay("Bemooste Bruchsteinmauer"));
register("sandstone_slab", (new BlockSlab(sandstone)).setDisplay("Sandsteinstufe"));
register("sandstone_stairs", (new BlockStairs(sandstone)).setDisplay("Sandsteintreppe"));
register("sandstone_slab", (new BlockSlab(sandstone, "sandstone_bottom", "sandstone_all")).setDisplay("Sandsteinstufe"));
register("sandstone_stairs", (new BlockStairs(sandstone, "sandstone_bottom", "sandstone_all")).setDisplay("Sandsteintreppe"));
register("smooth_sandstone_slab", (new BlockSlab(smooth_sandstone)).setDisplay("Glatte Sandsteinstufe"));
register("smooth_sandstone_stairs", (new BlockStairs(smooth_sandstone)).setDisplay("Glatte Sandsteintreppe"));
register("smooth_sandstone_slab", (new BlockSlab(smooth_sandstone, "sandstone_bottom", "sandstone_all")).setDisplay("Glatte Sandsteinstufe"));
register("smooth_sandstone_stairs", (new BlockStairs(smooth_sandstone, "sandstone_bottom", "sandstone_all")).setDisplay("Glatte Sandsteintreppe"));
register("obsidian_slab", (new BlockSlab(obsidian)).setDisplay("Obsidianstufe"));
register("obsidian_stairs", (new BlockStairs(obsidian)).setDisplay("Obsidiantreppe"));
@ -469,32 +459,24 @@ public abstract class BlockRegistry {
register("dirt_slab", (new BlockSlab(dirt)).setDisplay("Erdstufe"));
register("dirt_stairs", (new BlockStairs(dirt)).setDisplay("Erdtreppe"));
register("grass_slab", (new BlockSlab(grass)).setDisplay("Grasstufe"));
register("grass_stairs", (new BlockStairs(grass)).setDisplay("Grastreppe"));
register("grass_slab", (new BlockSlab(grass, "dirt", "grass_top", "dirt", "grass_side")).setDisplay("Grasstufe"));
register("coarse_dirt_slab", (new BlockSlab(coarse_dirt)).setDisplay("Grobe Erdstufe"));
register("coarse_dirt_stairs", (new BlockStairs(coarse_dirt)).setDisplay("Grobe Erdtreppe"));
register("podzol_slab", (new BlockSlab(podzol)).setDisplay("Podsolstufe"));
register("podzol_stairs", (new BlockStairs(podzol)).setDisplay("Podsoltreppe"));
register("mycelium_slab", (new BlockSlab(mycelium)).setDisplay("Myzelstufe"));
register("mycelium_stairs", (new BlockStairs(mycelium)).setDisplay("Myzeltreppe"));
register("swamp_slab", (new BlockSlab(swamp)).setDisplay("Sumpfstufe"));
register("swamp_stairs", (new BlockStairs(swamp)).setDisplay("Sumpftreppe"));
register("podzol_slab", (new BlockSlab(podzol, "dirt", "podzol_top", "dirt", "podzol_side")).setDisplay("Podsolstufe"));
register("mycelium_slab", (new BlockSlab(mycelium, "dirt", "mycelium_top", "dirt", "mycelium_side")).setDisplay("Myzelstufe"));
register("swamp_slab", (new BlockSlab(swamp, "dirt", "swamp_top", "dirt", "swamp_side")).setDisplay("Sumpfstufe"));
register("tian_slab", (new BlockSlab(tian)).setDisplay("Tianstufe"));
register("tian_stairs", (new BlockStairs(tian)).setDisplay("Tiantreppe"));
register("tian_soil_slab", (new BlockSlab(tian_soil)).setDisplay("Tianerdestufe"));
register("tian_soil_stairs", (new BlockStairs(tian_soil)).setDisplay("Tianerdetreppe"));
register("tian_soil_slab", (new BlockSlab(tian_soil, "tian", "tian_soil_top", "tian", "tian_soil_side")).setDisplay("Tianerdestufe"));
register("blackened_dirt_slab", (new BlockSlab(blackened_dirt)).setDisplay("Schwarzerdestufe"));
register("blackened_dirt_stairs", (new BlockStairs(blackened_dirt)).setDisplay("Schwarzerdetreppe"));
register("blackened_soil_slab", (new BlockSlab(blackened_soil)).setDisplay("Schwarzgrasstufe"));
register("blackened_soil_stairs", (new BlockStairs(blackened_soil)).setDisplay("Schwarzgrastreppe"));
register("blackened_soil_slab", (new BlockSlab(blackened_soil, "blackened_dirt", "blackened_soil_top", "blackened_dirt", "blackened_soil_side")).setDisplay("Schwarzgrasstufe"));
register("slime_slab", (new BlockSlab(slime_block)).setDisplay("Schleimstufe"));
register("slime_stairs", (new BlockStairs(slime_block)).setDisplay("Schleimtreppe"));

View file

@ -84,9 +84,9 @@ public abstract class Blocks {
public static final BlockSlab black_quartz_slab = get("black_quartz_slab");
public static final BlockStairs black_quartz_stairs = get("black_quartz_stairs");
public static final BlockWool black_wool = get("black_wool");
public static final Block blackened_cobble = get("blackened_cobble");
public static final BlockBlackenedDirt blackened_dirt = get("blackened_dirt");
public static final BlockBlackenedSoil blackened_soil = get("blackened_soil");
public static final BlockBlackenedSoil snowy_blackened_soil = get("snowy_blackened_soil");
public static final BlockBlackenedStone blackened_stone = get("blackened_stone");
public static final BlockDoor black_wood_door = get("black_wood_door");
public static final BlockFence black_wood_fence = get("black_wood_fence");
@ -130,8 +130,10 @@ public abstract class Blocks {
public static final BlockMetalBlock calcium_block = get("calcium_block");
public static final BlockMetalOre calcium_ore = get("calcium_ore");
public static final BlockCarrot carrots = get("carrots");
public static final BlockSandStone carved_sandstone = get("carved_sandstone");
public static final Block carved_stonebrick = get("carved_stonebrick");
public static final BlockCauldron cauldron = get("cauldron");
public static final Block cell_rock = get("cell_rock");
public static final BlockDoor cherry_door = get("cherry_door");
public static final BlockFence cherry_fence = get("cherry_fence");
public static final BlockFenceGate cherry_fence_gate = get("cherry_fence_gate");
@ -151,9 +153,10 @@ public abstract class Blocks {
public static final BlockClay clay = get("clay");
public static final BlockCompressable coal_block = get("coal_block");
public static final BlockOre coal_ore = get("coal_ore");
public static final BlockNonBlock coarse_dirt = get("coarse_dirt");
public static final Block coarse_dirt = get("coarse_dirt");
public static final BlockMetalBlock cobalt_block = get("cobalt_block");
public static final BlockMetalOre cobalt_ore = get("cobalt_ore");
public static final Block cobblestone = get("cobblestone");
public static final BlockSlab cobblestone_slab = get("cobblestone_slab");
public static final BlockStairs cobblestone_stairs = get("cobblestone_stairs");
public static final BlockWall cobblestone_wall = get("cobblestone_wall");
@ -185,7 +188,7 @@ public abstract class Blocks {
public static final BlockTallGrass dead_bush = get("dead_bush");
public static final BlockDeadBush deadbush = get("deadbush");
public static final BlockOre diamond_ore = get("diamond_ore");
public static final BlockNonBlock dirt = get("dirt");
public static final Block dirt = get("dirt");
public static final BlockDispenser dispenser = get("dispenser");
public static final BlockDragonEgg dragon_egg = get("dragon_egg");
public static final BlockDispenser dropper = get("dropper");
@ -232,7 +235,6 @@ public abstract class Blocks {
public static final BlockMetalOre gold_ore = get("gold_ore");
public static final BlockStaticLiquid goo = get("goo");
public static final BlockGrass grass = get("grass");
public static final BlockGrass snowy_grass = get("snowy_grass");
public static final BlockGravel gravel = get("gravel");
public static final BlockCarpet gray_carpet = get("gray_carpet");
public static final BlockColoredClay gray_clay = get("gray_clay");
@ -316,6 +318,8 @@ public abstract class Blocks {
public static final BlockStaticLiquid mercury = get("mercury");
public static final BlockMobSpawner mob_spawner = get("mob_spawner");
public static final BlockTreasure cheese = get("cheese");
public static final Block moon_rock = get("moon_rock");
public static final Block mossy_cobblestone = get("mossy_cobblestone");
public static final BlockWall mossy_cobblestone_wall = get("mossy_cobblestone_wall");
public static final Block mossy_stonebrick = get("mossy_stonebrick");
public static final BlockMycelium mycelium = get("mycelium");
@ -395,6 +399,7 @@ public abstract class Blocks {
public static final BlockWool red_wool = get("red_wool");
public static final BlockOre charged_ore = get("charged_ore");
public static final BlockReed reeds = get("reeds");
public static final Block rock = get("rock");
public static final BlockFlower rose = get("rose");
public static final BlockDoublePlant rose_bush = get("rose_bush");
public static final BlockOre ruby_ore = get("ruby_ore");
@ -412,6 +417,7 @@ public abstract class Blocks {
public static final BlockSkull skull = get("skull");
public static final BlockStaticLiquid slime = get("slime");
public static final BlockSlime slime_block = get("slime_block");
public static final Block smooth_rock = get("smooth_rock");
public static final BlockSandStone smooth_sandstone = get("smooth_sandstone");
public static final BlockSnowBlock snow = get("snow");
public static final BlockSnow snow_layer = get("snow_layer");
@ -451,7 +457,7 @@ public abstract class Blocks {
public static final BlockDoublePlant syringa = get("syringa");
public static final BlockTallGrass tallgrass = get("tallgrass");
public static final BlockOre thetium_ore = get("thetium_ore");
public static final BlockNonBlock tian = get("tian");
public static final Block tian = get("tian");
public static final BlockDoor tian_wood_door = get("tian_wood_door");
public static final BlockFence tian_wood_fence = get("tian_wood_fence");
public static final BlockFenceGate tian_wood_fence_gate = get("tian_wood_fence_gate");
@ -864,25 +870,8 @@ public abstract class Blocks {
public static final BlockItemPipe pipe = get("pipe");
public static final BlockSuctionPipe suction_pipe = get("suction_pipe");
public static final BlockCyber cyber = get("cyber");
public static final BlockMycelium snowy_mycelium = get("snowy_mycelium");
public static final BlockPodzol snowy_podzol = get("snowy_podzol");
public static final BlockSwamp snowy_swamp = get("snowy_swamp");
public static final BlockTianSoil snowy_tian_soil = get("snowy_tian_soil");
public static final BlockNonBlock blackened_cobble = get("blackened_cobble");
public static final BlockNonBlock cell_rock = get("cell_rock");
public static final BlockNonBlock cobblestone = get("cobblestone");
public static final BlockNonBlock moon_rock = get("moon_rock");
public static final BlockNonBlock mossy_cobblestone = get("mossy_cobblestone");
public static final BlockNonBlock rock = get("rock");
public static final BlockNonBlock smooth_rock = get("smooth_rock");
public static final BlockStairs blackened_soil_stairs = get("blackened_soil_stairs");
public static final BlockSlab cyber_slab = get("cyber_slab");
public static final BlockStairs cyber_stairs = get("cyber_stairs");
public static final BlockStairs grass_stairs = get("grass_stairs");
public static final BlockStairs mycelium_stairs = get("mycelium_stairs");
public static final BlockStairs podzol_stairs = get("podzol_stairs");
public static final BlockStairs swamp_stairs = get("swamp_stairs");
public static final BlockStairs tian_soil_stairs = get("tian_soil_stairs");
private static <T extends Block> T get(String id) {
T block = (T)BlockRegistry.byNameExact(id);

View file

@ -211,6 +211,7 @@ public abstract class Items {
public static final ItemCamera camera = get("camera");
public static final ItemSeedFood carrot = get("carrot");
public static final ItemWhip whip = get("whip");
public static final Item carved_sandstone = get("carved_sandstone");
public static final Item carved_stonebrick = get("carved_stonebrick");
public static final Item cauldron = get("cauldron");
public static final Item cell_rock = get("cell_rock");
@ -368,7 +369,6 @@ public abstract class Items {
public static final ItemAppleGold charged_apple = get("charged_apple");
public static final ItemBucket goo_bucket = get("goo_bucket");
public static final Item grass = get("grass");
public static final Item snowy_grass = get("snowy_grass");
public static final Item gravel = get("gravel");
public static final Item gray_carpet = get("gray_carpet");
public static final Item gray_clay = get("gray_clay");
@ -1703,19 +1703,8 @@ public abstract class Items {
public static final ItemTool zinc_shovel = get("zinc_shovel");
public static final ItemTool zinc_sword = get("zinc_sword");
public static final Item cyber = get("cyber");
public static final Item snowy_blackened_soil = get("snowy_blackened_soil");
public static final Item snowy_mycelium = get("snowy_mycelium");
public static final Item snowy_podzol = get("snowy_podzol");
public static final Item snowy_swamp = get("snowy_swamp");
public static final Item snowy_tian_soil = get("snowy_tian_soil");
public static final Item blackened_soil_stairs = get("blackened_soil_stairs");
public static final Item cyber_slab = get("cyber_slab");
public static final Item cyber_stairs = get("cyber_stairs");
public static final Item grass_stairs = get("grass_stairs");
public static final Item mycelium_stairs = get("mycelium_stairs");
public static final Item podzol_stairs = get("podzol_stairs");
public static final Item swamp_stairs = get("swamp_stairs");
public static final Item tian_soil_stairs = get("tian_soil_stairs");
private static <T extends Item> T get(String id) {
T item = (T)ItemRegistry.byName(id);