fix exterminated state

This commit is contained in:
Sen 2025-07-13 13:53:53 +02:00
parent 8b983f15c2
commit d09b9516a8
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
13 changed files with 88 additions and 64 deletions

View file

@ -1923,6 +1923,7 @@ public class ClientPlayer implements IClientPlayer
public void handleCelestials(SPacketCelestials packet) {
NetHandler.checkThread(packet, this, this.gm, this.world);
this.world.setExterminated(packet.getExterminated());
if(this.world.dimension.getType().celestials) {
this.world.dimension.setSunColor(packet.getSunColor());
this.world.dimension.setMoonColors(packet.getMoonColors());

View file

@ -1351,8 +1351,8 @@ public class EntityRenderer {
if (shift > 0.0F)
{
float[] sun = world.dimension.getType().days ?
RenderGlobal.calcSunriseSunsetColors(world.getCelestialAngle(partial), partial) : null;
float[] sun = world.dimension.getType().days && !world.dimension.isBaseDestroyed() ?
RenderGlobal.calcSunriseSunsetColors(world.getCelestialAngleRadians(partial), partial) : null;
if (sun != null)
{
shift = shift * sun[3];

View file

@ -1201,8 +1201,8 @@ public class RenderGlobal
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
ItemRenderer.disableStandardItemLighting();
float[] afloat = this.theWorld.dimension.getType().days ?
RenderGlobal.calcSunriseSunsetColors(this.theWorld.getCelestialAngle(partialTicks), partialTicks) : null;
float[] afloat = this.theWorld.dimension.getType().days && !this.theWorld.dimension.isBaseDestroyed() ?
RenderGlobal.calcSunriseSunsetColors(this.theWorld.getCelestialAngleRadians(partialTicks), partialTicks) : null;
if (afloat != null)
{
GlState.disableTexture2D();
@ -1865,9 +1865,9 @@ public class RenderGlobal
rand.setSeed(seed);
}
public static float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks) {
public static float[] calcSunriseSunsetColors(float radians, float partial) {
float f = 0.4F;
float f1 = ExtMath.cos(celestialAngle * (float)Math.PI * 2.0F) - 0.0F;
float f1 = ExtMath.cos(radians) - 0.0F;
float f2 = -0.0F;
if(f1 >= f2 - f && f1 <= f2 + f) {

View file

@ -59,7 +59,7 @@ public class ChunkEmpty extends ChunkClient {
super(world, 0, 0);
this.debug = debug;
this.liquidY = world.dimension.getSeaLevel() - 1;
this.liquid = world.dimension.getLiquid();
this.liquid = world.dimension.isExterminated() ? Blocks.air.getState() : world.dimension.getLiquid();
this.liquidBlock = this.liquid.getBlock();
this.dummyBlock = this.fillerBlock == Blocks.air ? Blocks.air : Blocks.bedrock;
this.dummy = this.dummyBlock.getState();

View file

@ -39,7 +39,6 @@ public class WorldClient extends AWorldClient
private static final int DISPLAY_RANGE = 16;
private final Client gm;
private final ChunkClient emptyChunk;
private final Set<Entity> entityList = Sets.<Entity>newHashSet();
private final Set<Entity> spawnQueue = Sets.<Entity>newHashSet();
private final Set<ChunkPos> previousActive = Sets.<ChunkPos>newHashSet();
@ -47,7 +46,8 @@ public class WorldClient extends AWorldClient
private final List<ChunkClient> chunkListing = Lists.<ChunkClient>newArrayList();
private final Set<Long> emptyChunkListing = Sets.<Long>newHashSet();
private final Set<Long> nextEmptyChunkListing = Sets.<Long>newHashSet();
// public final Profiler profiler;
private ChunkClient emptyChunk;
protected int lastLightning;
protected Vec3 lightColor = new Vec3(0xffffff);
@ -94,6 +94,18 @@ public class WorldClient extends AWorldClient
if(this.gm.player != null && !this.gm.charEditor)
this.markReload((int)this.gm.player.posX >> 4, (int)this.gm.player.posZ >> 4, this.gm.renderDistance + 4);
}
public void setExterminated(boolean exterminated) {
this.dimension.setExterminated(exterminated);
this.emptyChunk = new ChunkEmpty(this, this.gm.debugWorld);
this.markReload();
for(Long id : this.emptyChunkListing) {
this.chunkMapping.add(id, this.emptyChunk);
int x = LongHashMap.getX(id);
int z = LongHashMap.getZ(id);
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
}
}
public void tick()
{
@ -668,8 +680,8 @@ public class WorldClient extends AWorldClient
}
public float getSunBrightness(float p_72971_1_) {
float f = this.getCelestialAngle(p_72971_1_);
float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F);
float f = this.getCelestialAngleRadians(p_72971_1_);
float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.2F);
f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
f1 = 1.0F - f1;
f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength() * 5.0F) / 16.0D));
@ -741,12 +753,12 @@ public class WorldClient extends AWorldClient
ExtMath.floord(entity.posZ));
Biome biome = this.getBiomeGenForCoords(pos);
Vec3 vec;
if(biome.skyColor != 0xffffffff)
vec = new Vec3(biome.skyColor);
if(this.dimension.isExterminated())
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,
float mult = ExtMath.clampf(ExtMath.cos(this.getCelestialAngleRadians(partial)) * 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,
@ -797,8 +809,8 @@ public class WorldClient extends AWorldClient
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.dimension.isExterminated())
color = new Vec3(0x000000);
float r = (float)color.xCoord;
float g = (float)color.yCoord;
float b = (float)color.zCoord;
@ -813,7 +825,7 @@ public class WorldClient extends AWorldClient
}
if(this.dimension.getType().days) {
float sun = ExtMath.clampf(ExtMath.cos(this.getCelestialAngle(partialTicks) * (float)Math.PI * 2.0F) * 2.0F + 0.5F,
float sun = ExtMath.clampf(ExtMath.cos(this.getCelestialAngleRadians(partialTicks)) * 2.0F + 0.5F,
0.0F, 1.0F);
r = r * (sun * 0.9F + 0.1F);
g = g * (sun * 0.9F + 0.1F);
@ -836,11 +848,11 @@ public class WorldClient extends AWorldClient
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.dimension.isExterminated())
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,
float sun = ExtMath.clampf(ExtMath.cos(this.getCelestialAngleRadians(partialTicks)) * 2.0F + 0.5F,
0.0F, 1.0F);
float r = (float)color.xCoord;
float g = (float)color.yCoord;
@ -852,15 +864,15 @@ public class WorldClient extends AWorldClient
}
public float getStarBrightness(float partialTicks) {
float f = this.getCelestialAngle(partialTicks);
float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F);
float f = this.getCelestialAngleRadians(partialTicks);
float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.25F);
f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
return f1 * f1 * this.dimension.getStarBrightness();
}
public float getDeepStarBrightness(float partialTicks) {
float f = this.getCelestialAngle(partialTicks);
float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F);
float f = this.getCelestialAngleRadians(partialTicks);
float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.25F);
f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
return f1 * f1 * this.dimension.getDeepStarBrightness();
}