universe cleanup
This commit is contained in:
parent
9b5eab4f57
commit
e289dc7d5b
41 changed files with 440 additions and 599 deletions
|
@ -33,6 +33,7 @@ import common.dimension.Dimension;
|
|||
import common.dimension.Domain;
|
||||
import common.dimension.Galaxy;
|
||||
import common.dimension.Moon;
|
||||
import common.dimension.Section;
|
||||
import common.dimension.Planet;
|
||||
import common.dimension.Sector;
|
||||
import common.dimension.Semi;
|
||||
|
@ -302,57 +303,41 @@ public final class Server implements IThreadListener, Executor {
|
|||
|
||||
private static void writeDimensions(TagObject tag) {
|
||||
List<TagObject> list = Lists.newArrayList();
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(dim.isCustom()) {
|
||||
for(Section obj : UniverseRegistry.getSections()) {
|
||||
if(obj.isCustom()) {
|
||||
TagObject data = new TagObject();
|
||||
data.setString("Type", dim.getType().getName());
|
||||
data.setString("Name", UniverseRegistry.getName(dim));
|
||||
data.setString("CustomName", dim.getDisplay());
|
||||
switch(dim.getType()) {
|
||||
case AREA:
|
||||
data.setString("Domain", UniverseRegistry.getDomain((Area)dim).id);
|
||||
break;
|
||||
case MOON:
|
||||
data.setString("Planet", UniverseRegistry.getName(UniverseRegistry.getPlanet((Moon)dim)));
|
||||
break;
|
||||
case PLANET:
|
||||
data.setString("Star", UniverseRegistry.getName(UniverseRegistry.getStar((Planet)dim)));
|
||||
break;
|
||||
case STAR:
|
||||
data.setString("Sector", UniverseRegistry.getSector((Star)dim).id);
|
||||
break;
|
||||
}
|
||||
data.setString("Name", UniverseRegistry.getName(obj));
|
||||
data.setString("CustomName", obj.getDisplay());
|
||||
if(obj instanceof Dimension dim) {
|
||||
data.setString("Type", dim.getType().getName());
|
||||
switch(dim.getType()) {
|
||||
case AREA:
|
||||
data.setString("Domain", UniverseRegistry.getName(UniverseRegistry.getDomain((Area)obj)));
|
||||
break;
|
||||
case MOON:
|
||||
data.setString("Planet", UniverseRegistry.getName(UniverseRegistry.getPlanet((Moon)obj)));
|
||||
break;
|
||||
case PLANET:
|
||||
data.setString("Star", UniverseRegistry.getName(UniverseRegistry.getStar((Planet)obj)));
|
||||
break;
|
||||
case STAR:
|
||||
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);
|
||||
}
|
||||
}
|
||||
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())
|
||||
tag.setList("Dimensions", list);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class CommandTime extends Command {
|
|||
dim.setDayTime(time);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class CommandWeather extends Command {
|
|||
}
|
||||
|
||||
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());
|
||||
else if(world.isExterminated())
|
||||
throw new RunException("Welt %s ist zerstört", world.dimension.getDisplay());
|
||||
|
|
|
@ -992,11 +992,11 @@ public class Player extends User implements Executor, IPlayer
|
|||
{
|
||||
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
|
||||
{
|
||||
this.sendPacket(getPacket(list, !this.entity.worldObj.dimension.hasNoLight()));
|
||||
this.sendPacket(getPacket(list, this.entity.worldObj.dimension.hasSkyLight()));
|
||||
}
|
||||
|
||||
for (TileEntity tileentity : list1)
|
||||
|
|
|
@ -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) {
|
||||
this(world, x, z);
|
||||
boolean sky = !world.dimension.hasNoLight();
|
||||
boolean sky = world.dimension.hasSkyLight();
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
for(int by = 0; by < height; ++by) {
|
||||
|
|
|
@ -561,7 +561,7 @@ public class Region {
|
|||
chunk.setInhabited(tag.getLong("InhabitedTime"));
|
||||
List<TagObject> sects = tag.getList("Sections");
|
||||
BlockArray[] sections = new BlockArray[sects.size()];
|
||||
boolean light = !world.dimension.hasNoLight();
|
||||
boolean light = world.dimension.hasSkyLight();
|
||||
|
||||
for(int n = 0; n < sects.size(); ++n) {
|
||||
TagObject sect = sects.get(n);
|
||||
|
@ -685,7 +685,7 @@ public class Region {
|
|||
tag.setLong("InhabitedTime", chunk.getInhabited());
|
||||
Set<BlockArray> sections = chunk.getStorage();
|
||||
List<TagObject> sects = Lists.newArrayList();
|
||||
boolean light = !world.dimension.hasNoLight();
|
||||
boolean light = world.dimension.hasSkyLight();
|
||||
|
||||
for(BlockArray storage : sections) {
|
||||
if(storage != null) {
|
||||
|
|
|
@ -365,7 +365,7 @@ public final class WorldServer extends AWorldServer {
|
|||
this.dropped.remove(v);
|
||||
}
|
||||
}
|
||||
int light = this.calculateSkylightSubtracted(true);
|
||||
int light = this.calcSkylightSubtracted(true);
|
||||
if(light != this.getSkylightSubtracted())
|
||||
this.setSkylightSubtracted(light);
|
||||
// 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 prevRain = this.rain;
|
||||
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 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);
|
||||
|
||||
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);
|
||||
|
@ -2725,7 +2725,7 @@ public final class WorldServer extends AWorldServer {
|
|||
}
|
||||
}
|
||||
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) {
|
||||
List<TileEntity> list = WorldServer.this.getTileEntitiesIn(x, Integer.MIN_VALUE, z, x + 16, Integer.MAX_VALUE, z + 16);
|
||||
|
|
|
@ -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));
|
||||
|
||||
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);
|
||||
flag = true;
|
||||
|
|
|
@ -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));
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue