fix dimension names

This commit is contained in:
Sen 2025-07-13 14:54:37 +02:00
parent d09b9516a8
commit cad8ff6adb
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
44 changed files with 147 additions and 140 deletions

View file

@ -1718,7 +1718,7 @@ public class Client implements IThreadListener {
ChunkClient chunk = this.world.getChunk(blockpos); ChunkClient chunk = this.world.getChunk(blockpos);
biome = chunk.getBiome(blockpos); biome = chunk.getBiome(blockpos);
bline = "Biom: " + biome.display + " (" + biome.name + "), D: " + bline = "Biom: " + biome.display + " (" + biome.name + "), D: " +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) + TextColor.stripCodes(this.world.dimension.getNameString()) +
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")"; " (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")";
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(
@ -1727,7 +1727,7 @@ public class Client implements IThreadListener {
} }
else { else {
bline = "Biom: <?>, D: " + bline = "Biom: <?>, D: " +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) + TextColor.stripCodes(this.world.dimension.getNameString()) +
" (" + (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: "

View file

@ -454,10 +454,8 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
private void setDimButton() { private void setDimButton() {
Dimension dim = DIMENSIONS.get(this.dimension); Dimension dim = DIMENSIONS.get(this.dimension);
this.dimButton.setText((dim.getType() == DimType.PLANET ? "Heimplanet" : "Heimdimension") + ": " + dim.getFormattedName(false)); this.dimButton.setText((dim.getType() == DimType.PLANET ? "Heimplanet" : "Heimdimension") + ": " + dim.getNameString());
String name = dim.getFormattedName(true); this.descLines.setText(Util.buildLines(dim.getBaseNames()));
int index = name.indexOf(" / ");
this.descLines.setText(index >= 0 ? Util.buildLines(name.substring(index + " / ".length()).split(" / ")) : "");
} }
public void onGuiClosed() public void onGuiClosed()

View file

@ -76,7 +76,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> impleme
this.elements.clear(); this.elements.clear();
int selected = this.gm.selectedCharacter; int selected = this.gm.selectedCharacter;
for(PlayerCharacter character : this.gm.characterList) { for(PlayerCharacter character : this.gm.characterList) {
this.elements.add(new CharacterEntry(selected == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getFormattedName(false), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel) : character, selected == this.elements.size())); this.elements.add(new CharacterEntry(selected == this.elements.size() ? new PlayerCharacter(character.name(), character.info(), character.align(), this.gm.player.worldObj.dimension.getNameString(), this.gm.player.getPosition(), character.type(), this.gm.player.experienceLevel) : character, selected == this.elements.size()));
} }
if(!this.gm.charEditor) if(!this.gm.charEditor)
this.elements.add(new CharacterEntry(null, false)); this.elements.add(new CharacterEntry(null, false));

View file

@ -21,7 +21,7 @@ public class GuiGameOver extends Gui {
public void init(int width, int height) { public void init(int width, int height) {
this.timer = 0; this.timer = 0;
this.add(new Label(0, 0, 400, 0, TextColor.DRED + "Du bist gestorben!")); this.add(new Label(0, 0, 400, 0, TextColor.DRED + "Du bist gestorben!"));
this.add(new MultiLabel(0, 32, 400, 42, String.format(TextColor.GREEN + "Letzte Position" + TextColor.GRAY + ":\n" + TextColor.YELLOW + "%d, %d, %d\n" + TextColor.YELLOW + "%s", ExtMath.floord(this.gm.player.posX), ExtMath.floord(this.gm.player.posY), ExtMath.floord(this.gm.player.posZ), this.gm.player.worldObj.dimension.getFormattedName(false)))); this.add(new MultiLabel(0, 32, 400, 42, String.format(TextColor.GREEN + "Letzte Position" + TextColor.GRAY + ":\n" + TextColor.YELLOW + "%d, %d, %d\n" + TextColor.YELLOW + "%s", ExtMath.floord(this.gm.player.posX), ExtMath.floord(this.gm.player.posY), ExtMath.floord(this.gm.player.posZ), this.gm.player.worldObj.dimension.getNameString())));
this.button = this.add(new ActButton(100, 100, 200, 0, new ButtonCallback() { this.button = this.add(new ActButton(100, 100, 200, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) { public void use(ActButton elem, PressType action) {
GuiGameOver.this.gm.player.respawnPlayer(); GuiGameOver.this.gm.player.respawnPlayer();

View file

@ -18,7 +18,7 @@ public class GuiSign extends Gui implements FieldCallback {
public void init(int width, int height) { public void init(int width, int height) {
this.add(new Label(0, -140, 300, 0, "Bearbeite Schild")); this.add(new Label(0, -140, 300, 0, "Bearbeite Schild"));
this.add(new Label(0, -80, 300, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ()))); this.add(new Label(0, -80, 300, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ())));
this.add(new Label(0, -50, 300, 0, this.gm.world == null ? "<?>" : this.gm.world.dimension.getFormattedName(false))); this.add(new Label(0, -50, 300, 0, this.gm.world == null ? "<?>" : this.gm.world.dimension.getNameString()));
for(int z = 0; z < this.lines.length; z++) { for(int z = 0; z < this.lines.length; z++) {
this.lines[z] = this.add(new Field(0, 40 * z, 300, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z])); this.lines[z] = this.add(new Field(0, 40 * z, 300, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z]));
} }

View file

@ -1917,7 +1917,7 @@ public class ClientPlayer implements IClientPlayer
NetHandler.checkThread(packet, this, this.gm, this.world); NetHandler.checkThread(packet, this, this.gm, this.world);
if(this.world.dimension.isCustom()) { if(this.world.dimension.isCustom()) {
this.world.dimension.setCustomName(packet.getCustomName()); this.world.dimension.setCustomName(packet.getCustomName());
this.world.dimension.setDisplayName(packet.getFullName()); this.world.dimension.setBaseNames(packet.getFullName());
} }
} }

View file

@ -72,7 +72,7 @@ public class BlockBed extends Block implements Rotatable {
&& Math.abs(player.posY - (double)pos.getY()) <= 2.0D && Math.abs(player.posZ - (double)pos.getZ()) <= 3.0D) { && Math.abs(player.posY - (double)pos.getY()) <= 2.0D && Math.abs(player.posZ - (double)pos.getZ()) <= 3.0D) {
player.setSpawnPoint(new WorldPos(pos, player.worldObj)); player.setSpawnPoint(new WorldPos(pos, player.worldObj));
player.connection.addHotbar(TextColor.DGREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt", player.connection.addHotbar(TextColor.DGREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt",
player.worldObj.dimension.getFormattedName(false), player.getSpawnPoint().getX(), player.worldObj.dimension.getNameString(), player.getSpawnPoint().getX(),
player.getSpawnPoint().getY(), player.getSpawnPoint().getZ()); player.getSpawnPoint().getY(), player.getSpawnPoint().getZ());
} }
// else if(!Config.bedSpawn) { // else if(!Config.bedSpawn) {

View file

@ -160,7 +160,7 @@ public abstract class Dimension extends Nameable {
private SkyboxType skyboxTexture = null; private SkyboxType skyboxTexture = null;
private ColorGenerator starColorFunc = null; private ColorGenerator starColorFunc = null;
private ColorGenerator deepstarColorFunc = null; private ColorGenerator deepstarColorFunc = null;
private String display; // synced only private String[] baseNames; // synced only
private int sunColor = 0xffffffff; private int sunColor = 0xffffffff;
private int[] moonColors = null; private int[] moonColors = null;
@ -866,12 +866,38 @@ public abstract class Dimension extends Nameable {
return !this.getType().days; return !this.getType().days;
} }
public final void setDisplayName(String display) { public final void setBaseNames(String[] names) {
this.display = display; this.baseNames = names;
} }
public final String getFormattedName(boolean full) { public final String[] getBaseNames() {
return this.display != null ? (full ? this.display : this.getNameString()) : UniverseRegistry.getFormattedName(this, full); if(this.baseNames != null)
return this.baseNames;
String planet = null;
String star = null;
Dimension dim = this;
switch(this.getType()) {
case MOON:
dim = UniverseRegistry.getPlanet((Moon)dim);
planet = dim.getNameString();
case PLANET:
dim = UniverseRegistry.getStar((Planet)dim);
star = dim.getNameString();
case STAR:
Sector sector = UniverseRegistry.getSector((Star)dim);
String sect = sector.getNameString();
String galaxy = UniverseRegistry.getGalaxy(sector).getNameString();
if(planet != null)
return new String[] {planet, star, sect, galaxy};
else if(star != null)
return new String[] {star, sect, galaxy};
else
return new String[] {sect, galaxy};
case AREA:
return new String[] {UniverseRegistry.getDomain((Area)dim).getNameString()};
default:
return new String[0];
}
} }

View file

@ -21,12 +21,11 @@ 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 {
public static final long EARTH_YEAR = 8766144L;
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();
@ -123,35 +122,13 @@ public abstract class UniverseRegistry {
public static Set<String> getWorldNames() { public static Set<String> getWorldNames() {
return NAME_LIST; return NAME_LIST;
} }
public static String getFormattedName(Dimension dim, boolean full) {
String base = dim.getNameString();
if(!full)
return base;
switch(dim.getType()) {
case MOON:
dim = MOON_MAP.get(dim);
base += " / " + dim.getNameString();
case PLANET:
dim = PLANET_MAP.get(dim);
base += " / " + dim.getNameString();
case STAR:
Sector sector = STAR_MAP.get(dim);
base += " / " + sector.getNameString();
return base + " / " + SECTOR_MAP.get(sector).getNameString();
case AREA:
return base + " / " + AREA_MAP.get(dim).getNameString();
default:
return base;
}
}
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 GALAXIES.containsKey(name) || SECTORS.containsKey(name) || DOMAINS.containsKey(name) || NAME_MAP.containsKey(name);
} }
public static boolean isDimension(String name) { public static boolean isType(String name, DimType type) {
return NAME_MAP.containsKey(name); return NAME_MAP.containsKey(name) && NAME_MAP.get(name).getType() == type;
} }
public static Galaxy registerCustomGalaxy(String name, String display) { public static Galaxy registerCustomGalaxy(String name, String display) {
@ -304,7 +281,7 @@ public abstract class UniverseRegistry {
registerGalaxy("milkyway", "Milchstraße"); registerGalaxy("milkyway", "Milchstraße");
registerSector("solar", "Solar", "milkyway"); registerSector("solar", "Solar", "milkyway");
registerStar("sol", "Sol", new Star(0xff7f00, 274.0f, 5778.0f, Blocks.lava.getState(), 128).setTimeQualifier(1), "solar"); 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, UniverseRegistry.EARTH_YEAR, 24000L, 28.0f, 9.81f, registerPlanet("terra", "Terra", new Planet(0xffffffff, 0xc0d8ff, 0xffffff, World.EARTH_YEAR, 24000L, 28.0f, 9.81f,
259.15f).setTimeQualifier(0) 259.15f).setTimeQualifier(0)
.setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63) .setPerlinGen(Blocks.stone.getState(), Blocks.water.getState(), 63)
.setBiomeReplacer(Blocks.gravel.getState()) .setBiomeReplacer(Blocks.gravel.getState())

View file

@ -65,7 +65,7 @@ public class ItemCharTemplate extends Item
public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) { public void addInformation(ItemStack stack, EntityNPC player, List<String> tooltip) {
Dimension dim = this.spawned.species.origin == null ? null : UniverseRegistry.getDimension(this.spawned.species.origin); Dimension dim = this.spawned.species.origin == null ? null : UniverseRegistry.getDimension(this.spawned.species.origin);
tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getFormattedName(false))); tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getNameString()));
} }
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)

View file

@ -57,7 +57,7 @@ public class ItemMobTemplate extends Item
EntityInfo egg = EntityRegistry.DNA.get(this.entityId); EntityInfo egg = EntityRegistry.DNA.get(this.entityId);
if(egg != null) { if(egg != null) {
Dimension dim = egg.origin() == null ? null : UniverseRegistry.getDimension(egg.origin()); Dimension dim = egg.origin() == null ? null : UniverseRegistry.getDimension(egg.origin());
tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getFormattedName(false))); tooltip.add(TextColor.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getNameString()));
} }
} }

