mirror of
https://github.com/GeyserMC/GeyserConnect.git
synced 2025-06-26 14:15:22 +02:00
Update to 1.16
This commit is contained in:
parent
dfe1b53750
commit
867cf9ae51
11 changed files with 41 additions and 34 deletions
6
pom.xml
6
pom.xml
|
@ -80,12 +80,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.nukkitx.protocol</groupId>
|
<groupId>com.nukkitx.protocol</groupId>
|
||||||
<artifactId>bedrock-v390</artifactId>
|
<artifactId>bedrock-v407</artifactId>
|
||||||
<version>2.5.6</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.minecrell</groupId>
|
<groupId>net.minecrell</groupId>
|
||||||
|
|
|
@ -28,6 +28,7 @@ package org.geysermc.connect;
|
||||||
|
|
||||||
import com.nukkitx.protocol.bedrock.*;
|
import com.nukkitx.protocol.bedrock.*;
|
||||||
import com.nukkitx.protocol.bedrock.v390.Bedrock_v390;
|
import com.nukkitx.protocol.bedrock.v390.Bedrock_v390;
|
||||||
|
import com.nukkitx.protocol.bedrock.v407.Bedrock_v407;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.geysermc.connect.utils.Server;
|
import org.geysermc.connect.utils.Server;
|
||||||
|
@ -49,7 +50,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
public class MasterServer {
|
public class MasterServer {
|
||||||
|
|
||||||
public static final BedrockPacketCodec CODEC = Bedrock_v390.V390_CODEC;
|
public static final BedrockPacketCodec CODEC = Bedrock_v407.V407_CODEC;
|
||||||
|
|
||||||
private final Timer timer;
|
private final Timer timer;
|
||||||
private BedrockServer bdServer;
|
private BedrockServer bdServer;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import com.nimbusds.jose.JWSObject;
|
||||||
import com.nimbusds.jose.crypto.factories.DefaultJWSVerifierFactory;
|
import com.nimbusds.jose.crypto.factories.DefaultJWSVerifierFactory;
|
||||||
import com.nukkitx.network.util.DisconnectReason;
|
import com.nukkitx.network.util.DisconnectReason;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
||||||
import com.nukkitx.protocol.bedrock.data.Attribute;
|
import com.nukkitx.protocol.bedrock.data.AttributeData;
|
||||||
import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler;
|
import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import com.nukkitx.protocol.bedrock.util.EncryptionUtils;
|
import com.nukkitx.protocol.bedrock.util.EncryptionUtils;
|
||||||
|
@ -89,9 +89,9 @@ public class PacketHandler implements BedrockPacketHandler {
|
||||||
if (protocol != MasterServer.CODEC.getProtocolVersion()) {
|
if (protocol != MasterServer.CODEC.getProtocolVersion()) {
|
||||||
PlayStatusPacket status = new PlayStatusPacket();
|
PlayStatusPacket status = new PlayStatusPacket();
|
||||||
if (protocol > MasterServer.CODEC.getProtocolVersion()) {
|
if (protocol > MasterServer.CODEC.getProtocolVersion()) {
|
||||||
status.setStatus(PlayStatusPacket.Status.FAILED_SERVER);
|
status.setStatus(PlayStatusPacket.Status.LOGIN_FAILED_SERVER_OLD);
|
||||||
} else {
|
} else {
|
||||||
status.setStatus(PlayStatusPacket.Status.FAILED_CLIENT);
|
status.setStatus(PlayStatusPacket.Status.LOGIN_FAILED_CLIENT_OLD);
|
||||||
}
|
}
|
||||||
session.sendPacket(status);
|
session.sendPacket(status);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ public class PacketHandler implements BedrockPacketHandler {
|
||||||
// This is to fix a bug in the client where it doesn't load form images
|
// This is to fix a bug in the client where it doesn't load form images
|
||||||
UpdateAttributesPacket updateAttributesPacket = new UpdateAttributesPacket();
|
UpdateAttributesPacket updateAttributesPacket = new UpdateAttributesPacket();
|
||||||
updateAttributesPacket.setRuntimeEntityId(1);
|
updateAttributesPacket.setRuntimeEntityId(1);
|
||||||
List<Attribute> attributes = new ArrayList<>();
|
List<AttributeData> attributes = new ArrayList<>();
|
||||||
attributes.add(AttributeUtils.getBedrockAttribute(AttributeType.EXPERIENCE_LEVEL.getAttribute(0f)));
|
attributes.add(AttributeUtils.getBedrockAttribute(AttributeType.EXPERIENCE_LEVEL.getAttribute(0f)));
|
||||||
updateAttributesPacket.setAttributes(attributes);
|
updateAttributesPacket.setAttributes(attributes);
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,12 @@ package org.geysermc.connect.proxy;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||||
import org.geysermc.common.PlatformType;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
import org.geysermc.connector.bootstrap.GeyserBootstrap;
|
||||||
import org.geysermc.connector.command.CommandManager;
|
import org.geysermc.connector.command.CommandManager;
|
||||||
|
import org.geysermc.connector.common.PlatformType;
|
||||||
import org.geysermc.connector.configuration.GeyserConfiguration;
|
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||||
|
import org.geysermc.connector.dump.BootstrapDumpInfo;
|
||||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||||
import org.geysermc.connect.GeyserConnectConfig;
|
import org.geysermc.connect.GeyserConnectConfig;
|
||||||
|
@ -43,6 +44,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class GeyserProxyBootstrap implements GeyserBootstrap {
|
public class GeyserProxyBootstrap implements GeyserBootstrap {
|
||||||
|
@ -115,5 +118,15 @@ public class GeyserProxyBootstrap implements GeyserBootstrap {
|
||||||
public IGeyserPingPassthrough getGeyserPingPassthrough() {
|
public IGeyserPingPassthrough getGeyserPingPassthrough() {
|
||||||
return geyserPingPassthrough;
|
return geyserPingPassthrough;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Path getConfigFolder() {
|
||||||
|
return Paths.get(System.getProperty("user.dir"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BootstrapDumpInfo getDumpInfo() {
|
||||||
|
return new BootstrapDumpInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
package org.geysermc.connect.proxy;
|
package org.geysermc.connect.proxy;
|
||||||
|
|
||||||
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
||||||
import org.geysermc.common.AuthType;
|
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
|
import org.geysermc.connector.common.AuthType;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connect.MasterServer;
|
import org.geysermc.connect.MasterServer;
|
||||||
import org.geysermc.connect.utils.Player;
|
import org.geysermc.connect.utils.Player;
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
package org.geysermc.connect.proxy;
|
package org.geysermc.connect.proxy;
|
||||||
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket;
|
import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket;
|
||||||
import org.geysermc.common.AuthType;
|
|
||||||
import org.geysermc.connect.MasterServer;
|
import org.geysermc.connect.MasterServer;
|
||||||
import org.geysermc.connect.utils.Player;
|
import org.geysermc.connect.utils.Player;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
|
import org.geysermc.connector.common.AuthType;
|
||||||
import org.geysermc.connector.network.UpstreamPacketHandler;
|
import org.geysermc.connector.network.UpstreamPacketHandler;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ package org.geysermc.connect.utils;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import net.minecrell.terminalconsole.SimpleTerminalConsole;
|
import net.minecrell.terminalconsole.SimpleTerminalConsole;
|
||||||
import org.apache.logging.log4j.core.config.Configurator;
|
import org.apache.logging.log4j.core.config.Configurator;
|
||||||
import org.geysermc.common.ChatColor;
|
|
||||||
import org.geysermc.connector.GeyserLogger;
|
import org.geysermc.connector.GeyserLogger;
|
||||||
import org.geysermc.connect.MasterServer;
|
import org.geysermc.connect.MasterServer;
|
||||||
|
import org.geysermc.connector.common.ChatColor;
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class Logger extends SimpleTerminalConsole implements GeyserLogger {
|
public class Logger extends SimpleTerminalConsole implements GeyserLogger {
|
||||||
|
|
|
@ -26,12 +26,7 @@
|
||||||
|
|
||||||
package org.geysermc.connect.utils;
|
package org.geysermc.connect.utils;
|
||||||
|
|
||||||
import com.nukkitx.nbt.CompoundTagBuilder;
|
import com.nukkitx.nbt.*;
|
||||||
import com.nukkitx.nbt.NbtUtils;
|
|
||||||
import com.nukkitx.nbt.stream.NBTInputStream;
|
|
||||||
import com.nukkitx.nbt.stream.NBTOutputStream;
|
|
||||||
import com.nukkitx.nbt.tag.CompoundTag;
|
|
||||||
import com.nukkitx.nbt.tag.ListTag;
|
|
||||||
import org.geysermc.connector.utils.FileUtils;
|
import org.geysermc.connector.utils.FileUtils;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -43,18 +38,18 @@ import java.io.InputStream;
|
||||||
*/
|
*/
|
||||||
public class PalleteManger {
|
public class PalleteManger {
|
||||||
|
|
||||||
public static final ListTag<CompoundTag> BLOCK_PALLETE;
|
public static final NbtList<NbtMap> BLOCK_PALLETE;
|
||||||
public static final CompoundTag BIOMES_PALLETE;
|
public static final NbtMap BIOMES_PALLETE;
|
||||||
public static final byte[] EMPTY_LEVEL_CHUNK_DATA;
|
public static final byte[] EMPTY_LEVEL_CHUNK_DATA;
|
||||||
|
|
||||||
private static final com.nukkitx.nbt.tag.CompoundTag EMPTY_TAG = CompoundTagBuilder.builder().buildRootTag();
|
private static final NbtMap EMPTY_TAG = NbtMap.EMPTY;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
/* Load block palette */
|
/* Load block palette */
|
||||||
InputStream stream = FileUtils.getResource("bedrock/runtime_block_states.dat");
|
InputStream stream = FileUtils.getResource("bedrock/runtime_block_states.dat");
|
||||||
|
|
||||||
try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)) {
|
try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)) {
|
||||||
BLOCK_PALLETE = (ListTag<CompoundTag>) nbtInputStream.readTag();
|
BLOCK_PALLETE = (NbtList<NbtMap>) nbtInputStream.readTag();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new AssertionError("Unable to get blocks from runtime block states", e);
|
throw new AssertionError("Unable to get blocks from runtime block states", e);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +58,7 @@ public class PalleteManger {
|
||||||
stream = FileUtils.getResource("bedrock/biome_definitions.dat");
|
stream = FileUtils.getResource("bedrock/biome_definitions.dat");
|
||||||
|
|
||||||
try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)){
|
try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)){
|
||||||
BIOMES_PALLETE = (CompoundTag) nbtInputStream.readTag();
|
BIOMES_PALLETE = (NbtMap) nbtInputStream.readTag();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new AssertionError("Failed to get biomes from biome definitions", e);
|
throw new AssertionError("Failed to get biomes from biome definitions", e);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +68,7 @@ public class PalleteManger {
|
||||||
outputStream.write(new byte[258]); // Biomes + Border Size + Extra Data Size
|
outputStream.write(new byte[258]); // Biomes + Border Size + Extra Data Size
|
||||||
|
|
||||||
try (NBTOutputStream nbtOutputStream = NbtUtils.createNetworkWriter(outputStream)) {
|
try (NBTOutputStream nbtOutputStream = NbtUtils.createNetworkWriter(outputStream)) {
|
||||||
nbtOutputStream.write(EMPTY_TAG);
|
nbtOutputStream.writeTag(EMPTY_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMPTY_LEVEL_CHUNK_DATA = outputStream.toByteArray();
|
EMPTY_LEVEL_CHUNK_DATA = outputStream.toByteArray();
|
||||||
|
|
|
@ -31,9 +31,9 @@ import com.nukkitx.math.vector.Vector2f;
|
||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
import com.nukkitx.math.vector.Vector3i;
|
import com.nukkitx.math.vector.Vector3i;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
import com.nukkitx.protocol.bedrock.BedrockServerSession;
|
||||||
import com.nukkitx.protocol.bedrock.data.Attribute;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
|
import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
|
||||||
import com.nukkitx.protocol.bedrock.data.GameRuleData;
|
import com.nukkitx.protocol.bedrock.data.GameRuleData;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.GameType;
|
||||||
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
|
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
|
||||||
import com.nukkitx.protocol.bedrock.packet.*;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
|
@ -44,8 +44,6 @@ import org.geysermc.common.window.FormWindow;
|
||||||
import org.geysermc.connect.MasterServer;
|
import org.geysermc.connect.MasterServer;
|
||||||
import org.geysermc.connect.ui.FormID;
|
import org.geysermc.connect.ui.FormID;
|
||||||
import org.geysermc.connect.ui.UIHandler;
|
import org.geysermc.connect.ui.UIHandler;
|
||||||
import org.geysermc.connector.entity.attribute.AttributeType;
|
|
||||||
import org.geysermc.connector.utils.AttributeUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -90,18 +88,18 @@ public class Player {
|
||||||
StartGamePacket startGamePacket = new StartGamePacket();
|
StartGamePacket startGamePacket = new StartGamePacket();
|
||||||
startGamePacket.setUniqueEntityId(1);
|
startGamePacket.setUniqueEntityId(1);
|
||||||
startGamePacket.setRuntimeEntityId(1);
|
startGamePacket.setRuntimeEntityId(1);
|
||||||
startGamePacket.setPlayerGamemode(0);
|
startGamePacket.setPlayerGameType(GameType.CREATIVE);
|
||||||
startGamePacket.setPlayerPosition(Vector3f.from(0, 64 + 2, 0));
|
startGamePacket.setPlayerPosition(Vector3f.from(0, 64 + 2, 0));
|
||||||
startGamePacket.setRotation(Vector2f.ONE);
|
startGamePacket.setRotation(Vector2f.ONE);
|
||||||
|
|
||||||
startGamePacket.setSeed(-1);
|
startGamePacket.setSeed(-1);
|
||||||
startGamePacket.setDimensionId(2);
|
startGamePacket.setDimensionId(2);
|
||||||
startGamePacket.setGeneratorId(1);
|
startGamePacket.setGeneratorId(1);
|
||||||
startGamePacket.setLevelGamemode(1);
|
startGamePacket.setLevelGameType(GameType.CREATIVE);
|
||||||
startGamePacket.setDifficulty(0);
|
startGamePacket.setDifficulty(0);
|
||||||
startGamePacket.setDefaultSpawn(Vector3i.ZERO);
|
startGamePacket.setDefaultSpawn(Vector3i.ZERO);
|
||||||
startGamePacket.setAchievementsDisabled(true);
|
startGamePacket.setAchievementsDisabled(true);
|
||||||
startGamePacket.setTime(-1);
|
startGamePacket.setCurrentTick(-1);
|
||||||
startGamePacket.setEduEditionOffers(0);
|
startGamePacket.setEduEditionOffers(0);
|
||||||
startGamePacket.setEduFeaturesEnabled(false);
|
startGamePacket.setEduFeaturesEnabled(false);
|
||||||
startGamePacket.setRainLevel(0);
|
startGamePacket.setRainLevel(0);
|
||||||
|
@ -126,7 +124,7 @@ public class Player {
|
||||||
startGamePacket.setWorldTemplateOptionLocked(false);
|
startGamePacket.setWorldTemplateOptionLocked(false);
|
||||||
|
|
||||||
startGamePacket.setLevelId("");
|
startGamePacket.setLevelId("");
|
||||||
startGamePacket.setWorldName("GeyserMulti");
|
startGamePacket.setLevelName("GeyserMulti");
|
||||||
startGamePacket.setPremiumWorldTemplateId("");
|
startGamePacket.setPremiumWorldTemplateId("");
|
||||||
startGamePacket.setCurrentTick(0);
|
startGamePacket.setCurrentTick(0);
|
||||||
startGamePacket.setEnchantmentSeed(0);
|
startGamePacket.setEnchantmentSeed(0);
|
||||||
|
@ -146,7 +144,7 @@ public class Player {
|
||||||
|
|
||||||
// Send the biomes
|
// Send the biomes
|
||||||
BiomeDefinitionListPacket biomeDefinitionListPacket = new BiomeDefinitionListPacket();
|
BiomeDefinitionListPacket biomeDefinitionListPacket = new BiomeDefinitionListPacket();
|
||||||
biomeDefinitionListPacket.setTag(PalleteManger.BIOMES_PALLETE);
|
biomeDefinitionListPacket.setDefinitions(PalleteManger.BIOMES_PALLETE);
|
||||||
session.sendPacket(biomeDefinitionListPacket);
|
session.sendPacket(biomeDefinitionListPacket);
|
||||||
|
|
||||||
// Let the client know the player can spawn
|
// Let the client know the player can spawn
|
||||||
|
@ -179,7 +177,7 @@ public class Player {
|
||||||
|
|
||||||
// This packet is used to fix the image loading bug
|
// This packet is used to fix the image loading bug
|
||||||
NetworkStackLatencyPacket networkStackLatencyPacket = new NetworkStackLatencyPacket();
|
NetworkStackLatencyPacket networkStackLatencyPacket = new NetworkStackLatencyPacket();
|
||||||
networkStackLatencyPacket.setSendBack(true);
|
networkStackLatencyPacket.setFromServer(true);
|
||||||
networkStackLatencyPacket.setTimestamp(System.currentTimeMillis());
|
networkStackLatencyPacket.setTimestamp(System.currentTimeMillis());
|
||||||
session.sendPacket(networkStackLatencyPacket);
|
session.sendPacket(networkStackLatencyPacket);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue