remove clientside biomes + temperature

This commit is contained in:
Sen 2025-05-19 20:40:00 +02:00
parent 77b05e1b09
commit c0135b4acb
45 changed files with 248 additions and 582 deletions

View file

@ -95,7 +95,6 @@ import client.window.Wheel;
import client.window.Window;
import client.window.WindowEvent;
import client.world.WorldClient;
import common.biome.Biome;
import common.block.Block;
import common.collect.Lists;
import common.collect.Maps;
@ -158,7 +157,6 @@ import common.util.Util;
import common.util.HitPosition.ObjectType;
import common.world.Chunk;
import common.world.State;
import common.world.World;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelException;
@ -426,8 +424,9 @@ public class Client implements IThreadListener {
public int soundBufferSize = 2048;
@Variable(name = "snd_frame_size", category = CVarCategory.SOUND, min = 2, max = 8192, display = "PCM-Intervall")
public int soundFrameSize = 32;
private String serverInfo;
private String tickInfo;
private int lastTickTime = -1;
private AudioInterface audio;
private boolean cfgDirty;
@ -1652,10 +1651,11 @@ public class Client implements IThreadListener {
this.serverInfo = info;
}
public void setLastTick(int time) {
public void setLastTick(int time, String info) {
if(this.lastTickTime >= 0) {
this.lastTicked = System.currentTimeMillis();
this.lastTickTime = time;
this.tickInfo = info;
}
}
@ -1729,30 +1729,20 @@ public class Client implements IThreadListener {
break;
}
Biome biome = null;
String bline;
String lline;
String light;
if(this.world.isBlockLoaded(blockpos)) {
Chunk chunk = this.world.getChunk(blockpos);
biome = chunk.getBiome(blockpos, null);
bline = "Biom: " + biome.display + " (" + biome.id + ")" + /* (this.debugHideInfo ? "" : */ (", D: " +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
" (" + this.world.dimension.getDimensionId() + ")");
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " ("
light = "Licht: " + chunk.getLightSub(blockpos, 0) + " ("
+ chunk.getLight(blockpos) + " Blöcke, " + String.format(
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
+ String.format("%.3f", this.world.getCelestialAngle(1.0f));
}
else {
bline = "Biom: <?>, D: " +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
" (" + this.world.dimension.getDimensionId() + ")";
lline = "Licht: " + String.format(
light = "Licht: " + String.format(
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: "
+ String.format("%.3f", this.world.getCelestialAngle(1.0f));
}
float temp = this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f);
long ticked = System.currentTimeMillis() - this.lastTicked;
return
@ -1777,8 +1767,10 @@ public class Client implements IThreadListener {
String.format(" (Zoom x%.1f)", this.zoomLevel) : "") + "\n" +
String.format("Richtung: %s (%.1f / %.1f)", dirStr,
ExtMath.wrapf(entity.rotYaw), ExtMath.wrapf(entity.rotPitch)) + "\n" +
bline + "\n" +
lline + "\n" +
"Dimension: " + (this.world.isExterminated() ? "[zerstört] " : "") +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
" (" + this.world.dimension.getDimensionId() + ")" + "\n" +
light + "\n" +
String.format("Zeit: %d T, R %d / %d T, U %d / %d T",
this.world.getDayTime(),
this.world.getDayTime() % this.world.dimension.getRotationalPeriod(),
@ -1786,10 +1778,7 @@ public class Client implements IThreadListener {
this.world.getDayTime() % this.world.dimension.getOrbitalPeriod(),
this.world.dimension.getOrbitalPeriod()
) + "\n" +
String.format("Laub: %s%s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)",
!this.world.dimension.getType().days ? "*" : "",
this.world.getLeavesGen(blockpos).getDisplayName(),
temp, World.ABSOLUTE_ZERO + temp,
String.format("Wetter: %s (R %.1f, %.1f)",
this.world.getWeather().getDisplay(), this.world.getRainStrength(),
this.world.getDarkness()
) + "\n" +
@ -1799,7 +1788,8 @@ public class Client implements IThreadListener {
String.format("Letzte Zeitsynch.: + %d.%d s",
ticked / 1000L, (ticked / 100L) % 10L
) +
(this.serverInfo != null ? "\n" + this.serverInfo : "")
(this.serverInfo != null ? "\n" + this.serverInfo : "") +
(this.tickInfo != null ? "\n" + this.tickInfo : "")
// IWorldServer world = this.server.getWorld(this.theWorld.dimension.getDimensionId());
// if(world != null)
// list.add("Seed: " + world.getSeed());
@ -1866,7 +1856,7 @@ public class Client implements IThreadListener {
"Eigens.: " + (entity.dead ? "D" : " ") + (entity.noClip ? "N" : " ") + (entity.onGround ? "G" : " ")
+ (entity.canBeCollidedWith() ? "C" : " ") + (entity.canBePushed() ? "P" : " ")
+ (entity.isBurning() ? "B" : " ") // + (entity.isInvisible() ? "I" : " ") // + (entity.isSilent() ? "S" : " ")
+ (entity.isWet() ? "W" : " ") + (entity.canAttackWithItem() ? "A" : " ")
+ (entity.canAttackWithItem() ? "A" : " ")
+ (entity.passenger != null ? "H" : " ") + (entity.vehicle != null ? "R" : " ") + (entity instanceof EntityLiving ?
("+" /* + (((EntityLivingBase)entity).isEntityUndead() ? "U" : " ") */ // + (((EntityLivingBase)entity).isChild() ? "C" : " ")
+ (((EntityLiving)entity).doesEntityNotTriggerPressurePlate() ? "P" : " ")) : "") + "\n" +
@ -2608,6 +2598,7 @@ public class Client implements IThreadListener {
if(Client.this.lastTickTime >= 0) {
Client.this.performAction(Action.STOP_PROFILING);
Client.this.lastTickTime = -1;
Client.this.tickInfo = null;
}
else {
Client.this.performAction(Action.START_PROFILING);

View file

@ -94,7 +94,6 @@ import common.packet.S39PacketPlayerAbilities;
import common.packet.S3APacketTabComplete;
import common.packet.S43PacketUpdateEntityNBT;
import common.packet.SPacketAnimation;
import common.packet.SPacketBiomes;
import common.packet.SPacketBlockAction;
import common.packet.SPacketBlockBreakAnim;
import common.packet.SPacketBlockChange;
@ -753,7 +752,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
if (packetIn.hasBiomes())
if (packetIn.isResend())
{
if (packetIn.getExtractedSize() == 0)
{
@ -766,23 +765,15 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
// this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.hasBiomes());
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedSize(), packetIn.isResend());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
if (!packetIn.hasBiomes() || this.clientWorldController.dimension.hasNoLight()) // TODO: check
if (!packetIn.isResend() || this.clientWorldController.dimension.hasNoLight()) // TODO: check
{
chunk.resetRelight();
}
}
public void handleBiomes(SPacketBiomes packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Chunk chunk = this.clientWorldController.getChunk(packetIn.getChunkX(), packetIn.getChunkZ());
chunk.setBiomes(packetIn.getBiomes());
this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 512, (packetIn.getChunkZ() << 4) + 15);
}
/**
* Updates the block and metadata and generates a blockupdate (and notify the clients)
*/
@ -998,7 +989,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
public void handleServerTick(SPacketServerTick packet)
{
NetHandler.checkThread(packet, this, this.gameController);
this.gameController.setLastTick(packet.getTime());
this.gameController.setLastTick(packet.getTime(), packet.getServerinfo());
}
// public void handleCompass(SPacketCompass packetIn)
@ -1441,9 +1432,6 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
case FOG_STRENGTH:
this.clientWorldController.setFogStrength(packetIn.getFloat(true));
break;
case TEMPERATURE:
this.clientWorldController.setTemperature(packetIn.getFloat(false));
break;
}
}

View file

@ -14,7 +14,6 @@ import client.renderer.particle.EffectRenderer;
import client.renderer.texture.DynamicTexture;
import client.renderer.texture.TextureMap;
import client.world.WorldClient;
import common.biome.Biome;
import common.block.Block;
import common.entity.Entity;
import common.entity.npc.EntityNPC;
@ -1144,10 +1143,9 @@ public class EntityRenderer {
for (int l = 0; l < k; ++l)
{
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.zrange(i) - this.random.zrange(i), 0, this.random.zrange(i) - this.random.zrange(i)), blockpos.getY() + 48, 64);
Biome biomegenbase = world.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = world.getState(blockpos2).getBlock();
float temp = World.ABSOLUTE_ZERO + world.getTempOffset() + biomegenbase.getTemperature(blockpos1);
float temp = 10.0f; // world.getTemperatureC(blockpos1); TODO: fix particles
if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && /* biomegenbase.canRain() && */ temp > 0.0F)
{
@ -1253,7 +1251,6 @@ public class EntityRenderer {
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 (biomegenbase.canRain() || biomegenbase.isSnowyBiome())
// {
@ -1282,7 +1279,7 @@ public class EntityRenderer {
{
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);
float f2 = 10.0f; // world.getTemperatureC(blockpos$mutableblockpos); TODO: fix particles
if(f2 >= 194.0f)
{

View file

@ -2,7 +2,6 @@ package client.renderer;
import java.util.Arrays;
import common.biome.Biome;
import common.init.Blocks;
import common.tileentity.TileEntity;
import common.util.BlockPos;
@ -122,12 +121,7 @@ public class RegionRenderCache extends ChunkCache implements IWorldAccess
return 15 << 20 | j << 4;
}
public Biome getBiomeGenForCoords(BlockPos pos)
{
return this.worldObj.getBiomeGenForCoords(pos);
}
private int getLightForExt(BlockPos pos)
{
if (pos.getY() >= 0 && pos.getY() < 512)

View file

@ -1,6 +1,5 @@
package client.renderer.entity;
import client.renderer.GlState;
import client.renderer.layers.LayerWolfCollar;
import client.renderer.model.ModelBase;
import common.entity.animal.EntityWolf;
@ -25,21 +24,7 @@ public class RenderWolf extends RenderLiving<EntityWolf>
{
return livingBase.getTailRotation();
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityWolf entity, double x, double y, double z, float partialTicks)
{
if (entity.isWolfWet())
{
float f = entity.getBrightness(partialTicks) * entity.getShadingWhileWet(partialTicks);
GlState.color(f, f, f, 1.0F);
}
super.doRender(entity, x, y, z, partialTicks);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/

View file

@ -157,10 +157,7 @@ public class ModelWolf extends ModelBase
this.wolfLeg4.rotateAngleX = ExtMath.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_;
}
this.wolfHeadMain.rotateAngleZ = entitywolf.getInterestedAngle(partialTickTime) + entitywolf.getShakeAngle(partialTickTime, 0.0F);
this.wolfMane.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.08F);
this.wolfBody.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.16F);
this.wolfTail.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.2F);
this.wolfHeadMain.rotateAngleZ = entitywolf.getInterestedAngle(partialTickTime);
}
/**

View file

@ -7,7 +7,6 @@ import java.util.Set;
import client.Client;
import client.renderer.particle.EntityFX;
import client.renderer.particle.EntityFirework;
import common.biome.Biome;
import common.block.Block;
import common.collect.Lists;
import common.collect.Maps;
@ -52,6 +51,7 @@ public class WorldClient extends AWorldClient
// public final Profiler profiler;
protected int lastLightning;
protected Vec3 lightColor = new Vec3(0xffffff);
protected boolean exterminated;
public WorldClient(Client gm, boolean debug, Dimension dim)
{
@ -759,19 +759,16 @@ public class WorldClient extends AWorldClient
}
public Vec3 getSkyColor(Entity entity, float partial) {
BlockPos pos = new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
ExtMath.floord(entity.posZ));
Biome biome = this.getBiomeGenForCoords(pos);
Vec3 vec;
if(biome.skyColor != 0xffffffff)
vec = new Vec3(biome.skyColor);
if(this.exterminated)
vec = new Vec3(0x101010);
else
vec = new Vec3(this.dimension.getSkyColor());
if(this.dimension.getType().days) {
float mult = ExtMath.clampf(ExtMath.cos(this.getCelestialAngle(partial) * (float)Math.PI * 2.0F) * 2.0F + 0.5F,
0.0F, 1.0F);
if(this.dimension.getSkyColor() == 0xffffffff) {
float temp = ExtMath.clampf(((biome.getTemperature(pos) + 14.0f) / 40.0f + 0.15f) / 3.0F,
float temp = ExtMath.clampf(((0.0f /* temp */ + 14.0f) / 40.0f + 0.15f) / 3.0F,
-1.0F, 1.0F);
Vec3 sky = new Vec3(hsvToRGB(0.62222224F - temp * 0.05F, 0.5F + temp * 0.1F, 1.0F));
vec = new Vec3(vec.xCoord * sky.xCoord * mult, vec.yCoord * sky.yCoord * mult, vec.zCoord * sky.zCoord * mult);
@ -817,10 +814,8 @@ public class WorldClient extends AWorldClient
public Vec3 getCloudColour(Entity entity, float partialTicks) {
Vec3 color = new Vec3(this.dimension.getCloudColor());
Biome biome = this.getBiomeGenForCoords(new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
ExtMath.floord(entity.posZ)));
if(biome.cloudColor != 0xffffffff)
color = new Vec3(biome.cloudColor);
if(this.exterminated)
color = new Vec3(0x000000);
float r = (float)color.xCoord;
float g = (float)color.yCoord;
float b = (float)color.zCoord;
@ -856,10 +851,8 @@ public class WorldClient extends AWorldClient
public Vec3 getFogColor(Entity entity, float partialTicks) {
Vec3 color = new Vec3(this.dimension.getFogColor());
Biome biome = this.getBiomeGenForCoords(new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
ExtMath.floord(entity.posZ)));
if(biome.fogColor != 0xffffffff)
color = new Vec3(biome.fogColor);
if(this.exterminated)
color = new Vec3(0x303030);
if(!this.dimension.getType().days)
return color;
float sun = ExtMath.clampf(ExtMath.cos(this.getCelestialAngle(partialTicks) * (float)Math.PI * 2.0F) * 2.0F + 0.5F,
@ -932,4 +925,12 @@ public class WorldClient extends AWorldClient
public boolean hasNoChunks() {
return this.chunkListing.isEmpty();
}
public void setExterminated(boolean exterminated) {
this.exterminated = exterminated;
}
public boolean isExterminated() {
return this.exterminated;
}
}