View file

@ -23,9 +23,9 @@ public class ItemExterminator extends ItemMagnetic {
if(world.dimension == Space.INSTANCE) if(world.dimension == Space.INSTANCE)
player.connection.addHotbar(TextColor.RED + "Der Weltraum kann nicht zerstört werden (lol)"); player.connection.addHotbar(TextColor.RED + "Der Weltraum kann nicht zerstört werden (lol)");
else if(!((AWorldServer)world).exterminate()) else if(!((AWorldServer)world).exterminate())
player.connection.addHotbar(TextColor.YELLOW + "Die Welt %s ist bereits zerstört", world.dimension.getFormattedName(false)); player.connection.addHotbar(TextColor.YELLOW + "Die Welt %s ist bereits zerstört", world.dimension.getNameString());
else else
player.connection.addHotbar(TextColor.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getFormattedName(false)); player.connection.addHotbar(TextColor.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getNameString());
// if (!playerIn.capabilities.isCreativeMode) // if (!playerIn.capabilities.isCreativeMode)
// { // {

View file

@ -16,7 +16,7 @@ public class ItemScanner extends ItemWand {
public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec) public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec)
{ {
Biome biome = world.getBiomeGenForCoords(new BlockPos(vec.xCoord, 0, vec.zCoord)); Biome biome = world.getBiomeGenForCoords(new BlockPos(vec.xCoord, 0, vec.zCoord));
player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.3f %.3f %.3f, %s, %.2f °C", world.dimension.getFormattedName(false), player.connection.addHotbar(TextColor.NEON + "* Position in %s: %.3f %.3f %.3f, %s, %.2f °C", world.dimension.getNameString(),
vec.xCoord, vec.yCoord, vec.zCoord, vec.xCoord, vec.yCoord, vec.zCoord,
biome.display, world.getTemperatureC(new BlockPos(vec))); biome.display, world.getTemperatureC(new BlockPos(vec)));
} }

