hollow-cube/dimension-names-part-2

(cherry picked from commit 3dbf364340)
This commit is contained in:
mworzala 2023-07-04 21:21:59 -04:00 committed by Matt Worzala
parent c733016d9e
commit f6c91085b6

View File

@ -283,7 +283,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
"value", NBT.List(NBTType.TAG_Compound, damageTypes) "value", NBT.List(NBTType.TAG_Compound, damageTypes)
))); )));
final JoinGamePacket joinGamePacket = new JoinGamePacket(getEntityId(), false, gameMode, null, final JoinGamePacket joinGamePacket = new JoinGamePacket(getEntityId(), false, gameMode, null,
List.of(dimensionType.getName().asString()), NBT.Compound(registry), dimensionType.toString(), dimensionType.getName().asString(), List.of(), NBT.Compound(registry), dimensionType.toString(), spawnInstance.getDimensionName(),
0, 0, MinecraftServer.getChunkViewDistance(), MinecraftServer.getChunkViewDistance(), 0, 0, MinecraftServer.getChunkViewDistance(), MinecraftServer.getChunkViewDistance(),
false, true, false, levelFlat, deathLocation, portalCooldown); false, true, false, levelFlat, deathLocation, portalCooldown);
sendPacket(joinGamePacket); sendPacket(joinGamePacket);
@ -607,7 +607,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
} }
// Must update the player chunks // Must update the player chunks
chunkUpdateLimitChecker.clearHistory(); chunkUpdateLimitChecker.clearHistory();
final boolean dimensionChange = !Objects.equals(dimensionType, instance.getDimensionType()); final boolean dimensionChange = currentInstance != null && !Objects.equals(currentInstance.getDimensionName(), instance.getDimensionName());
final Consumer<Instance> runnable = (i) -> spawnPlayer(i, spawnPosition, final Consumer<Instance> runnable = (i) -> spawnPlayer(i, spawnPosition,
currentInstance == null, dimensionChange, true); currentInstance == null, dimensionChange, true);
@ -1423,7 +1423,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
* @param dimensionType the new player dimension * @param dimensionType the new player dimension
*/ */
protected void sendDimension(@NotNull DimensionType dimensionType, @NotNull String dimensionName) { protected void sendDimension(@NotNull DimensionType dimensionType, @NotNull String dimensionName) {
Check.argCondition(dimensionType.equals(getDimensionType()), Check.argCondition(instance.getDimensionName().equals(dimensionName),
"The dimension needs to be different than the current one!"); "The dimension needs to be different than the current one!");
this.dimensionType = dimensionType; this.dimensionType = dimensionType;
sendPacket(new RespawnPacket(dimensionType.toString(), dimensionName, sendPacket(new RespawnPacket(dimensionType.toString(), dimensionName,