From d4c7c5bbea539ab753de9ac2c1c68f9e634e6ae2 Mon Sep 17 00:00:00 2001 From: Sen Date: Sat, 30 Aug 2025 14:10:58 +0200 Subject: [PATCH] add colored lighting --- client/src/main/java/client/Client.java | 6 +- .../java/client/renderer/EffectRenderer.java | 2 +- .../java/client/renderer/ItemRenderer.java | 2 +- .../client/renderer/RegionRenderCache.java | 42 +- .../java/client/renderer/RenderBuffer.java | 8 - .../main/java/client/renderer/Renderer.java | 399 ++++++++---------- .../client/renderer/entity/RenderManager.java | 2 +- .../renderer/tileentity/SpecialRenderer.java | 2 +- .../main/java/client/world/ChunkClient.java | 13 - .../main/java/client/world/ChunkEmpty.java | 4 - common/src/main/java/common/block/Block.java | 9 +- .../block/artificial/BlockFloorPortal.java | 2 +- .../block/artificial/BlockMetalBlock.java | 2 +- .../common/block/foliage/BlockBlueShroom.java | 2 +- .../common/block/foliage/BlockMushroom.java | 2 +- .../common/block/natural/BlockMetalOre.java | 2 +- .../common/block/tech/BlockActiveDisplay.java | 2 +- .../java/common/block/tech/BlockFurnace.java | 2 +- .../block/tech/BlockToggleableLight.java | 2 +- .../main/java/common/init/BlockRegistry.java | 40 +- .../main/java/common/world/BlockArray.java | 8 +- .../main/java/common/world/IWorldAccess.java | 2 +- common/src/main/java/common/world/World.java | 2 +- 23 files changed, 234 insertions(+), 323 deletions(-) diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 94589156..3f5a9e80 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -428,8 +428,8 @@ public class Client implements IThreadListener { Client.this.renderer.checkBlockLight(pos); } - public int getCombinedLight(BlockPos pos, int lightValue) { - return Client.this.renderer.getCombinedLight(pos, lightValue); + public int getCombinedLight(BlockPos pos) { + return Client.this.renderer.getCombinedLight(pos); } } @@ -2053,7 +2053,7 @@ public class Client implements IThreadListener { String.format("Biom: %.2f K, N: %.2f K, D: %s (%s)", chunk.getTemperature(pos), chunk.getOffset(pos), Color.stripCodes(this.world.dimension.getDisplay()), this.dimensionName) + "\n" + - "Licht: " + chunk.getLightSub(pos, 0) + " (" + (this.world.dimension.hasSkyLight() ? + Renderer.getSkyLightFor(pos.getY()) + " Himmel, " : "") + String.format("Licht: %06x", chunk.getLight(pos)) + " (" + (this.world.dimension.hasSkyLight() ? + Renderer.getSkyLightFor(pos.getY()) + " Himmel, " : "") + chunk.getLight(pos) + " Blöcke, " + String.format( "%.1f", this.renderer.getSunBrightness(1.0f) * 15.0f) + " Welt), A: " + String.format("%.1f ° (%.1f, %.1f)", this.renderer.getCelestialAngle(1.0f), !this.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos((-90.0f + this.renderer.getCelestialAngle(1.0f)) / 180.0f * (float)Math.PI), diff --git a/client/src/main/java/client/renderer/EffectRenderer.java b/client/src/main/java/client/renderer/EffectRenderer.java index 5c730690..e8872002 100755 --- a/client/src/main/java/client/renderer/EffectRenderer.java +++ b/client/src/main/java/client/renderer/EffectRenderer.java @@ -78,7 +78,7 @@ public class EffectRenderer { public int getBrightness(float partial) { BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ); - return world.isBlockLoaded(pos) ? world.getCombinedLight(pos, 0) : 0; + return world.isBlockLoaded(pos) ? world.getCombinedLight(pos) : 0; } } diff --git a/client/src/main/java/client/renderer/ItemRenderer.java b/client/src/main/java/client/renderer/ItemRenderer.java index 80f8e82c..09bcee3f 100755 --- a/client/src/main/java/client/renderer/ItemRenderer.java +++ b/client/src/main/java/client/renderer/ItemRenderer.java @@ -126,7 +126,7 @@ public class ItemRenderer private void setLightMapFromPlayer(EntityNPC clientPlayer) { - int i = this.gm.world.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0); + int i = this.gm.world.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ)); float f = (float)(i & 65535); float f1 = (float)(i >> 16); GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, f, f1); diff --git a/client/src/main/java/client/renderer/RegionRenderCache.java b/client/src/main/java/client/renderer/RegionRenderCache.java index 7d01a6eb..f4651eda 100755 --- a/client/src/main/java/client/renderer/RegionRenderCache.java +++ b/client/src/main/java/client/renderer/RegionRenderCache.java @@ -69,14 +69,14 @@ public class RegionRenderCache implements IWorldAccess return this.chunks[i][j].getTileEntity(pos, TileEntity.CreateMode.QUEUED); } - public int getCombinedLight(BlockPos pos, int lightValue) + public int getCombinedLight(BlockPos pos) { int i = this.getPositionIndex(pos); int j = this.combinedLights[i]; if (j == -1) { - j = this.getLight(pos, lightValue); + j = this.getBlockLightExt(pos); this.combinedLights[i] = j; } @@ -124,43 +124,37 @@ public class RegionRenderCache implements IWorldAccess return this.empty; } - public int getLight(BlockPos pos, int lightValue) - { - int i = this.sky ? Renderer.getSkyLightFor(pos.getY()) : 0; - int j = this.getBlockLightExt(pos); - - if (j < lightValue) - { - j = lightValue; - } - - return i << 20 | j << 4; - } - private int getBlockLightExt(BlockPos pos) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { if (this.getState(pos).getBlock().getSumBrightness()) { - int l = 0; + int r = 0; + int g = 0; + int b = 0; for (Facing enumfacing : Facing.values()) { - int k = this.getBlockLight(pos.offset(enumfacing)); + int light = this.getBlockLight(pos.offset(enumfacing)); + int lr = (light >> 16) & 255; + int lg = (light >> 8) & 255; + int lb = light & 255; - if (k > l) - { - l = k; - } + if(lr > r) + r = lr; + if(lg > g) + g = lg; + if(lb > b) + b = lb; - if (l >= 15) + if (r >= 255 && g >= 255 && b >= 255) { - return l; + return 0xffffff; } } - return l; + return (r > 255 ? 255 : r) << 16 | (g > 255 ? 255 : g) << 16 | (b > 255 ? 255 : b); } else { diff --git a/client/src/main/java/client/renderer/RenderBuffer.java b/client/src/main/java/client/renderer/RenderBuffer.java index 83e8a331..8def53f3 100755 --- a/client/src/main/java/client/renderer/RenderBuffer.java +++ b/client/src/main/java/client/renderer/RenderBuffer.java @@ -454,12 +454,4 @@ public class RenderBuffer this.putColor(argb, i + 1); } } - - public void putColorRGB_F4(float red, float green, float blue) - { - for (int i = 0; i < 4; ++i) - { - this.putColorRGB_F(red, green, blue, i + 1); - } - } } diff --git a/client/src/main/java/client/renderer/Renderer.java b/client/src/main/java/client/renderer/Renderer.java index 1c9b2d95..4387878d 100755 --- a/client/src/main/java/client/renderer/Renderer.java +++ b/client/src/main/java/client/renderer/Renderer.java @@ -140,8 +140,6 @@ public class Renderer { private float fogColorRed; private float fogColorGreen; private float fogColorBlue; - private float lastFogMult; - private float fogMult; private double cameraYaw; private double cameraPitch; private int frameCount; @@ -189,10 +187,6 @@ public class Renderer { private float moonColorRed; private float moonColorGreen; private float moonColorBlue; - private float blockColorRed; - private float blockColorGreen; - private float blockColorBlue; - private int subtract; private final int[] lightUpdate = new int[32768]; public Renderer(Client gm, ModelManager manager) @@ -266,7 +260,6 @@ public class Renderer { { this.updateFovModifierHand(); this.updateTorchFlicker(); - this.lastFogMult = this.fogMult; this.thirdPersonDistanceTemp = this.thirdPersonDistance; if (this.gm.getRenderViewEntity() == null) @@ -274,10 +267,6 @@ public class Renderer { this.gm.setRenderViewEntity(this.gm.player); } - float light = this.getLightBrightness(new BlockPos(this.gm.getRenderViewEntity())); - float dist = (float)this.gm.renderDistance / 32.0F; - float shift = light * (1.0F - dist) + dist; - this.fogMult += (shift - this.fogMult) * 0.1F; ++this.rendererUpdateCount; this.itemRenderer.update(); this.addRainParticles(); @@ -1150,11 +1139,6 @@ public class Renderer { this.moonColorGreen = green * (world.dimension.hasDaylight() ? 1.0f - sun : 0.0f); this.moonColorBlue = blue * (world.dimension.hasDaylight() ? 1.0f - sun : 0.0f); } - else if(n == 15) { - this.blockColorRed = red; - this.blockColorGreen = green; - this.blockColorBlue = blue; - } this.lightmapColors[n] = a << 24 | r << 16 | g << 8 | b; } @@ -1485,7 +1469,7 @@ public class Renderer { float dist = ExtMath.sqrtd(dx * dx + dz * dz) / (float)range; float alpha = ((1.0F - dist * dist) * 0.5F + 0.5F) * rain; pos.set(x, lpos, z); - int light = world.getCombinedLight(pos, 0); + int light = world.getCombinedLight(pos); int sky = light >> 16 & 65535; int blk = light & 65535; buf.pos((double)x - rx + 0.5D, (double)miny, (double)z - rz + 0.5D).tex(0.0D, (double)miny * 0.25D + offset) @@ -1514,7 +1498,7 @@ public class Renderer { float dist = ExtMath.sqrtd(dx * dx + dz * dz) / (float)range; float alpha = ((1.0F - dist * dist) * 0.3F + 0.5F) * rain; pos.set(x, lpos, z); - int light = (world.getCombinedLight(pos, 0) * 3 + 15728880) / 4; + int light = (world.getCombinedLight(pos) * 3 + 15728880) / 4; int sky = light >> 16 & 65535; int blk = light & 65535; buf.pos((double)x - rx + 0.5D, (double)miny, (double)z - rz + 0.5D).tex(0.0D + tx, (double)miny * 0.25D + offset + ty) @@ -1627,10 +1611,9 @@ public class Renderer { this.fogColorBlue = 0.0F; } - float mult = this.lastFogMult + (this.fogMult - this.lastFogMult) * partial; - this.fogColorRed *= mult; - this.fogColorGreen *= mult; - this.fogColorBlue *= mult; +// this.fogColorRed *= this.lastFogMultRed + (this.fogMultRed - this.lastFogMultRed) * partial; +// this.fogColorGreen *= this.lastFogMultGreen + (this.fogMultGreen - this.lastFogMultGreen) * partial; +// this.fogColorBlue *= this.lastFogMultBlue + (this.fogMultBlue - this.lastFogMultBlue) * partial; double vision = 1.0; if(world.dimension.hasVoidFog() && this.gm.voidFog) { @@ -2041,7 +2024,6 @@ public class Renderer { if (worldClientIn != null) { - this.calculateInitialSkylight(); // worldClientIn.setWorldAccess(this); this.loadRenderers(); } @@ -3253,21 +3235,21 @@ public class Renderer { { if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid()) { - float brightness = brightPos == null ? 1.0f : this.getLightBrightness(brightPos); + int light = brightPos == null ? 0xffffffff : getLightmapValue(this.gm.world, brightPos); IBakedModel model = this.manager.getModelForState(state); Block block = state.getBlock(); GL46.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); for (Facing enumfacing : Facing.values()) { - this.renderSimple(brightness, model.getFace(enumfacing)); + this.renderSimple(light, model.getFace(enumfacing)); } - this.renderSimple(brightness, model.getQuads()); + this.renderSimple(light, model.getQuads()); } } - private void renderSimple(float brightness, List listQuads) + private void renderSimple(int light, List listQuads) { RenderBuffer worldrenderer = Tessellator.getBuffer(); @@ -3275,7 +3257,7 @@ public class Renderer { { worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.ITEM); worldrenderer.addVertexData(bakedquad.getVertexData()); - worldrenderer.putColorRGB_F4(brightness, brightness, brightness); + worldrenderer.putBrightness4(light, light, light, light); Vec3i vec3i = bakedquad.getFace().getDirectionVec(); worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ()); Tessellator.draw(); @@ -3324,26 +3306,29 @@ public class Renderer { return rendered; } - private int getLightColor(int light) { - return light << 24 | (int)(this.blockColorBlue * (float)light) << 16 | (int)(this.blockColorGreen * (float)light) << 8 | (int)(this.blockColorRed * (float)light); + 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) { Block block = world.getState(pos).getBlock(); - int light = world.getCombinedLight(pos, block.getLight()) & 0xff; + int light = componentMax(world.getCombinedLight(pos), block.getLight()); if(light == 0 && block instanceof BlockSlab) { pos = pos.down(); block = world.getState(pos).getBlock(); - light = world.getCombinedLight(pos, block.getLight()) & 0xff; + light = componentMax(world.getCombinedLight(pos), block.getLight()); } - return this.getLightColor(light); + return getLightColor(light); } private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos) { - int light = world.getCombinedLight(pos, 0) & 0xff; - int up = world.getCombinedLight(pos.up(), 0) & 0xff; - light = light > up ? light : up; - return this.getLightColor(light); + int light = world.getCombinedLight(pos); + int up = world.getCombinedLight(pos.up()); + return getLightColor(componentMax(light, up)); } private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, boolean ownLight, RenderBuffer worldRendererIn, List listQuadsIn, BitSet boundsFlags) @@ -3924,7 +3909,7 @@ public class Renderer { return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i); } - private int getLightFor(BlockPos pos) { + private int getLight(BlockPos pos) { if(pos.getY() < -World.MAX_SIZE_Y) { pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); } @@ -3938,7 +3923,7 @@ public class Renderer { } } - private int getBlockLightSum(BlockPos pos) { + public int getCombinedLight(BlockPos pos) { if(pos.getY() < -World.MAX_SIZE_Y) { pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); } @@ -3947,101 +3932,64 @@ public class Renderer { return 0; } else if(this.gm.world.getState(pos).getBlock().getSumBrightness()) { - int i1 = this.getLightFor(pos.up()); - int i = this.getLightFor(pos.east()); - int j = this.getLightFor(pos.west()); - int k = this.getLightFor(pos.south()); - int l = this.getLightFor(pos.north()); + int light = this.getLight(pos.up()); + int east = this.getLight(pos.east()); + int west = this.getLight(pos.west()); + int south = this.getLight(pos.south()); + int north = this.getLight(pos.north()); - if(i > i1) { - i1 = i; - } + light = componentMax(light, east); + light = componentMax(light, west); + light = componentMax(light, south); + light = componentMax(light, north); - if(j > i1) { - i1 = j; - } - - if(k > i1) { - i1 = k; - } - - if(l > i1) { - i1 = l; - } - - return i1; + return light; } else { ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4); return chunk.getLight(pos); } } +// +// private int getLight(BlockPos pos, boolean checkNeighbors) { +// if(pos.getX() >= -World.MAX_SIZE && pos.getZ() >= -World.MAX_SIZE && pos.getX() < World.MAX_SIZE && pos.getZ() < World.MAX_SIZE) { +// if(checkNeighbors && this.gm.world.getState(pos).getBlock().getSumBrightness()) { +// int light = this.getLight(pos.up(), false); +// int east = this.getLight(pos.east(), false); +// int west = this.getLight(pos.west(), false); +// int south = this.getLight(pos.south(), false); +// int north = this.getLight(pos.north(), false); +// +// light = componentMax(light, east); +// light = componentMax(light, west); +// light = componentMax(light, south); +// light = componentMax(light, north); +// +// return light; +// } +// else if(pos.getY() < -World.MAX_SIZE_Y) { +// return 0; +// } +// else { +// if(pos.getY() >= World.MAX_SIZE_Y) { +// pos = new BlockPos(pos.getX(), World.MAX_SIZE_Y - 1, pos.getZ()); +// } +// +// ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4); +// return chunk.getLight(pos); +// } +// } +// else { +// return 0; +// } +// } - public int getCombinedLight(BlockPos pos, int lightValue) { - int i = this.gm.world.dimension.hasSkyLight() ? getSkyLightFor(pos.getY()) : 0; - int j = this.getBlockLightSum(pos); - - if(j < lightValue) { - j = lightValue; - } - - return i << 20 | j << 4; - } - - private int getLight(BlockPos pos, boolean checkNeighbors) { - if(pos.getX() >= -World.MAX_SIZE && pos.getZ() >= -World.MAX_SIZE && pos.getX() < World.MAX_SIZE && pos.getZ() < World.MAX_SIZE) { - if(checkNeighbors && this.gm.world.getState(pos).getBlock().getSumBrightness()) { - int i1 = this.getLight(pos.up(), false); - int i = this.getLight(pos.east(), false); - int j = this.getLight(pos.west(), false); - int k = this.getLight(pos.south(), false); - int l = this.getLight(pos.north(), false); - - if(i > i1) { - i1 = i; - } - - if(j > i1) { - i1 = j; - } - - if(k > i1) { - i1 = k; - } - - if(l > i1) { - i1 = l; - } - - return i1; - } - else if(pos.getY() < -World.MAX_SIZE_Y) { - return 0; - } - else { - if(pos.getY() >= World.MAX_SIZE_Y) { - pos = new BlockPos(pos.getX(), World.MAX_SIZE_Y - 1, pos.getZ()); - } - - ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4); - return chunk.getLightSub(pos, this.subtract); - } - } - else { - return 15; - } - } - - public float getLightBrightness(BlockPos pos) { - return Math.max(BRIGHTNESS[this.getLight(pos, true)], (float)this.gm.world.dimension.getBrightness() / 15.0f); - } - - private int getRawBlockLight(BlockPos pos) { + private int getRawBlockLight(BlockPos pos, int component) { Block block = this.gm.world.getState(pos).getBlock(); - int light = block.getLight(); + int light = ((block.getLight() >> ((2 - component) * 8)) & 0xff) / 16; int opacity = block.getLightOpacity(); - if(opacity >= 15 && block.getLight() > 0) { + if(opacity >= 15 && light > 0) { opacity = 1; } @@ -4058,7 +4006,7 @@ public class Renderer { else { for(Facing side : Facing.values()) { BlockPos bpos = pos.offset(side); - int blight = this.getLightFor(bpos) - opacity; + int blight = this.getLightFor(bpos, component) - opacity; if(blight > light) { light = blight; @@ -4073,112 +4021,122 @@ public class Renderer { } } - private void setBlockLight(BlockPos pos, int lightValue) { + private int getLightFor(BlockPos pos, int component) { + return ((this.getLight(pos) >> ((2 - component) * 8)) & 0xff) / 16; + } + + private void setBlockLight(BlockPos pos, int component, int value) { if(World.isValid(pos)) { ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4); - chunk.setLight(pos, lightValue); - this.markUpdate(pos.getX() - 1, pos.getY() - 1, pos.getZ() - 1, pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + int light = chunk.getLight(pos); + int nlight = (light & ~(0xff << ((2 - component) * 8))) | ((value * 16) << ((2 - component) * 8)); + if(nlight != light) { + chunk.setLight(pos, nlight); + this.markUpdate(pos.getX() - 1, pos.getY() - 1, pos.getZ() - 1, pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + } } } public boolean checkBlockLight(BlockPos pos) { if(!this.gm.world.isAreaLoaded(pos, 17, false)) return false; - int done = 0; - int cnt = 0; - int light = this.getLightFor(pos); - int raw = this.getRawBlockLight(pos); - int bx = pos.getX(); - int by = pos.getY(); - int bz = pos.getZ(); - - if(raw > light) { - this.lightUpdate[cnt++] = 133152; - } - else if(raw < light) { - this.lightUpdate[cnt++] = 133152 | light << 18; - - while(done < cnt) { - int p = this.lightUpdate[done++]; - int x = (p & 63) - 32 + bx; - int y = (p >> 6 & 63) - 32 + by; - int z = (p >> 12 & 63) - 32 + bz; - int s = p >> 18 & 15; - BlockPos blk = new BlockPos(x, y, z); - int l = this.getLightFor(blk); - - if(l == s) { - this.setBlockLight(blk, 0); - - if(s > 0) { - int dx = ExtMath.absi(x - bx); - int dy = ExtMath.absi(y - by); - int dz = ExtMath.absi(z - bz); - - if(dx + dy + dz < 17) { - BlockPos.MutableBlockPos bpos = new BlockPos.MutableBlockPos(); - - for(Facing dir : Facing.values()) { - int ox = x + dir.getFrontOffsetX(); - int oy = y + dir.getFrontOffsetY(); - int oz = z + dir.getFrontOffsetZ(); - bpos.set(ox, oy, oz); - int op = Math.max(1, this.theWorld.getState(bpos).getBlock().getLightOpacity()); - l = this.getLightFor(bpos); - - if(l == s - op && cnt < this.lightUpdate.length) { - this.lightUpdate[cnt++] = ox - bx + 32 | oy - by + 32 << 6 | oz - bz + 32 << 12 | s - op << 18; + for(int component = 0; component < 3; component++) { + int done = 0; + int cnt = 0; + int light = this.getLightFor(pos, component); + int raw = this.getRawBlockLight(pos, component); + int bx = pos.getX(); + int by = pos.getY(); + int bz = pos.getZ(); + + if(raw > light) { + this.lightUpdate[cnt++] = 133152; + } + else if(raw < light) { + this.lightUpdate[cnt++] = 133152 | light << 18; + + while(done < cnt) { + int p = this.lightUpdate[done++]; + int x = (p & 63) - 32 + bx; + int y = (p >> 6 & 63) - 32 + by; + int z = (p >> 12 & 63) - 32 + bz; + int s = p >> 18 & 15; + BlockPos blk = new BlockPos(x, y, z); + int l = this.getLightFor(blk, component); + + if(l == s) { + this.setBlockLight(blk, component, 0); + + if(s > 0) { + int dx = ExtMath.absi(x - bx); + int dy = ExtMath.absi(y - by); + int dz = ExtMath.absi(z - bz); + + if(dx + dy + dz < 17) { + BlockPos.MutableBlockPos bpos = new BlockPos.MutableBlockPos(); + + for(Facing dir : Facing.values()) { + int ox = x + dir.getFrontOffsetX(); + int oy = y + dir.getFrontOffsetY(); + int oz = z + dir.getFrontOffsetZ(); + bpos.set(ox, oy, oz); + int op = Math.max(1, this.theWorld.getState(bpos).getBlock().getLightOpacity()); + l = this.getLightFor(bpos, component); + + if(l == s - op && cnt < this.lightUpdate.length) { + this.lightUpdate[cnt++] = ox - bx + 32 | oy - by + 32 << 6 | oz - bz + 32 << 12 | s - op << 18; + } } } } } } + + done = 0; } - - done = 0; - } - - while(done < cnt) { - int p = this.lightUpdate[done++]; - int x = (p & 63) - 32 + bx; - int y = (p >> 6 & 63) - 32 + by; - int z = (p >> 12 & 63) - 32 + bz; - BlockPos blk = new BlockPos(x, y, z); - int l = this.getLightFor(blk); - int r = this.getRawBlockLight(blk); - - if(r != l) { - this.setBlockLight(blk, r); - - if(r > l) { - int k6 = Math.abs(x - bx); - int l6 = Math.abs(y - by); - int i7 = Math.abs(z - bz); - boolean flag = cnt < this.lightUpdate.length - 6; - - if(k6 + l6 + i7 < 17 && flag) { - if(this.getLightFor(blk.west()) < r) { - this.lightUpdate[cnt++] = x - 1 - bx + 32 + (y - by + 32 << 6) + (z - bz + 32 << 12); - } - - if(this.getLightFor(blk.east()) < r) { - this.lightUpdate[cnt++] = x + 1 - bx + 32 + (y - by + 32 << 6) + (z - bz + 32 << 12); - } - - if(this.getLightFor(blk.down()) < r) { - this.lightUpdate[cnt++] = x - bx + 32 + (y - 1 - by + 32 << 6) + (z - bz + 32 << 12); - } - - if(this.getLightFor(blk.up()) < r) { - this.lightUpdate[cnt++] = x - bx + 32 + (y + 1 - by + 32 << 6) + (z - bz + 32 << 12); - } - - if(this.getLightFor(blk.north()) < r) { - this.lightUpdate[cnt++] = x - bx + 32 + (y - by + 32 << 6) + (z - 1 - bz + 32 << 12); - } - - if(this.getLightFor(blk.south()) < r) { - this.lightUpdate[cnt++] = x - bx + 32 + (y - by + 32 << 6) + (z + 1 - bz + 32 << 12); + + while(done < cnt) { + int p = this.lightUpdate[done++]; + int x = (p & 63) - 32 + bx; + int y = (p >> 6 & 63) - 32 + by; + int z = (p >> 12 & 63) - 32 + bz; + BlockPos blk = new BlockPos(x, y, z); + int l = this.getLightFor(blk, component); + int r = this.getRawBlockLight(blk, component); + + if(r != l) { + this.setBlockLight(blk, component, r); + + if(r > l) { + int k6 = Math.abs(x - bx); + int l6 = Math.abs(y - by); + int i7 = Math.abs(z - bz); + boolean flag = cnt < this.lightUpdate.length - 6; + + if(k6 + l6 + i7 < 17 && flag) { + if(this.getLightFor(blk.west(), component) < r) { + this.lightUpdate[cnt++] = x - 1 - bx + 32 + (y - by + 32 << 6) + (z - bz + 32 << 12); + } + + if(this.getLightFor(blk.east(), component) < r) { + this.lightUpdate[cnt++] = x + 1 - bx + 32 + (y - by + 32 << 6) + (z - bz + 32 << 12); + } + + if(this.getLightFor(blk.down(), component) < r) { + this.lightUpdate[cnt++] = x - bx + 32 + (y - 1 - by + 32 << 6) + (z - bz + 32 << 12); + } + + if(this.getLightFor(blk.up(), component) < r) { + this.lightUpdate[cnt++] = x - bx + 32 + (y + 1 - by + 32 << 6) + (z - bz + 32 << 12); + } + + if(this.getLightFor(blk.north(), component) < r) { + this.lightUpdate[cnt++] = x - bx + 32 + (y - by + 32 << 6) + (z - 1 - bz + 32 << 12); + } + + if(this.getLightFor(blk.south(), component) < r) { + this.lightUpdate[cnt++] = x - bx + 32 + (y - by + 32 << 6) + (z + 1 - bz + 32 << 12); + } } } } @@ -4186,17 +4144,6 @@ public class Renderer { } return true; } - - private void calculateInitialSkylight() { - float f = !this.gm.world.dimension.hasDaylight() ? 0.5f : this.calcRotationPhase(this.gm.world.dimension.getRotationalPeriod() / 4L, 1.0f); - float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); - f1 = ExtMath.clampf(f1, 0.0F, 1.0F); -// f1 = 1.0F - f1; -// f1 = (float)((double)f1 * (1.0D - (double)(this.gm.world.getRainStrength() * 5.0F) / 16.0D)); -// f1 = (float)((double)f1 * (1.0D - (double)(this.gm.world.getDarkness() * 5.0F) / 16.0D)); -// f1 = 1.0F - f1; - this.subtract = (int)(f1 * 11.0F); - } public static int getSkyLightFor(int y) { return y < 0 ? 0 : (y < 64 ? y / 4 : 15); diff --git a/client/src/main/java/client/renderer/entity/RenderManager.java b/client/src/main/java/client/renderer/entity/RenderManager.java index d29e3559..9d322abb 100755 --- a/client/src/main/java/client/renderer/entity/RenderManager.java +++ b/client/src/main/java/client/renderer/entity/RenderManager.java @@ -121,7 +121,7 @@ public class RenderManager { public static int getBrightnessForRender(Entity entity) { BlockPos pos = new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ); - return entity.worldObj.isBlockLoaded(pos) ? entity.worldObj.getCombinedLight(pos, 0) : 0; + return entity.worldObj.isBlockLoaded(pos) ? entity.worldObj.getCombinedLight(pos) : 0; } public boolean renderEntity(Entity entity, float partialTicks) { diff --git a/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java index 9e0c3b13..d698047e 100755 --- a/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java @@ -55,7 +55,7 @@ public class SpecialRenderer { public void renderTile(TileEntity tile, float partial) { if(tile.getDistanceSq(this.posX, this.posY, this.posZ) < tile.getMaxRenderDistanceSquared()) { - int light = this.world.getCombinedLight(tile.getPos(), 0); + int light = this.world.getCombinedLight(tile.getPos()); int block = light % 65536; int sky = light / 65536; GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); diff --git a/client/src/main/java/client/world/ChunkClient.java b/client/src/main/java/client/world/ChunkClient.java index 63c62719..47a892d2 100644 --- a/client/src/main/java/client/world/ChunkClient.java +++ b/client/src/main/java/client/world/ChunkClient.java @@ -189,17 +189,4 @@ public class ChunkClient extends Chunk { stor.setLight(x, y & 15, z, value); } - - public int getLightSub(BlockPos pos, int amount) { - int x = pos.getX() & 15; - int y = pos.getY(); - int z = pos.getZ() & 15; - BlockArray stor = this.getArray(y >> 4); - int l = this.world.dimension.hasSkyLight() ? Renderer.getSkyLightFor(pos.getY()) : 0; - if(stor == null) - return this.world.dimension.hasSkyLight() && amount < l ? l - amount : 0; - l = l - amount; - int b = stor.getLight(x, y & 15, z); - return b > l ? b : l; - } } diff --git a/client/src/main/java/client/world/ChunkEmpty.java b/client/src/main/java/client/world/ChunkEmpty.java index 750c93c4..46b75239 100755 --- a/client/src/main/java/client/world/ChunkEmpty.java +++ b/client/src/main/java/client/world/ChunkEmpty.java @@ -79,10 +79,6 @@ public class ChunkEmpty extends ChunkClient { public void setLight(BlockPos pos, int value) { } - public int getLightSub(BlockPos pos, int amount) { - return 0; - } - public void addEntity(Entity entity) { } diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index c2d814e7..1e401f4d 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -386,13 +386,8 @@ public class Block { return this; } - public final Block setLight(float level) { - this.light = (int)(15.0F * level); - return this; - } - - public final Block setLight(int level) { - this.light = level; + public final Block setLight(int color) { + this.light = color; return this; } diff --git a/common/src/main/java/common/block/artificial/BlockFloorPortal.java b/common/src/main/java/common/block/artificial/BlockFloorPortal.java index 789aaed2..14c26eca 100755 --- a/common/src/main/java/common/block/artificial/BlockFloorPortal.java +++ b/common/src/main/java/common/block/artificial/BlockFloorPortal.java @@ -25,7 +25,7 @@ public class BlockFloorPortal extends Block public BlockFloorPortal(Material materialIn) { super(materialIn); - this.setLight(1.0F); + this.setLight(0x7f00ff); } // /** diff --git a/common/src/main/java/common/block/artificial/BlockMetalBlock.java b/common/src/main/java/common/block/artificial/BlockMetalBlock.java index 40d1fe13..96fa6dde 100644 --- a/common/src/main/java/common/block/artificial/BlockMetalBlock.java +++ b/common/src/main/java/common/block/artificial/BlockMetalBlock.java @@ -20,7 +20,7 @@ public class BlockMetalBlock extends Block { super(Material.SOLID); this.metal = metal; this.setSound(SoundType.STONE); - this.setLight(metal.radioactivity > 0.0F ? 0.25F : 0.0F); + this.setLight(metal.radioactivity > 0.0F ? 0x003f00 : 0x000000); this.setRadiation(metal.radioactivity * 2.0f); this.setTab(CheatTab.GEMS); } diff --git a/common/src/main/java/common/block/foliage/BlockBlueShroom.java b/common/src/main/java/common/block/foliage/BlockBlueShroom.java index cc7b249d..18f2fc80 100755 --- a/common/src/main/java/common/block/foliage/BlockBlueShroom.java +++ b/common/src/main/java/common/block/foliage/BlockBlueShroom.java @@ -67,7 +67,7 @@ public class BlockBlueShroom extends BlockBush protected boolean canPlaceBlockOn(Block ground) { - return ground.isFullBlock(); + return ground.isFullBlock() || ground.isNonBlock(); } public boolean canBlockStay(World worldIn, BlockPos pos, State state) diff --git a/common/src/main/java/common/block/foliage/BlockMushroom.java b/common/src/main/java/common/block/foliage/BlockMushroom.java index 5940671f..9343e311 100755 --- a/common/src/main/java/common/block/foliage/BlockMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockMushroom.java @@ -70,7 +70,7 @@ public class BlockMushroom extends BlockBush implements IGrowable */ protected boolean canPlaceBlockOn(Block ground) { - return ground.isFullBlock(); + return ground.isFullBlock() || ground.isNonBlock(); } public boolean canBlockStay(World worldIn, BlockPos pos, State state) diff --git a/common/src/main/java/common/block/natural/BlockMetalOre.java b/common/src/main/java/common/block/natural/BlockMetalOre.java index 41935426..45d94067 100644 --- a/common/src/main/java/common/block/natural/BlockMetalOre.java +++ b/common/src/main/java/common/block/natural/BlockMetalOre.java @@ -15,7 +15,7 @@ public class BlockMetalOre extends BlockOre { public BlockMetalOre(MetalType metal) { this.metal = metal; this.setSound(SoundType.STONE); - this.setLight(metal.radioactivity > 0.0F ? 0.25F : 0.0F); + this.setLight(metal.radioactivity > 0.0F ? 0x003f00 : 0x000000); this.setRadiation(metal.radioactivity * 0.5f); } diff --git a/common/src/main/java/common/block/tech/BlockActiveDisplay.java b/common/src/main/java/common/block/tech/BlockActiveDisplay.java index 97c98ab8..3b06bb27 100644 --- a/common/src/main/java/common/block/tech/BlockActiveDisplay.java +++ b/common/src/main/java/common/block/tech/BlockActiveDisplay.java @@ -18,7 +18,7 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi public BlockActiveDisplay(BlockInactiveDisplay inactive) { super(inactive.getDensity()); - this.setLight(1.0f); + this.setLight(0xafafff); this.inactive = inactive; inactive.setActive(this); } diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index 48d5d34f..83a74aea 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -37,7 +37,7 @@ public class BlockFurnace extends BlockMachine { this.fuelEfficiency = fuelEfficiency; this.setHardness(3.5F).setSound(SoundType.STONE); if(this.isBurning) - this.setLight(0.875F); + this.setLight(0xffffaf); } public BlockFurnace(int burnTime, int fuelEfficiency) { diff --git a/common/src/main/java/common/block/tech/BlockToggleableLight.java b/common/src/main/java/common/block/tech/BlockToggleableLight.java index 0938db89..39f12ffd 100755 --- a/common/src/main/java/common/block/tech/BlockToggleableLight.java +++ b/common/src/main/java/common/block/tech/BlockToggleableLight.java @@ -18,7 +18,7 @@ public class BlockToggleableLight extends Block { super(Material.LOOSE); this.isOn = isOn; if(isOn) - this.setLight(1.0F); + this.setLight(0xffffcf); } public void toggle(World worldIn, BlockPos pos) { diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index 709ef0b2..515febca 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -118,10 +118,10 @@ public abstract class BlockRegistry { private static void registerFluid(String name, String display, LiquidType type, int light, int rate, float radiation, Object still, Object flowing) { BlockDynamicLiquid dy = (BlockDynamicLiquid)(new BlockDynamicLiquid(type.material, rate, flowing)).setHardness(100.0F) - .setOpacity(3).setLight((float)light / 15.0f).setDisplay(display) + .setOpacity(3).setLight(light).setDisplay(display) .setRadiation(radiation); BlockStaticLiquid st = (BlockStaticLiquid)(new BlockStaticLiquid(type.material, rate, still, dy)).setHardness(100.0F) - .setOpacity(3).setLight((float)light / 15.0f).setDisplay(display) + .setOpacity(3).setLight(light).setDisplay(display) .setRadiation(radiation); register("flowing_" + name, dy); register(name, st); @@ -170,7 +170,7 @@ public abstract class BlockRegistry { register("ice", (new BlockIce()).setHardness(0.5F).setOpacity(3).setSound(SoundType.GLASS).setDisplay("Eis").setMiningTool(Equipment.PICKAXE, 0)); register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setSound(SoundType.GLASS).setDisplay("Packeis").setMiningTool(Equipment.PICKAXE, 0)); register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Seelensand").setMiningTool(Equipment.SHOVEL)); - register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(1.0F) + 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) @@ -178,9 +178,9 @@ public abstract class BlockRegistry { registerFluid("water", "Wasser", LiquidType.WATER, 0, 5, 0.0f, TextureAnimation.WATER_STILL, TextureAnimation.WATER_FLOW); - registerFluid("lava", "Lava", LiquidType.LAVA, 15, -30, 0.0f, 2, 3); - registerFluid("magma", "Magma", LiquidType.HOT, 15, 40, 0.0f, TextureAnimation.MAGMA_STILL, TextureAnimation.MAGMA_FLOW); - registerFluid("plasma", "Plasma", LiquidType.HOT, 15, 15, 0.0f, 2, 2); + registerFluid("lava", "Lava", LiquidType.LAVA, 0xffcfaf, -30, 0.0f, 2, 3); + registerFluid("magma", "Magma", LiquidType.HOT, 0xffaf8f, 40, 0.0f, TextureAnimation.MAGMA_STILL, TextureAnimation.MAGMA_FLOW); + registerFluid("plasma", "Plasma", LiquidType.HOT, 0xff7f00, 15, 0.0f, 2, 2); registerFluid("mercury", "Quecksilber", LiquidType.COLD, 0, 40, 0.0f, 8, 4); registerFluid("hydrogen", "Wasserstoff", LiquidType.COLD, 0, 50, 0.0f, 8, 4); registerFluid("acid", "Säure", LiquidType.HOT, 0, 5, 0.0f, 1, 1); @@ -271,7 +271,7 @@ public abstract class BlockRegistry { - Block brown_mushroom = (new BlockMushroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0.125F) + Block brown_mushroom = (new BlockMushroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0x1f1f1f) .setDisplay("Pilz"); register("brown_mushroom", brown_mushroom); register("brown_mushroom_block", (new BlockHugeMushroom(brown_mushroom)).setHardness(0.2F) @@ -280,7 +280,7 @@ public abstract class BlockRegistry { register("red_mushroom", red_mushrooom); register("red_mushroom_block", (new BlockHugeMushroom(red_mushrooom)).setHardness(0.2F) .setSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); - register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0.5F) + register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0x00007f) .setDisplay("Tianpilz")); Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setSound(SoundType.WOOD).setDisplay("Kürbis"); @@ -317,9 +317,9 @@ public abstract class BlockRegistry { register("web", (new BlockWeb()).setOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz")); - register("fire", (new BlockFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Feuer")); - register("black_fire", (new BlockBlackFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Dunkles Feuer")); - register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Feuer der Seelen")); + register("fire", (new BlockFire()).setHardness(0.0F).setLight(0xffffbf).setSound(SoundType.CLOTH).setDisplay("Feuer")); + register("black_fire", (new BlockBlackFire()).setHardness(0.0F).setLight(0x7f7f7f).setSound(SoundType.CLOTH).setDisplay("Dunkles Feuer")); + register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLight(0x0000ff).setSound(SoundType.CLOTH).setDisplay("Feuer der Seelen")); register("glass", (new BlockGlass()).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Glas")); @@ -348,7 +348,7 @@ public abstract class BlockRegistry { register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setSound(SoundType.WOOD).setDisplay("Bücherregal")); register("cake", (new BlockCake()).setHardness(0.5F).setSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION)); register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setSound(SoundType.STONE) - .setLight(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION)); + .setLight(0x1f001f).setDisplay("Drachenei").setTab(CheatTab.DECORATION)); register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf").setTab(CheatTab.DECORATION)); register("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay())); for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { @@ -371,10 +371,10 @@ public abstract class BlockRegistry { for(PortalType portal : PortalType.values()) { if(portal != PortalType.FLOOR && portal != PortalType.VOID) - register(portal.getName() + "_portal", (new BlockPortal(portal)).setHardness(0.0F).setSound(SoundType.GLASS).setLight(0.75F).setDisplay(portal.getDisplay())); + register(portal.getName() + "_portal", (new BlockPortal(portal)).setHardness(0.0F).setSound(SoundType.GLASS).setLight(0x1f1f1f).setDisplay(portal.getDisplay())); } register(PortalType.FLOOR.getName() + "_portal", (new BlockFloorPortal(Material.PORTAL)).setHardness(0.0F).setDisplay(PortalType.FLOOR.getDisplay())); - register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0.125F).setHardness(5.0F) + register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0x1f002f).setHardness(5.0F) .setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY)); register("farmland", (new BlockFarmland()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ackerboden").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.PLANTS)); @@ -589,9 +589,9 @@ public abstract class BlockRegistry { register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss")); } register("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch")); - register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLight(0.125F).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY)); + register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLight(0x1f1f18).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY)); register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY)); - register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLight(1.0F)); + register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLight(0xffffff)); register("wood_chest", new BlockChest(9, 3).setDisplay("Holztruhe")); register("stone_chest", new BlockChest(9, 6).setDisplay("Steintruhe")); @@ -602,7 +602,7 @@ public abstract class BlockRegistry { register("black_metal_chest", new BlockChest(28, 18).setDisplay("Schwarzmetalltruhe")); register("nichun_chest", new BlockChest(32, 18).setDisplay("Nichuntruhe")); register("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setSound(SoundType.STONE) - .setDisplay("Warptruhe").setLight(0.5F)); + .setDisplay("Warptruhe").setLight(0x7f00af)); for(int z = 0; z < BlockTNT.TNTS.length; z++) { register("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z))); @@ -639,14 +639,14 @@ public abstract class BlockRegistry { register("wire", (new BlockWire()).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Kabel").setTab(CheatTab.TECHNOLOGY)); BlockUnlitTorch torch; register("torch", (torch = new BlockUnlitTorch(0xffffffff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Fackel")); - register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLight(0.9375F).setSound(SoundType.WOOD).setDisplay("Fackel")); + register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLight(0xefef9f).setSound(SoundType.WOOD).setDisplay("Fackel")); BlockUnlitTorch tian_torch; register("tian_torch", (tian_torch = new BlockUnlitTorch(0x7f00ff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Tian-Fackel")); - register("lit_tian_torch", (new BlockLitTorch(tian_torch)).setHardness(0.0F).setLight(0.5F).setSound(SoundType.WOOD) + register("lit_tian_torch", (new BlockLitTorch(tian_torch)).setHardness(0.0F).setLight(0xaf00ff).setSound(SoundType.WOOD) .setDisplay("Tian-Fackel")); BlockUnlitTorch soul_torch; register("soul_torch", (soul_torch = new BlockUnlitTorch(0x1f1fff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Seelenfackel")); - register("lit_soul_torch", (new BlockLitTorch(soul_torch)).setHardness(0.0F).setLight(0.75F).setSound(SoundType.WOOD) + register("lit_soul_torch", (new BlockLitTorch(soul_torch)).setHardness(0.0F).setLight(0x0000af).setSound(SoundType.WOOD) .setDisplay("Seelenfackel")); register("lamp", (new BlockToggleableLight(false)).setHardness(0.3F).setSound(SoundType.GLASS) .setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY)); diff --git a/common/src/main/java/common/world/BlockArray.java b/common/src/main/java/common/world/BlockArray.java index 4cbf8f67..ef6abdf2 100755 --- a/common/src/main/java/common/world/BlockArray.java +++ b/common/src/main/java/common/world/BlockArray.java @@ -15,7 +15,7 @@ public class BlockArray { private int ticked; private int filled; private char[] data; - private NibbleArray blocklight; + private int[] blocklight; public BlockArray(int y, State filler) { this.yBase = y; @@ -113,12 +113,12 @@ public class BlockArray { public void setLight(int x, int y, int z, int value) { if(this.blocklight == null) - this.blocklight = new NibbleArray(); - this.blocklight.set(x, y, z, value); + this.blocklight = new int[4096]; + this.blocklight[y << 8 | z << 4 | x] = value; } public int getLight(int x, int y, int z) { - return this.blocklight == null ? 0 : this.blocklight.get(x, y, z); + return this.blocklight == null ? 0 : this.blocklight[y << 8 | z << 4 | x]; } public void clearLight() { diff --git a/common/src/main/java/common/world/IWorldAccess.java b/common/src/main/java/common/world/IWorldAccess.java index 77dfcb24..d2d9e945 100755 --- a/common/src/main/java/common/world/IWorldAccess.java +++ b/common/src/main/java/common/world/IWorldAccess.java @@ -8,5 +8,5 @@ public interface IWorldAccess extends IBlockAccess { TileEntity getTileEntity(BlockPos pos); @Clientside - int getCombinedLight(BlockPos pos, int lightValue); + int getCombinedLight(BlockPos pos); } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index abaab740..de62709e 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -187,7 +187,7 @@ public abstract class World implements IWorldAccess { public void checkBlockLight(BlockPos pos) { } - public int getCombinedLight(BlockPos pos, int lightValue) { + public int getCombinedLight(BlockPos pos) { return 0; }