View file

@ -4,48 +4,31 @@ import java.util.List;
import common.color.TextColor; import common.color.TextColor;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.UniverseRegistry;
import common.item.ItemMagnetic; import common.item.ItemMagnetic;
import common.item.ItemStack; import common.item.ItemStack;
import common.util.BlockPos; import common.util.BlockPos;
import common.world.World;
public class ItemSpaceNavigator extends ItemMagnetic { public class ItemSpaceNavigator extends ItemMagnetic {
public static String formatImperialTime(World world, boolean days) { public ItemSpaceNavigator() {
long time = world.getDayTime();
long year = time / UniverseRegistry.EARTH_YEAR;
long frac = (time * 1000L / UniverseRegistry.EARTH_YEAR) % 1000L;
if(!world.dimension.getType().time) {
return String.format("%d.%03d.%03d.M%d" + (days ? " T???.??? D???.???.G?" : ""), world.dimension.getTimeQualifier(),
frac, year % 1000L, year / 1000L + 1L);
}
long day = time / world.dimension.getRotationalPeriod();
time = time % world.dimension.getRotationalPeriod();
return String.format("%d.%03d.%03d.M%d" + (days ? " T%03d.%03d D%03d.%03d.G%d" : ""), world.dimension.getTimeQualifier(),
frac, year % 1000L, year / 1000L + 1L,
time / 1000L, time % 1000L, (day / 1000L) % 1000L, day % 1000L, day / 1000000L);
}
public ItemSpaceNavigator() {
this.setUnstackable(); this.setUnstackable();
this.setColor(TextColor.DGREEN); this.setColor(TextColor.DGREEN);
} }
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 + formatImperialTime(player.worldObj, false) + " / " + return TextColor.ORANGE + player.worldObj.formatImperialTime(false) + " / " +
String.format("%s bei %d, %d, %d", player.worldObj.dimension.getFormattedName(false) + TextColor.ORANGE, String.format("%s bei %d, %d, %d", player.worldObj.dimension.getNameString() + 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 + formatImperialTime(player.worldObj, true)); tooltip.add(TextColor.ORANGE + player.worldObj.formatImperialTime(true));
String[] dims = TextColor.stripCodes(player.worldObj.dimension.getFormattedName(true)).split(" / "); 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]);
} }
BlockPos pos = player.getPosition(); BlockPos pos = player.getPosition();
tooltip.add(TextColor.ORANGE + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getFormattedName(false) tooltip.add(TextColor.ORANGE + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getNameString()
+ TextColor.ORANGE, pos.getX(), pos.getY(), pos.getZ())); + TextColor.ORANGE, pos.getX(), pos.getY(), pos.getZ()));
} }
} }

View file

@ -8,14 +8,14 @@ import common.network.Packet;
import common.network.PacketBuffer; import common.network.PacketBuffer;
public class SPacketDimensionName implements Packet<IClientPlayer> { public class SPacketDimensionName implements Packet<IClientPlayer> {
private String fullName; private String[] fullName;
private String customName; private String customName;
public SPacketDimensionName() { public SPacketDimensionName() {
} }
public SPacketDimensionName(Dimension dim) { public SPacketDimensionName(Dimension dim) {
this.fullName = dim.getFormattedName(true); this.fullName = dim.getBaseNames();
this.customName = dim.getCustomName(); this.customName = dim.getCustomName();
} }
@ -24,16 +24,22 @@ public class SPacketDimensionName implements Packet<IClientPlayer> {
} }
public void readPacketData(PacketBuffer buf) throws IOException { public void readPacketData(PacketBuffer buf) throws IOException {
this.fullName = buf.readString(4096); this.fullName = new String[buf.readByte()];
for(int z = 0; z < this.fullName.length; z++) {
this.fullName[z] = buf.readString(1024);
}
this.customName = buf.readString(1024); this.customName = buf.readString(1024);
} }
public void writePacketData(PacketBuffer buf) throws IOException { public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeString(this.fullName); buf.writeByte(this.fullName.length);
for(int z = 0; z < this.fullName.length; z++) {
buf.writeString(this.fullName[z]);
}
buf.writeString(this.customName); buf.writeString(this.customName);
} }
public String getFullName() { public String[] getFullName() {
return this.fullName; return this.fullName;
} }

View file

@ -16,7 +16,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
private TagObject dimData; private TagObject dimData;
private String dimName; private String dimName;
private String dimDisplay; private String dimDisplay;
private String dimFull; private String[] dimFull;
private int sunColor; private int sunColor;
private int[] moonColors; private int[] moonColors;
private int type; private int type;
@ -39,7 +39,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
if(dim.isCustom()) { if(dim.isCustom()) {
this.dimName = UniverseRegistry.getName(dim); this.dimName = UniverseRegistry.getName(dim);
this.dimDisplay = dim.getCustomName(); this.dimDisplay = dim.getCustomName();
this.dimFull = dim.getFormattedName(true); this.dimFull = dim.getBaseNames();
this.dimId = -1; this.dimId = -1;
} }
else { else {
@ -70,7 +70,10 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
if(this.dimId == -1) { if(this.dimId == -1) {
this.dimName = buf.readString(1024); this.dimName = buf.readString(1024);
this.dimDisplay = buf.readString(1024); this.dimDisplay = buf.readString(1024);
this.dimFull = buf.readString(4096); this.dimFull = new String[buf.readByte()];
for(int z = 0; z < this.dimFull.length; z++) {
this.dimFull[z] = buf.readString(1024);
}
} }
this.type = buf.readUnsignedShort(); this.type = buf.readUnsignedShort();
this.editor = buf.readBoolean(); this.editor = buf.readBoolean();
@ -92,7 +95,10 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
if(this.dimId == -1) { if(this.dimId == -1) {
buf.writeString(this.dimName); buf.writeString(this.dimName);
buf.writeString(this.dimDisplay); buf.writeString(this.dimDisplay);
buf.writeString(this.dimFull); buf.writeByte(this.dimFull.length);
for(int z = 0; z < this.dimFull.length; z++) {
buf.writeString(this.dimFull[z]);
}
} }
buf.writeShort(this.type & 65535); buf.writeShort(this.type & 65535);
buf.writeBoolean(this.editor); buf.writeBoolean(this.editor);
@ -110,7 +116,7 @@ public class SPacketRespawn implements Packet<IClientPlayer> {
if(!dim.isCustom()) if(!dim.isCustom())
return dim; return dim;
dim.setCustomName(this.dimDisplay); dim.setCustomName(this.dimDisplay);
dim.setDisplayName(this.dimFull); dim.setBaseNames(this.dimFull);
return dim; return dim;
} }

View file

@ -35,7 +35,6 @@ public abstract class Util {
public static final boolean DEVMODE = System.getProperty("runtime.devmode") != null; public static final boolean DEVMODE = System.getProperty("runtime.devmode") != null;
public static final int PROTOCOL = Version.MAJOR << 16 | Version.MINOR << 8 | Version.PATCH; public static final int PROTOCOL = Version.MAJOR << 16 | Version.MINOR << 8 | Version.PATCH;
public static final String VERSION = "v" + Version.MAJOR + "." + Version.MINOR + "." + Version.PATCH + Version.RELEASE; public static final String VERSION = "v" + Version.MAJOR + "." + Version.MINOR + "." + Version.PATCH + Version.RELEASE;
private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}; private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};
private static boolean crashed; private static boolean crashed;

View file

@ -56,6 +56,7 @@ public abstract class World implements IWorldAccess {
public static final int MAX_SIZE_Y = 4096; public static final int MAX_SIZE_Y = 4096;
public static final long START_TIME = 4385238000L; public static final long START_TIME = 4385238000L;
public static final float ABSOLUTE_ZERO = -273.15f; public static final float ABSOLUTE_ZERO = -273.15f;
public static final long EARTH_YEAR = 8766144L;
// private static final Calendar calendar = Calendar.getInstance(); // private static final Calendar calendar = Calendar.getInstance();
// private static long lastUpdate; // private static long lastUpdate;
@ -132,6 +133,21 @@ public abstract class World implements IWorldAccess {
this.gravity = Math.signum(this.gravity) * 0.075; this.gravity = Math.signum(this.gravity) * 0.075;
} }
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) {
return String.format("%d.%03d.%03d.M%d" + (days ? " T???.??? D???.???.G?" : ""), this.dimension.getTimeQualifier(),
frac, year % 1000L, year / 1000L + 1L);
}
long day = time / this.dimension.getRotationalPeriod();
time = time % this.dimension.getRotationalPeriod();
return String.format("%d.%03d.%03d.M%d" + (days ? " T%03d.%03d D%03d.%03d.G%d" : ""), this.dimension.getTimeQualifier(),
frac, year % 1000L, year / 1000L + 1L,
time / 1000L, time % 1000L, (day / 1000L) % 1000L, day % 1000L, day / 1000000L);
}
public abstract Biome getBiomeGenForCoords(BlockPos pos); public abstract Biome getBiomeGenForCoords(BlockPos pos);
public boolean isAirBlock(BlockPos pos) { public boolean isAirBlock(BlockPos pos) {

View file

@ -300,9 +300,7 @@ public final class Server implements IThreadListener, Executor {
} }
} }
private static TagObject writeDimensions() { private static void writeDimensions(TagObject tag) {
TagObject tag = new TagObject();
List<TagObject> list = Lists.newArrayList(); List<TagObject> list = Lists.newArrayList();
for(Dimension dim : UniverseRegistry.getDimensions()) { for(Dimension dim : UniverseRegistry.getDimensions()) {
if(dim.isCustom()) { if(dim.isCustom()) {
@ -357,31 +355,29 @@ public final class Server implements IThreadListener, Executor {
} }
if(!list.isEmpty()) if(!list.isEmpty())
tag.setList("Dimensions", list); tag.setList("Dimensions", list);
return tag;
} }
private void saveServerConfig(long time) { private void saveServerConfig(long time) {
TagObject data = new TagObject(); TagObject tag = new TagObject();
data.setLong("Time", time); tag.setLong("Time", time);
data.setLong("LastAccess", System.currentTimeMillis()); tag.setLong("LastAccess", System.currentTimeMillis());
data.setString("Version", Util.VERSION); tag.setString("Version", Util.VERSION);
TagObject cfg = new TagObject(); TagObject cfg = new TagObject();
for(String cvar : this.variables.keySet()) { for(String cvar : this.variables.keySet()) {
SVar value = this.variables.get(cvar); SVar value = this.variables.get(cvar);
if(!value.noDef || !value.def.equals(value.get())) if(!value.noDef || !value.def.equals(value.get()))
cfg.setString(cvar, value.get()); cfg.setString(cvar, value.get());
} }
data.setObject("Config", cfg); tag.setObject("Config", cfg);
data.setObject("Universe", writeDimensions()); writeDimensions(tag);
if(this.keyPair != null) { if(this.keyPair != null) {
data.setByteArray("PrivateKey", this.keyPair.getPrivate().getEncoded()); tag.setByteArray("PrivateKey", this.keyPair.getPrivate().getEncoded());
data.setByteArray("PublicKey", this.keyPair.getPublic().getEncoded()); tag.setByteArray("PublicKey", this.keyPair.getPublic().getEncoded());
} }
File nfile = new File("server.cdt.tmp"); File nfile = new File("server.cdt.tmp");
File lfile = new File("server.cdt"); File lfile = new File("server.cdt");
try { try {
TagObject.writeGZip(data, nfile); TagObject.writeGZip(tag, nfile);
if(lfile.exists()) if(lfile.exists())
lfile.delete(); lfile.delete();
nfile.renameTo(lfile); nfile.renameTo(lfile);
@ -404,7 +400,7 @@ public final class Server implements IThreadListener, Executor {
if(svar != null) if(svar != null)
svar.set(cfg.getString(key), false, false); svar.set(cfg.getString(key), false, false);
} }
readDimensions(tag.getObject("Universe")); readDimensions(tag);
long lastPlayed = tag.getLong("LastAccess"); long lastPlayed = tag.getLong("LastAccess");
String version = tag.hasString("Version") ? tag.getString("Version") : null; String version = tag.hasString("Version") ? tag.getString("Version") : null;
version = version != null && version.isEmpty() ? "<unbekannt>" : version; version = version != null && version.isEmpty() ? "<unbekannt>" : version;
@ -444,7 +440,7 @@ public final class Server implements IThreadListener, Executor {
} }
dim.readData(tag == null ? new TagObject() : tag); dim.readData(tag == null ? new TagObject() : tag);
if(tag == null || !tag.hasLong("Seed")) if(tag == null || !tag.hasLong("Seed"))
Log.TICK.info("Startwert für %s: %d" + (Vars.seed.isEmpty() ? "" : " von Basiswert '%s'"), dim.getFormattedName(false), dim.getSeed(), Vars.seed); Log.TICK.info("Startwert für %s: %d" + (Vars.seed.isEmpty() ? "" : " von Basiswert '%s'"), dim.getNameString(), dim.getSeed(), Vars.seed);
} }
private void saveDimension(Dimension dim) { private void saveDimension(Dimension dim) {
@ -1085,7 +1081,7 @@ public final class Server implements IThreadListener, Executor {
if(message != null) if(message != null)
conn.addHotbar(TextColor.DRED + message); conn.addHotbar(TextColor.DRED + message);
conn.addFeed(TextColor.RED + "* Bei %d, %d, %d in Dimension %s gestorben", pos.getX(), pos.getY(), pos.getZ(), conn.addFeed(TextColor.RED + "* Bei %d, %d, %d in Dimension %s gestorben", pos.getX(), pos.getY(), pos.getZ(),
old.worldObj.dimension.getFormattedName(false)); old.worldObj.dimension.getNameString());
} }
public TagObject swapPlayer(Player conn, TagObject tag, Class<? extends EntityNPC> clazz) { public TagObject swapPlayer(Player conn, TagObject tag, Class<? extends EntityNPC> clazz) {

View file

@ -20,7 +20,7 @@ public class WorldParser extends DimensionParser {
Dimension dim = (Dimension)super.parse(env, input); Dimension dim = (Dimension)super.parse(env, input);
WorldServer world = this.loadedOnly ? env.getServer().getWorldNoLoad(dim) : env.getServer().getWorld(dim); WorldServer world = this.loadedOnly ? env.getServer().getWorldNoLoad(dim) : env.getServer().getWorld(dim);
if(world == null) if(world == null)
throw new RunException("Dimension '%s' ist nicht geladen", dim.getFormattedName(false)); throw new RunException("Dimension '%s' ist nicht geladen", dim.getNameString());
return world; return world;
} }
@ -30,7 +30,7 @@ public class WorldParser extends DimensionParser {
return null; return null;
return this.loadedOnly ? env.getServer().getWorldNoLoad(dim) : env.getServer().getWorld(dim); return this.loadedOnly ? env.getServer().getWorldNoLoad(dim) : env.getServer().getWorld(dim);
// if(world == null) // if(world == null)
// throw new ScriptException("Dimension '%s' ist nicht geladen", dim.getFormattedName(false)); // throw new ScriptException("Dimension '%s' ist nicht geladen", dim.getNameString());
// return world; // return world;
} }

View file

@ -59,7 +59,7 @@ public class CommandBlock extends Command {
} }
} }
if(success) if(success)
exec.log("%s bei %d, %d, %d in %s gesetzt", state.getBlock().getDisplay(), position.getX(), position.getY(), position.getZ(), world.dimension.getFormattedName(false)); exec.log("%s bei %d, %d, %d in %s gesetzt", state.getBlock().getDisplay(), position.getX(), position.getY(), position.getZ(), world.dimension.getNameString());
else else
exec.log("Block wurde nicht verändert"); exec.log("Block wurde nicht verändert");
return success; return success;

View file

@ -27,7 +27,7 @@ public class CommandDeathspot extends Command {
throw new RunException("%s hat keinen letzten Todespunkt", player.getCommandName()); throw new RunException("%s hat keinen letzten Todespunkt", player.getCommandName());
for(Entity entity : entities) { for(Entity entity : entities) {
entity.teleport(pos); entity.teleport(pos);
exec.log("%s zum Todespunkt von %s (%d, %d, %d in %s) teleportiert", entity.getCommandName(), player.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getFormattedName(false)); exec.log("%s zum Todespunkt von %s (%d, %d, %d in %s) teleportiert", entity.getCommandName(), player.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -20,6 +20,6 @@ public class CommandDelwarp extends Command {
throw new RunException("Warp '%s' existiert nicht", warp); throw new RunException("Warp '%s' existiert nicht", warp);
Position pos = env.getServer().getWarps().remove(warp); Position pos = env.getServer().getWarps().remove(warp);
Dimension wdim = pos.getDimension(); Dimension wdim = pos.getDimension();
exec.log("Warp %s bei %d, %d, %d in %s entfernt", warp, ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), wdim == null ? "<?>" : wdim.getFormattedName(false)); exec.log("Warp %s bei %d, %d, %d in %s entfernt", warp, ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), wdim == null ? "<?>" : wdim.getNameString());
} }
} }

View file

@ -28,13 +28,13 @@ public class CommandEntity extends Command {
entity.writeTags(etag); entity.writeTags(etag);
if(tag == null) { if(tag == null) {
exec.log("************************************************************"); exec.log("************************************************************");
exec.log("Daten von %s bei %d, %d, %d in %s:", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getFormattedName(false)); exec.log("Daten von %s bei %d, %d, %d in %s:", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getNameString());
exec.log(etag.format(4)); exec.log(etag.format(4));
} }
else { else {
etag.merge(tag); etag.merge(tag);
entity.readTags(etag); entity.readTags(etag);
exec.log("Daten von %s bei %d, %d, %d in %s geändert", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getFormattedName(false)); exec.log("Daten von %s bei %d, %d, %d in %s geändert", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getNameString());
} }
done++; done++;
} }

View file

@ -19,9 +19,9 @@ public class CommandExterminatus extends Command {
if(world.dimension == Space.INSTANCE) if(world.dimension == Space.INSTANCE)
throw new RunException("Der Weltraum kann nicht zerstört werden (lol?)"); throw new RunException("Der Weltraum kann nicht zerstört werden (lol?)");
else if(world.isExterminated()) else if(world.isExterminated())
throw new RunException("Dimension %s ist bereits zerstört", world.dimension.getFormattedName(false)); throw new RunException("Dimension %s ist bereits zerstört", world.dimension.getNameString());
exec.log(TextColor.YELLOW + "Dimension %s wird zerstört ...", world.dimension.getFormattedName(false)); exec.log(TextColor.YELLOW + "Dimension %s wird zerstört ...", world.dimension.getNameString());
world.exterminate(); world.exterminate();
exec.log(TextColor.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getFormattedName(false)); exec.log(TextColor.CRIMSON + "Die Welt %s wurde vernichtet >:)-", world.dimension.getNameString());
} }
} }

View file

@ -21,7 +21,7 @@ public class CommandFind extends Command {
for(Entity entity : entities) { for(Entity entity : entities) {
if(entity.isEntityAlive()) { if(entity.isEntityAlive()) {
BlockPos pos = entity.getPosition(); BlockPos pos = entity.getPosition();
exec.log("%s bei %d, %d, %d in %s gefunden", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getFormattedName(false)); exec.log("%s bei %d, %d, %d in %s gefunden", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getNameString());
done++; done++;
} }
} }

View file

@ -16,6 +16,7 @@ import common.init.Blocks;
import common.init.NameRegistry; import common.init.NameRegistry;
import common.init.UniverseRegistry; import common.init.UniverseRegistry;
import common.rng.Random; import common.rng.Random;
import common.world.World;
import server.command.ArgumentParser; import server.command.ArgumentParser;
import server.command.Command; import server.command.Command;
import server.command.CommandEnvironment; import server.command.CommandEnvironment;
@ -32,7 +33,7 @@ public class CommandLoad extends Command {
public static Planet registerPlanet(String star, String name, String custom, int sky, int fog, int clouds, long orbit, long rotation, public static Planet registerPlanet(String star, String name, String custom, int sky, int fog, int clouds, long orbit, long rotation,
float offset, float gravity, float temperature, int brightness) { float offset, float gravity, float temperature, int brightness) {
star = star == null ? UniverseRegistry.getName(new Random().pick(Lists.newArrayList(UniverseRegistry.getStars()))) : star; star = star == null ? UniverseRegistry.getName(new Random().pick(Lists.newArrayList(UniverseRegistry.getStars()))) : star;
if(!UniverseRegistry.isDimension(star) || UniverseRegistry.getDimension(star).getType() != DimType.STAR || UniverseRegistry.isRegistered(name)) if(!UniverseRegistry.isType(star, DimType.STAR) || UniverseRegistry.isRegistered(name))
return null; return null;
Planet dim = new Planet(sky, fog, clouds, orbit, rotation, offset, gravity, temperature, brightness); Planet dim = new Planet(sky, fog, clouds, orbit, rotation, offset, gravity, temperature, brightness);
dim.setTimeQualifier(3); dim.setTimeQualifier(3);
@ -94,7 +95,7 @@ public class CommandLoad extends Command {
this.addColor("sky", 's', 0xffffffff); this.addColor("sky", 's', 0xffffffff);
this.addColor("fog", 'f', 0xc0d8ff); this.addColor("fog", 'f', 0xc0d8ff);
this.addColor("clouds", 'w', 0xffffff); this.addColor("clouds", 'w', 0xffffff);
this.addLong("orbit", 'o', 1L, 1000000000000L, UniverseRegistry.EARTH_YEAR); this.addLong("orbit", 'o', 1L, 1000000000000L, World.EARTH_YEAR);
this.addLong("rotation", 'r', 1L, 1000000000000L, 24000L); this.addLong("rotation", 'r', 1L, 1000000000000L, 24000L);
this.addDouble("offset", 'm', 0.0, 100000.0, 0.0); this.addDouble("offset", 'm', 0.0, 100000.0, 0.0);
this.addDouble("gravity", 'g', 0.0, 100000.0, 9.81); this.addDouble("gravity", 'g', 0.0, 100000.0, 9.81);

View file

@ -33,7 +33,7 @@ public class CommandOfflinetp extends Command {
throw new RunException("Spieler '%s' konnte nicht gefunden werden", user); throw new RunException("Spieler '%s' konnte nicht gefunden werden", user);
for(Entity entity : entities) { for(Entity entity : entities) {
entity.teleport(pos); entity.teleport(pos);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getFormattedName(false)); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -27,7 +27,7 @@ public class CommandPlayers extends Command {
exec.log(TextColor.GREEN + "Es " + (players.size() == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Spieler online", players.size()); exec.log(TextColor.GREEN + "Es " + (players.size() == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Spieler online", players.size());
for(Player player : players) { for(Player player : players) {
EntityNPC entity = player.getPresentEntity(); EntityNPC entity = player.getPresentEntity();
exec.log("%s%s" + TextColor.GRAY + ": '%s" + TextColor.GRAY + "'" + (coords && entity != null ? " [" + TextColor.ORANGE + "%s @ %d, %d, %d" + TextColor.GRAY + "]" : ""), player.isAdmin() ? TextColor.RED : TextColor.NEON, player.getUser(), entity == null ? TextColor.DGRAY + "<->" : TextColor.ACID + entity.getCommandName(), entity == null ? null : entity.worldObj.dimension.getFormattedName(false), entity == null ? null : ExtMath.floord(entity.posX), entity == null ? null : ExtMath.floord(entity.posY), entity == null ? null : ExtMath.floord(entity.posZ)); exec.log("%s%s" + TextColor.GRAY + ": '%s" + TextColor.GRAY + "'" + (coords && entity != null ? " [" + TextColor.ORANGE + "%s @ %d, %d, %d" + TextColor.GRAY + "]" : ""), player.isAdmin() ? TextColor.RED : TextColor.NEON, player.getUser(), entity == null ? TextColor.DGRAY + "<->" : TextColor.ACID + entity.getCommandName(), entity == null ? null : entity.worldObj.dimension.getNameString(), entity == null ? null : ExtMath.floord(entity.posX), entity == null ? null : ExtMath.floord(entity.posY), entity == null ? null : ExtMath.floord(entity.posZ));
} }
} }
} }

View file

@ -13,8 +13,8 @@ public class CommandReset extends Command {
} }
public void exec(CommandEnvironment env, Executor exec, WorldServer world) { public void exec(CommandEnvironment env, Executor exec, WorldServer world) {
exec.log("Dimension %s wird zurückgesetzt ...", world.dimension.getFormattedName(false)); exec.log("Dimension %s wird zurückgesetzt ...", world.dimension.getNameString());
world.reset(); world.reset();
exec.log("Dimension %s zurückgesetzt", world.dimension.getFormattedName(false)); exec.log("Dimension %s zurückgesetzt", world.dimension.getNameString());
} }
} }

View file

@ -23,7 +23,7 @@ public class CommandReturn extends Command {
Position pos = ((Player)player.connection).getLastTeleport(); Position pos = ((Player)player.connection).getLastTeleport();
if(pos != null) { if(pos != null) {
player.teleport(pos); player.teleport(pos);
exec.log("%s zum letzten Punkt (%d, %d, %d in %s) teleportiert", player.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getFormattedName(false)); exec.log("%s zum letzten Punkt (%d, %d, %d in %s) teleportiert", player.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getNameString());
done++; done++;
} }
} }

View file

@ -18,7 +18,7 @@ public class CommandSeed extends Command {
public Object exec(CommandEnvironment env, Executor exec, WorldServer world, boolean dump) { public Object exec(CommandEnvironment env, Executor exec, WorldServer world, boolean dump) {
if(dump) if(dump)
exec.log("Daten: %s", world.dimension.dumpTags().format(4)); exec.log("Daten: %s", world.dimension.dumpTags().format(4));
exec.log("Startwert von %s: %d", world.dimension.getFormattedName(false), world.dimension.getSeed()); exec.log("Startwert von %s: %d", world.dimension.getNameString(), world.dimension.getSeed());
return world.dimension.getSeed(); return world.dimension.getSeed();
} }
} }

View file

@ -28,13 +28,13 @@ public class CommandSetwarp extends Command {
Position pos = env.getServer().getWarps().get(warp); Position pos = env.getServer().getWarps().get(warp);
Dimension wdim = pos.getDimension(); Dimension wdim = pos.getDimension();
if(wdim != null) if(wdim != null)
exec.log("Alte Position %d, %d, %d in %s entfernt", ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), dim.getFormattedName(false)); exec.log("Alte Position %d, %d, %d in %s entfernt", ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), dim.getNameString());
} }
else { else {
throw new RunException("Warp '%s' existiert bereits", warp); throw new RunException("Warp '%s' existiert bereits", warp);
} }
} }
env.getServer().getWarps().put(warp, new Position(position.xCoord, position.yCoord, position.zCoord, yaw == null ? 0.0f : yaw.floatValue(), pitch == null ? 0.0f : pitch.floatValue(), dim)); env.getServer().getWarps().put(warp, new Position(position.xCoord, position.yCoord, position.zCoord, yaw == null ? 0.0f : yaw.floatValue(), pitch == null ? 0.0f : pitch.floatValue(), dim));
exec.log("Warp '%s' auf %d, %d, %d in %s gesetzt", warp, ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getFormattedName(false)); exec.log("Warp '%s' auf %d, %d, %d in %s gesetzt", warp, ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getNameString());
} }
} }

View file

@ -19,6 +19,6 @@ public class CommandShowwarp extends Command {
throw new RunException("Warp '%s' existiert nicht", warp); throw new RunException("Warp '%s' existiert nicht", warp);
Position pos = env.getServer().getWarps().get(warp); Position pos = env.getServer().getWarps().get(warp);
Dimension wdim = pos.getDimension(); Dimension wdim = pos.getDimension();
exec.log("Warp %s ist bei %.2f, %.2f, %.2f [%.1f, %.1f] in %s", warp, pos.xCoord, pos.yCoord, pos.zCoord, pos.yaw(), pos.pitch(), wdim == null ? "<?>" : wdim.getFormattedName(false)); exec.log("Warp %s ist bei %.2f, %.2f, %.2f [%.1f, %.1f] in %s", warp, pos.xCoord, pos.yCoord, pos.zCoord, pos.yaw(), pos.pitch(), wdim == null ? "<?>" : wdim.getNameString());
} }
} }

View file

@ -56,7 +56,7 @@ public class CommandSpawn extends Command {
tag != null && tag.hasInt("damage") ? tag.getInt("damage") : 0, tag != null && tag.hasBool("fire") && tag.getBool("fire"), tag != null && tag.hasInt("damage") ? tag.getInt("damage") : 0, tag != null && tag.hasBool("fire") && tag.getBool("fire"),
exec.isPlayer() && tag != null && tag.hasBool("summoned") && tag.getBool("summoned") ? ((Player)exec).getPresentEntity() : null); exec.isPlayer() && tag != null && tag.hasBool("summoned") && tag.getBool("summoned") ? ((Player)exec).getPresentEntity() : null);
} }
exec.log("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getFormattedName(false)); exec.log("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getNameString());
return null; return null;
} }
else { else {
@ -83,7 +83,7 @@ public class CommandSpawn extends Command {
} }
spawned.add("#" + entity.getId()); spawned.add("#" + entity.getId());
} }
exec.log("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getFormattedName(false)); exec.log("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getNameString());
return Util.buildLines(",", spawned); return Util.buildLines(",", spawned);
} }
} }

View file

@ -28,7 +28,7 @@ public class CommandTele extends Command {
public Object exec(CommandEnvironment env, Executor exec, Vec3 position, Dimension dim, Double yaw, Double pitch, List<Entity> entities) { public Object exec(CommandEnvironment env, Executor exec, Vec3 position, Dimension dim, Double yaw, Double pitch, List<Entity> entities) {
for(Entity entity : entities) { for(Entity entity : entities) {
entity.teleport(position.xCoord, position.yCoord, position.zCoord, yaw == null ? entity.rotYaw : yaw.floatValue(), pitch == null ? entity.rotPitch : pitch.floatValue(), dim); entity.teleport(position.xCoord, position.yCoord, position.zCoord, yaw == null ? entity.rotYaw : yaw.floatValue(), pitch == null ? entity.rotPitch : pitch.floatValue(), dim);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getFormattedName(false)); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -1,7 +1,6 @@
package server.command.commands; package server.command.commands;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.item.tool.ItemSpaceNavigator;
import common.util.Position; import common.util.Position;
import server.command.Command; import server.command.Command;
import server.command.CommandEnvironment; import server.command.CommandEnvironment;
@ -90,7 +89,7 @@ public class CommandTime extends Command {
dim.setDayTime(time); dim.setDayTime(time);
dim.resetWeather(); dim.resetWeather();
} }
exec.log("Zeit auf %s gesetzt", ItemSpaceNavigator.formatImperialTime(world, false)); exec.log("Zeit auf %s gesetzt", world.formatImperialTime(false));
return time; return time;
} }
} }

View file

