Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 08:10:11 +01:00
Update to 1.16.2-rc1
Dieser Commit ist enthalten in:
Ursprung
098a0e7993
Commit
6e80f22ee9
@ -105,7 +105,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.GeyserMC</groupId>
|
||||
<artifactId>MCProtocolLib</artifactId>
|
||||
<version>da148409ff</version>
|
||||
<version>2ee53b72d1</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -51,10 +51,11 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
|
||||
entity.setEntityId(packet.getEntityId());
|
||||
// If the player is already initialized and a join game packet is sent, they
|
||||
// are swapping servers
|
||||
String newDimension = DimensionUtils.getNewDimension(packet.getDimension());
|
||||
if (session.isSpawned()) {
|
||||
String fakeDim = entity.getDimension().equals(DimensionUtils.OVERWORLD) ? DimensionUtils.NETHER : DimensionUtils.OVERWORLD;
|
||||
DimensionUtils.switchDimension(session, fakeDim);
|
||||
DimensionUtils.switchDimension(session, packet.getDimension());
|
||||
DimensionUtils.switchDimension(session, newDimension);
|
||||
|
||||
session.getScoreboardCache().removeScoreboard();
|
||||
}
|
||||
@ -91,8 +92,8 @@ public class JavaJoinGameTranslator extends PacketTranslator<ServerJoinGamePacke
|
||||
ClientSettingsPacket clientSettingsPacket = new ClientSettingsPacket(locale, (byte) session.getRenderDistance(), ChatVisibility.FULL, true, skinParts, HandPreference.RIGHT_HAND);
|
||||
session.sendDownstreamPacket(clientSettingsPacket);
|
||||
|
||||
if (!packet.getDimension().equals(entity.getDimension())) {
|
||||
DimensionUtils.switchDimension(session, packet.getDimension());
|
||||
if (!newDimension.equals(entity.getDimension())) {
|
||||
DimensionUtils.switchDimension(session, newDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,13 +65,14 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
|
||||
stopRainPacket.setPosition(Vector3f.ZERO);
|
||||
session.sendUpstreamPacket(stopRainPacket);
|
||||
|
||||
if (!entity.getDimension().equals(packet.getDimension())) {
|
||||
DimensionUtils.switchDimension(session, packet.getDimension());
|
||||
String newDimension = DimensionUtils.getNewDimension(packet.getDimension());
|
||||
if (!entity.getDimension().equals(newDimension)) {
|
||||
DimensionUtils.switchDimension(session, newDimension);
|
||||
} else {
|
||||
if (session.isManyDimPackets()) { //reloading world
|
||||
String fakeDim = entity.getDimension().equals(DimensionUtils.OVERWORLD) ? DimensionUtils.NETHER : DimensionUtils.OVERWORLD;
|
||||
DimensionUtils.switchDimension(session, fakeDim);
|
||||
DimensionUtils.switchDimension(session, packet.getDimension());
|
||||
DimensionUtils.switchDimension(session, newDimension);
|
||||
} else {
|
||||
// Handled in JavaPlayerPositionRotationTranslator
|
||||
session.setSpawned(false);
|
||||
|
@ -26,8 +26,13 @@
|
||||
package org.geysermc.connector.utils;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.Effect;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import com.nukkitx.protocol.bedrock.packet.*;
|
||||
import com.nukkitx.protocol.bedrock.packet.ChangeDimensionPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.MobEffectPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.StopSoundPacket;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
@ -99,6 +104,25 @@ public class DimensionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the new dimension based on the {@link CompoundTag} sent by either the {@link com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket}
|
||||
* or {@link com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket}.
|
||||
* @param dimensionTag the packet's dimension tag.
|
||||
* @return the dimension identifier.
|
||||
*/
|
||||
public static String getNewDimension(CompoundTag dimensionTag) {
|
||||
if (dimensionTag == null || dimensionTag.isEmpty()) {
|
||||
GeyserConnector.getInstance().getLogger().debug("Dimension tag was null or empty.");
|
||||
return "minecraft:overworld";
|
||||
}
|
||||
if (dimensionTag.getValue().get("effects") != null) {
|
||||
System.out.println(((StringTag) dimensionTag.getValue().get("effects")).getValue());
|
||||
return ((StringTag) dimensionTag.getValue().get("effects")).getValue();
|
||||
}
|
||||
GeyserConnector.getInstance().getLogger().debug("Effects portion of the tag was null or empty.");
|
||||
return "minecraft:overworld";
|
||||
}
|
||||
|
||||
public static void changeBedrockNetherId() {
|
||||
// Change dimension ID to the End to allow for building above Bedrock
|
||||
BEDROCK_NETHER_ID = 2;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren