add option to fix rain lag

This commit is contained in:
Sen 2025-06-30 11:37:23 +02:00
parent 2a0e6c3cf7
commit ea2d11ae3a
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
7 changed files with 164 additions and 260 deletions

View file

@ -475,8 +475,11 @@ public class Client implements IThreadListener {
public int scrollLines = 3;
@Variable(name = "gui_font_tiny", category = CVarCategory.GUI, display = "Kleine Schrift", callback = FontFunction.class)
public boolean tinyFont = false;
@Variable(name = "draw_downfall_range", category = CVarCategory.RENDER, min = 0, max = 15, display = "Niederschlag-Radius")
public int downfallRange = 10;
@Variable(name = "draw_rain_particle_range", category = CVarCategory.RENDER, min = 0, max = 25, display = "Regen-Partikel-Radius")
public int rainParticleRange = 10;
@Variable(name = "tic_target", category = CVarCategory.SYSTEM, min = 1.0f, max = 1200.0f, callback = TickFunction.class, display = "Tickrate")
public float tpsTarget = 20.0f;

View file

@ -87,7 +87,7 @@ public class GuiDisplay extends GuiOptions {
this.addSelector("feed_size", 0, 110, 240, 0);
this.addSelector("hotbar_size", 242, 110, 240, 0);
this.addSelector("gl_fov", 0, 140, 240, 0);
this.distanceSlider = this.addSelector("chunk_view_distance", 0, 160, 240, 0);

View file

@ -0,0 +1,17 @@
package client.gui.options;
public class GuiGraphics extends GuiOptions {
protected GuiGraphics() {
}
public void init(int width, int height) {
this.addSelector("draw_downfall_range", 0, 0, 240, 0);
this.addSelector("draw_rain_particle_range", 242, 0, 240, 0);
super.init(width, height);
}
public String getTitle() {
return "Darstellung";
}
}

View file

@ -5,7 +5,7 @@ import client.gui.GuiMenu;
import client.gui.element.NavButton;
public abstract class GuiOptions extends Gui {
private static final GuiOptions[] PAGES = {lastPage = new GuiBinds(), new GuiStyle(), new GuiDisplay(), new GuiSound()};
private static final GuiOptions[] PAGES = {lastPage = new GuiBinds(), new GuiStyle(), new GuiDisplay(), new GuiSound(), new GuiGraphics()};
private static GuiOptions lastPage;

View file

@ -61,8 +61,8 @@ public class EntityRenderer {
private float torchFlickerX;
private float torchFlickerDX;
private int rainSoundCounter;
private float[] rainXCoords = new float[1024];
private float[] rainYCoords = new float[1024];
private float[] rainXCoords = new float[32*32];
private float[] rainZCoords = new float[32*32];
private FloatBuffer fogColorBuffer = ByteBuffer.allocateDirect(16 << 2).order(ByteOrder.nativeOrder()).asFloatBuffer();
private float fogColorRed;
private float fogColorGreen;
@ -82,15 +82,15 @@ public class EntityRenderer {
gmIn.getTextureManager().loadTexture(locationLightMap, this.lightmapTexture);
this.lightmapColors = this.lightmapTexture.getData();
for (int i = 0; i < 32; ++i)
for (int x = 0; x < 32; ++x)
{
for (int j = 0; j < 32; ++j)
for (int z = 0; z < 32; ++z)
{
float f = (float)(j - 16);
float f1 = (float)(i - 16);
float f2 = ExtMath.sqrtf(f * f + f1 * f1);
this.rainXCoords[i << 5 | j] = -f1 / f2;
this.rainYCoords[i << 5 | j] = f / f2;
float dz = (float)(z - 16);
float dx = (float)(x - 16);
float dist = ExtMath.sqrtf(dz * dz + dx * dx);
this.rainXCoords[x << 5 | z] = -dx / dist;
this.rainZCoords[x << 5 | z] = dz / dist;
}
}
}
@ -652,9 +652,6 @@ public class EntityRenderer {
// }
}
/**
* Render player hand
*/
private void renderHand(float partialTicks)
{
// if (!this.debugView)
@ -735,9 +732,6 @@ public class EntityRenderer {
GlState.setActiveTexture(GL13.GL_TEXTURE0);
}
/**
* Recompute a random value that is applied to block color in updateLightmap()
*/
private void updateTorchFlicker()
{
this.torchFlickerDX = (float)((double)this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random());
@ -891,35 +885,6 @@ public class EntityRenderer {
return i > 200 ? 1.0F : 0.7F + ExtMath.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F;
}
// public void updateCameraAndRender(float partialTicks, long nanoTime)
// {
// if (this.gm.theWorld != null)
// {
// this.renderWorld(partialTicks, );
// this.renderEndNanoTime = System.nanoTime();
// if (!this.gm.hideGUI || this.gm.openGui != null)
// {
// this.gm.ingameGui.renderGameOverlay(partialTicks);
// }
// }
// else
// {
// SKC.glMatrixMode(5889);
// SKC.glLoadIdentity();
// SKC.glMatrixMode(5888);
// SKC.glLoadIdentity();
// this.setupOverlayRendering();
// this.renderEndNanoTime = System.nanoTime();
// }
// }
// public void renderMainOverlay(float partialTicks)
// {
// this.setupOverlayRendering();
//
// }
public void renderWorld(float partialTicks, long finishTimeNano)
{
finishTimeNano = System.nanoTime() + Math.max((long)this.gm.maxBuildTime * 1000000L - finishTimeNano, 0L);
@ -1123,13 +1088,15 @@ public class EntityRenderer {
Entity entity = this.gm.getRenderViewEntity();
World world = this.gm.world;
BlockPos blockpos = new BlockPos(entity);
int i = 10;
int i = this.gm.rainParticleRange;
if(i <= 0)
return;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int j = 0;
int n = 0;
int k = (int)(100.0F * f * f);
int k = (int)(10.0F * (float)i * f * f);
// if (this.gm.particleSetting == 1)
// {
@ -1166,8 +1133,8 @@ public class EntityRenderer {
d2 = (double)blockpos2.getZ() + d4;
}
}
if(temp < 194.0f || this.random.chance(5))
this.gm.world.spawnParticle(temp >= 194.0f && this.random.chance(10) ? ParticleType.LAVA : ParticleType.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D);
if(temp < 194.0f || this.random.chance(8))
this.gm.world.spawnParticle(temp >= 194.0f && this.random.chance(20) ? ParticleType.LAVA : ParticleType.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D);
}
else if (block != Blocks.air)
{
@ -1206,210 +1173,136 @@ public class EntityRenderer {
return this.random.chance(28) ? this.random.pick(SoundEvent.MOLTEN, SoundEvent.MOLTEN_POP) : SoundEvent.FIRE;
}
/**
* Render rain and snow
*/
protected void renderRainSnow(float partialTicks)
{
float f = this.gm.world.getRainStrength();
private void renderRainSnow(float partial) {
float rain = this.gm.world.getRainStrength();
if(rain <= 0.0F)
return;
this.enableLightmap();
Entity entity = this.gm.getRenderViewEntity();
World world = this.gm.world;
int ex = ExtMath.floord(entity.posX);
int ey = ExtMath.floord(entity.posY);
int ez = ExtMath.floord(entity.posZ);
RenderBuffer buf = Tessellator.getBuffer();
GlState.disableCull();
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GlState.enableBlend();
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
double ax = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partial;
double ay = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial;
double az = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partial;
int height = ExtMath.floord(ay);
int range = this.gm.downfallRange;
int hrange = 10;
int mode = -1;
float tic = (float)this.rendererUpdateCount + partial;
buf.setTranslation(-ax, -ay, -az);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
if (f > 0.0F) // && this.gm.downfallSetting < 2)
{
this.enableLightmap();
Entity entity = this.gm.getRenderViewEntity();
World world = this.gm.world;
int i = ExtMath.floord(entity.posX);
int j = ExtMath.floord(entity.posY);
int k = ExtMath.floord(entity.posZ);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
GlState.disableCull();
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GlState.enableBlend();
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
int l = ExtMath.floord(d1);
int i1 = 10;
for(int z = ez - range; z <= ez + range; z++) {
for(int x = ex - range; x <= ex + range; x++) {
int idx = (z - ez + 16) * 32 + x - ex + 16;
double rx = (double)this.rainXCoords[idx] * 0.5D;
double rz = (double)this.rainZCoords[idx] * 0.5D;
pos.set(x, 0, z);
Biome biome = world.getBiomeGenForCoords(pos);
// if (this.gm.downfallSetting == 0)
// {
// i1 *= 2;
// }
int prec = world.getPrecipitationHeight(pos).getY();
int miny = ey - hrange;
int maxy = ey + hrange;
int mode = -1;
float f1 = (float)this.rendererUpdateCount + partialTicks;
worldrenderer.setTranslation(-d0, -d1, -d2);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
// boolean hail = !world.getWeather().isWet() && world.getWeather().hasDownfall();
if(miny < prec) {
miny = prec;
}
for (int k1 = k - i1; k1 <= k + i1; ++k1)
{
for (int l1 = i - i1; l1 <= i + i1; ++l1)
{
int i2 = (k1 - k + 16) * 32 + l1 - i + 16;
double d3 = (double)this.rainXCoords[i2] * 0.5D;
double d4 = (double)this.rainYCoords[i2] * 0.5D;
blockpos$mutableblockpos.set(l1, 0, k1);
Biome biomegenbase = world.getBiomeGenForCoords(blockpos$mutableblockpos);
if(maxy < prec) {
maxy = prec;
}
// if (biomegenbase.canRain() || biomegenbase.isSnowyBiome())
// {
int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY();
int k2 = j - i1;
int l2 = j + i1;
int lpos = prec;
if (k2 < j2)
{
k2 = j2;
}
if(prec < height) {
lpos = height;
}
if (l2 < j2)
{
l2 = j2;
}
if(miny != maxy) {
this.random.setSeed((long)(x * x * 3121 + x * 45238971 ^ z * z * 418711 + z * 13761));
pos.set(x, miny, z);
float temp = World.ABSOLUTE_ZERO + world.getTempOffset() + biome.getTemperature(pos);
int i3 = j2;
if(temp > 0.0F) {
if(mode != (temp >= 194.0f ? 2 : (temp <= 5.0f ? 3 : 0))) {
if(mode >= 0)
Tessellator.draw();
mode = temp >= 194.0f ? 2 : (temp <= 5.0f ? 3 : 0);
this.gm.getTextureManager()
.bindTexture(temp >= 194.0f ? locationMoltenPng : (temp <= 5.0f ? locationHailPng : locationRainPng));
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
}
if (j2 < l)
{
i3 = l;
}
double offset = ((double)(this.rendererUpdateCount + x * x * 3121 + x * 45238971 + z * z * 418711 + z * 13761 & 31)
+ (double)partial) / (temp >= 194.0f ? 64.0 : 32.0) * (3.0 + this.random.doublev());
double dx = (double)((float)x + 0.5F) - entity.posX;
double dz = (double)((float)z + 0.5F) - entity.posZ;
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 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)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
buf.pos((double)x + rx + 0.5D, (double)miny, (double)z + rz + 0.5D).tex(1.0D, (double)miny * 0.25D + offset)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
buf.pos((double)x + rx + 0.5D, (double)maxy, (double)z + rz + 0.5D).tex(1.0D, (double)maxy * 0.25D + offset)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
buf.pos((double)x - rx + 0.5D, (double)maxy, (double)z - rz + 0.5D).tex(0.0D, (double)maxy * 0.25D + offset)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
}
else {
if(mode != 1) {
if(mode >= 0)
Tessellator.draw();
mode = 1;
this.gm.getTextureManager().bindTexture(locationSnowPng);
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
}
if (k2 != l2)
{
this.random.setSeed((long)(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761));
blockpos$mutableblockpos.set(l1, k2, k1);
float f2 = World.ABSOLUTE_ZERO + world.getTempOffset() + biomegenbase.getTemperature(blockpos$mutableblockpos);
double offset = (double)(((float)(this.rendererUpdateCount & 511) + partial) / 512.0F);
double tx = this.random.doublev() + (double)tic * 0.01D * (double)((float)this.random.gaussian());
double ty = this.random.doublev() + (double)(tic * (float)this.random.gaussian()) * 0.001D;
double dx = (double)((float)x + 0.5F) - entity.posX;
double dz = (double)((float)z + 0.5F) - entity.posZ;
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 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)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
buf.pos((double)x + rx + 0.5D, (double)miny, (double)z + rz + 0.5D).tex(1.0D + tx, (double)miny * 0.25D + offset + ty)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
buf.pos((double)x + rx + 0.5D, (double)maxy, (double)z + rz + 0.5D).tex(1.0D + tx, (double)maxy * 0.25D + offset + ty)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
buf.pos((double)x - rx + 0.5D, (double)maxy, (double)z - rz + 0.5D).tex(0.0D + tx, (double)maxy * 0.25D + offset + ty)
.color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex();
}
}
}
}
if(f2 >= 194.0f)
{
if (mode != 2)
{
if (mode >= 0)
{
Tessellator.draw();
}
if(mode >= 0)
Tessellator.draw();
buf.setTranslation(0.0D, 0.0D, 0.0D);
GlState.enableCull();
GlState.disableBlend();
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
this.disableLightmap();
}
mode = 2;
this.gm.getTextureManager().bindTexture(locationMoltenPng);
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
}
double d5 = ((double)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 63) + (double)partialTicks) / 64.0D * (3.0D + this.random.doublev());
double d6 = (double)((float)l1 + 0.5F) - entity.posX;
double d7 = (double)((float)k1 + 0.5F) - entity.posZ;
float f3 = ExtMath.sqrtd(d6 * d6 + d7 * d7) / (float)i1;
float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f;
blockpos$mutableblockpos.set(l1, i3, k1);
int j3 = world.getCombinedLight(blockpos$mutableblockpos, 15);
int k3 = j3 >> 16 & 65535;
int l3 = j3 & 65535;
worldrenderer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
worldrenderer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
worldrenderer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
worldrenderer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
}
else if (/* world.getBiomeGenerator().getTemperatureAtHeight( */ f2 /* , j2) */ > 0.0F)
{
if (mode != (f2 <= 5.0f ? 3 : 0))
{
if (mode >= 0)
{
Tessellator.draw();
}
mode = f2 <= 5.0f ? 3 : 0;
this.gm.getTextureManager().bindTexture(f2 <= 5.0f ? locationHailPng : locationRainPng);
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
}
double d5 = ((double)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.doublev());
double d6 = (double)((float)l1 + 0.5F) - entity.posX;
double d7 = (double)((float)k1 + 0.5F) - entity.posZ;
float f3 = ExtMath.sqrtd(d6 * d6 + d7 * d7) / (float)i1;
float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f;
blockpos$mutableblockpos.set(l1, i3, k1);
int j3 = world.getCombinedLight(blockpos$mutableblockpos, 0);
int k3 = j3 >> 16 & 65535;
int l3 = j3 & 65535;
worldrenderer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
worldrenderer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
worldrenderer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
worldrenderer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
}
else
{
if (mode != 1)
{
if (mode >= 0)
{
Tessellator.draw();
}
mode = 1;
this.gm.getTextureManager().bindTexture(locationSnowPng);
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
}
double d8 = (double)(((float)(this.rendererUpdateCount & 511) + partialTicks) / 512.0F);
double d9 = this.random.doublev() + (double)f1 * 0.01D * (double)((float)this.random.gaussian());
double d10 = this.random.doublev() + (double)(f1 * (float)this.random.gaussian()) * 0.001D;
double d11 = (double)((float)l1 + 0.5F) - entity.posX;
double d12 = (double)((float)k1 + 0.5F) - entity.posZ;
float f6 = ExtMath.sqrtd(d11 * d11 + d12 * d12) / (float)i1;
float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f;
blockpos$mutableblockpos.set(l1, i3, k1);
int i4 = (world.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4;
int j4 = i4 >> 16 & 65535;
int k4 = i4 & 65535;
worldrenderer.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
worldrenderer.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
worldrenderer.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
worldrenderer.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
}
}
// }
}
}
if (mode >= 0)
{
Tessellator.draw();
}
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
GlState.enableCull();
GlState.disableBlend();
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
this.disableLightmap();
}
}
/**
* Setup orthogonal projection for rendering GUI screen overlays
*/
// public void setupOverlayRendering()
// {
//// Scaler scaledresolution = new Scaler(this.gm);
// }
// /**
// * Returns a double value representing the Y value relative to the top of the
// * map at which void fog is at its maximum. The default factor of 0.03125
// * relative to 256, for example, means the void fog will be at its maximum at
// * (256*0.03125), or 8.
// */
// public double getVoidFogYFactor() {
// return 1.0D; // 0.03125D * 2.5D / (((double)this.worldObj.getSeaLevel() + 1) / 64.0);
// }
/**
* calculates fog and calls glClearColor
*/
private void updateFogColor(float partial)
{
WorldClient world = this.gm.world;
@ -1689,9 +1582,6 @@ public class EntityRenderer {
GlState.colorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT);
}
/**
* Update and return fogColorBuffer with the RGBA values passed as arguments
*/
private FloatBuffer setFogColorBuffer(float red, float green, float blue, float alpha)
{
this.fogColorBuffer.clear();
@ -1699,9 +1589,4 @@ public class EntityRenderer {
this.fogColorBuffer.flip();
return this.fogColorBuffer;
}
// public MapItemRenderer getMapItemRenderer()
// {
// return this.theMapItemRenderer;
// }
}

View file

@ -29,7 +29,7 @@ public class ChunkClient extends Chunk {
for(int x = 0; x < 16; ++x) {
for(int z = 0; z < 16; ++z) {
this.precHeight[x + (z << 4)] = -99999999;
this.precHeight[x + (z << 4)] = Integer.MIN_VALUE;
for(int y = top + 16; y > bottom; --y) {
Block block = this.getBlock0(x, y - 1, z);

View file

@ -61,7 +61,7 @@ public abstract class Chunk {
for(int y = 0; y < this.entities.length; ++y) {
this.entities[y] = new InheritanceMultiMap(Entity.class);
}
Arrays.fill(this.precHeight, -99999999);
Arrays.fill(this.precHeight, Integer.MIN_VALUE);
}
public int getHeight(int x, int z) {
@ -88,7 +88,7 @@ public abstract class Chunk {
for(int x = 0; x < 16; ++x) {
for(int z = 0; z < 16; ++z) {
this.precHeight[x + (z << 4)] = -99999999;
this.precHeight[x + (z << 4)] = Integer.MIN_VALUE;
for(int y = top + 16; y > bottom; --y) {
if(this.getOpacity(x, y - 1, z) != 0) {
@ -315,7 +315,7 @@ public abstract class Chunk {
int o = z << 4 | x;
if(y >= this.precHeight[o] - 1) {
this.precHeight[o] = -99999999;
this.precHeight[o] = Integer.MIN_VALUE;
}
int h = this.height[o];
@ -631,13 +631,12 @@ public abstract class Chunk {
int o = x | z << 4;
BlockPos loc = new BlockPos(pos.getX(), this.precHeight[o], pos.getZ());
if(loc.getY() == -99999999) {
if(loc.getY() == Integer.MIN_VALUE) {
int y = this.top + 15;
int min = this.bottom < -64 ? -64 : this.bottom;
loc = new BlockPos(pos.getX(), y, pos.getZ());
int h = -99999999;
while(loc.getY() > min && h == -99999999) {
while(loc.getY() > min) {
Block block = this.getBlock(loc);
Material mat = block.getMaterial();
@ -647,11 +646,11 @@ public abstract class Chunk {
loc = loc.down();
}
else {
h = loc.getY() + 1;
return new BlockPos(pos.getX(), this.precHeight[o] = loc.getY() + 1, pos.getZ());
}
}
this.precHeight[o] = h;
return new BlockPos(pos.getX(), this.precHeight[o] = -64, pos.getZ());
}
return new BlockPos(pos.getX(), this.precHeight[o], pos.getZ());