universe cleanup

This commit is contained in:
Sen 2025-07-17 15:37:39 +02:00
parent 9b5eab4f57
commit e289dc7d5b
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
41 changed files with 440 additions and 599 deletions

View file

@ -486,6 +486,10 @@ public class Client implements IThreadListener {
public int downfallRange = 4; public int downfallRange = 4;
@Variable(name = "draw_rain_particle_range", category = CVarCategory.RENDER, min = 0, max = 25, display = "Regen-Partikel-Radius") @Variable(name = "draw_rain_particle_range", category = CVarCategory.RENDER, min = 0, max = 25, display = "Regen-Partikel-Radius")
public int rainParticleRange = 10; public int rainParticleRange = 10;
@Variable(name = "draw_void_particles", category = CVarCategory.RENDER, display = "Partikel in der Tiefe")
public boolean voidParticles = true;
@Variable(name = "draw_void_fog", category = CVarCategory.RENDER, display = "Nebel in der Tiefe")
public boolean voidFog = true;
@Variable(name = "crosshair_size", category = CVarCategory.GUI, min = 0, max = 32, display = "Größe des Fadenkreuzes") @Variable(name = "crosshair_size", category = CVarCategory.GUI, min = 0, max = 32, display = "Größe des Fadenkreuzes")
private int crosshairSize = 6; private int crosshairSize = 6;
@Variable(name = "crosshair_color_notarget", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (ohne Ziel)") @Variable(name = "crosshair_color_notarget", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (ohne Ziel)")
@ -1733,7 +1737,7 @@ public class Client implements IThreadListener {
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, " lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, "
+ chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format( + chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format(
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: " "%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
+ String.format("%.3f", this.world.getCelestialAngle(1.0f)); + String.format("%.3f °", this.world.getCelestialAngle(1.0f));
} }
else { else {
bline = "Biom: <?>, D: " + bline = "Biom: <?>, D: " +
@ -1741,7 +1745,7 @@ public class Client implements IThreadListener {
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")"; " (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")";
lline = "Licht: " + String.format( lline = "Licht: " + String.format(
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: " "%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: "
+ String.format("%.3f", this.world.getCelestialAngle(1.0f)); + String.format("%.3f °", this.world.getCelestialAngle(1.0f));
} }
float temp = Math.max(this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f), 0.0f); float temp = Math.max(this.world.getTempOffset() + (biome != null ? biome.getTemperature(blockpos) : 0.0f), 0.0f);
@ -1778,7 +1782,7 @@ public class Client implements IThreadListener {
this.world.dimension.getOrbitalPeriod() this.world.dimension.getOrbitalPeriod()
) + "\n" + ) + "\n" +
String.format("Laub: %s%s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)", String.format("Laub: %s%s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)",
!this.world.dimension.getType().days ? "*" : "", !this.world.dimension.hasSeasons() ? "*" : "",
this.world.getLeavesGen(blockpos).getDisplayName(), this.world.getLeavesGen(blockpos).getDisplayName(),
temp, World.ABSOLUTE_ZERO + temp, temp, World.ABSOLUTE_ZERO + temp,
this.world.getWeather().getDisplay(), this.world.getRainStrength(), this.world.getWeather().getDisplay(), this.world.getRainStrength(),

View file

@ -31,6 +31,7 @@ import common.block.tech.BlockChest;
import common.block.tech.BlockDispenser; import common.block.tech.BlockDispenser;
import common.block.tech.BlockFurnace; import common.block.tech.BlockFurnace;
import common.block.tech.BlockWorkbench; import common.block.tech.BlockWorkbench;
import common.dimension.DimType;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.dimension.Space; import common.dimension.Space;
import common.effect.StatusEffect; import common.effect.StatusEffect;
@ -761,7 +762,7 @@ public class ClientPlayer implements IClientPlayer
chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedExtend(), packetIn.hasBiomes()); chunk.setData(packetIn.getExtractedDataBytes(), packetIn.getExtractedExtend(), packetIn.hasBiomes());
this.world.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15); this.world.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, -World.MAX_SIZE_Y, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, World.MAX_SIZE_Y, (packetIn.getChunkZ() << 4) + 15);
if (!packetIn.hasBiomes() || this.world.dimension.hasNoLight()) // TODO: check if (!packetIn.hasBiomes() || !this.world.dimension.hasSkyLight()) // TODO: check
{ {
chunk.resetRelight(); chunk.resetRelight();
} }
@ -1401,7 +1402,7 @@ public class ClientPlayer implements IClientPlayer
chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkExtend(i), true); chunk.setData(packetIn.getChunkBytes(i), packetIn.getChunkExtend(i), true);
this.world.markBlockRangeForRenderUpdate(j << 4, -World.MAX_SIZE_Y, k << 4, (j << 4) + 15, World.MAX_SIZE_Y, (k << 4) + 15); this.world.markBlockRangeForRenderUpdate(j << 4, -World.MAX_SIZE_Y, k << 4, (j << 4) + 15, World.MAX_SIZE_Y, (k << 4) + 15);
if (this.world.dimension.hasNoLight()) // TODO: check if (!this.world.dimension.hasSkyLight()) // TODO: check
{ {
chunk.resetRelight(); chunk.resetRelight();
} }
@ -1900,7 +1901,7 @@ public class ClientPlayer implements IClientPlayer
public void handleCelestials(SPacketCelestials packet) { public void handleCelestials(SPacketCelestials packet) {
NetHandler.checkThread(packet, this, this.gm, this.world); NetHandler.checkThread(packet, this, this.gm, this.world);
this.world.setExterminated(packet.getExterminated()); this.world.setExterminated(packet.getExterminated());
if(this.world.dimension.getType().celestials) { if(this.world.dimension.getType() == DimType.PLANET || this.world.dimension.getType() == DimType.MOON) {
this.world.dimension.setSunColor(packet.getSunColor()); this.world.dimension.setSunColor(packet.getSunColor());
this.world.dimension.setMoonColors(packet.getMoonColors()); this.world.dimension.setMoonColors(packet.getMoonColors());
} }

View file

@ -764,7 +764,7 @@ public class EntityRenderer {
if (world.dimension.getLightColor() != 0xffffffff) if (world.dimension.getLightColor() != 0xffffffff)
{ {
Vec3 lightColor = new Vec3(world.dimension.getLightColor()); Vec3 lightColor = new Vec3(world.dimension.getLightColor());
float light = world.dimension.hasNoLight() ? 1.0f : sky; float light = world.dimension.hasSkyLight() ? sky : 1.0f;
sred = (float)lightColor.xCoord * light; sred = (float)lightColor.xCoord * light;
sgreen = (float)lightColor.yCoord * light; sgreen = (float)lightColor.yCoord * light;
sblue = (float)lightColor.zCoord * light; sblue = (float)lightColor.zCoord * light;
@ -780,7 +780,7 @@ public class EntityRenderer {
float intens = (float)world.getLastLightning() - partialTicks; float intens = (float)world.getLastLightning() - partialTicks;
if(intens > 1.0F) if(intens > 1.0F)
intens = 1.0F; intens = 1.0F;
float light = world.dimension.hasNoLight() ? 1.0f : rsky; float light = world.dimension.hasSkyLight() ? rsky : 1.0f;
sred = sred * (1.0F - intens) + (float)lightColor.xCoord * light * intens; sred = sred * (1.0F - intens) + (float)lightColor.xCoord * light * intens;
sgreen = sgreen * (1.0F - intens) + (float)lightColor.yCoord * light * intens; sgreen = sgreen * (1.0F - intens) + (float)lightColor.yCoord * light * intens;
sblue = sblue * (1.0F - intens) + (float)lightColor.zCoord * light * intens; sblue = sblue * (1.0F - intens) + (float)lightColor.zCoord * light * intens;
@ -1089,7 +1089,7 @@ public class EntityRenderer {
this.setupFog(0, partialTicks); this.setupFog(0, partialTicks);
// renderGlobalIn.renderClouds(partialTicks); // renderGlobalIn.renderClouds(partialTicks);
float alpha = 0.8F * (1.0f - this.gm.world.getSpaceFactor()); float alpha = 0.8F * (1.0f - this.gm.world.getSpaceFactor());
if(this.gm.world.dimension.getType().clouds && alpha > 0.5f) if(this.gm.world.dimension.hasWeather() && alpha > 0.5f)
renderGlobalIn.renderClouds(alpha, partialTicks); renderGlobalIn.renderClouds(alpha, partialTicks);
GlState.disableFog(); GlState.disableFog();
GL11.glPopMatrix(); GL11.glPopMatrix();
@ -1334,32 +1334,40 @@ public class EntityRenderer {
{ {
WorldClient world = this.gm.world; WorldClient world = this.gm.world;
Entity entity = this.gm.getRenderViewEntity(); Entity entity = this.gm.getRenderViewEntity();
float dist = 0.25F + 0.75F * (float)this.gm.renderDistance / 32.0F;
dist = 1.0F - (float)Math.pow((double)dist, 0.25D); Vec3 fog = new Vec3(world.dimension.getFogColor());
Vec3 sky = world.getSkyColor(this.gm.getRenderViewEntity(), partial);
float sr = (float)sky.xCoord;
float sg = (float)sky.yCoord;
float sb = (float)sky.zCoord;
Vec3 fog = world.getFogColor(this.gm.getRenderViewEntity(), partial);
this.fogColorRed = (float)fog.xCoord; this.fogColorRed = (float)fog.xCoord;
this.fogColorGreen = (float)fog.yCoord; this.fogColorGreen = (float)fog.yCoord;
this.fogColorBlue = (float)fog.zCoord; this.fogColorBlue = (float)fog.zCoord;
if(world.dimension.isExterminated()) {
this.fogColorRed = 0.188f;
this.fogColorGreen = 0.188f;
this.fogColorBlue = 0.188f;
}
if(world.dimension.hasDaylight()) {
float sun = ExtMath.clampf(ExtMath.cos(world.getDayPhase(partial)) * 2.0F + 0.5F, 0.0F, 1.0F);
this.fogColorRed = this.fogColorRed * (sun * 0.94F + 0.06F);
this.fogColorGreen = this.fogColorGreen * (sun * 0.94F + 0.06F);
this.fogColorBlue = this.fogColorBlue * (sun * 0.91F + 0.09F);
}
if (this.gm.renderDistance >= 4) float space = world.getSpaceFactor();
if(space > 0.0f) {
this.fogColorRed = this.fogColorRed * (1.0F - space);
this.fogColorGreen = this.fogColorGreen * (1.0F - space);
this.fogColorBlue = this.fogColorBlue * (1.0F - space);
}
if (this.gm.renderDistance >= 4 && world.dimension.hasDaylight() && !world.dimension.isBaseDestroyed())
{ {
double neg = -1.0D; double neg = -1.0D;
Vec3 pos = ExtMath.sin(world.getCelestialAngleRadians(partial)) > 0.0F ? new Vec3(neg, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D); Vec3 pos = ExtMath.sin(world.getDayPhase(partial)) > 0.0F ? new Vec3(neg, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D);
float shift = (float)entity.getLook(partial).dotProduct(pos); float shift = (float)entity.getLook(partial).dotProduct(pos);
if (shift < 0.0F)
{
shift = 0.0F;
}
if (shift > 0.0F) if (shift > 0.0F)
{ {
float[] sun = world.dimension.getType().days && !world.dimension.isBaseDestroyed() ? float[] sun = RenderGlobal.calcSunriseSunsetColors(world.getDayPhase(partial), partial);
RenderGlobal.calcSunriseSunsetColors(world.getCelestialAngleRadians(partial), partial) : null;
if (sun != null) if (sun != null)
{ {
shift = shift * sun[3]; shift = shift * sun[3];
@ -1370,11 +1378,14 @@ public class EntityRenderer {
} }
} }
this.fogColorRed += (sr - this.fogColorRed) * dist; float dist = 0.25F + 0.75F * (float)this.gm.renderDistance / 32.0F;
this.fogColorGreen += (sg - this.fogColorGreen) * dist; dist = 1.0F - (float)Math.pow((double)dist, 0.25D);
this.fogColorBlue += (sb - this.fogColorBlue) * dist; Vec3 sky = world.getSkyColor(this.gm.getRenderViewEntity(), partial);
this.fogColorRed += ((float)sky.xCoord - this.fogColorRed) * dist;
this.fogColorGreen += ((float)sky.yCoord - this.fogColorGreen) * dist;
this.fogColorBlue += ((float)sky.zCoord - this.fogColorBlue) * dist;
float rain = world.getRainStrength(); float rain = world.getRainStrength();
if (rain > 0.0F) if (rain > 0.0F)
{ {
float rg = 1.0F - rain * 0.5F; float rg = 1.0F - rain * 0.5F;
@ -1385,7 +1396,6 @@ public class EntityRenderer {
} }
float dark = world.getDarkness(); float dark = world.getDarkness();
if (dark > 0.0F) if (dark > 0.0F)
{ {
float mul = 1.0F - dark * 0.5F; float mul = 1.0F - dark * 0.5F;
@ -1395,27 +1405,11 @@ public class EntityRenderer {
} }
Block block = MatrixState.getLookedBlock(this.gm.world, entity, partial); Block block = MatrixState.getLookedBlock(this.gm.world, entity, partial);
// if (this.cloudFog)
// {
// Vec3 cloud = world.getCloudColour(this.gm.getRenderViewEntity(), partial);
// this.fogColorRed = (float)cloud.xCoord;
// this.fogColorGreen = (float)cloud.yCoord;
// this.fogColorBlue = (float)cloud.zCoord;
// }
// else
if (block.getMaterial().isColdLiquid()) if (block.getMaterial().isColdLiquid())
{ {
float cn = 0.4f; // (float)EnchantmentHelper.getRespiration(entity) * 0.2F; this.fogColorRed = 0.42F;
this.fogColorGreen = 0.42F;
// if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).hasEffect(Potion.waterBreathing)) this.fogColorBlue = 0.6F;
// {
// f12 = f12 * 0.3F + 0.6F;
// }
this.fogColorRed = 0.02F + cn;
this.fogColorGreen = 0.02F + cn;
this.fogColorBlue = 0.2F + cn;
} }
else if (block.getMaterial().isHotLiquid()) else if (block.getMaterial().isHotLiquid())
{ {
@ -1428,73 +1422,45 @@ public class EntityRenderer {
this.fogColorRed *= mult; this.fogColorRed *= mult;
this.fogColorGreen *= mult; this.fogColorGreen *= mult;
this.fogColorBlue *= mult; this.fogColorBlue *= mult;
double vfog = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial); // * world.dimension.getVoidFogYFactor();
double vision = 1.0;
if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Effect.BLINDNESS)) if(world.dimension.hasVoidFog() && this.gm.voidFog) {
double y = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial);
if(y < 0.0)
vision += y / 64.0;
}
if (entity instanceof EntityLiving living && living.hasEffect(Effect.BLINDNESS))
{ {
int blind = ((EntityLiving)entity).getEffect(Effect.BLINDNESS).getRemaining(); int blind = living.getEffect(Effect.BLINDNESS).getRemaining();
if (blind < 20) if (blind < 20)
{ vision *= (double)(1.0F - (float)blind / 20.0F);
vfog *= (double)(1.0F - (float)blind / 20.0F);
}
else else
{ vision = 0.0D;
vfog = 0.0D; }
} if (vision < 1.0D)
{
if (vision < 0.0D)
vision = 0.0D;
vision = vision * vision;
this.fogColorRed = (float)((double)this.fogColorRed * vision);
this.fogColorGreen = (float)((double)this.fogColorGreen * vision);
this.fogColorBlue = (float)((double)this.fogColorBlue * vision);
} }
if (vfog < 1.0D) if (entity instanceof EntityLiving living && living.hasEffect(Effect.NIGHT_VISION))
{ {
if (vfog < 0.0D) float vis = this.getNightVisionBrightness(living, partial);
{
vfog = 0.0D;
}
vfog = vfog * vfog;
this.fogColorRed = (float)((double)this.fogColorRed * vfog);
this.fogColorGreen = (float)((double)this.fogColorGreen * vfog);
this.fogColorBlue = (float)((double)this.fogColorBlue * vfog);
}
// if (this.bossColorModifier > 0.0F)
// {
// float shift = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partial;
// this.fogColorRed = this.fogColorRed * (1.0F - shift) + this.fogColorRed * 0.7F * shift;
// this.fogColorGreen = this.fogColorGreen * (1.0F - shift) + this.fogColorGreen * 0.6F * shift;
// this.fogColorBlue = this.fogColorBlue * (1.0F - shift) + this.fogColorBlue * 0.6F * shift;
// }
if (entity instanceof EntityLiving && ((EntityLiving)entity).hasEffect(Effect.NIGHT_VISION))
{
float vis = this.getNightVisionBrightness((EntityLiving)entity, partial);
float mul = 1.0F / this.fogColorRed; float mul = 1.0F / this.fogColorRed;
if (mul > 1.0F / this.fogColorGreen) if (mul > 1.0F / this.fogColorGreen)
{
mul = 1.0F / this.fogColorGreen; mul = 1.0F / this.fogColorGreen;
}
if (mul > 1.0F / this.fogColorBlue) if (mul > 1.0F / this.fogColorBlue)
{
mul = 1.0F / this.fogColorBlue; mul = 1.0F / this.fogColorBlue;
}
this.fogColorRed = this.fogColorRed * (1.0F - vis) + this.fogColorRed * mul * vis; this.fogColorRed = this.fogColorRed * (1.0F - vis) + this.fogColorRed * mul * vis;
this.fogColorGreen = this.fogColorGreen * (1.0F - vis) + this.fogColorGreen * mul * vis; this.fogColorGreen = this.fogColorGreen * (1.0F - vis) + this.fogColorGreen * mul * vis;
this.fogColorBlue = this.fogColorBlue * (1.0F - vis) + this.fogColorBlue * mul * vis; this.fogColorBlue = this.fogColorBlue * (1.0F - vis) + this.fogColorBlue * mul * vis;
} }
// if (this.gm.anaglyph)
// {
// float f16 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F;
// float f17 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F;
// float f7 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F;
// this.fogColorRed = f16;
// this.fogColorGreen = f17;
// this.fogColorBlue = f7;
// }
GlState.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); GlState.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
} }

View file

@ -146,7 +146,7 @@ public class RegionRenderCache implements IWorldAccess
private int getLightForExt(LightType p_175629_1_, BlockPos pos) private int getLightForExt(LightType p_175629_1_, BlockPos pos)
{ {
if (p_175629_1_ == LightType.SKY && this.world.dimension.hasNoLight()) if (p_175629_1_ == LightType.SKY && !this.world.dimension.hasSkyLight())
{ {
return 0; return 0;
} }

View file

@ -1137,7 +1137,7 @@ public class RenderGlobal
{ {
this.renderSkyBox(this.gm.world.dimension.getSkyBoxTexture()); this.renderSkyBox(this.gm.world.dimension.getSkyBoxTexture());
} }
else if (this.gm.world.dimension.getType().sky) else if (this.gm.world.dimension.hasSky())
{ {
GlState.disableTexture2D(); GlState.disableTexture2D();
Vec3 vec3 = this.theWorld.getSkyColor(this.gm.getRenderViewEntity(), partialTicks); Vec3 vec3 = this.theWorld.getSkyColor(this.gm.getRenderViewEntity(), partialTicks);
@ -1183,15 +1183,15 @@ public class RenderGlobal
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
ItemRenderer.disableStandardItemLighting(); ItemRenderer.disableStandardItemLighting();
float[] afloat = this.theWorld.dimension.getType().days && !this.theWorld.dimension.isBaseDestroyed() ? float[] afloat = this.theWorld.dimension.hasDaylight() && !this.theWorld.dimension.isBaseDestroyed() ?
RenderGlobal.calcSunriseSunsetColors(this.theWorld.getCelestialAngleRadians(partialTicks), partialTicks) : null; RenderGlobal.calcSunriseSunsetColors(this.theWorld.getDayPhase(partialTicks), partialTicks) : null;
if (afloat != null) if (afloat != null)
{ {
GlState.disableTexture2D(); GlState.disableTexture2D();
GlState.shadeModel(GL11.GL_SMOOTH); GlState.shadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(ExtMath.sin(this.theWorld.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(ExtMath.sin(this.theWorld.getDayPhase(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
float f6 = afloat[0]; float f6 = afloat[0];
float f7 = afloat[1]; float f7 = afloat[1];
@ -1229,8 +1229,8 @@ public class RenderGlobal
GL11.glPushMatrix(); GL11.glPushMatrix();
float f16 = 1.0F - Math.max(this.theWorld.getRainStrength(), this.theWorld.getFogStrength()); float f16 = 1.0F - Math.max(this.theWorld.getRainStrength(), this.theWorld.getFogStrength());
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(this.theWorld.getCelestialAngle(partialTicks), 1.0F, 0.0F, 0.0F);
if(this.gm.world.dimension.getType().celestials) { if(this.gm.world.dimension.getType() == DimType.PLANET || this.gm.world.dimension.getType() == DimType.MOON) {
float size = 30.0F; float size = 30.0F;
int color = this.gm.world.dimension.getSunColor(); int color = this.gm.world.dimension.getSunColor();
if(color != 0xffffffff) { if(color != 0xffffffff) {

View file

@ -64,7 +64,7 @@ public class ChunkClient extends Chunk {
public void setData(byte[] data, int[] extend, boolean biomes) { public void setData(byte[] data, int[] extend, boolean biomes) {
int pos = 0; int pos = 0;
boolean sky = !this.world.dimension.hasNoLight(); boolean sky = this.world.dimension.hasSkyLight();
if(biomes) { if(biomes) {
this.clearArrays(); this.clearArrays();

View file

@ -314,14 +314,15 @@ public class WorldClient extends AWorldClient
State state = this.getState(pos); State state = this.getState(pos);
state.getBlock().randomDisplayTick(this, pos, state, rand); state.getBlock().randomDisplayTick(this, pos, state, rand);
} }
// if(this.canShowVoidParticles()) { if(this.dimension.hasVoidFog() && this.gm.voidParticles && posY < 32) {
for(int n = 0; n < 1000; n++) { for(int n = 0; n < 1000; n++) {
float x = ((float)posX) + (rand.floatv() - rand.floatv() - 0.5f) * 32.0f; float x = ((float)posX) + (rand.floatv() - rand.floatv() - 0.5f) * 32.0f;
float y = -64.0f + rand.floatv() * 65.0f; // * 68.0f; float y = (posY < -32 ? (float)posY - 32.0f : -64.0f) + rand.floatv() * 65.0f;
float z = ((float)posZ) + (rand.floatv() - rand.floatv() - 0.5f) * 32.0f; float z = ((float)posZ) + (rand.floatv() - rand.floatv() - 0.5f) * 32.0f;
this.spawnParticle(ParticleType.DEPTH, (double)x, (double)y, (double)z); if(y < -64.0f || rand.floatv() >= (64.0f + y) / 64.0f)
this.spawnParticle(ParticleType.DEPTH, (double)x, (double)y, (double)z);
}
} }
// }
} }
public void removeAllEntities() public void removeAllEntities()
@ -695,7 +696,7 @@ public class WorldClient extends AWorldClient
} }
public float getSunBrightness(float p_72971_1_) { public float getSunBrightness(float p_72971_1_) {
float f = this.getCelestialAngleRadians(p_72971_1_); float f = this.getDayPhase(p_72971_1_);
float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.2F); float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.2F);
f1 = ExtMath.clampf(f1, 0.0F, 1.0F); f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
f1 = 1.0F - f1; f1 = 1.0F - f1;
@ -772,8 +773,8 @@ public class WorldClient extends AWorldClient
vec = new Vec3(0x101010); vec = new Vec3(0x101010);
else else
vec = new Vec3(this.dimension.getSkyColor()); vec = new Vec3(this.dimension.getSkyColor());
if(this.dimension.getType().days) { if(this.dimension.hasDaylight()) {
float mult = ExtMath.clampf(ExtMath.cos(this.getCelestialAngleRadians(partial)) * 2.0F + 0.5F, float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F,
0.0F, 1.0F); 0.0F, 1.0F);
if(this.dimension.getSkyColor() == 0xffffffff) { if(this.dimension.getSkyColor() == 0xffffffff) {
float temp = ExtMath.clampf(((biome.getTemperature(pos) + 14.0f) / 40.0f + 0.15f) / 3.0F, float temp = ExtMath.clampf(((biome.getTemperature(pos) + 14.0f) / 40.0f + 0.15f) / 3.0F,
@ -829,8 +830,6 @@ public class WorldClient extends AWorldClient
public Vec3 getCloudColour(Entity entity, float partialTicks) { public Vec3 getCloudColour(Entity entity, float partialTicks) {
Vec3 color = new Vec3(this.dimension.getCloudColor()); 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(this.dimension.isExterminated()) if(this.dimension.isExterminated())
color = new Vec3(0x000000); color = new Vec3(0x000000);
float r = (float)color.xCoord; float r = (float)color.xCoord;
@ -846,8 +845,8 @@ public class WorldClient extends AWorldClient
b = b * shift + mul * (1.0F - shift); b = b * shift + mul * (1.0F - shift);
} }
if(this.dimension.getType().days) { if(this.dimension.hasDaylight()) {
float sun = ExtMath.clampf(ExtMath.cos(this.getCelestialAngleRadians(partialTicks)) * 2.0F + 0.5F, float sun = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partialTicks)) * 2.0F + 0.5F,
0.0F, 1.0F); 0.0F, 1.0F);
r = r * (sun * 0.9F + 0.1F); r = r * (sun * 0.9F + 0.1F);
g = g * (sun * 0.9F + 0.1F); g = g * (sun * 0.9F + 0.1F);
@ -873,42 +872,15 @@ public class WorldClient extends AWorldClient
return new Vec3((double)r, (double)g, (double)b); return new Vec3((double)r, (double)g, (double)b);
} }
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(this.dimension.isExterminated())
color = new Vec3(0x303030);
if(!this.dimension.getType().days)
return color;
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;
float b = (float)color.zCoord;
r = r * (sun * 0.94F + 0.06F);
g = g * (sun * 0.94F + 0.06F);
b = b * (sun * 0.91F + 0.09F);
float space = this.getSpaceFactor();
if(space > 0.0f) {
r = r * (1.0F - space);
g = g * (1.0F - space);
b = b * (1.0F - space);
}
return new Vec3((double)r, (double)g, (double)b);
}
public float getStarBrightness(float partialTicks) { public float getStarBrightness(float partialTicks) {
float f = this.getCelestialAngleRadians(partialTicks); float f = this.getDayPhase(partialTicks);
float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.25F); float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.25F);
f1 = ExtMath.clampf(f1, 0.0F, 1.0F); f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
return Math.max(f1 * f1 * this.dimension.getStarBrightness(), this.getSpaceFactor()); return Math.max(f1 * f1 * this.dimension.getStarBrightness(), this.getSpaceFactor());
} }
public float getDeepStarBrightness(float partialTicks) { public float getDeepStarBrightness(float partialTicks) {
float f = this.getCelestialAngleRadians(partialTicks); float f = this.getDayPhase(partialTicks);
float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.25F); float f1 = 1.0F - (ExtMath.cos(f) * 2.0F + 0.25F);
f1 = ExtMath.clampf(f1, 0.0F, 1.0F); f1 = ExtMath.clampf(f1, 0.0F, 1.0F);
return Math.max(f1 * f1 * this.dimension.getDeepStarBrightness(), this.getSpaceFactor()); return Math.max(f1 * f1 * this.dimension.getDeepStarBrightness(), this.getSpaceFactor());

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -27,7 +27,7 @@ public class EntityAIMoveIndoors extends EntityAIBase
{ {
BlockPos blockpos = new BlockPos(this.entityObj); BlockPos blockpos = new BlockPos(this.entityObj);
if ((!((AWorldServer)this.entityObj.worldObj).isDaytime() /* || this.entityObj.worldObj.isRaining() && !this.entityObj.worldObj.getBiomeGenForCoords(blockpos).canRain() */) && !this.entityObj.worldObj.dimension.hasNoLight()) if ((!((AWorldServer)this.entityObj.worldObj).isDaytime() /* || this.entityObj.worldObj.isRaining() && !this.entityObj.worldObj.getBiomeGenForCoords(blockpos).canRain() */) && this.entityObj.worldObj.dimension.hasSkyLight())
{ {
if (this.entityObj.getRNG().zrange(50) != 0) if (this.entityObj.getRNG().zrange(50) != 0)
{ {

View file

@ -53,11 +53,11 @@ public class BlockDaylightDetector extends Block implements ITileEntityProvider
public void updatePower(AWorldServer worldIn, BlockPos pos) public void updatePower(AWorldServer worldIn, BlockPos pos)
{ {
if (!worldIn.dimension.hasNoLight()) if (worldIn.dimension.hasSkyLight() && worldIn.dimension.hasDaylight())
{ {
State iblockstate = worldIn.getState(pos); State iblockstate = worldIn.getState(pos);
int i = worldIn.getLightFor(LightType.SKY, pos) - worldIn.getSkylightSubtracted(); int i = worldIn.getLightFor(LightType.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F); float f = worldIn.getDayPhase(1.0F);
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F); float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
f = f + (f1 - f) * 0.2F; f = f + (f1 - f) * 0.2F;
i = Math.round((float)i * ExtMath.cos(f)); i = Math.round((float)i * ExtMath.cos(f));

View file

@ -23,4 +23,12 @@ public final class Area extends Dimension {
public final DimType getType() { public final DimType getType() {
return DimType.AREA; return DimType.AREA;
} }
public boolean hasVoidFog() {
return true;
}
public boolean hasSky() {
return false;
}
} }

View file

@ -5,31 +5,18 @@ import java.util.Map;
import common.collect.Maps; import common.collect.Maps;
public enum DimType { public enum DimType {
STAR("star", true, false, false, false, false, true), STAR("star"),
PLANET("planet", true, true, true, true, true, true), PLANET("planet"),
MOON("moon", true, false, false, true, false, true), MOON("moon"),
SPACE("space", false, false, false, false, false, true), SEMI("semi"),
SEMI("semi", false, false, true, false, true, true), AREA("area");
AREA("area", false, false, false, false, false, false);
private static final Map<String, DimType> LOOKUP = Maps.newHashMap(); private static final Map<String, DimType> LOOKUP = Maps.newHashMap();
private final String name; private final String name;
public final boolean celestial;
public final boolean days;
public final boolean weather;
public final boolean celestials;
public final boolean clouds;
public final boolean sky;
private DimType(String name, boolean time, boolean days, boolean weather, boolean celestials, boolean clouds, boolean sky) { private DimType(String name) {
this.name = name; this.name = name;
this.celestial = time;
this.days = days;
this.weather = weather;
this.celestials = celestials;
this.clouds = clouds;
this.sky = sky;
} }
public String getName() { public String getName() {

View file

@ -20,7 +20,7 @@ import common.world.State;
import common.world.Weather; import common.world.Weather;
import common.world.World; import common.world.World;
public abstract class Dimension extends Nameable { public abstract class Dimension extends Section {
public class GeneratorSettings { public class GeneratorSettings {
public float coordinateScale = 684.412F; public float coordinateScale = 684.412F;
public float heightScale = 684.412F; public float heightScale = 684.412F;
@ -779,6 +779,35 @@ public abstract class Dimension extends Nameable {
public boolean isBaseDestroyed() { public boolean isBaseDestroyed() {
return false; return false;
} }
public boolean hasVoidFog() {
return false;
}
public boolean hasSeasons() {
return false;
}
public boolean hasDaylight() {
return false;
}
public boolean hasSkyLight() {
return false;
}
public boolean isCelestial() {
return false;
}
public boolean hasWeather() {
return false;
}
public boolean hasSky() {
return true;
}
public final int getSunColor() { public final int getSunColor() {
return this.sunColor != 0xffffffff ? this.sunColor : this.calcSunColor(); return this.sunColor != 0xffffffff ? this.sunColor : this.calcSunColor();
@ -857,10 +886,6 @@ public abstract class Dimension extends Nameable {
return this.populated; return this.populated;
} }
public final boolean hasNoLight() {
return !this.getType().days;
}
public final void setBaseNames(String[] names) { public final void setBaseNames(String[] names) {
this.baseNames = names; this.baseNames = names;
@ -869,6 +894,8 @@ public abstract class Dimension extends Nameable {
public final String[] getBaseNames() { public final String[] getBaseNames() {
if(this.baseNames != null) if(this.baseNames != null)
return this.baseNames; return this.baseNames;
if(this == Space.INSTANCE)
return new String[0];
String planet = null; String planet = null;
String star = null; String star = null;
Dimension dim = this; Dimension dim = this;
@ -898,7 +925,7 @@ public abstract class Dimension extends Nameable {
public static Dimension create(DimType type) { public static Dimension create(DimType type) {
if(type == null || type == DimType.SPACE) if(type == null)
return null; return null;
switch(type) { switch(type) {
case STAR: case STAR:
@ -916,6 +943,8 @@ public abstract class Dimension extends Nameable {
} }
public final Dimension makeCustomCopy() { public final Dimension makeCustomCopy() {
if(this == Space.INSTANCE)
return null;
Dimension dim = create(this.getType()); Dimension dim = create(this.getType());
TagObject tag = new TagObject(); TagObject tag = new TagObject();
this.toTags(tag); this.toTags(tag);
@ -938,7 +967,7 @@ public abstract class Dimension extends Nameable {
tag.setBool("Exterminated", this.exterminated); tag.setBool("Exterminated", this.exterminated);
if(this.isCustom()) if(this.isCustom())
this.toTags(tag); this.toTags(tag);
if(!this.exterminated && this.getType().weather) if(!this.exterminated && this.hasWeather())
tag.setString("Weather", this.weather.getName()); tag.setString("Weather", this.weather.getName());
return tag; return tag;
} }
@ -962,7 +991,7 @@ public abstract class Dimension extends Nameable {
if(this.exterminated) { if(this.exterminated) {
this.weather = Weather.CLEAR; this.weather = Weather.CLEAR;
} }
else if(this.getType().weather) { else if(this.hasWeather()) {
this.weather = Weather.getByName(tag.getString("Weather")); this.weather = Weather.getByName(tag.getString("Weather"));
if(this.weather == null) if(this.weather == null)
this.weather = this.defaultWeather; this.weather = this.defaultWeather;

View file

@ -1,14 +1,7 @@
package common.dimension; package common.dimension;
public final class Domain extends Nameable implements Comparable<Domain> { public final class Domain extends Section {
public final String id; public Domain(boolean custom) {
public Domain(String id, boolean custom) {
super(custom); super(custom);
this.id = id;
}
public int compareTo(Domain other) {
return other == null ? -1 : this.id.compareTo(other.id);
} }
} }

View file

@ -1,14 +1,7 @@
package common.dimension; package common.dimension;
public final class Galaxy extends Nameable implements Comparable<Galaxy> { public final class Galaxy extends Section {
public final String id; public Galaxy(boolean custom) {
public Galaxy(String id, boolean custom) {
super(custom); super(custom);
this.id = id;
}
public int compareTo(Galaxy other) {
return other == null ? -1 : this.id.compareTo(other.id);
} }
} }

View file

@ -51,4 +51,12 @@ public final class Moon extends Dimension {
public boolean isBaseDestroyed() { public boolean isBaseDestroyed() {
return (this.getSunColor() & 0xff000000) != 0; return (this.getSunColor() & 0xff000000) != 0;
} }
public boolean hasVoidFog() {
return true;
}
public boolean isCelestial() {
return true;
}
} }

View file

@ -64,4 +64,28 @@ public final class Planet extends Dimension {
public boolean isBaseDestroyed() { public boolean isBaseDestroyed() {
return (this.getSunColor() & 0xff000000) != 0; return (this.getSunColor() & 0xff000000) != 0;
} }
public boolean hasVoidFog() {
return true;
}
public boolean hasSeasons() {
return this.getOrbitOffset() != 0.0f;
}
public boolean hasDaylight() {
return true;
}
public boolean hasSkyLight() {
return true;
}
public boolean isCelestial() {
return true;
}
public boolean hasWeather() {
return true;
}
} }

View file

@ -1,11 +1,11 @@
package common.dimension; package common.dimension;
public abstract class Nameable { public abstract class Section {
private final boolean custom; private final boolean custom;
private String display = null; private String display = null;
protected Nameable(boolean custom) { protected Section(boolean custom) {
this.custom = custom; this.custom = custom;
} }

View file

@ -1,14 +1,7 @@
package common.dimension; package common.dimension;
public final class Sector extends Nameable implements Comparable<Sector> { public final class Sector extends Section {
public final String id; public Sector(boolean custom) {
public Sector(String id, boolean custom) {
super(custom); super(custom);
this.id = id;
}
public int compareTo(Sector other) {
return other == null ? -1 : this.id.compareTo(other.id);
} }
} }

View file

@ -19,4 +19,12 @@ public final class Semi extends Dimension {
public final DimType getType() { public final DimType getType() {
return DimType.SEMI; return DimType.SEMI;
} }
public boolean hasVoidFog() {
return true;
}
public boolean hasWeather() {
return true;
}
} }

View file

@ -13,134 +13,6 @@ public final class Space extends Dimension {
} }
public final DimType getType() { public final DimType getType() {
return DimType.SPACE; return null;
} }
// public String getDimensionName() {
// return "space";
// }
//
// public int getDimensionId() {
// return Constants.SPACE_WORLD;
// }
// public Biome getBiome() {
// return Biome.space;
// }
//
// public final float getGravity() {
// return 0.0f;
// }
//
// public IBlockState getCaveFiller() {
// return Blocks.air.getDefaultState();
// }
//
// public IBlockState getFiller() {
// return Blocks.air.getDefaultState();
// }
//
// public IBlockState getTop() {
// return Blocks.air.getDefaultState();
// }
//
// public IBlockState getSurface() {
// return Blocks.air.getDefaultState();
// }
//
// public IBlockState getAltFiller() {
// return Blocks.air.getDefaultState();
// }
//
// public IBlockState getLavaFiller() {
// return null;
// }
//
// public boolean hasRavines() {
// return false;
// }
// public ChunkGenerator createChunkGenerator(Random rand) {
// return new GeneratorFlat(new IBlockState[0]);
// }
//
// public BlockReplacer createBlockReplacer(Random rand) {
// return null;
// }
// public int getBrightness() {
// return 15;
// }
//
// public final int getSkyColor() {
// return 0x000000;
// }
//
// public IBlockState getWorldFloor() {
// return null;
// }
//
// public final boolean hasSnow() {
// return false;
// }
//
// public final boolean hasCaves() {
// return false;
// }
// public final float getCloudHeight(float height) {
// return height;
// }
// public float getStarBrightness() {
// return 1.0f;
// }
//
// public float getDeepStarBrightness() {
// return 1.0f;
// }
//
// public float getLavaChance() {
// return 0.0f;
// }
//
// public float getWaterChance() {
// return 0.0f;
// }
//
// public boolean hasDungeons() {
// return false;
// }
//
// public IBlockState getSurfaceLiquid() {
// return Blocks.air.getDefaultState();
// }
//
// public int getSeaLevel() {
// return 0;
// }
//
// public final int getTimeQualifier() {
// return 8;
// }
//
// public final long getOrbitalPeriod() {
// return 1L;
// }
//
// public final long getRotationalPeriod() {
// return 1L;
// }
//
// public final float getOrbitOffset() {
// return 0.0f;
// }
//
// public final int getLevelBelow() {
// return this.getDimensionId();
// }
//
// public float getTemperature() {
// return 2.7f;
// }
} }

View file

@ -22,4 +22,8 @@ public final class Star extends Dimension {
public final DimType getType() { public final DimType getType() {
return DimType.STAR; return DimType.STAR;
} }
public boolean isCelestial() {
return true;
}
} }

View file

@ -12,6 +12,7 @@ import common.block.liquid.BlockLiquid;
import common.color.TextColor; import common.color.TextColor;
import common.dimension.DimType; import common.dimension.DimType;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.dimension.Space;
import common.enchantment.Enchantment; import common.enchantment.Enchantment;
import common.enchantment.EnchantmentHelper; import common.enchantment.EnchantmentHelper;
import common.entity.effect.EntityLightning; import common.entity.effect.EntityLightning;
@ -356,7 +357,7 @@ public abstract class Entity
} }
protected void onVoidUpdate() { protected void onVoidUpdate() {
if(!this.worldObj.client && this.worldObj.dimension.getType() != DimType.SPACE) { if(!this.worldObj.client && this.worldObj.dimension != Space.INSTANCE) {
// this.worldObj.profiler.start("descent"); // this.worldObj.profiler.start("descent");
Dimension current = this.worldObj.dimension; Dimension current = this.worldObj.dimension;
Dimension dim = Vars.voidPortal ? ((AWorldServer)this.worldObj).getPortalDest(PortalType.VOID) : current; Dimension dim = Vars.voidPortal ? ((AWorldServer)this.worldObj).getPortalDest(PortalType.VOID) : current;

View file

@ -385,7 +385,7 @@ public class EntitySlime extends EntityNPC
// { // {
Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos); Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos);
if (biomegenbase == Biome.SWAMPLAND && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8)) if (biomegenbase == Biome.SWAMPLAND && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.zrange(8))
{ {
return super.getCanSpawnHere(); return super.getCanSpawnHere();
} }

View file

@ -15,94 +15,114 @@ import common.dimension.Dimension;
import common.dimension.Domain; import common.dimension.Domain;
import common.dimension.Galaxy; import common.dimension.Galaxy;
import common.dimension.Moon; import common.dimension.Moon;
import common.dimension.Section;
import common.dimension.Planet; import common.dimension.Planet;
import common.dimension.Sector; import common.dimension.Sector;
import common.dimension.Semi; import common.dimension.Semi;
import common.dimension.Space; import common.dimension.Space;
import common.dimension.Star; import common.dimension.Star;
import common.world.Weather; import common.world.Weather;
import common.world.World;
import java.util.Set; import java.util.Set;
public abstract class UniverseRegistry { public abstract class UniverseRegistry {
private static final List<Section> SECTIONS = Lists.newArrayList();
private static final List<Dimension> DIMENSIONS = Lists.newArrayList(); private static final List<Dimension> DIMENSIONS = Lists.newArrayList();
private static final Map<Integer, Dimension> ID_MAP = Maps.newTreeMap(); private static final Map<Integer, Dimension> ID_MAP = Maps.newTreeMap();
private static final Map<Dimension, Integer> IDS = new IdentityHashMap(); private static final Map<Dimension, Integer> IDS = new IdentityHashMap();
private static final Map<String, Dimension> NAME_MAP = Maps.newTreeMap(); private static final Map<String, Section> NAME_MAP = Maps.newTreeMap();
private static final Map<Dimension, String> NAMES = new IdentityHashMap(); private static final Map<Section, String> NAMES = new IdentityHashMap();
private static final Set<String> NAME_LIST = Sets.newTreeSet(); private static final Set<String> NAME_LIST = Sets.newTreeSet();
private static final Map<String, Sector> SECTORS = Maps.newHashMap(); private static final Map<Moon, Planet> MOON_PLANET = Maps.newHashMap();
private static final Map<String, Galaxy> GALAXIES = Maps.newHashMap(); private static final Map<Planet, List<Moon>> PLANET_MOONS = Maps.newHashMap();
private static final Map<String, Domain> DOMAINS = Maps.newHashMap(); private static final Map<Planet, Star> PLANET_STAR = Maps.newHashMap();
private static final Map<Star, List<Planet>> STAR_PLANETS = Maps.newHashMap();
private static final Map<Moon, Planet> MOON_MAP = Maps.newHashMap(); private static final Map<Star, Sector> STAR_SECTOR = Maps.newHashMap();
private static final Map<Planet, List<Moon>> MOONS_MAP = Maps.newHashMap(); private static final Map<Sector, List<Star>> SECTOR_STARS = Maps.newHashMap();
private static final Map<Planet, Star> PLANET_MAP = Maps.newHashMap(); private static final Map<Sector, Galaxy> SECTOR_GALAXY = Maps.newHashMap();
private static final Map<Star, List<Planet>> PLANETS_MAP = Maps.newHashMap(); private static final Map<Galaxy, List<Sector>> GALAXY_SECTORS = Maps.newHashMap();
private static final Map<Star, Sector> STAR_MAP = Maps.newHashMap(); private static final Map<Area, Domain> AREA_DOMAIN = Maps.newHashMap();
private static final Map<Sector, List<Star>> STARS_MAP = Maps.newHashMap(); private static final Map<Domain, List<Area>> DOMAIN_AREAS = Maps.newHashMap();
private static final Map<Sector, Galaxy> SECTOR_MAP = Maps.newHashMap(); private static final Set<Semi> SEMI = Sets.newHashSet();
private static final Map<Galaxy, List<Sector>> SECTORS_MAP = Maps.newHashMap();
private static final Map<Area, Domain> AREA_MAP = Maps.newHashMap();
private static final Map<Domain, List<Area>> AREAS_MAP = Maps.newHashMap();
private static final Set<Semi> SEMI_SET = Sets.newHashSet();
public static List<Dimension> getDimensions() { public static List<Dimension> getDimensions() {
return DIMENSIONS; return DIMENSIONS;
} }
public static List<Section> getSections() {
return SECTIONS;
}
public static Collection<Galaxy> getGalaxies() { public static Collection<Galaxy> getGalaxies() {
return GALAXIES.values(); return GALAXY_SECTORS.keySet();
} }
public static Collection<Sector> getSectors() { public static Collection<Sector> getSectors() {
return SECTORS.values(); return SECTOR_GALAXY.keySet();
} }
public static Collection<Domain> getDomains() { public static Collection<Domain> getDomains() {
return DOMAINS.values(); return DOMAIN_AREAS.keySet();
} }
public static Collection<Star> getStars() { public static Collection<Star> getStars() {
return STAR_MAP.keySet(); return STAR_SECTOR.keySet();
} }
public static Collection<Planet> getPlanets() { public static Collection<Planet> getPlanets() {
return PLANET_MAP.keySet(); return PLANET_STAR.keySet();
} }
public static Collection<Moon> getMoons() { public static Collection<Moon> getMoons() {
return MOON_MAP.keySet(); return MOON_PLANET.keySet();
} }
public static Collection<Area> getAreas() { public static Collection<Area> getAreas() {
return AREA_MAP.keySet(); return AREA_DOMAIN.keySet();
} }
public static Collection<Semi> getSemis() { public static Collection<Semi> getSemis() {
return SEMI_SET; return SEMI;
} }
public static List<Sector> getSectors(Galaxy galaxy) { public static List<Sector> getSectors(Galaxy galaxy) {
return SECTORS_MAP.get(galaxy); return GALAXY_SECTORS.get(galaxy);
} }
public static List<Star> getStars(Sector sector) { public static List<Star> getStars(Sector sector) {
return STARS_MAP.get(sector); return SECTOR_STARS.get(sector);
} }
public static List<Planet> getPlanets(Star star) { public static List<Planet> getPlanets(Star star) {
return PLANETS_MAP.get(star); return STAR_PLANETS.get(star);
} }
public static List<Moon> getMoons(Planet planet) { public static List<Moon> getMoons(Planet planet) {
return MOONS_MAP.get(planet); return PLANET_MOONS.get(planet);
} }
public static List<Area> getAreas(Domain domain) { public static List<Area> getAreas(Domain domain) {
return AREAS_MAP.get(domain); return DOMAIN_AREAS.get(domain);
}
public static Star getStar(Planet planet) {
return PLANET_STAR.get(planet);
}
public static Planet getPlanet(Moon moon) {
return MOON_PLANET.get(moon);
}
public static Sector getSector(Star star) {
return STAR_SECTOR.get(star);
}
public static Galaxy getGalaxy(Sector sector) {
return SECTOR_GALAXY.get(sector);
}
public static Domain getDomain(Area area) {
return AREA_DOMAIN.get(area);
} }
public static Dimension getDimension(int dim) { public static Dimension getDimension(int dim) {
@ -116,31 +136,15 @@ public abstract class UniverseRegistry {
return id == null ? -1 : id; return id == null ? -1 : id;
} }
public static String getName(Dimension dim) { public static String getName(Section dim) {
return dim == null ? null : NAMES.get(dim); return dim == null ? null : NAMES.get(dim);
} }
public static Star getStar(Planet planet) {
return PLANET_MAP.get(planet);
}
public static Planet getPlanet(Moon moon) {
return MOON_MAP.get(moon);
}
public static Sector getSector(Star star) {
return STAR_MAP.get(star);
}
public static Galaxy getGalaxy(Sector sector) {
return SECTOR_MAP.get(sector);
}
public static Domain getDomain(Area area) {
return AREA_MAP.get(area);
}
public static Dimension getDimension(String name) { public static Dimension getDimension(String name) {
return NAME_MAP.get(name) instanceof Dimension dim ? dim : null;
}
public static Section getSection(String name) {
return NAME_MAP.get(name); return NAME_MAP.get(name);
} }
@ -149,50 +153,71 @@ public abstract class UniverseRegistry {
} }
public static boolean isRegistered(String name) { public static boolean isRegistered(String name) {
return GALAXIES.containsKey(name) || SECTORS.containsKey(name) || DOMAINS.containsKey(name) || NAME_MAP.containsKey(name); return NAME_MAP.containsKey(name);
} }
public static boolean isType(String name, DimType type) { public static boolean isType(String name, DimType type) {
return NAME_MAP.containsKey(name) && NAME_MAP.get(name).getType() == type; return NAME_MAP.containsKey(name) && NAME_MAP.get(name) instanceof Dimension dim && dim.getType() == type;
} }
public static Galaxy registerCustomGalaxy(String name, String display) { public static Galaxy registerCustomGalaxy(String name, String display) {
return registerGalaxyInt(name, display, true); Galaxy galaxy = new Galaxy(true);
registerGalaxyInt(name, display, galaxy);
return galaxy;
} }
public static Sector registerCustomSector(String name, String display, String galaxy) { public static Sector registerCustomSector(String name, String display, String galaxy) {
return registerSectorInt(name, display, galaxy, true); Section base = NAME_MAP.get(galaxy);
if(!(base instanceof Galaxy baseGalaxy))
throw new IllegalArgumentException("Galaxie " + galaxy + " existiert nicht");
Sector sector = new Sector(true);
registerSectorInt(name, display, sector, baseGalaxy);
return sector;
} }
public static Domain registerCustomDomain(String name, String display) { public static Domain registerCustomDomain(String name, String display) {
return registerDomainInt(name, display, true); Domain domain = new Domain(true);
registerDomainInt(name, display, domain);
return domain;
} }
public static Star registerCustomStar(String name, String display, Star dim, String sector) { public static Star registerCustomStar(String name, String display, Star dim, String sector) {
Section base = NAME_MAP.get(sector);
if(!(base instanceof Sector baseSector))
throw new IllegalArgumentException("Sektor " + sector + " existiert nicht");
if(!dim.isCustom()) if(!dim.isCustom())
dim = (Star)dim.makeCustomCopy(); dim = (Star)dim.makeCustomCopy();
registerStarInt(name, display, dim, sector); registerStarInt(name, display, dim, baseSector);
return dim; return dim;
} }
public static Planet registerCustomPlanet(String name, String display, Planet dim, String star) { public static Planet registerCustomPlanet(String name, String display, Planet dim, String star) {
Section base = NAME_MAP.get(star);
if(!(base instanceof Star baseStar))
throw new IllegalArgumentException("Stern " + star + " existiert nicht");
if(!dim.isCustom()) if(!dim.isCustom())
dim = (Planet)dim.makeCustomCopy(); dim = (Planet)dim.makeCustomCopy();
registerPlanetInt(name, display, dim, star); registerPlanetInt(name, display, dim, baseStar);
return dim; return dim;
} }
public static Moon registerCustomMoon(String name, String display, Moon dim, String planet) { public static Moon registerCustomMoon(String name, String display, Moon dim, String planet) {
Section base = NAME_MAP.get(planet);
if(!(base instanceof Planet basePlanet))
throw new IllegalArgumentException("Planet " + planet + " existiert nicht");
if(!dim.isCustom()) if(!dim.isCustom())
dim = (Moon)dim.makeCustomCopy(); dim = (Moon)dim.makeCustomCopy();
registerMoonInt(name, display, dim, planet); registerMoonInt(name, display, dim, basePlanet);
return dim; return dim;
} }
public static Area registerCustomArea(String name, String display, Area dim, String domain) { public static Area registerCustomArea(String name, String display, Area dim, String domain) {
Section base = NAME_MAP.get(domain);
if(!(base instanceof Domain baseDomain))
throw new IllegalArgumentException("Bereich " + domain + " existiert nicht");
if(!dim.isCustom()) if(!dim.isCustom())
dim = (Area)dim.makeCustomCopy(); dim = (Area)dim.makeCustomCopy();
registerAreaInt(name, display, dim, domain); registerAreaInt(name, display, dim, baseDomain);
return dim; return dim;
} }
@ -202,158 +227,126 @@ public abstract class UniverseRegistry {
registerSemiInt(name, display, dim); registerSemiInt(name, display, dim);
return dim; return dim;
} }
private static void checkRegistered(String name) {
if(isRegistered(name)) private static void register(String name, String display, Section obj) {
if(NAME_MAP.containsKey(name))
throw new IllegalArgumentException("Objekt " + name + " ist bereits registriert"); throw new IllegalArgumentException("Objekt " + name + " ist bereits registriert");
} obj.setDisplay(display);
NAME_MAP.put(name, obj);
private static Galaxy registerGalaxyInt(String name, String display, boolean custom) { NAMES.put(obj, name);
checkRegistered(name); SECTIONS.add(obj);
Galaxy galaxy = new Galaxy(name, custom); if(obj instanceof Dimension dim) {
galaxy.setDisplay(display); NAME_LIST.add(name);
GALAXIES.put(name, galaxy); ID_MAP.put(DIMENSIONS.size(), dim);
SECTORS_MAP.put(galaxy, Lists.newArrayList()); IDS.put(dim, DIMENSIONS.size());
return galaxy; DIMENSIONS.add(dim);
}
} }
private static Sector registerSectorInt(String name, String display, String galaxy, boolean custom) { private static void registerGalaxyInt(String name, String display, Galaxy galaxy) {
checkRegistered(name); register(name, display, galaxy);
Galaxy base = GALAXIES.get(galaxy); GALAXY_SECTORS.put(galaxy, Lists.newArrayList());
if(base == null)
throw new IllegalArgumentException("Galaxie " + galaxy + " existiert nicht");
Sector sector = new Sector(name, custom);
sector.setDisplay(display);
SECTORS.put(name, sector);
SECTOR_MAP.put(sector, base);
STARS_MAP.put(sector, Lists.newArrayList());
SECTORS_MAP.get(base).add(sector);
return sector;
} }
private static Domain registerDomainInt(String name, String display, boolean custom) { private static void registerSectorInt(String name, String display, Sector sector, Galaxy galaxy) {
checkRegistered(name); register(name, display, sector);
Domain domain = new Domain(name, custom); SECTOR_GALAXY.put(sector, galaxy);
domain.setDisplay(display); SECTOR_STARS.put(sector, Lists.newArrayList());
DOMAINS.put(name, domain); GALAXY_SECTORS.get(galaxy).add(sector);
AREAS_MAP.put(domain, Lists.newArrayList());
return domain;
} }
private static void registerDimension(String name, String display, Dimension dim) { private static void registerDomainInt(String name, String display, Domain domain) {
checkRegistered(name); register(name, display, domain);
dim.setDisplay(display); DOMAIN_AREAS.put(domain, Lists.newArrayList());
NAME_MAP.put(name, dim);
NAMES.put(dim, name);
NAME_LIST.add(name);
ID_MAP.put(DIMENSIONS.size(), dim);
IDS.put(dim, DIMENSIONS.size());
DIMENSIONS.add(dim);
} }
private static void registerStarInt(String name, String display, Dimension dim, String sector) { private static void registerStarInt(String name, String display, Star star, Sector sector) {
Sector base = SECTORS.get(sector); register(name, display, star);
if(base == null) STAR_SECTOR.put(star, sector);
throw new IllegalArgumentException("Sektor " + sector + " existiert nicht"); STAR_PLANETS.put(star, Lists.newArrayList());
registerDimension(name, display, dim); SECTOR_STARS.get(sector).add(star);
STAR_MAP.put((Star)dim, base);
PLANETS_MAP.put((Star)dim, Lists.newArrayList());
STARS_MAP.get(base).add((Star)dim);
} }
private static void registerPlanetInt(String name, String display, Dimension dim, String star) { private static void registerPlanetInt(String name, String display, Planet planet, Star star) {
Dimension base = NAME_MAP.get(star); register(name, display, planet);
if(base == null || base.getType() != DimType.STAR) PLANET_STAR.put(planet, star);
throw new IllegalArgumentException("Stern " + star + " existiert nicht"); PLANET_MOONS.put(planet, Lists.newArrayList());
registerDimension(name, display, dim); STAR_PLANETS.get(star).add(planet);
PLANET_MAP.put((Planet)dim, ((Star)base));
MOONS_MAP.put((Planet)dim, Lists.newArrayList());
PLANETS_MAP.get((Star)base).add((Planet)dim);
} }
private static void registerMoonInt(String name, String display, Dimension dim, String planet) { private static void registerMoonInt(String name, String display, Moon moon, Planet planet) {
Dimension base = NAME_MAP.get(planet); register(name, display, moon);
if(base == null || base.getType() != DimType.PLANET) MOON_PLANET.put(moon, planet);
throw new IllegalArgumentException("Planet " + planet + " existiert nicht"); PLANET_MOONS.get(planet).add(moon);
registerDimension(name, display, dim);
MOON_MAP.put((Moon)dim, ((Planet)base));
MOONS_MAP.get((Planet)base).add((Moon)dim);
} }
private static void registerAreaInt(String name, String display, Dimension dim, String domain) { private static void registerAreaInt(String name, String display, Area area, Domain domain) {
Domain base = DOMAINS.get(domain); register(name, display, area);
if(base == null) AREA_DOMAIN.put(area, domain);
throw new IllegalArgumentException("Bereich " + domain + " existiert nicht"); DOMAIN_AREAS.get(domain).add(area);
registerDimension(name, display, dim);
AREA_MAP.put((Area)dim, base);
AREAS_MAP.get(base).add((Area)dim);
} }
private static void registerSemiInt(String name, String display, Dimension dim) { private static void registerSemiInt(String name, String display, Semi semi) {
registerDimension(name, display, dim); register(name, display, semi);
SEMI_SET.add((Semi)dim); SEMI.add(semi);
} }
private static String lastGalaxy; private static Galaxy lastGalaxy;
private static String lastSector; private static Sector lastSector;
private static String lastDomain; private static Domain lastDomain;
private static String lastStar; private static Star lastStar;
private static String lastPlanet; private static Planet lastPlanet;
private static String fromDisplay(String display) { private static String fromDisplay(String display) {
return display.toLowerCase().replace("'", "").replace(' ', '_'); return display.toLowerCase().replace("'", "").replace(' ', '_');
} }
private static void registerGalaxy(String name, String display, Runnable sub) { private static void registerGalaxy(String name, String display, Runnable sub) {
registerGalaxyInt(name, display, false); registerGalaxyInt(name, display, lastGalaxy = new Galaxy(false));
lastGalaxy = name;
sub.run(); sub.run();
lastGalaxy = null; lastGalaxy = null;
} }
private static void registerSector(String name, String display, Runnable sub) { private static void registerSector(String name, String display, Runnable sub) {
registerSectorInt(name, display, lastGalaxy, false); registerSectorInt(name, display, lastSector = new Sector(false), lastGalaxy);
lastSector = name;
sub.run(); sub.run();
lastSector = null; lastSector = null;
} }
private static void registerDomain(String name, String display, Runnable sub) { private static void registerDomain(String name, String display, Runnable sub) {
registerDomainInt(name, display, false); registerDomainInt(name, display, lastDomain = new Domain(false));
lastDomain = name;
sub.run(); sub.run();
lastDomain = null; lastDomain = null;
} }
private static void registerStar(String name, String display, Dimension dim, Runnable sub) { private static void registerStar(String name, String display, Dimension dim, Runnable sub) {
registerStarInt(name, display, dim, lastSector); registerStarInt(name, display, lastStar = (Star)dim, lastSector);
lastStar = name;
sub.run(); sub.run();
lastStar = null; lastStar = null;
} }
private static void registerPlanet(String name, String display, Dimension dim) { private static void registerPlanet(String name, String display, Dimension dim) {
registerPlanetInt(name, display, dim, lastStar); registerPlanetInt(name, display, (Planet)dim, lastStar);
} }
private static void registerPlanet(String name, String display, Dimension dim, Runnable sub) { private static void registerPlanet(String name, String display, Dimension dim, Runnable sub) {
registerPlanet(name, display, dim); registerPlanetInt(name, display, lastPlanet = (Planet)dim, lastStar);
lastPlanet = name;
sub.run(); sub.run();
lastPlanet = null; lastPlanet = null;
} }
private static void registerMoon(String name, String display, Dimension dim) { private static void registerMoon(String name, String display, Dimension dim) {
registerMoonInt(name, display, dim, lastPlanet); registerMoonInt(name, display, (Moon)dim, lastPlanet);
} }
private static void registerArea(String name, String display, Dimension dim) { private static void registerArea(String name, String display, Dimension dim) {
registerAreaInt(name, display, dim, lastDomain); registerAreaInt(name, display, (Area)dim, lastDomain);
} }
private static void registerSemi(String name, String display, Dimension dim) { private static void registerSemi(String name, String display, Dimension dim) {
registerSemiInt(name, display, dim); registerSemiInt(name, display, (Semi)dim);
} }
private static void registerGalaxy(String display, Runnable sub) { private static void registerGalaxy(String display, Runnable sub) {
@ -405,7 +398,7 @@ public abstract class UniverseRegistry {
} }
public static void register() { public static void register() {
registerDimension("space", "Der Weltraum", Space.INSTANCE); register("space", "Der Weltraum", Space.INSTANCE);
registerGalaxy("milkyway", "Galaxie Milchstraße", () -> { registerGalaxy("milkyway", "Galaxie Milchstraße", () -> {
registerSector("Solar", () -> { registerSector("Solar", () -> {

View file

@ -16,13 +16,13 @@ public class ItemSpaceNavigator extends ItemMagnetic {
public String getHotbarText(EntityNPC player, ItemStack stack) { public String getHotbarText(EntityNPC player, ItemStack stack) {
BlockPos pos = player.getPosition(); BlockPos pos = player.getPosition();
return TextColor.ORANGE + player.worldObj.formatImperialTime(player, false) + " / " + return TextColor.ORANGE + player.worldObj.formatTime(player, false) + " / " +
String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + TextColor.ORANGE, String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + TextColor.ORANGE,
pos.getX(), pos.getY(), pos.getZ()); pos.getX(), pos.getY(), pos.getZ());
} }
public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) { public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) {
tooltip.add(TextColor.ORANGE + player.worldObj.formatImperialTime(player, true)); tooltip.add(TextColor.ORANGE + player.worldObj.formatTime(player, true));
String[] dims = player.worldObj.dimension.getBaseNames(); String[] dims = player.worldObj.dimension.getBaseNames();
for(int z = dims.length - 1; z >= 0; z--) { for(int z = dims.length - 1; z >= 0; z--) {
tooltip.add(TextColor.ORANGE + dims[z]); tooltip.add(TextColor.ORANGE + dims[z]);

View file

@ -21,7 +21,7 @@ public class ItemWeatherToken extends ItemMagnetic {
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
{ {
if(worldIn.dimension.getType().weather) { if(worldIn.dimension.hasWeather()) {
// if (!playerIn.creative) // if (!playerIn.creative)
itemStackIn.decrSize(); itemStackIn.decrSize();
worldIn.playSoundAtEntity(playerIn, SoundEvent.SPELL, 0.5F); worldIn.playSoundAtEntity(playerIn, SoundEvent.SPELL, 0.5F);

View file

@ -32,7 +32,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
else { else {
this.dimType = dim.getType(); this.dimType = dim.getType();
this.dimData = dim.writeData(); this.dimData = dim.writeData();
if(this.dimType.celestials) { if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
this.sunColor = dim.getSunColor(); this.sunColor = dim.getSunColor();
this.moonColors = dim.getMoonColors(); this.moonColors = dim.getMoonColors();
} }
@ -57,9 +57,9 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
public void readPacketData(PacketBuffer buf) throws IOException { public void readPacketData(PacketBuffer buf) throws IOException {
this.dimId = buf.readVarInt(); this.dimId = buf.readVarInt();
if(this.dimId >= -1) { if(this.dimId >= -1) {
this.dimType = buf.readEnumValue(DimType.class); this.dimType = buf.readEnumOrNull(DimType.class);
this.dimData = buf.readTag(); this.dimData = buf.readTag();
if(this.dimType.celestials) { if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
this.sunColor = buf.readInt(); this.sunColor = buf.readInt();
this.moonColors = new int[buf.readVarInt()]; this.moonColors = new int[buf.readVarInt()];
for(int z = 0; z < this.moonColors.length; z++) { for(int z = 0; z < this.moonColors.length; z++) {
@ -82,9 +82,9 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
public void writePacketData(PacketBuffer buf) throws IOException { public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeVarInt(this.dimId); buf.writeVarInt(this.dimId);
if(this.dimId >= -1) { if(this.dimId >= -1) {
buf.writeEnumValue(this.dimType); buf.writeEnumOrNull(this.dimType);
buf.writeTag(this.dimData); buf.writeTag(this.dimData);
if(this.dimType.celestials) { if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
buf.writeInt(this.sunColor); buf.writeInt(this.sunColor);
buf.writeVarInt(this.moonColors.length); buf.writeVarInt(this.moonColors.length);
for(int z = 0; z < this.moonColors.length; z++) { for(int z = 0; z < this.moonColors.length; z++) {
@ -109,7 +109,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
return null; return null;
Dimension dim = this.dimId >= 0 ? UniverseRegistry.getDimension(this.dimId) : Dimension.create(this.dimType); Dimension dim = this.dimId >= 0 ? UniverseRegistry.getDimension(this.dimId) : Dimension.create(this.dimType);
dim.readData(this.dimData); dim.readData(this.dimData);
if(this.dimType.celestials) { if(this.dimType == DimType.PLANET || this.dimType == DimType.MOON) {
dim.setSunColor(this.sunColor); dim.setSunColor(this.sunColor);
dim.setMoonColors(this.moonColors); dim.setMoonColors(this.moonColors);
} }

View file

@ -103,7 +103,7 @@ public abstract class Chunk {
} }
} }
if(!this.world.dimension.hasNoLight() && top != Integer.MIN_VALUE) { if(this.world.dimension.hasSkyLight() && top != Integer.MIN_VALUE) {
int l = 15; int l = 15;
int y = top + 16 - 1; int y = top + 16 - 1;
@ -216,7 +216,7 @@ public abstract class Chunk {
int cx = this.xPos * 16 + x; int cx = this.xPos * 16 + x;
int cz = this.zPos * 16 + z; int cz = this.zPos * 16 + z;
if(!this.world.dimension.hasNoLight()) { if(this.world.dimension.hasSkyLight()) {
if(cy < h) { if(cy < h) {
for(int n = cy; n < h; ++n) { for(int n = cy; n < h; ++n) {
BlockArray stor = this.getArray(n >> 4); BlockArray stor = this.getArray(n >> 4);
@ -275,7 +275,7 @@ public abstract class Chunk {
this.minHeight = sh; this.minHeight = sh;
} }
if(!this.world.dimension.hasNoLight()) { if(this.world.dimension.hasSkyLight()) {
for(Facing face : Facing.Plane.HORIZONTAL) { for(Facing face : Facing.Plane.HORIZONTAL) {
this.updateNeighbor(cx + face.getFrontOffsetX(), cz + face.getFrontOffsetZ(), sy, ey); this.updateNeighbor(cx + face.getFrontOffsetX(), cz + face.getFrontOffsetZ(), sy, ey);
} }
@ -336,7 +336,7 @@ public abstract class Chunk {
return null; return null;
} }
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight(), y < 0 ? this.filler : null); stor = new BlockArray(y >> 4 << 4, this.world.dimension.hasSkyLight(), y < 0 ? this.filler : null);
this.setArray(stor); this.setArray(stor);
up = y >= h; up = y >= h;
} }
@ -414,7 +414,7 @@ public abstract class Chunk {
int z = pos.getZ() & 15; int z = pos.getZ() & 15;
BlockArray stor = this.getArray(y >> 4); BlockArray stor = this.getArray(y >> 4);
if(type == LightType.SKY) { if(type == LightType.SKY) {
int l = stor == null ? (this.canSeeSky(pos) ? type.defValue : 0) : (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z)); int l = stor == null ? (this.canSeeSky(pos) ? type.defValue : 0) : (this.world.dimension.hasSkyLight() ? stor.getSky(x, y & 15, z) : 0);
if(y < 0) { if(y < 0) {
int max = y < -64 ? 0 : (y + 64) / 4; int max = y < -64 ? 0 : (y + 64) / 4;
l = l > max ? max : l; l = l > max ? max : l;
@ -433,7 +433,7 @@ public abstract class Chunk {
BlockArray stor = this.getArray(y >> 4); BlockArray stor = this.getArray(y >> 4);
if(stor == null) { if(stor == null) {
stor = new BlockArray(y >> 4 << 4, !this.world.dimension.hasNoLight(), y < 0 ? this.filler : null); stor = new BlockArray(y >> 4 << 4, this.world.dimension.hasSkyLight(), y < 0 ? this.filler : null);
this.setArray(stor); this.setArray(stor);
this.genSkyLight(); this.genSkyLight();
} }
@ -441,7 +441,7 @@ public abstract class Chunk {
this.modified = true; this.modified = true;
if(type == LightType.SKY) { if(type == LightType.SKY) {
if(!this.world.dimension.hasNoLight()) { if(this.world.dimension.hasSkyLight()) {
stor.setSky(x, y & 15, z, value); stor.setSky(x, y & 15, z, value);
} }
} }
@ -455,13 +455,13 @@ public abstract class Chunk {
int y = pos.getY(); int y = pos.getY();
int z = pos.getZ() & 15; int z = pos.getZ() & 15;
BlockArray stor = this.getArray(y >> 4); BlockArray stor = this.getArray(y >> 4);
int l = stor == null ? LightType.SKY.defValue : (this.world.dimension.hasNoLight() ? 0 : stor.getSky(x, y & 15, z)); int l = stor == null ? LightType.SKY.defValue : (this.world.dimension.hasSkyLight() ? stor.getSky(x, y & 15, z) : 0);
if(y < 0) { if(y < 0) {
int max = y < -64 ? 0 : (y + 64) / 4; int max = y < -64 ? 0 : (y + 64) / 4;
l = l > max ? max : l; l = l > max ? max : l;
} }
if(stor == null) if(stor == null)
return !this.world.dimension.hasNoLight() && amount < l ? l - amount : 0; return this.world.dimension.hasSkyLight() && amount < l ? l - amount : 0;
l = l - amount; l = l - amount;
int b = stor.getLight(x, y & 15, z); int b = stor.getLight(x, y & 15, z);
return b > l ? b : l; return b > l ? b : l;
@ -658,7 +658,7 @@ public abstract class Chunk {
} }
public void update(boolean noGaps) { public void update(boolean noGaps) {
if(this.gapUpdate && !this.world.dimension.hasNoLight() && !noGaps) { if(this.gapUpdate && this.world.dimension.hasSkyLight() && !noGaps) {
this.recheckGaps(this.world.client); this.recheckGaps(this.world.client);
} }
@ -735,7 +735,7 @@ public abstract class Chunk {
this.lightInit = true; this.lightInit = true;
BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4); BlockPos pos = new BlockPos(this.xPos << 4, 0, this.zPos << 4);
if(!this.world.dimension.hasNoLight()) { if(this.world.dimension.hasSkyLight()) {
if(this.world.isAreaLoaded(pos.add(-1, 0, -1), pos.add(16, this.world.getSeaLevel(), 16))) { if(this.world.isAreaLoaded(pos.add(-1, 0, -1), pos.add(16, this.world.getSeaLevel(), 16))) {
label92: label92:

View file

@ -166,15 +166,15 @@ public abstract class World implements IWorldAccess {
return 6; return 6;
} }
public String formatImperialTime(Dimension home, boolean days) { public String formatTime(Dimension home, boolean days) {
String qualifier = home != null ? (home.getType() == DimType.PLANET ? this.getTimeQualifier((Planet)home) + "." : "?.") : ""; String qualifier = home != null ? (home.getType() == DimType.PLANET ? this.getTimeQualifier((Planet)home) + "." : "?.") : "";
long time = this.daytime; long time = this.daytime;
String gtime; String gtime;
if((home == null || !home.getType().celestial) && !this.dimension.getType().celestial) { if((home == null || !home.isCelestial()) && !this.dimension.isCelestial()) {
gtime = "???.???.M?"; gtime = "???.???.M?";
} }
else { else {
long yearTime = (home != null && home.getType().celestial ? home : this.dimension).getOrbitalPeriod(); long yearTime = (home != null && home.isCelestial() ? home : this.dimension).getOrbitalPeriod();
long year = time / yearTime; long year = time / yearTime;
long frac = (time * 1000L / yearTime) % 1000L; long frac = (time * 1000L / yearTime) % 1000L;
gtime = String.format("%03d.%03d.M%d", frac, year % 1000L, year / 1000L + 1L); gtime = String.format("%03d.%03d.M%d", frac, year % 1000L, year / 1000L + 1L);
@ -182,7 +182,7 @@ public abstract class World implements IWorldAccess {
if(!days) if(!days)
return qualifier + gtime; return qualifier + gtime;
String ltime; String ltime;
if(!this.dimension.getType().celestial) { if(!this.dimension.isCelestial()) {
ltime = " T???.??? D???.???.G?"; ltime = " T???.??? D???.???.G?";
} }
else { else {
@ -194,8 +194,8 @@ public abstract class World implements IWorldAccess {
return qualifier + gtime + ltime; return qualifier + gtime + ltime;
} }
public String formatImperialTime(EntityNPC player, boolean days) { public String formatTime(EntityNPC player, boolean days) {
return this.formatImperialTime(player == null ? null : player.getOrigin().getDimension(), days); return this.formatTime(player == null ? null : player.getOrigin().getDimension(), days);
} }
public abstract Biome getBiomeGenForCoords(BlockPos pos); public abstract Biome getBiomeGenForCoords(BlockPos pos);
@ -328,7 +328,7 @@ public abstract class World implements IWorldAccess {
x2 = i; x2 = i;
} }
if(!this.dimension.hasNoLight()) { if(this.dimension.hasSkyLight()) {
for(int j = x2; j <= z2; ++j) { for(int j = x2; j <= z2; ++j) {
this.checkLightFor(LightType.SKY, new BlockPos(x1, j, z1)); this.checkLightFor(LightType.SKY, new BlockPos(x1, j, z1));
} }
@ -483,7 +483,7 @@ public abstract class World implements IWorldAccess {
} }
public int getLightFromNeighborsFor(LightType type, BlockPos pos) { public int getLightFromNeighborsFor(LightType type, BlockPos pos) {
if(this.dimension.hasNoLight() && type == LightType.SKY) { if(!this.dimension.hasSkyLight() && type == LightType.SKY) {
return 0; return 0;
} }
else { else {
@ -934,9 +934,9 @@ public abstract class World implements IWorldAccess {
return list; return list;
} }
private float calculateCelestialAngle(long worldTime, float partialTicks) { private float calcRotationPhase(long worldTime, float partial) {
int i = (int)(worldTime % this.dimension.getRotationalPeriod()); int i = (int)(worldTime % this.dimension.getRotationalPeriod());
float f = ((float)i + partialTicks) / (float)this.dimension.getRotationalPeriod() - 0.5F; float f = ((float)i + partial) / (float)this.dimension.getRotationalPeriod() - 0.5F;
if(f < 0.0F) { if(f < 0.0F) {
++f; ++f;
@ -951,8 +951,8 @@ public abstract class World implements IWorldAccess {
return f; return f;
} }
public int calculateSkylightSubtracted(boolean current) { public int calcSkylightSubtracted(boolean current) {
float f = !this.dimension.getType().days || (current && this.dimension.isBaseDestroyed()) ? 0.5f : this.calculateCelestialAngle(current ? this.daytime : float f = !this.dimension.hasDaylight() || (current && this.dimension.isBaseDestroyed()) ? 0.5f : this.calcRotationPhase(current ? this.daytime :
(this.dimension.getRotationalPeriod() / 4L), 1.0f); (this.dimension.getRotationalPeriod() / 4L), 1.0f);
float f1 = 1.0F - (ExtMath.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); 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 = ExtMath.clampf(f1, 0.0F, 1.0F);
@ -963,8 +963,8 @@ public abstract class World implements IWorldAccess {
return (int)(f1 * 11.0F); return (int)(f1 * 11.0F);
} }
public float getCelestialAngle(float partialTicks) { public float getCelestialAngle(float partial) {
return !this.dimension.getType().days ? 0.5f : this.calculateCelestialAngle(this.daytime, Vars.dayCycle ? partialTicks : 0.0f); return !this.dimension.isCelestial() ? 180.0f : (this.calcRotationPhase(this.daytime, Vars.dayCycle ? partial : 0.0f) * 360.0F);
} }
public int getMoonPhase(int moon) { public int getMoonPhase(int moon) {
@ -972,12 +972,12 @@ public abstract class World implements IWorldAccess {
return (int)(this.daytime / this.dimension.getRotationalPeriod() % 8L + 8L + this.rand.zrange(8)) % 8; return (int)(this.daytime / this.dimension.getRotationalPeriod() % 8L + 8L + this.rand.zrange(8)) % 8;
} }
public float getCurrentMoonPhaseFactor() { public float getMoonPhase() {
return MOON_PHASES[this.getMoonPhase(0)]; return MOON_PHASES[this.getMoonPhase(0)];
} }
public float getCelestialAngleRadians(float partialTicks) { public float getDayPhase(float partial) {
return (this.dimension.isBaseDestroyed() ? 0.5f : this.getCelestialAngle(partialTicks)) * (float)Math.PI * 2.0F; return !this.dimension.hasDaylight() || this.dimension.isBaseDestroyed() ? (float)Math.PI : (this.calcRotationPhase(this.daytime, Vars.dayCycle ? partial : 0.0f) * (float)Math.PI * 2.0F);
} }
public BlockPos getPrecipitationHeight(BlockPos pos) { public BlockPos getPrecipitationHeight(BlockPos pos) {
@ -1545,7 +1545,7 @@ public abstract class World implements IWorldAccess {
} }
protected void calculateInitialSkylight() { protected void calculateInitialSkylight() {
int light = this.calculateSkylightSubtracted(false); int light = this.calcSkylightSubtracted(false);
if(light != this.subtract) if(light != this.subtract)
this.subtract = light; this.subtract = light;
} }
@ -1601,7 +1601,7 @@ public abstract class World implements IWorldAccess {
} }
public LeavesType getLeavesGen(BlockPos pos) { public LeavesType getLeavesGen(BlockPos pos) {
return this.canFreezeAt(pos) ? LeavesType.SNOWY : ((!this.dimension.getType().days || this.dimension.getOrbitOffset() == 0.0f) ? return this.canFreezeAt(pos) ? LeavesType.SNOWY : (!this.dimension.hasSeasons() ?
this.dimension.getLeavesType() : LeavesType.values()[(int)((this.daytime % this.dimension.getLeavesType() : LeavesType.values()[(int)((this.daytime %
this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]); this.dimension.getOrbitalPeriod()) * (long)LeavesType.values().length / this.dimension.getOrbitalPeriod())]);
} }
@ -1654,7 +1654,7 @@ public abstract class World implements IWorldAccess {
public boolean checkLight(BlockPos pos) { public boolean checkLight(BlockPos pos) {
boolean flag = false; boolean flag = false;
if(!this.dimension.hasNoLight()) { if(this.dimension.hasSkyLight()) {
flag |= this.checkLightFor(LightType.SKY, pos); flag |= this.checkLightFor(LightType.SKY, pos);
} }
@ -2017,7 +2017,7 @@ public abstract class World implements IWorldAccess {
public double getSpaceFactor(double x, double y, double z) { public double getSpaceFactor(double x, double y, double z) {
if(this.dimension.getType() == DimType.SEMI) if(this.dimension.getType() == DimType.SEMI)
return ExtMath.clampd((y - (double)World.MAX_SIZE_Y) / 16384.0, 0.0, 1.0); return ExtMath.clampd((y - (double)World.MAX_SIZE_Y) / 16384.0, 0.0, 1.0);
else if(!this.dimension.getType().celestial) else if(!this.dimension.isCelestial())
return 0.0; return 0.0;
double r = (double)this.dimension.getSize(); double r = (double)this.dimension.getSize();
double xm = (Math.abs(x) - r) / 16384.0; double xm = (Math.abs(x) - r) / 16384.0;

View file

@ -33,6 +33,7 @@ import common.dimension.Dimension;
import common.dimension.Domain; import common.dimension.Domain;
import common.dimension.Galaxy; import common.dimension.Galaxy;
import common.dimension.Moon; import common.dimension.Moon;
import common.dimension.Section;
import common.dimension.Planet; import common.dimension.Planet;
import common.dimension.Sector; import common.dimension.Sector;
import common.dimension.Semi; import common.dimension.Semi;
@ -302,57 +303,41 @@ public final class Server implements IThreadListener, Executor {
private static void writeDimensions(TagObject tag) { private static void writeDimensions(TagObject tag) {
List<TagObject> list = Lists.newArrayList(); List<TagObject> list = Lists.newArrayList();
for(Dimension dim : UniverseRegistry.getDimensions()) { for(Section obj : UniverseRegistry.getSections()) {
if(dim.isCustom()) { if(obj.isCustom()) {
TagObject data = new TagObject(); TagObject data = new TagObject();
data.setString("Type", dim.getType().getName()); data.setString("Name", UniverseRegistry.getName(obj));
data.setString("Name", UniverseRegistry.getName(dim)); data.setString("CustomName", obj.getDisplay());
data.setString("CustomName", dim.getDisplay()); if(obj instanceof Dimension dim) {
switch(dim.getType()) { data.setString("Type", dim.getType().getName());
case AREA: switch(dim.getType()) {
data.setString("Domain", UniverseRegistry.getDomain((Area)dim).id); case AREA:
break; data.setString("Domain", UniverseRegistry.getName(UniverseRegistry.getDomain((Area)obj)));
case MOON: break;
data.setString("Planet", UniverseRegistry.getName(UniverseRegistry.getPlanet((Moon)dim))); case MOON:
break; data.setString("Planet", UniverseRegistry.getName(UniverseRegistry.getPlanet((Moon)obj)));
case PLANET: break;
data.setString("Star", UniverseRegistry.getName(UniverseRegistry.getStar((Planet)dim))); case PLANET:
break; data.setString("Star", UniverseRegistry.getName(UniverseRegistry.getStar((Planet)obj)));
case STAR: break;
data.setString("Sector", UniverseRegistry.getSector((Star)dim).id); case STAR:
break; data.setString("Sector", UniverseRegistry.getName(UniverseRegistry.getSector((Star)obj)));
} break;
}
}
else if(obj instanceof Sector sector) {
data.setString("Type", "sector");
data.setString("Galaxy", UniverseRegistry.getName(UniverseRegistry.getGalaxy(sector)));
}
else if(obj instanceof Galaxy galaxy) {
data.setString("Type", "galaxy");
}
else if(obj instanceof Domain domain) {
data.setString("Type", "domain");
}
list.add(data); list.add(data);
} }
} }
for(Sector sector : UniverseRegistry.getSectors()) {
if(sector.isCustom()) {
TagObject data = new TagObject();
data.setString("Type", "sector");
data.setString("Name", sector.id);
data.setString("CustomName", sector.getDisplay());
data.setString("Galaxy", UniverseRegistry.getGalaxy(sector).id);
list.add(data);
}
}
for(Galaxy galaxy : UniverseRegistry.getGalaxies()) {
if(galaxy.isCustom()) {
TagObject data = new TagObject();
data.setString("Type", "galaxy");
data.setString("Name", galaxy.id);
data.setString("CustomName", galaxy.getDisplay());
list.add(data);
}
}
for(Domain domain : UniverseRegistry.getDomains()) {
if(domain.isCustom()) {
TagObject data = new TagObject();
data.setString("Type", "domain");
data.setString("Name", domain.id);
data.setString("CustomName", domain.getDisplay());
list.add(data);
}
}
if(!list.isEmpty()) if(!list.isEmpty())
tag.setList("Dimensions", list); tag.setList("Dimensions", list);
} }

View file

@ -90,7 +90,7 @@ public class CommandTime extends Command {
dim.setDayTime(time); dim.setDayTime(time);
dim.resetWeather(); dim.resetWeather();
} }
exec.log("Zeit auf %s gesetzt", world.formatImperialTime(exec.isPlayer() ? ((Player)exec).getPresentEntity() : null, false)); exec.log("Zeit auf %s gesetzt", world.formatTime(exec.isPlayer() ? ((Player)exec).getPresentEntity() : null, false));
return time; return time;
} }
} }

View file

@ -19,7 +19,7 @@ public class CommandWeather extends Command {
} }
public void exec(CommandEnvironment env, Executor exec, Weather weather, WorldServer world, boolean transition) { public void exec(CommandEnvironment env, Executor exec, Weather weather, WorldServer world, boolean transition) {
if(!world.dimension.getType().weather) if(!world.dimension.hasWeather())
throw new RunException("Welt %s hat kein Wetter", world.dimension.getDisplay()); throw new RunException("Welt %s hat kein Wetter", world.dimension.getDisplay());
else if(world.isExterminated()) else if(world.isExterminated())
throw new RunException("Welt %s ist zerstört", world.dimension.getDisplay()); throw new RunException("Welt %s ist zerstört", world.dimension.getDisplay());

View file

@ -992,11 +992,11 @@ public class Player extends User implements Executor, IPlayer
{ {
if (list.size() == 1) if (list.size() == 1)
{ {
this.sendPacket(getPacket(list.get(0), true, null, !this.entity.worldObj.dimension.hasNoLight())); this.sendPacket(getPacket(list.get(0), true, null, this.entity.worldObj.dimension.hasSkyLight()));
} }
else else
{ {
this.sendPacket(getPacket(list, !this.entity.worldObj.dimension.hasNoLight())); this.sendPacket(getPacket(list, this.entity.worldObj.dimension.hasSkyLight()));
} }
for (TileEntity tileentity : list1) for (TileEntity tileentity : list1)

View file

@ -27,7 +27,7 @@ public class ChunkServer extends Chunk {
public ChunkServer(World world, char[] data, int height, boolean base, boolean ceil, Random rand, Biome[] biomes, int x, int z) { public ChunkServer(World world, char[] data, int height, boolean base, boolean ceil, Random rand, Biome[] biomes, int x, int z) {
this(world, x, z); this(world, x, z);
boolean sky = !world.dimension.hasNoLight(); boolean sky = world.dimension.hasSkyLight();
for(int bx = 0; bx < 16; ++bx) { for(int bx = 0; bx < 16; ++bx) {
for(int bz = 0; bz < 16; ++bz) { for(int bz = 0; bz < 16; ++bz) {
for(int by = 0; by < height; ++by) { for(int by = 0; by < height; ++by) {

View file

@ -561,7 +561,7 @@ public class Region {
chunk.setInhabited(tag.getLong("InhabitedTime")); chunk.setInhabited(tag.getLong("InhabitedTime"));
List<TagObject> sects = tag.getList("Sections"); List<TagObject> sects = tag.getList("Sections");
BlockArray[] sections = new BlockArray[sects.size()]; BlockArray[] sections = new BlockArray[sects.size()];
boolean light = !world.dimension.hasNoLight(); boolean light = world.dimension.hasSkyLight();
for(int n = 0; n < sects.size(); ++n) { for(int n = 0; n < sects.size(); ++n) {
TagObject sect = sects.get(n); TagObject sect = sects.get(n);
@ -685,7 +685,7 @@ public class Region {
tag.setLong("InhabitedTime", chunk.getInhabited()); tag.setLong("InhabitedTime", chunk.getInhabited());
Set<BlockArray> sections = chunk.getStorage(); Set<BlockArray> sections = chunk.getStorage();
List<TagObject> sects = Lists.newArrayList(); List<TagObject> sects = Lists.newArrayList();
boolean light = !world.dimension.hasNoLight(); boolean light = world.dimension.hasSkyLight();
for(BlockArray storage : sections) { for(BlockArray storage : sections) {
if(storage != null) { if(storage != null) {

View file

@ -365,7 +365,7 @@ public final class WorldServer extends AWorldServer {
this.dropped.remove(v); this.dropped.remove(v);
} }
} }
int light = this.calculateSkylightSubtracted(true); int light = this.calcSkylightSubtracted(true);
if(light != this.getSkylightSubtracted()) if(light != this.getSkylightSubtracted())
this.setSkylightSubtracted(light); this.setSkylightSubtracted(light);
// if(this.primary) // if(this.primary)
@ -1008,7 +1008,7 @@ public final class WorldServer extends AWorldServer {
// } // }
// } // }
if((this.dimension.getType().weather && !this.dimension.isExterminated()) || force) { if((this.dimension.hasWeather() && !this.dimension.isExterminated()) || force) {
float prevDarkness = this.darkness; float prevDarkness = this.darkness;
float prevRain = this.rain; float prevRain = this.rain;
float prevFog = this.fog; float prevFog = this.fog;
@ -1070,7 +1070,7 @@ public final class WorldServer extends AWorldServer {
} }
} }
if((this.dimension.getType().days || (this.dimension.getType().weather && !this.dimension.isExterminated())) || force) { if((this.dimension.hasWeather() && !this.dimension.isExterminated()) || force) {
float prevTemp = this.temp; float prevTemp = this.temp;
float temp = this.getBaseTemperature() + this.weather.getTemperature(); float temp = this.getBaseTemperature() + this.weather.getTemperature();
@ -2633,7 +2633,7 @@ public final class WorldServer extends AWorldServer {
ChunkServer chunk = WorldServer.this.getChunk(this.position.x, this.position.z); ChunkServer chunk = WorldServer.this.getChunk(this.position.x, this.position.z);
if(chunk.isPopulated()) { if(chunk.isPopulated()) {
player.connection.sendPacket(Player.getPacket(chunk, true, new int[0], !WorldServer.this.dimension.hasNoLight())); player.connection.sendPacket(Player.getPacket(chunk, true, new int[0], WorldServer.this.dimension.hasSkyLight()));
} }
this.watching.remove(player); this.watching.remove(player);
@ -2725,7 +2725,7 @@ public final class WorldServer extends AWorldServer {
} }
} }
this.sendToAllPlayersWatchingChunk(Player.getPacket(WorldServer.this.getChunk(this.position.x, this.position.z), this.sendToAllPlayersWatchingChunk(Player.getPacket(WorldServer.this.getChunk(this.position.x, this.position.z),
this.biomes, extend, !WorldServer.this.dimension.hasNoLight())); this.biomes, extend, WorldServer.this.dimension.hasSkyLight()));
if(this.biomes) { if(this.biomes) {
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, Integer.MIN_VALUE, z, x + 16, Integer.MAX_VALUE, z + 16); List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, Integer.MIN_VALUE, z, x + 16, Integer.MAX_VALUE, z + 16);

View file

@ -22,7 +22,7 @@ public class FeatureDoublePlant
{ {
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && this.type.canPlaceBlockAt(worldIn, blockpos)) if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 254) && this.type.canPlaceBlockAt(worldIn, blockpos))
{ {
this.type.placeAt(worldIn, blockpos, 2); this.type.placeAt(worldIn, blockpos, 2);
flag = true; flag = true;

View file

@ -29,7 +29,7 @@ public class WorldGenFlowers extends FeatureGenerator
{ {
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.state)) if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.state))
{ {
worldIn.setState(blockpos, this.state, 2); worldIn.setState(blockpos, this.state, 2);
} }

View file

@ -21,7 +21,7 @@ public class WorldGenMushroom extends FeatureGenerator
{ {
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getState())) if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 511) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getState()))
{ {
worldIn.setState(blockpos, this.field_175908_a.getState(), 2); worldIn.setState(blockpos, this.field_175908_a.getState(), 2);
} }