@ -22,7 +22,7 @@ public class CommandTp extends Command {
Position pos = target.getPos(); Position pos = target.getPos();
for(Entity entity : entities) { for(Entity entity : entities) {
entity.teleport(pos); entity.teleport(pos);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getFormattedName(false)); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -23,7 +23,7 @@ public class CommandTphere extends Command {
throw new RunException("Keine Position zum Teleportieren vorhanden"); throw new RunException("Keine Position zum Teleportieren vorhanden");
for(Entity entity : entities) { for(Entity entity : entities) {
entity.teleport(pos); entity.teleport(pos);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getFormattedName(false)); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -45,7 +45,7 @@ public class CommandWarp extends Command {
// } // }
for(Entity entity : entities) { for(Entity entity : entities) {
entity.teleport(pos); entity.teleport(pos);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getFormattedName(false)); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), (int)pos.x(), (int)pos.y(), (int)pos.z(), pos.getDimension().getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -32,15 +32,15 @@ public class CommandWarps extends Command {
n++; n++;
} }
if(dim != null && n == 0) { if(dim != null && n == 0) {
exec.log(TextColor.DGRAY + "Es sind keine Warps in %s vorhanden", dim.getFormattedName(false)); exec.log(TextColor.DGRAY + "Es sind keine Warps in %s vorhanden", dim.getNameString());
return; return;
} }
exec.log(TextColor.GREEN + "Es " + (n == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Warp" + (n == 1 ? "" : "s") + " " + (dim == null ? "" : "in Dimension %s ") + "vorhanden", n, dim == null ? null : dim.getFormattedName(false)); exec.log(TextColor.GREEN + "Es " + (n == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Warp" + (n == 1 ? "" : "s") + " " + (dim == null ? "" : "in Dimension %s ") + "vorhanden", n, dim == null ? null : dim.getNameString());
for(Entry<String, Position> warp : warps.entrySet()) { for(Entry<String, Position> warp : warps.entrySet()) {
Position pos = warp.getValue(); Position pos = warp.getValue();
Dimension wdim = pos.getDimension(); Dimension wdim = pos.getDimension();
if(wdim != null && (dim == null || wdim == dim)) if(wdim != null && (dim == null || wdim == dim))
exec.log(TextColor.NEON + "%s" + TextColor.GRAY + ": " + TextColor.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getFormattedName(false), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord)); exec.log(TextColor.NEON + "%s" + TextColor.GRAY + ": " + TextColor.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getNameString(), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord));
} }
} }
} }

View file

@ -20,12 +20,12 @@ 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.getType().weather)
throw new RunException("Welt %s hat kein Wetter", world.dimension.getFormattedName(false)); throw new RunException("Welt %s hat kein Wetter", world.dimension.getNameString());
else if(world.isExterminated()) else if(world.isExterminated())
throw new RunException("Welt %s ist zerstört", world.dimension.getFormattedName(false)); throw new RunException("Welt %s ist zerstört", world.dimension.getNameString());
world.setWeather(weather); world.setWeather(weather);
if(!transition) if(!transition)
world.resetWeather(); world.resetWeather();
exec.log("Wetter in %s zu %s geändert", world.dimension.getFormattedName(false), weather.getDisplay()); exec.log("Wetter in %s zu %s geändert", world.dimension.getNameString(), weather.getDisplay());
} }
} }

View file

@ -23,7 +23,7 @@ public class CommandWorld extends Command {
for(Entity entity : entities) { for(Entity entity : entities) {
BlockPos pos = adjust(world, entity.getPosition()); BlockPos pos = adjust(world, entity.getPosition());
entity.teleport(pos, world); entity.teleport(pos, world);
exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), world.dimension.getFormattedName(false)); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getCommandName(), pos.getX(), pos.getY(), pos.getZ(), world.dimension.getNameString());
} }
return entities.size(); return entities.size();
} }

View file

@ -1390,7 +1390,7 @@ public class Player extends User implements Executor, IPlayer
if(this.edit == EditAction.SELECT && this.selectionDim != Integer.MIN_VALUE && (this.selPos1 != null || this.selPos2 != null)) { if(this.edit == EditAction.SELECT && this.selectionDim != Integer.MIN_VALUE && (this.selPos1 != null || this.selPos2 != null)) {
Dimension dim = UniverseRegistry.getDimension(this.selectionDim); Dimension dim = UniverseRegistry.getDimension(this.selectionDim);
if(dim != null) { if(dim != null) {
msg += "; Bereich " + dim.getFormattedName(false) + ": "; msg += "; Bereich " + dim.getNameString() + ": ";
msg += (this.selPos1 != null ? this.selPos1 : "*") + " -> " + (this.selPos2 != null ? this.selPos2 : "*"); msg += (this.selPos1 != null ? this.selPos1 : "*") + " -> " + (this.selPos2 != null ? this.selPos2 : "*");
if(this.selPos1 != null && this.selPos2 != null) { if(this.selPos1 != null && this.selPos2 != null) {
msg += " = " + (1 + Math.max(this.selPos1.getX(), this.selPos2.getX()) - Math.min(this.selPos1.getX(), this.selPos2.getX())) + msg += " = " + (1 + Math.max(this.selPos1.getX(), this.selPos2.getX()) - Math.min(this.selPos1.getX(), this.selPos2.getX())) +
@ -1600,7 +1600,7 @@ public class Player extends User implements Executor, IPlayer
info = null; info = null;
Alignment align = Alignment.getByName(tag.getString("Align")); Alignment align = Alignment.getByName(tag.getString("Align"));
Dimension dimension = UniverseRegistry.getDimension(tag.getString("Dimension")); Dimension dimension = UniverseRegistry.getDimension(tag.getString("Dimension"));
String dim = dimension == null ? "???" : dimension.getFormattedName(false); String dim = dimension == null ? "???" : dimension.getNameString();
BlockPos pos = new BlockPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ")); BlockPos pos = new BlockPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ"));
String type = EntityRegistry.getEntityName(tag.getString("id")); String type = EntityRegistry.getEntityName(tag.getString("id"));
int level = tag.getInt("XpLevel"); int level = tag.getInt("XpLevel");
@ -2472,7 +2472,7 @@ public class Player extends User implements Executor, IPlayer
Position pos = this.server.getRandomSpawnPosition(origin); Position pos = this.server.getRandomSpawnPosition(origin);
this.entity.teleport(pos); this.entity.teleport(pos);
this.teleportPos = this.deathPos = null; this.teleportPos = this.deathPos = null;
this.sendPacket(new SPacketCharacterList(this.selected, this.selected, new PlayerCharacter(this.entity.getCustomNameTag(), this.entity.getDescription(), this.entity.getAlignment(), this.entity.worldObj.dimension.getFormattedName(false), this.entity.getPosition(), EntityRegistry.getEntityName(EntityRegistry.getEntityString(this.entity)), this.entity.experienceLevel))); this.sendPacket(new SPacketCharacterList(this.selected, this.selected, new PlayerCharacter(this.entity.getCustomNameTag(), this.entity.getDescription(), this.entity.getAlignment(), this.entity.worldObj.dimension.getNameString(), this.entity.getPosition(), EntityRegistry.getEntityName(EntityRegistry.getEntityString(this.entity)), this.entity.experienceLevel)));
// if(this.local) // if(this.local)
// this.server.setDone(); // this.server.setDone();
break; break;