initial commit

This commit is contained in:
Sen 2025-03-11 00:23:54 +01:00 committed by Sen
parent 3c9ee26b06
commit 22186c33b9
1458 changed files with 282792 additions and 0 deletions

View file

@ -0,0 +1,17 @@
package game.dimension;
public final class Area extends Dimension {
Area(int id, String name) {
super(id, name);
}
public Area(int id, String name, int sky, int fog, float temperature, int brightness) {
super(id, name);
this.setPhysics(1L, 1L, 0.0f, 10.0f, temperature, brightness);
this.setSkyColor(sky).setFogColor(fog);
}
public final DimType getType() {
return DimType.AREA;
}
}

View file

@ -0,0 +1,54 @@
package game.dimension;
import java.util.Map;
import game.collect.Maps;
public enum DimType {
STAR("star", "Stern %s", true, false, false, false, false, false, true),
PLANET("planet", "Planet %s", true, true, true, true, true, true, true),
MOON("moon", "Mond %s", true, false, false, true, false, false, true),
SPACE("space", "%s", false, false, false, false, false, false, true),
SEMI("semi", "%s", false, false, true, false, false, true, true),
AREA("area", "%s", false, false, false, false, false, false, false);
private static final Map<String, DimType> LOOKUP = Maps.newHashMap();
private final String name;
public final String format;
public final boolean time;
public final boolean days;
public final boolean weather;
public final boolean sun;
public final boolean moon;
public final boolean clouds;
public final boolean sky;
private DimType(String name, String format,
boolean time, boolean days, boolean weather, boolean sun, boolean moon, boolean clouds, boolean sky) {
this.name = name;
this.format = format;
this.time = time;
this.days = days;
this.weather = weather;
this.sun = sun;
this.moon = moon;
this.clouds = clouds;
this.sky = sky;
}
public String getName() {
return this.name;
}
public static DimType getByName(String name) {
DimType type = LOOKUP.get(name.toLowerCase());
return type == null ? PLANET : type;
}
static {
for(DimType type : values()) {
LOOKUP.put(type.name, type);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
package game.dimension;
import java.util.Set;
import game.collect.Sets;
public final class Domain extends Nameable implements Comparable<Domain> {
public final String id;
private final Set<Area> areas = Sets.newTreeSet();
public Domain(String id) {
this.id = id;
}
public void addArea(Area area) {
this.areas.add(area);
}
public int compareTo(Domain other) {
return other == null ? -1 : this.id.compareTo(other.id);
}
protected String getNameIdentifier() {
return "%s";
}
protected String getIdentifier() {
return this.id;
}
}

View file

@ -0,0 +1,30 @@
package game.dimension;
import java.util.Set;
import game.collect.Sets;
public final class Galaxy extends Nameable implements Comparable<Galaxy> {
public final String id;
private final Set<Sector> sectors = Sets.newTreeSet();
public Galaxy(String id) {
this.id = id;
}
public void addSector(Sector sector) {
this.sectors.add(sector);
}
public int compareTo(Galaxy other) {
return other == null ? -1 : this.id.compareTo(other.id);
}
protected String getNameIdentifier() {
return "Galaxie %s";
}
protected String getIdentifier() {
return this.id;
}
}

View file

@ -0,0 +1,19 @@
package game.dimension;
public final class Moon extends Dimension {
Moon(int id, String name) {
super(id, name);
}
public Moon(int id, String name, int sky, int fog, long orbit, long rotation, float gravity, float temperature, int brightness) {
super(id, name);
this.setPhysics(orbit, rotation, 0.0f, gravity, temperature, brightness);
this.setTimeQualifier(7);
this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f);
this.setSkyColor(sky).setFogColor(fog);
}
public final DimType getType() {
return DimType.MOON;
}
}

View file

@ -0,0 +1,43 @@
package game.dimension;
import game.nbt.NBTTagCompound;
public abstract class Nameable {
protected String customName = null;
public final String getCustomName() {
return this.customName;
}
public final void setCustomName(String name) {
this.customName = name;
}
public void readNbt(NBTTagCompound tag) {
this.customName = tag.hasKey("CustomName", 8) ? tag.getString("CustomName") : null;
}
public void writeNbt(NBTTagCompound tag) {
if(this.customName != null)
tag.setString("CustomName", this.customName);
}
protected abstract String getNameIdentifier();
protected abstract String getIdentifier();
public final String getNameString() {
return this.customName != null && !this.customName.isEmpty()
? (this.customName.startsWith("'") && this.customName.endsWith("'") && this.customName.length() > 2
? this.customName.substring(1, this.customName.length() - 1) :
String.format(this.getNameIdentifier(), this.customName)) :
String.format(this.getNameIdentifier(), this.getIdentifier());
}
// public final Text getNameComponent() {
// return this.customName != null && !this.customName.isEmpty()
// ? (this.customName.startsWith("'") && this.customName.endsWith("'") && this.customName.length() > 2
// ? new Text(this.customName.substring(1, this.customName.length() - 1)) :
// new Text(this.getNameIdentifier(), this.customName)) :
// new Text(this.getNameIdentifier(), this.getIdentifier());
// }
}

View file

@ -0,0 +1,44 @@
package game.dimension;
import java.util.Set;
import game.collect.Sets;
public final class Planet extends Dimension {
private final Set<Moon> moons = Sets.newTreeSet();
Planet(int id, String name) {
super(id, name);
}
public Planet(int id, String name, int sky, int fog, int clouds, long orbit, long rotation, float gravity, float temperature,
int brightness) {
this(id, name, sky, fog, clouds, orbit, rotation, 0.0f, gravity, temperature, brightness);
}
public Planet(int id, String name, int sky, int fog, int clouds, long orbit, long rotation, float offset, float gravity,
float temperature) {
this(id, name, sky, fog, clouds, orbit, rotation, offset, gravity, temperature, 0);
}
public Planet(int id, String name, int sky, int fog, int clouds, long orbit, long rotation, float gravity, float temperature) {
this(id, name, sky, fog, clouds, orbit, rotation, 0.0f, gravity, temperature, 0);
}
public Planet(int id, String name, int sky, int fog, int clouds, long orbit, long rotation, float offset, float gravity,
float temperature, int brightness) {
super(id, name);
this.setPhysics(orbit, rotation, offset, gravity, temperature, brightness);
this.setTimeQualifier(7);
this.setStarBrightness(0.5f).setDeepStarBrightness(0.0f);
this.setSkyColor(sky).setFogColor(fog).setCloudColor(clouds);
}
public void addMoon(Moon moon) {
this.moons.add(moon);
}
public final DimType getType() {
return DimType.PLANET;
}
}

View file

@ -0,0 +1,30 @@
package game.dimension;
import java.util.Set;
import game.collect.Sets;
public final class Sector extends Nameable implements Comparable<Sector> {
public final String id;
private final Set<Star> stars = Sets.newTreeSet();
public Sector(String id) {
this.id = id;
}
public void addStar(Star star) {
this.stars.add(star);
}
public int compareTo(Sector other) {
return other == null ? -1 : this.id.compareTo(other.id);
}
protected String getNameIdentifier() {
return "Sektor %s";
}
protected String getIdentifier() {
return this.id;
}
}

View file

@ -0,0 +1,18 @@
package game.dimension;
public final class Semi extends Dimension {
Semi(int id, String name) {
super(id, name);
}
public Semi(int id, String name, int sky, int fog, int clouds, float temperature, int brightness) {
super(id, name);
this.setPhysics(1L, 1L, 0.0f, 10.0f, temperature, brightness);
this.setStarBrightness(0.5f).setDeepStarBrightness(0.5f);
this.setSkyColor(sky).setFogColor(fog).setCloudColor(clouds);
}
public final DimType getType() {
return DimType.SEMI;
}
}

View file

@ -0,0 +1,146 @@
package game.dimension;
import game.biome.Biome;
public final class Space extends Dimension {
public static final Space INSTANCE = new Space();
private Space() {
super(0, "space");
this.setPhysics(1L, 1L, 0.0f, 0.0f, 2.7f, 15).setTimeQualifier(8);
this.setBiome(Biome.space).setStarBrightness(1.0f).setDeepStarBrightness(1.0f);
this.setCustomName("Der Weltraum");
}
public final DimType getType() {
return DimType.SPACE;
}
// 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;
// }
}

124
java/src/game/dimension/Star.java Executable file
View file

@ -0,0 +1,124 @@
package game.dimension;
import java.util.Set;
import game.collect.Sets;
import game.world.State;
public final class Star extends Dimension {
private final Set<Planet> planets = Sets.newTreeSet();
Star(int id, String name) {
super(id, name);
}
public Star(int id, String name, int color, float gravity, float temp, State surface, int height) {
super(id, name);
this.setPhysics(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);
}
public void addPlanet(Planet planet) {
this.planets.add(planet);
}
public final DimType getType() {
return DimType.STAR;
}
// public final ChunkGenerator createChunkGenerator(Random rand) {
// return new GeneratorFlat(this.getHeight(), this.getFiller());
// }
//
// public final BlockReplacer createBlockReplacer(Random rand) {
// return null;
// }
//
// public float getGravity() {
// return 4.0f;
// }
//
// public final long getOrbitalPeriod() {
// return 1L;
// }
//
// public final long getRotationalPeriod() {
// return 1L;
// }
//
// public final float getOrbitOffset() {
// return 0.0f;
// }
//
//
// public Biome getBiome() {
// return Biome.star;
// }
//
// public final IBlockState getCaveFiller() {
// return Blocks.air.getDefaultState();
// }
//
// public final IBlockState getTop() {
// return Blocks.air.getDefaultState();
// }
//
// public final IBlockState getSurface() {
// return Blocks.air.getDefaultState();
// }
//
// public final IBlockState getAltFiller() {
// return Blocks.air.getDefaultState();
// }
//
// public final IBlockState getLavaFiller() {
// return null;
// }
//
// public final IBlockState getWorldFloor() {
// return null;
// }
//
// public final boolean hasRavines() {
// return false;
// }
//
// public final boolean hasSnow() {
// return false;
// }
//
// public final boolean hasCaves() {
// return false;
// }
//
// public final float getLavaChance() {
// return 0.0f;
// }
//
// public final float getWaterChance() {
// return 0.0f;
// }
//
// public final boolean hasDungeons() {
// return false;
// }
//
// public final IBlockState getSurfaceLiquid() {
// return Blocks.air.getDefaultState();
// }
//
//
// public int getBrightness() {
// return 15;
// }
//
// public float getStarBrightness() {
// return 0.75f;
// }
//
// public float getDeepStarBrightness() {
// return 0.75f;
// }
}