add world size, space around worlds

This commit is contained in:
Sen 2025-07-13 20:34:50 +02:00
parent 629e8aadc5
commit c2dc0e7247
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
22 changed files with 214 additions and 123 deletions

View file

@ -1775,10 +1775,10 @@ public class Client implements IThreadListener {
this.world.getDarkness()
) + "\n" +
String.format("Zeitfaktor: %dx, Schwerkraft: %.2f m/s²",
Vars.timeFlow, this.world.gravity * 10.0
Vars.timeFlow, this.world.getGravity(this.viewEntity) * 10.0
) + "\n" +
String.format("Letzte Zeitsynch.: + %d.%d s",
ticked / 1000L, (ticked / 100L) % 10L
String.format("Letzte Zeitsynch.: + %d.%d s, Größe: %d .. %d",
ticked / 1000L, (ticked / 100L) % 10L, -this.world.dimension.getSize(), this.world.dimension.getSize()
) + "\n" +
"Startwert: " + this.world.dimension.getSeed() +
(this.serverInfo != null ? "\n" + this.serverInfo : "")

View file

@ -749,6 +749,7 @@ public class EntityRenderer {
{
float sun = world.getSunBrightness(1.0F);
float msun = sun * 0.95F + 0.05F;
float space = world.getSpaceFactor();
for (int n = 0; n < 256; ++n)
{
@ -768,6 +769,11 @@ public class EntityRenderer {
sgreen = (float)lightColor.yCoord * light;
sblue = (float)lightColor.zCoord * light;
}
if(space > 0.0f) {
sred = sred * (1.0F - space) + space;
sgreen = sgreen * (1.0F - space) + space;
sblue = sblue * (1.0F - space) + space;
}
if (world.getLastLightning() > 0)
{
Vec3 lightColor = world.getLightColor();
@ -1082,8 +1088,9 @@ public class EntityRenderer {
GL11.glPushMatrix();
this.setupFog(0, partialTicks);
// renderGlobalIn.renderClouds(partialTicks);
if(this.gm.world.dimension.getType().clouds)
renderGlobalIn.renderClouds(partialTicks);
float alpha = 0.8F * (1.0f - this.gm.world.getSpaceFactor());
if(this.gm.world.dimension.getType().clouds && alpha > 0.5f)
renderGlobalIn.renderClouds(alpha, partialTicks);
GlState.disableFog();
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_PROJECTION);

View file

@ -1357,7 +1357,7 @@ public class RenderGlobal
}
}
public void renderClouds(float partialTicks)
public void renderClouds(float alpha, float partialTicks)
{
GlState.disableCull();
float f = (float)(this.gm.getRenderViewEntity().lastTickPosY + (this.gm.getRenderViewEntity().posY - this.gm.getRenderViewEntity().lastTickPosY) * (double)partialTicks);
@ -1445,28 +1445,28 @@ public class RenderGlobal
if (f3 > -5.0F)
{
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, alpha).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, alpha).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, alpha).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, alpha).normal(0.0F, -1.0F, 0.0F).endVertex();
}
if (f3 <= 5.0F)
{
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, alpha).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, alpha).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, alpha).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, alpha).normal(0.0F, 1.0F, 0.0F).endVertex();
}
if (j1 > -1)
{
for (int l1 = 0; l1 < 8; ++l1)
{
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)l1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)l1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(-1.0F, 0.0F, 0.0F).endVertex();
}
}
@ -1474,10 +1474,10 @@ public class RenderGlobal
{
for (int i2 = 0; i2 < 8; ++i2)
{
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f24 + (float)i2 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i2 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, alpha).normal(1.0F, 0.0F, 0.0F).endVertex();
}
}
@ -1485,10 +1485,10 @@ public class RenderGlobal
{
for (int j2 = 0; j2 < 8; ++j2)
{
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)j2 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)j2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, -1.0F).endVertex();
}
}
@ -1496,10 +1496,10 @@ public class RenderGlobal
{
for (int k2 = 0; k2 < 8; ++k2)
{
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)k2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)k2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, alpha).normal(0.0F, 0.0F, 1.0F).endVertex();
}
}

View file

@ -55,11 +55,11 @@ public class ChunkEmpty extends ChunkClient {
return state;
}
public ChunkEmpty(WorldClient world, boolean debug) {
super(world, 0, 0);
public ChunkEmpty(WorldClient world, boolean out, boolean debug) {
super(world, out ? Integer.MAX_VALUE : 0, 0);
this.debug = debug;
this.liquidY = world.dimension.getSeaLevel() - 1;
this.liquid = world.dimension.isExterminated() ? Blocks.air.getState() : world.dimension.getLiquid();
this.liquid = out || 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

@ -48,6 +48,7 @@ public class WorldClient extends AWorldClient
private final Set<Long> nextEmptyChunkListing = Sets.<Long>newHashSet();
private ChunkClient emptyChunk;
private ChunkClient outsideChunk;
protected int lastLightning;
protected Vec3 lightColor = new Vec3(0xffffff);
@ -55,13 +56,19 @@ public class WorldClient extends AWorldClient
{
super(dim);
this.gm = gm;
this.emptyChunk = new ChunkEmpty(this, this.gm.debugWorld);
this.emptyChunk = new ChunkEmpty(this, false, this.gm.debugWorld);
this.outsideChunk = new ChunkEmpty(this, true, this.gm.debugWorld);
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.updatePhysics();
// this.setDifficulty(this.gm.difficulty);
}
private ChunkClient getEmptyChunk(int x, int z) {
int size = this.dimension.getSize() / 16;
return x < -size || z < -size || x >= size || z >= size ? this.outsideChunk : this.emptyChunk;
}
private void markReload(int cx, int cz, int range) {
this.nextEmptyChunkListing.clear();
for(int x = cx - range; x <= cx + range; x++) {
@ -74,7 +81,7 @@ public class WorldClient extends AWorldClient
}
continue;
}
this.chunkMapping.add(id, this.emptyChunk);
this.chunkMapping.add(id, this.getEmptyChunk(x, z));
this.emptyChunkListing.remove(id);
this.nextEmptyChunkListing.add(id);
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
@ -97,12 +104,13 @@ public class WorldClient extends AWorldClient
public void setExterminated(boolean exterminated) {
this.dimension.setExterminated(exterminated);
this.emptyChunk = new ChunkEmpty(this, this.gm.debugWorld);
this.emptyChunk = new ChunkEmpty(this, false, this.gm.debugWorld);
this.outsideChunk = new ChunkEmpty(this, true, 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.chunkMapping.add(id, this.getEmptyChunk(x, z));
this.markBlockRangeForRenderUpdate(x << 4, -World.MAX_SIZE_Y, z << 4, (x << 4) + 15, World.MAX_SIZE_Y, (z << 4) + 15);
}
}
@ -394,7 +402,7 @@ public class WorldClient extends AWorldClient
public ChunkClient getChunk(int x, int z)
{
ChunkClient chunk = this.chunkMapping.getValueByKey(LongHashMap.packInt(x, z));
return chunk == null ? this.emptyChunk : chunk;
return chunk == null ? this.getEmptyChunk(x, z) : chunk;
}
public ChunkClient getChunk(BlockPos pos) {
@ -686,7 +694,7 @@ public class WorldClient extends AWorldClient
f1 = 1.0F - f1;
f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength() * 5.0F) / 16.0D));
f1 = (float)((double)f1 * (1.0D - (double)(this.getDarkness() * 5.0F) / 16.0D));
return f1 * 0.8F + 0.2F;
return Math.max(f1 * 0.8F + 0.2F, this.getSpaceFactor());
}
private static int hsvToRGB(float hue, float saturation, float value)
@ -802,6 +810,13 @@ public class WorldClient extends AWorldClient
b = b * (1.0F - light) + (float)this.lightColor.zCoord * light;
}
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);
}
@ -841,6 +856,13 @@ public class WorldClient extends AWorldClient
b = b * shift + mul * (1.0F - shift);
}
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);
}
@ -860,6 +882,14 @@ public class WorldClient extends AWorldClient
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);
}
@ -867,14 +897,19 @@ public class WorldClient extends AWorldClient
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();
return Math.max(f1 * f1 * this.dimension.getStarBrightness(), this.getSpaceFactor());
}
public float getDeepStarBrightness(float partialTicks) {
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();
return Math.max(f1 * f1 * this.dimension.getDeepStarBrightness(), this.getSpaceFactor());
}
public float getSpaceFactor() {
Entity entity = this.gm.getRenderViewEntity();
return entity == null ? 0.0f : (float)this.getSpaceFactor(entity.posX, entity.posY, entity.posZ);
}
public int getLastLightning() {

View file

@ -1,13 +1,18 @@
package common.dimension;
public final class Area extends Dimension {
public static int widthToSize(int width) {
int size = width / 2;
return size - size % 16;
}
Area() {
super(true);
}
public Area(int sky, int fog, float temperature, int brightness) {
public Area(int sky, int fog, int width, float temperature, int brightness) {
super(false);
this.setPhysics(1L, 1L, 0.0f, 10.0f, temperature, brightness);
this.setPhysics(widthToSize(width), 1L, 1L, 0.0f, 10.0f, temperature, brightness);
this.setSkyColor(sky).setFogColor(fog);
}

View file

@ -16,7 +16,7 @@ public enum DimType {
private final String name;
public final String format;
public final boolean time;
public final boolean celestial;
public final boolean days;
public final boolean weather;
public final boolean celestials;
@ -26,7 +26,7 @@ public enum DimType {
private DimType(String name, String format, boolean time, boolean days, boolean weather, boolean celestials, boolean clouds, boolean sky) {
this.name = name;
this.format = format;
this.time = time;
this.celestial = time;
this.days = days;
this.weather = weather;
this.celestials = celestials;

View file

@ -18,6 +18,7 @@ import common.util.Vec3;
import common.vars.Vars;
import common.world.State;
import common.world.Weather;
import common.world.World;
public abstract class Dimension extends Nameable {
public class GeneratorSettings {
@ -172,6 +173,7 @@ public abstract class Dimension extends Nameable {
private long rotationPeriod = 1L;
private int timeQualifier = 9;
private int brightness = 0;
private int size = World.MAX_SIZE;
// server / gen
private Weather defaultWeather = Weather.CLEAR;
@ -545,8 +547,9 @@ public abstract class Dimension extends Nameable {
protected final Dimension setPhysics(long orbitalPeriod, long rotationPeriod, float orbitOffset, float gravity, float temperature,
protected final Dimension setPhysics(int size, long orbitalPeriod, long rotationPeriod, float orbitOffset, float gravity, float temperature,
int brightness) {
this.size = size;
this.orbitalPeriod = orbitalPeriod;
this.rotationPeriod = rotationPeriod;
this.orbitOffset = orbitOffset;
@ -695,6 +698,10 @@ public abstract class Dimension extends Nameable {
return this.gravity;
}
public final int getSize() {
return this.size;
}
public final int getTimeQualifier() {
@ -1153,6 +1160,7 @@ public abstract class Dimension extends Nameable {
this.blockColor = tag.getInt("BlockColor");
this.subtractBlock = tag.getBool("SubtractBlock");
this.gravity = tag.getFloat("Gravity");
this.size = tag.getInt("Size");
this.temperature = tag.getFloat("Temperature");
this.orbitOffset = tag.getFloat("OrbitOffset");
this.cloudHeight = tag.getFloat("CloudHeight");
@ -1332,6 +1340,7 @@ public abstract class Dimension extends Nameable {
tag.setInt("BlockColor", this.blockColor);
tag.setBool("SubtractBlock", this.subtractBlock);
tag.setFloat("Gravity", this.gravity);
tag.setInt("Size", this.size);
tag.setFloat("Temperature", this.temperature);
tag.setFloat("OrbitOffset", this.orbitOffset);
tag.setFloat("CloudHeight", this.cloudHeight);

View file

@ -7,9 +7,9 @@ public final class Moon extends Dimension {
super(true);
}
public Moon(int sky, int fog, long orbit, long rotation, float gravity, float temperature, int brightness) {
public Moon(int sky, int fog, int radius, long orbit, long rotation, float gravity, float temperature, int brightness) {
super(false);
this.setPhysics(orbit, rotation, 0.0f, gravity, temperature, brightness);
this.setPhysics(Planet.radiusToSize(Math.min(radius, 26000000)), orbit, rotation, 0.0f, gravity, temperature, brightness);
this.setTimeQualifier(7);
this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f);
this.setSkyColor(sky).setFogColor(fog);

View file

@ -4,28 +4,33 @@ import java.util.List;
import common.init.UniverseRegistry;
public final class Planet extends Dimension {
public static int radiusToSize(int radius) {
int size = (int)(Math.sqrt((double)radius * (double)radius * 4.0 * Math.PI) / 2.0);
return size - size % 16;
}
Planet() {
super(true);
}
public Planet(int sky, int fog, int clouds, long orbit, long rotation, float gravity, float temperature,
public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature,
int brightness) {
this(sky, fog, clouds, orbit, rotation, 0.0f, gravity, temperature, brightness);
this(sky, fog, clouds, radius, orbit, rotation, 0.0f, gravity, temperature, brightness);
}
public Planet(int sky, int fog, int clouds, long orbit, long rotation, float offset, float gravity,
public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float offset, float gravity,
float temperature) {
this(sky, fog, clouds, orbit, rotation, offset, gravity, temperature, 0);
this(sky, fog, clouds, radius, orbit, rotation, offset, gravity, temperature, 0);
}
public Planet(int sky, int fog, int clouds, long orbit, long rotation, float gravity, float temperature) {
this(sky, fog, clouds, orbit, rotation, 0.0f, gravity, temperature, 0);
public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float gravity, float temperature) {
this(sky, fog, clouds, radius, orbit, rotation, 0.0f, gravity, temperature, 0);
}
public Planet(int sky, int fog, int clouds, long orbit, long rotation, float offset, float gravity,
public Planet(int sky, int fog, int clouds, int radius, long orbit, long rotation, float offset, float gravity,
float temperature, int brightness) {
super(false);
this.setPhysics(orbit, rotation, offset, gravity, temperature, brightness);
this.setPhysics(radiusToSize(Math.min(radius, 26000000)), orbit, rotation, offset, gravity, temperature, brightness);
this.setTimeQualifier(7);
this.setStarBrightness(0.5f).setDeepStarBrightness(0.0f);
this.setSkyColor(sky).setFogColor(fog).setCloudColor(clouds);

View file

@ -5,9 +5,9 @@ public final class Semi extends Dimension {
super(true);
}
public Semi(int sky, int fog, int clouds, float temperature, int brightness) {
public Semi(int sky, int fog, int clouds, int width, float temperature, int brightness) {
super(false);
this.setPhysics(1L, 1L, 0.0f, 10.0f, temperature, brightness);
this.setPhysics(Area.widthToSize(width), 1L, 1L, 0.0f, 10.0f, temperature, brightness);
this.setStarBrightness(0.5f).setDeepStarBrightness(0.5f);
this.setSkyColor(sky).setFogColor(fog).setCloudColor(clouds);
}

View file

@ -1,13 +1,14 @@
package common.dimension;
import common.biome.Biome;
import common.world.World;
public final class Space extends Dimension {
public static final Space INSTANCE = new Space();
private Space() {
super(false);
this.setPhysics(1L, 1L, 0.0f, 0.0f, 2.7f, 15).setTimeQualifier(8);
this.setPhysics(World.MAX_SIZE, 1L, 1L, 0.0f, 0.0f, 2.7f, 15).setTimeQualifier(8);
this.setBiome(Biome.SPACE).setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
}

View file

@ -7,9 +7,9 @@ public final class Star extends Dimension {
super(true);
}
public Star(int color, float gravity, float temp, State surface, int height) {
public Star(int color, int radius, float gravity, float temp, State surface, int height) {
super(false);
this.setPhysics(1L, 1L, 0.0f, gravity, temp, 15);
this.setPhysics(Planet.radiusToSize(Math.min(radius, 945000000) / 25), 1L, 1L, 0.0f, gravity, temp, 15);
this.setTimeQualifier(7);
this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f);
this.setSkyColor(color).setFogColor(color).setFlatGen(surface, height);

View file

@ -407,7 +407,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
public void fall(float distance, float damageMultiplier)
{
damageMultiplier = Math.max(0.0f, damageMultiplier - (1.65f - (float)this.worldObj.gravity * 1.65f));
damageMultiplier = Math.max(0.0f, damageMultiplier - (1.65f - (float)this.worldObj.getGravity(this) * 1.65f));
if (distance > 1.0F)
{
this.playSound(SoundEvent.HORSE_LAND, 0.4F);

View file

@ -3966,7 +3966,7 @@ public abstract class EntityNPC extends EntityLiving
super.fall(distance, damageMultiplier);
return;
}
if (!this.noclip && this.worldObj.gravity != 0.0)
if (!this.noclip && this.worldObj.getGravity(this) != 0.0)
{
if (distance >= 2.0F)
{
@ -3980,7 +3980,7 @@ public abstract class EntityNPC extends EntityLiving
public void makeLandingParticles(BlockPos pos)
{
if (!this.isPlayer() || (!this.noclip && this.worldObj.gravity != 0.0))
if (!this.isPlayer() || (!this.noclip && this.worldObj.getGravity(this) != 0.0))
{
super.makeLandingParticles(pos);
}
@ -4241,7 +4241,7 @@ public abstract class EntityNPC extends EntityLiving
}
public boolean isFlying() {
return this.flying || this.worldObj.gravity == 0.0;
return this.flying || this.worldObj.getGravity(this) == 0.0;
}
public boolean canNaturallyFly() {

View file

@ -1111,7 +1111,7 @@ public abstract class EntityLiving extends Entity
public void fall(float distance, float damageMultiplier)
{
damageMultiplier = Math.max(0.0f, damageMultiplier - (1.65f - (float)this.worldObj.gravity * 1.65f));
damageMultiplier = Math.max(0.0f, damageMultiplier - (1.65f - (float)this.worldObj.getGravity(this) * 1.65f));
super.fall(distance, damageMultiplier);
StatusEffect potioneffect = this.getEffect(Effect.JUMP);
float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
@ -1602,7 +1602,7 @@ public abstract class EntityLiving extends Entity
}
else
{
this.motionY -= 0.08D * this.worldObj.gravity;
this.motionY -= 0.08D * this.worldObj.getGravity(this);
}
this.motionY *= 0.9800000190734863D;
@ -1617,7 +1617,7 @@ public abstract class EntityLiving extends Entity
this.motionX *= 0.5D;
this.motionY *= 0.5D;
this.motionZ *= 0.5D;
this.motionY -= 0.02D * this.worldObj.gravity;
this.motionY -= 0.02D * this.worldObj.getGravity(this);
if (this.collidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + d1, this.motionZ))
{
@ -1654,7 +1654,7 @@ public abstract class EntityLiving extends Entity
this.motionX *= (double)f1;
this.motionY *= 0.800000011920929D;
this.motionZ *= (double)f1;
this.motionY -= 0.02D * this.worldObj.gravity;
this.motionY -= 0.02D * this.worldObj.getGravity(this);
if (this.collidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + d0, this.motionZ))
{

View file

@ -310,8 +310,8 @@ public abstract class UniverseRegistry {
registerDimension("space", "Der Weltraum", Space.INSTANCE);
registerGalaxy("milkyway", "Milchstraße");
registerSector("solar", "Solar", "milkyway");
registerStar("sol", "Sol", new Star(0xff7f00, 274.0f, 5778.0f, Blocks.lava.getState(), 128).setTimeQualifier(1), "solar");
registerPlanet("terra", "Terra", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, World.EARTH_YEAR, 24000L, 28.0f, 9.81f,
registerStar("sol", "Sol", new Star(0xff7f00, 695508000, 274.0f, 5778.0f, Blocks.lava.getState(), 128).setTimeQualifier(1), "solar");
registerPlanet("terra", "Terra", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, 6378136, World.EARTH_YEAR, 24000L, 28.0f, 9.81f,
259.15f).setTimeQualifier(0)
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
.setBiomeReplacer(Blocks.gravel.getState())
@ -337,49 +337,49 @@ public abstract class UniverseRegistry {
.addOre(Blocks.ruby_ore.getState(), 1, 0, 4, 12, 8, true)
.addOre(Blocks.cinnabar_ore.getState(), 1, 0, 11, 0, 24, false)
.enableVillages().enableMineshafts().enableScattered().enableStrongholds(), "sol");
registerMoon("luna", "Luna", new Moon(0x333333, 0x333333, 655728L, 655728L, 1.62f, 210.0f, 8)
registerMoon("luna", "Luna", new Moon(0x333333, 0x333333, 1737100, 655728L, 655728L, 1.62f, 210.0f, 8)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63).setBiome(Biome.MOON)
.setTimeQualifier(1), "terra");
registerPlanet("mercury", "Merkur", new Planet(0x666666, 0x535353, 0x858585, 2111297L, 1407509L, 3.7f, 440.0f)
registerPlanet("mercury", "Merkur", new Planet(0x666666, 0x535353, 0x858585, 2440530, 2111297L, 1407509L, 3.7f, 440.0f)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerPlanet("venus", "Venus", new Planet(0xc0c0c0, 0xa0a0a0, 0xe0e0e0, 5392908L, 5832449L, 8.87f, 737.0f)
registerPlanet("venus", "Venus", new Planet(0xc0c0c0, 0xa0a0a0, 0xe0e0e0, 6051800, 5392908L, 5832449L, 8.87f, 737.0f)
.setPerlinGen(Blocks.sand.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerPlanet("mars", "Mars", new Planet(0xd6905b, 0xbd723a, 0xbd9273, 16487781L, 24623L, 3.71f, 208.0f)
registerPlanet("mars", "Mars", new Planet(0xd6905b, 0xbd723a, 0xbd9273, 3396190, 16487781L, 24623L, 3.71f, 208.0f)
.setPerlinGen(Blocks.red_sand.getState(),
Blocks.air.getState(), 63).setTimeQualifier(1), "sol");
registerPlanet("jupiter", "Jupiter", new Planet(0xffd5ba, 0xb89f90, 0xc7b5a9, 103989391L, 9925L, 24.79f, 163.0f).enableDenseFog()
registerPlanet("jupiter", "Jupiter", new Planet(0xffd5ba, 0xb89f90, 0xc7b5a9, 71492000, 103989391L, 9925L, 24.79f, 163.0f).enableDenseFog()
.setFlatGen(Blocks.hydrogen.getState(), 256).setTimeQualifier(1).setCloudHeight(576.0f), "sol");
registerPlanet("saturn", "Saturn", new Planet(0xf1d1a1, 0xd3b385, 0xeed7b5, 258141008L, 10656L, 10.44f, 133.0f).enableDenseFog()
registerPlanet("saturn", "Saturn", new Planet(0xf1d1a1, 0xd3b385, 0xeed7b5, 60268000, 258141008L, 10656L, 10.44f, 133.0f).enableDenseFog()
.setFlatGen(Blocks.hydrogen.getState(), 256).setTimeQualifier(1).setCloudHeight(576.0f), "sol");
registerPlanet("uranus", "Uranus", new Planet(0xcee6ff, 0xadd2f9, 0x8eb0d3, 736503770L, 17240L, 8.87f, 78.0f)
registerPlanet("uranus", "Uranus", new Planet(0xcee6ff, 0xadd2f9, 0x8eb0d3, 25559000, 736503770L, 17240L, 8.87f, 78.0f)
.setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70)
.addOre(Blocks.diamond_ore.getState(), 4, 4, 12, 0, 60, false)
.setTimeQualifier(1), "sol");
registerPlanet("neptune", "Neptun", new Planet(0xb4d9ff, 0x85bef9, 0x649bd3, 1444584441L, 16110L, 11.15f, 72.0f)
registerPlanet("neptune", "Neptun", new Planet(0xb4d9ff, 0x85bef9, 0x649bd3, 24764000, 1444584441L, 16110L, 11.15f, 72.0f)
.setPerlinGen(Blocks.packed_ice.getState(), Blocks.water.getState(), 70)
.addOre(Blocks.diamond_ore.getState(), 4, 2, 1, 0, 60, false)
.setTimeQualifier(1), "sol");
registerPlanet("ceres", "Ceres", new Planet(0x666666, 0x535353, 0x858585, 40315496L, 9074L, 0.27f, 167.0f)
registerPlanet("ceres", "Ceres", new Planet(0x666666, 0x535353, 0x858585, 473000, 40315496L, 9074L, 0.27f, 167.0f)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerPlanet("pluto", "Pluto", new Planet(0x666666, 0x535353, 0x858585, 2173127098L, 153293L, 0.62f, 40.0f)
registerPlanet("pluto", "Pluto", new Planet(0x666666, 0x535353, 0x858585, 1188300, 2173127098L, 153293L, 0.62f, 40.0f)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerPlanet("haumea", "Haumea", new Planet(0x666666, 0x535353, 0x858585, 2487831667L, 3914L, 0.63f, 48.0f)
registerPlanet("haumea", "Haumea", new Planet(0x666666, 0x535353, 0x858585, 816000, 2487831667L, 3914L, 0.63f, 48.0f)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerPlanet("makemake", "Makemake", new Planet(0x666666, 0x535353, 0x858585, 2684193293L, 22826L, 0.4f, 30.0f)
registerPlanet("makemake", "Makemake", new Planet(0x666666, 0x535353, 0x858585, 715000, 2684193293L, 22826L, 0.4f, 30.0f)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerPlanet("eris", "Eris", new Planet(0x666666, 0x535353, 0x858585, 4900274496L, 378862L, 0.82f, 30.0f)
registerPlanet("eris", "Eris", new Planet(0x666666, 0x535353, 0x858585, 1163000, 4900274496L, 378862L, 0.82f, 30.0f)
.setPerlinGen(Blocks.moon_rock.getState(), Blocks.air.getState(), 63)
.setTimeQualifier(1), "sol");
registerStar("girok", "Gi'rok", new Star(0xff8f00, 232.0f, 5220.0f, Blocks.lava.getState(), 112).setTimeQualifier(2), "solar");
registerPlanet("gharoth", "'Elbenplanet Gharoth'", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, 4837386L, 52960L, 30.0f, 10.0f, 257.3f)
registerStar("girok", "Gi'rok", new Star(0xff8f00, 603421976, 232.0f, 5220.0f, Blocks.lava.getState(), 112).setTimeQualifier(2), "solar");
registerPlanet("gharoth", "'Elbenplanet Gharoth'", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, 2806382, 4837386L, 52960L, 30.0f, 10.0f, 257.3f)
.setTimeQualifier(2).setSimpleGen(Blocks.dirt.getState(), Blocks.water.getState(), 64)
.setSimpleReplacer(Blocks.gravel.getState(), Blocks.sand.getState()).setBiome(Biome.ELVENFOREST)
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs().enableSnow()
@ -389,7 +389,7 @@ public abstract class UniverseRegistry {
.addLiquid(Blocks.flowing_lava.getState(), 20, 8, 255, true)
.addOre(Blocks.thetium_ore.getState(), 1, 0, 3, 0, 14, false)
.addOre(Blocks.gyriyn_ore.getState(), 0, 2, 3, 0, 12, false), "girok");
registerPlanet("transylvania", "'Vampirplanet Transsylvanien'", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
registerPlanet("transylvania", "'Vampirplanet Transsylvanien'", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, 8374921, 33850466L, 49760L, 20.0f, 10.0f, 255.5f)
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.water.getState(), 63)
.setBiomeReplacer(Blocks.gravel.getState()).setBiomeGen(Biome.FOREST, true, 5, 3, 3, 30)
.enableCavesRavines(Blocks.lava.getState()).setDungeons(10).enableMobs().enableSnow()
@ -401,13 +401,13 @@ public abstract class UniverseRegistry {
.addOre(Blocks.lead_ore.getState(), 2, 0, 8, 0, 8, false)
.addOre(Blocks.ardite_ore.getState(), 0, 2, 3, 0, 12, false)
.addOre(Blocks.nichun_ore.getState(), 0, 10, 1, 0, 10, false), "girok");
registerMoon("yrdinath", "'Eismond Yrdinath'", new Moon(0xccccff, 0xccccff, 46743637L, 17460L, 2.5f, 239.15f, 8).setTimeQualifier(4)
registerMoon("yrdinath", "'Eismond Yrdinath'", new Moon(0xccccff, 0xccccff, 2503812, 46743637L, 17460L, 2.5f, 239.15f, 8).setTimeQualifier(4)
.setPerlinGen(Blocks.snow.getState(), Blocks.ice.getState(), 63).setBiome(Biome.SNOWLAND)
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW), "transylvania");
registerMoon("mythril", "'Eismond Mythril'", new Moon(0xbbbbff, 0xbbbbff, 42659432L, 15330L, 2.25f, 221.65f, 8).setTimeQualifier(4)
registerMoon("mythril", "'Eismond Mythril'", new Moon(0xbbbbff, 0xbbbbff, 2213749, 42659432L, 15330L, 2.25f, 221.65f, 8).setTimeQualifier(4)
.setPerlinGen(Blocks.snow.getState(), Blocks.ice.getState(), 63).setBiome(Biome.SNOWLAND)
.enableMobs().enableSnow().setDefaultWeather(Weather.SNOW), "transylvania");
registerPlanet("mesar", "'Wüstenplanet Me'sar'", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 56643366L, 87340L, 11.0f, 333.15f)
registerPlanet("mesar", "'Wüstenplanet Me'sar'", new Planet(0xff7f3f, 0xff6022, 0xff6f00, 9823183, 56643366L, 87340L, 11.0f, 333.15f)
.setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63)
.setBiomeReplacer(Blocks.red_sand.getState())
.setBiomeGen(Biome.MESA, true, 3, 1000, 100000, 100000)
@ -423,8 +423,8 @@ public abstract class UniverseRegistry {
registerGalaxy("drkthrn", "Drkthrn");
registerSector("blvck", "Blvck", "drkthrn");
registerStar("ovrol", "Ov'rol", new Star(0x000000, 302.0f, 12666.0f, Blocks.goo.getState(), 192), "blvck");
registerPlanet("blackplanet", "'Schwarzplanet'", new Planet(0x000000, 0x000000, 0x000000, 4632918508L, 204556L, 12.0f, 0.0f)
registerStar("ovrol", "Ov'rol", new Star(0x000000, 832718528, 302.0f, 12666.0f, Blocks.goo.getState(), 192), "blvck");
registerPlanet("blackplanet", "'Schwarzplanet'", new Planet(0x000000, 0x000000, 0x000000, 13038204, 4632918508L, 204556L, 12.0f, 0.0f)
.setPerlinGen(Blocks.blackened_stone.getState(), Blocks.goo.getState(), 63)
.setBiomeReplacer(Blocks.blackened_cobble.getState()).setBiome(Biome.BLACKENED)
.enableCaves(Blocks.air.getState()).setDungeons(4).enableMobs()
@ -432,7 +432,7 @@ public abstract class UniverseRegistry {
// .addOre(Blocks.PLACEHOLDER_ore.getState(), 0, 2, 3, 0, 12, false)
, "ovrol");
registerSemi("warp", "Der Warp", new Semi(0x0c001f, 0x0c001f, 0x190033, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f)
registerSemi("warp", "Der Warp", new Semi(0x0c001f, 0x0c001f, 0x190033, 124072917, 285.0f, 3).setCloudTexture(CloudType.DENSE).setCloudHeight(238.0f)
.setPerlinGen(Blocks.obsidian.getState(), Blocks.lava.getState(), 63)
.setBiome(Biome.CHAOS).enableCavesRavines(Blocks.air.getState()).enableLongCaves().enableMobs().enableSnow()
.addLake(Blocks.water.getState(), null, Blocks.obsidian.getState(), 8, 0, 255, false)
@ -443,41 +443,41 @@ public abstract class UniverseRegistry {
.setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4));
registerDomain("tianxin", "Tian'Xin");
registerArea("nienrath", "Ni'enrath", new Area(0x7f00ff, 0x7f00ff, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
registerArea("nienrath", "Ni'enrath", new Area(0x7f00ff, 0x7f00ff, 532109, 276.15f, 1).setLightColor(0x07000f).setBlockColor(0xcf6fff)
.setPerlinGen(Blocks.tian.getState(), Blocks.springwater.getState(), 63).setBiome(Biome.TIAN)
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
.addLake(Blocks.springwater.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
.addLiquid(Blocks.flowing_springwater.getState(), 50, 8, 255, false), "tianxin");
registerDomain("digital", "Digital");
registerArea("cyberspace", "Cyberspace", new Area(0x000000, 0x000000, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction()
registerArea("cyberspace", "Cyberspace", new Area(0x000000, 0x000000, 16777216, 293.15f, 15).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction()
.setFlatGen(Blocks.green_clay.getState(), 2)
.enableMobs(), "digital");
registerDomain("hell", "Hölle");
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 0x330707, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses()
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 0x330707, 105639735, 347.15f, 2).enableLongCaves().enableMobs().enableFortresses()
.enableWorldCeiling().enableDenseFog()
.setCavernGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setSurfaceReplacer(Blocks.gravel.getState(), Blocks.soul_sand.getState())
.setBiome(Biome.UPPERHELL), "hell");
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 0x990000, 387.15f, 3).enableLongCaves().enableMobs()
registerArea("kyroth", "Kreis Kyroth", new Area(0x990000, 0x990000, 86742970, 387.15f, 3).enableLongCaves().enableMobs()
.setSimpleGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 64)
.setSimpleReplacer(Blocks.obsidian.getState(), Blocks.soul_sand.getState())
.setBiome(Biome.LOWERHELL)
.addLake(Blocks.lava.getState(), null, null, 4, 8, 255, false)
.addLiquid(Blocks.flowing_lava.getState(), 40, 8, 255, true), "hell");
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 0xcc0000, 467.15f, 15).enableLongCaves().enableMobs()
registerArea("ahrd", "Kreis Ahrd", new Area(0xcc0000, 0xcc0000, 67028432, 467.15f, 15).enableLongCaves().enableMobs()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.lava.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.HELLHILLS)
.addLake(Blocks.lava.getState(), Blocks.soul_sand.getState(), Blocks.soul_sand.getState(),
2, 8, 255, false).addLiquid(Blocks.flowing_lava.getState(), 80, 8, 255, true), "hell");
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 0xff0000, 1067.15f, 15).enableMobs()
registerArea("mizorath", "Kreis Mizorath", new Area(0xff0000, 0xff0000, 54029584, 1067.15f, 15).enableMobs()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.blood.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOULPLAINS), "hell");
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 0xff3f0c, 1707.15f, 15).enableMobs()
registerArea("dargoth", "Kreis Dargoth", new Area(0xff3f0c, 0xff3f0c, 43293629, 1707.15f, 15).enableMobs()
.setPerlinGen(Blocks.hellrock.getState(), Blocks.magma.getState(), 63)
.setBiomeReplacer(Blocks.soul_sand.getState()).setBiome(Biome.SOULPLAINS), "hell");
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 0x191919, 2482.0f, 1).enableLongCaves().enableMobs()
registerArea("aasirith", "Kreis Aasirith", new Area(0x191919, 0x191919, 36291872, 2482.0f, 1).enableLongCaves().enableMobs()
.setPerlinGen(Blocks.rock.getState(), Blocks.magma.getState(), 63)
.setBiomeReplacer(Blocks.ash.getState()).setBiome(Biome.ASHLAND)
.addLake(Blocks.lava.getState(), Blocks.rock.getState(), Blocks.rock.getState(),

View file

@ -56,7 +56,8 @@ public abstract class Chunk {
this.world = world;
this.xPos = x;
this.zPos = z;
this.filler = world.dimension.isExterminated() ? Blocks.coal_block.getState() : world.dimension.getFiller();
int size = world.dimension.getSize() / 16;
this.filler = x < -size || z < -size || x >= size || z >= size ? Blocks.air.getState() : (world.dimension.isExterminated() ? Blocks.coal_block.getState() : world.dimension.getFiller());
this.fillerBlock = this.filler.getBlock();
for(int y = 0; y < this.entities.length; ++y) {
this.entities[y] = new InheritanceMultiMap(Entity.class);

View file

@ -18,6 +18,7 @@ import common.block.tech.BlockAnvil;
import common.block.tech.BlockHopper;
import common.collect.Lists;
import common.collect.Sets;
import common.dimension.DimType;
import common.dimension.Dimension;
import common.entity.Entity;
import common.entity.item.EntityExplosion;
@ -57,11 +58,8 @@ public abstract class World implements IWorldAccess {
public static final long START_TIME = 4385238000L;
public static final float ABSOLUTE_ZERO = -273.15f;
public static final long EARTH_YEAR = 8766144L;
// private static final Calendar calendar = Calendar.getInstance();
// private static long lastUpdate;
public final boolean client;
public double gravity = 1.0;
public final Random rand = new Random();
public final List<Entity> entities = Lists.<Entity>newArrayList();
protected final List<Entity> unloaded = Lists.<Entity>newArrayList();
@ -76,6 +74,7 @@ public abstract class World implements IWorldAccess {
protected final int[] lightUpdate = new int[32768];
public final Dimension dimension;
protected double gravity = 1.0;
protected boolean loadTiles;
protected int subtract;
protected float rain;
@ -130,14 +129,14 @@ public abstract class World implements IWorldAccess {
public void updatePhysics() {
this.gravity = (double)this.dimension.getGravity() * 0.1 * Vars.gravity;
if(Math.abs(this.gravity) < 0.075)
this.gravity = Math.signum(this.gravity) * 0.075;
this.gravity = 0.0;
}
public String formatImperialTime(boolean days) {
long time = this.daytime;
long year = time / EARTH_YEAR;
long frac = (time * 1000L / EARTH_YEAR) % 1000L;
if(!this.dimension.getType().time) {
if(!this.dimension.getType().celestial) {
return String.format("%d.%03d.%03d.M%d" + (days ? " T???.??? D???.???.G?" : ""), this.dimension.getTimeQualifier(),
frac, year % 1000L, year / 1000L + 1L);
}
@ -2055,6 +2054,28 @@ public abstract class World implements IWorldAccess {
// }
}
public double getSpaceFactor(double x, double y, double z) {
if(this.dimension.getType() == DimType.SEMI)
return ExtMath.clampd((y - (double)World.MAX_SIZE_Y) / 16384.0, 0.0, 1.0);
else if(!this.dimension.getType().celestial)
return 0.0;
double r = (double)this.dimension.getSize();
double xm = (Math.abs(x) - r) / 16384.0;
double ym = (Math.abs(y) - (double)World.MAX_SIZE_Y) / 16384.0;
double zm = (Math.abs(z) - r) / 16384.0;
return ExtMath.clampd(Math.max(Math.max(xm, zm), ym), 0.0, 1.0);
}
public double getGravity(double x, double y, double z) {
double gravity = this.gravity * (1.0 - this.getSpaceFactor(x, y, z));
return Math.abs(gravity) < 0.075 ? 0.0 : gravity;
}
public double getGravity(Entity entity) {
double gravity = this.gravity * (1.0 - this.getSpaceFactor(entity.posX, entity.posY, entity.posZ));
return Math.abs(gravity) < 0.075 ? 0.0 : gravity;
}
// public void setItemData(String dataID, WorldSavedData worldSavedDataIn) {
// }
//

View file

@ -35,7 +35,7 @@ public class CommandLoad extends Command {
star = star == null ? UniverseRegistry.getName(new Random().pick(Lists.newArrayList(UniverseRegistry.getStars()))) : star;
if(!UniverseRegistry.isType(star, DimType.STAR) || UniverseRegistry.isRegistered(name))
return null;
Planet dim = new Planet(sky, fog, clouds, orbit, rotation, offset, gravity, temperature, brightness);
Planet dim = new Planet(sky, fog, clouds, 17000000, orbit, rotation, offset, gravity, temperature, brightness);
dim.setTimeQualifier(3);
return UniverseRegistry.registerCustomPlanet(name, custom, dim, star);
}
@ -59,7 +59,7 @@ public class CommandLoad extends Command {
do {
sname = NameRegistry.FANTASY.generate(rand, rand.range(2, 5));
} while(UniverseRegistry.isRegistered(sname.toLowerCase()));
Star star = new Star(0xff0000 | (rand.range(0x60, 0xa0) << 8),
Star star = new Star(0xff0000 | (rand.range(0x60, 0xa0) << 8), rand.range(300000000, 1200000000),
rand.frange(200.0f, 400.0f), rand.frange(5000.0f, 7000.0f),
rand.pick(Blocks.lava.getState(), Blocks.magma.getState()), rand.range(64, 212));
UniverseRegistry.registerCustomGalaxy(galaxy.toLowerCase(), galaxy);

View file

@ -94,6 +94,12 @@ public class ChunkServer extends Chunk {
this.genSkyLight();
}
public ChunkServer(World world, Biome biome, int x, int z) {
this(world, x, z);
Arrays.fill(this.biomes, (char)biome.id);
this.genSkyLight();
}
public int getTopSegment() {
return this.top;
}

View file

@ -165,12 +165,13 @@ public final class WorldServer extends AWorldServer {
private FeatureLiquids[] liquids;
private long seed;
private int height;
private int size;
private int seaLevel;
private boolean mobs;
private boolean snow;
private boolean populate;
private boolean updateForced;
private int updatesForced;
private boolean loadersModified;
private int emptyTicks;
private int blockEvtIdx;
@ -180,10 +181,6 @@ public final class WorldServer extends AWorldServer {
private long prevUpdate;
private long time;
public static float clampGravity() {
return ExtMath.clampf(Vars.gravity, -10.0f, 10.0f);
}
public void sendPacket(Packet packet) {
for(Player conn : this.server.getPlayers()) {
if(conn.getEntity() != null && conn.getEntity().worldObj == this) {
@ -349,10 +346,6 @@ public final class WorldServer extends AWorldServer {
}
}
public Server getServer() {
return this.server;
}
public void tick() {
this.updatePhysics();
this.updateWeather(false);
@ -608,7 +601,8 @@ public final class WorldServer extends AWorldServer {
NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn);
int i = 0;
if(this.updateForced && blockIn != Blocks.air) {
if(this.updatesForced > 0 && blockIn != Blocks.air) {
--this.updatesForced;
if(blockIn.requiresUpdates()) {
i = 8;
@ -1358,6 +1352,10 @@ public final class WorldServer extends AWorldServer {
ChunkServer chunk = this.getChunk(x, z);
if(!chunk.isTerrainPopulated()) {
chunk.checkLight();
if(x < -this.size || z < -this.size || x >= this.size || z >= this.size) {
chunk.setModified(true);
return;
}
BlockFalling.fallInstantly = true;
int bx = x * 16;
int bz = z * 16;
@ -1429,6 +1427,8 @@ public final class WorldServer extends AWorldServer {
}
private ChunkServer generate(int x, int z) {
if(x < -this.size || z < -this.size || x >= this.size || z >= this.size)
return new ChunkServer(this, Biome.SPACE, x, z);
this.grng.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
ChunkPrimer primer = new ChunkPrimer(this.height);
this.generator.generateChunk(this, x, z, primer);
@ -1614,6 +1614,7 @@ public final class WorldServer extends AWorldServer {
this.liquids = exterminated ? null : this.createLiquids();
this.dungeons = exterminated ? null : this.createDungeonGenerator();
this.height = this.generator.getMaximumHeight();
this.size = this.dimension.getSize() / 16;
if(this.villageGen != null) {
TagObject tag = null;
try {
@ -1654,9 +1655,9 @@ public final class WorldServer extends AWorldServer {
}
public void forceBlockUpdateTick(Block blockType, BlockPos pos, Random random) {
this.updateForced = true;
this.updatesForced = 128;
blockType.updateTick(this, pos, this.getState(pos), random);
this.updateForced = false;
this.updatesForced = 0;
}
public Village getNearestVillage(BlockPos doorBlock, int radius) {