extend dimension system, remove dim ids

This commit is contained in:
Sen 2025-06-29 19:09:47 +02:00
parent a080ed5583
commit f613bd2122
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
46 changed files with 1216 additions and 1283 deletions

View file

@ -498,6 +498,8 @@ public class Client implements IThreadListener {
private boolean waitingForFile;
private boolean refreshing;
public String dimensionName;
public String message;
public int total;
public int progress = -1;
@ -1590,7 +1592,7 @@ public class Client implements IThreadListener {
// SKC.loaded(true);
}
public void setDimensionAndSpawnPlayer(int dimension, int type)
public void setDimensionAndSpawnPlayer(int type)
{
this.world.removeAllEntities();
int i = 0;
@ -1839,9 +1841,9 @@ public class Client implements IThreadListener {
if(this.world.isBlockLoaded(blockpos)) {
ChunkClient chunk = this.world.getChunk(blockpos);
biome = chunk.getBiome(blockpos);
bline = "Biom: " + biome.display + " (" + biome.id + ")" + /* (this.debugHideInfo ? "" : */ (", D: " +
bline = "Biom: " + biome.display + " (" + biome.name + ")" + /* (this.debugHideInfo ? "" : */ (", D: " +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
" (" + this.world.dimension.getDimensionId() + ")");
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")");
lline = "Licht: " + chunk.getLightSub(blockpos, 0) + " (" + chunk.getLight(LightType.SKY, blockpos) + " Himmel, "
+ chunk.getLight(LightType.BLOCK, blockpos) + " Blöcke, " + String.format(
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
@ -1850,7 +1852,7 @@ public class Client implements IThreadListener {
else {
bline = "Biom: <?>, D: " +
TextColor.stripCodes(this.world.dimension.getFormattedName(false)) +
" (" + this.world.dimension.getDimensionId() + ")";
" (" + (this.dimensionName == null ? UniverseRegistry.getName(this.world.dimension) : this.dimensionName) + ")";
lline = "Licht: " + String.format(
"%.1f", this.world.getSunBrightness(1.0f) * 15.0f) + " Welt, A: "
+ String.format("%.3f", this.world.getCelestialAngle(1.0f));

View file

@ -385,7 +385,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
GuiChar.this.gm.displayGuiScreen(GuiLoading.makeWaitTask("Lade Welt ..."));
Dimension dim = UniverseRegistry.getBaseDimensions().get(GuiChar.this.dimension);
GuiChar.this.gm.player.client.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText()));
GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, dim.getDimensionId()));
GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, UniverseRegistry.getId(dim)));
}
}
}, "Charakter erstellen"));
@ -416,7 +416,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
Dimension dim = UniverseRegistry.getDimension(egg.origin());
if(dim != null) {
for(int z = 0; z < UniverseRegistry.getBaseDimensions().size(); z++) {
if(UniverseRegistry.getBaseDimensions().get(z).getDimensionId() == dim.getDimensionId()) {
if(UniverseRegistry.getBaseDimensions().get(z) == dim) {
this.dimension = z;
break;
}

View file

@ -218,6 +218,7 @@ public class ClientPlayer implements IClientPlayer
public void handleJoinGame(SPacketJoinGame packetIn)
{
NetHandler.checkThread(packetIn, this, this.gm);
this.gm.dimensionName = packetIn.getDimName();
this.gm.charEditor = packetIn.isInEditor();
this.gm.controller = new PlayerController(this.gm, this);
this.world = new WorldClient(this.gm, packetIn.getDimension());
@ -1064,10 +1065,9 @@ public class ClientPlayer implements IClientPlayer
{
NetHandler.checkThread(packetIn, this, this.gm, this.world);
this.gm.charEditor = packetIn.isInEditor();
Dimension dim = packetIn.getDimension();
if (dim.getDimensionId() != this.world.dimension.getDimensionId()) // this.gameController.thePlayer.dimension)
{
if(dim != null) {
this.gm.dimensionName = packetIn.getDimName();
this.loaded = false;
// if(dim.getDimensionId() < 0 && this.gameController.thePlayer.dimension >= 0) {
// this.travelSound = "portal.travel";
@ -1082,7 +1082,7 @@ public class ClientPlayer implements IClientPlayer
// this.gameController.displayGuiScreen(GuiSkin.INSTANCE);
// }
this.gm.setDimensionAndSpawnPlayer(dim.getDimensionId(), packetIn.getEntityType());
this.gm.setDimensionAndSpawnPlayer(packetIn.getEntityType());
this.gm.displayGuiScreen(this.gm.charEditor ? GuiChar.INSTANCE : null);
// this.gameController.controller.setCheat(packetIn.getCheat());
}
@ -1928,7 +1928,9 @@ public class ClientPlayer implements IClientPlayer
public void handleDimName(SPacketDimensionName packetIn) {
NetHandler.checkThread(packetIn, this, this.gm, this.world);
this.world.dimension.setFullName(packetIn.getFullName());
this.world.dimension.setCustomName(packetIn.getCustomName());
if(this.world.dimension.isCustom()) {
this.world.dimension.setCustomName(packetIn.getCustomName());
this.world.dimension.setDisplayName(packetIn.getFullName());
}
}
}