1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-21 15:59:32 +00:00

Make it build, update MCPL

This commit is contained in:
Eclipse
2025-09-29 13:51:35 +00:00
parent ef55f76f0d
commit 5e69361d69
13 changed files with 39 additions and 29 deletions

View File

@@ -26,7 +26,7 @@ dependencies {
} }
repositories { repositories {
mavenLocal() // mavenLocal()
mavenCentral() mavenCentral()

View File

@@ -655,7 +655,7 @@ public final class EntityDefinitions {
.addTranslator(MetadataTypes.ROTATIONS, ArmorStandEntity::setRightLegRotation) .addTranslator(MetadataTypes.ROTATIONS, ArmorStandEntity::setRightLegRotation)
.build(); .build();
EntityDefinition<AvatarEntity> avatarEntityBase = EntityDefinition.inherited(AvatarEntity::new, livingEntityBase) EntityDefinition<AvatarEntity> avatarEntityBase = EntityDefinition.<AvatarEntity>inherited(null, livingEntityBase)
.height(1.8f).width(0.6f) .height(1.8f).width(0.6f)
.offset(1.62f) .offset(1.62f)
.addTranslator(null) // Player main hand .addTranslator(null) // Player main hand

View File

@@ -25,6 +25,8 @@
package org.geysermc.geyser.entity.type.player; package org.geysermc.geyser.entity.type.player;
import lombok.Getter;
import lombok.Setter;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
@@ -59,17 +61,21 @@ public class AvatarEntity extends LivingEntity {
public static final float SNEAKING_POSE_HEIGHT = 1.5f; public static final float SNEAKING_POSE_HEIGHT = 1.5f;
protected static final List<AbilityLayer> BASE_ABILITY_LAYER; protected static final List<AbilityLayer> BASE_ABILITY_LAYER;
@Getter
protected String username; protected String username;
/** /**
* The textures property from the GameProfile. * The textures property from the GameProfile.
*/ */
@Getter
@Setter
@Nullable @Nullable
protected String texturesProperty; protected String texturesProperty; // TODO no direct setter, rather one that updates the skin
private String cachedScore = ""; private String cachedScore = "";
private boolean scoreVisible = true; private boolean scoreVisible = true;
@Getter
@Nullable @Nullable
private Vector3i bedPosition; private Vector3i bedPosition;

View File

@@ -209,6 +209,10 @@ public class PlayerEntity extends AvatarEntity implements GeyserPlayerEntity {
super.setNametag(nametag, fromDisplayName); super.setNametag(nametag, fromDisplayName);
} }
public void setUsername(String username) {
this.username = username;
}
/** /**
* @return the UUID that should be used when dealing with Bedrock's tab list. * @return the UUID that should be used when dealing with Bedrock's tab list.
*/ */

View File

@@ -166,7 +166,7 @@ public final class GameProtocol {
* @return the supported Minecraft: Java Edition version * @return the supported Minecraft: Java Edition version
*/ */
public static String getJavaMinecraftVersion() { public static String getJavaMinecraftVersion() {
return "1.21.9-pre4"; // TODO change to 1.21.9 return "1.21.9-rc1"; // TODO change to 1.21.9
} }
/** /**

View File

@@ -151,14 +151,14 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
} }
@Override @Override
public void onDisconnect(String reason) { public void onDisconnect(CharSequence reason) {
// Use our own disconnect messages for these reasons // Use our own disconnect messages for these reasons
if (BedrockDisconnectReasons.CLOSED.equals(reason)) { if (BedrockDisconnectReasons.CLOSED.contentEquals(reason)) {
this.session.getUpstream().getSession().setDisconnectReason(GeyserLocale.getLocaleStringLog("geyser.network.disconnect.closed_by_remote_peer")); this.session.getUpstream().getSession().setDisconnectReason(GeyserLocale.getLocaleStringLog("geyser.network.disconnect.closed_by_remote_peer"));
} else if (BedrockDisconnectReasons.TIMEOUT.equals(reason)) { } else if (BedrockDisconnectReasons.TIMEOUT.contentEquals(reason)) {
this.session.getUpstream().getSession().setDisconnectReason(GeyserLocale.getLocaleStringLog("geyser.network.disconnect.timed_out")); this.session.getUpstream().getSession().setDisconnectReason(GeyserLocale.getLocaleStringLog("geyser.network.disconnect.timed_out"));
} }
this.session.disconnect(this.session.getUpstream().getSession().getDisconnectReason()); this.session.disconnect(this.session.getUpstream().getSession().getDisconnectReason().toString());
} }
@Override @Override

View File

@@ -39,7 +39,7 @@ import org.geysermc.geyser.api.skin.Skin;
import org.geysermc.geyser.api.skin.SkinData; import org.geysermc.geyser.api.skin.SkinData;
import org.geysermc.geyser.api.skin.SkinGeometry; import org.geysermc.geyser.api.skin.SkinGeometry;
import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.entity.type.LivingEntity;
import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.entity.type.player.AvatarEntity;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.mcprotocollib.auth.GameProfile; import org.geysermc.mcprotocollib.auth.GameProfile;
@@ -100,7 +100,7 @@ public class FakeHeadProvider {
} }
}); });
public static void setHead(GeyserSession session, PlayerEntity entity, @Nullable ResolvableProfile profile) { public static void setHead(GeyserSession session, AvatarEntity entity, @Nullable ResolvableProfile profile) {
if (profile == null) { if (profile == null) {
return; return;
} }
@@ -120,7 +120,7 @@ public class FakeHeadProvider {
}); });
} }
private static void loadHeadFromProfile(GeyserSession session, PlayerEntity entity, ResolvableProfile original, GameProfile resolved) { private static void loadHeadFromProfile(GeyserSession session, AvatarEntity entity, ResolvableProfile original, GameProfile resolved) {
Texture skinTexture = SkinManager.getTextureDataFromProfile(resolved, TextureType.SKIN); Texture skinTexture = SkinManager.getTextureDataFromProfile(resolved, TextureType.SKIN);
String originalTextures = entity.getTexturesProperty(); String originalTextures = entity.getTexturesProperty();
if (skinTexture != null) { if (skinTexture != null) {
@@ -137,7 +137,7 @@ public class FakeHeadProvider {
} }
public static void restoreOriginalSkin(GeyserSession session, LivingEntity livingEntity) { public static void restoreOriginalSkin(GeyserSession session, LivingEntity livingEntity) {
if (!(livingEntity instanceof PlayerEntity entity)) { if (!(livingEntity instanceof AvatarEntity entity)) {
return; return;
} }
@@ -161,7 +161,7 @@ public class FakeHeadProvider {
private static class FakeHeadEntry { private static class FakeHeadEntry {
private final String texturesProperty; private final String texturesProperty;
private final String fakeHeadSkinUrl; private final String fakeHeadSkinUrl;
private PlayerEntity entity; private AvatarEntity entity;
private GeyserSession session; private GeyserSession session;
@Override @Override

View File

@@ -40,7 +40,7 @@ import org.geysermc.geyser.api.skin.Cape;
import org.geysermc.geyser.api.skin.Skin; import org.geysermc.geyser.api.skin.Skin;
import org.geysermc.geyser.api.skin.SkinData; import org.geysermc.geyser.api.skin.SkinData;
import org.geysermc.geyser.api.skin.SkinGeometry; import org.geysermc.geyser.api.skin.SkinGeometry;
import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.entity.type.player.AvatarEntity;
import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; import org.geysermc.geyser.entity.type.player.SkullPlayerEntity;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.auth.BedrockClientData; import org.geysermc.geyser.session.auth.BedrockClientData;
@@ -73,7 +73,7 @@ public class SkinManager {
/** /**
* Builds a Bedrock player list entry from our existing, cached Bedrock skin information * Builds a Bedrock player list entry from our existing, cached Bedrock skin information
*/ */
public static PlayerListPacket.Entry buildCachedEntry(GeyserSession session, PlayerEntity playerEntity) { public static PlayerListPacket.Entry buildCachedEntry(GeyserSession session, AvatarEntity playerEntity) {
// First: see if we have the cached skin texture ID. // First: see if we have the cached skin texture ID.
GameProfileData data = GameProfileData.from(playerEntity); GameProfileData data = GameProfileData.from(playerEntity);
Skin skin = null; Skin skin = null;
@@ -156,7 +156,7 @@ public class SkinManager {
return entry; return entry;
} }
public static void sendSkinPacket(GeyserSession session, PlayerEntity entity, SkinData skinData) { public static void sendSkinPacket(GeyserSession session, AvatarEntity entity, SkinData skinData) {
Skin skin = skinData.skin(); Skin skin = skinData.skin();
Cape cape = skinData.cape(); Cape cape = skinData.cape();
SkinGeometry geometry = skinData.geometry(); SkinGeometry geometry = skinData.geometry();
@@ -278,7 +278,7 @@ public class SkinManager {
return textures.get(type); return textures.get(type);
} }
public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSession session, public static void requestAndHandleSkinAndCape(AvatarEntity entity, GeyserSession session,
Consumer<SkinProvider.SkinAndCape> skinAndCapeConsumer) { Consumer<SkinProvider.SkinAndCape> skinAndCapeConsumer) {
SkinProvider.requestSkinData(entity, session).whenCompleteAsync((skinData, throwable) -> { SkinProvider.requestSkinData(entity, session).whenCompleteAsync((skinData, throwable) -> {
if (skinData == null) { if (skinData == null) {
@@ -299,7 +299,7 @@ public class SkinManager {
}); });
} }
public static void handleBedrockSkin(PlayerEntity playerEntity, BedrockClientData clientData) { public static void handleBedrockSkin(AvatarEntity playerEntity, BedrockClientData clientData) {
GeyserImpl geyser = GeyserImpl.getInstance(); GeyserImpl geyser = GeyserImpl.getInstance();
if (geyser.getConfig().isDebugMode()) { if (geyser.getConfig().isDebugMode()) {
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid()));
@@ -370,7 +370,7 @@ public class SkinManager {
* @param entity entity to build the GameProfileData from * @param entity entity to build the GameProfileData from
* @return The built GameProfileData * @return The built GameProfileData
*/ */
public static @Nullable GameProfileData from(PlayerEntity entity) { public static @Nullable GameProfileData from(AvatarEntity entity) {
String texturesProperty = entity.getTexturesProperty(); String texturesProperty = entity.getTexturesProperty();
if (texturesProperty == null) { if (texturesProperty == null) {
// Likely offline mode // Likely offline mode

View File

@@ -38,7 +38,7 @@ import org.geysermc.geyser.api.skin.Cape;
import org.geysermc.geyser.api.skin.Skin; import org.geysermc.geyser.api.skin.Skin;
import org.geysermc.geyser.api.skin.SkinData; import org.geysermc.geyser.api.skin.SkinData;
import org.geysermc.geyser.api.skin.SkinGeometry; import org.geysermc.geyser.api.skin.SkinGeometry;
import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.entity.type.player.AvatarEntity;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.util.FileUtils;
@@ -236,7 +236,7 @@ public class SkinProvider {
return CACHED_JAVA_CAPES.getIfPresent(capeUrl); return CACHED_JAVA_CAPES.getIfPresent(capeUrl);
} }
static CompletableFuture<SkinData> requestSkinData(PlayerEntity entity, GeyserSession session) { static CompletableFuture<SkinData> requestSkinData(AvatarEntity entity, GeyserSession session) {
SkinManager.GameProfileData data = SkinManager.GameProfileData.from(entity); SkinManager.GameProfileData data = SkinManager.GameProfileData.from(entity);
if (data == null) { if (data == null) {
// This player likely does not have a textures property // This player likely does not have a textures property

View File

@@ -86,7 +86,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements
partialOrStatic.setProperties(properties); partialOrStatic.setProperties(properties);
// Only if all fields are present, then the profile is a static one // Only if all fields are present, then the profile is a static one
// TODO shorthand constructor in MCPL // TODO shorthand constructor in MCPL
return new ResolvableProfile(partialOrStatic, uuid == null || name == null || properties == null); return new ResolvableProfile(partialOrStatic);
} }
public static @Nullable BlockDefinition translateSkull(GeyserSession session, NbtMap javaNbt, Vector3i blockPosition, BlockState blockState) { public static @Nullable BlockDefinition translateSkull(GeyserSession session, NbtMap javaNbt, Vector3i blockPosition, BlockState blockState) {

View File

@@ -38,8 +38,8 @@ public class JavaSetDefaultSpawnPositionTranslator extends PacketTranslator<Clie
@Override @Override
public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) { public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) {
SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket(); SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket();
spawnPositionPacket.setBlockPosition(packet.getPosition()); spawnPositionPacket.setBlockPosition(packet.getGlobalPos().getPosition());
spawnPositionPacket.setDimensionId(DimensionUtils.javaToBedrock(session)); spawnPositionPacket.setDimensionId(DimensionUtils.javaToBedrock(packet.getGlobalPos().getDimension().asString()));
spawnPositionPacket.setSpawnType(SetSpawnPositionPacket.Type.WORLD_SPAWN); spawnPositionPacket.setSpawnType(SetSpawnPositionPacket.Type.WORLD_SPAWN);
session.sendUpstreamPacket(spawnPositionPacket); session.sendUpstreamPacket(spawnPositionPacket);
} }

View File

@@ -171,7 +171,7 @@ public class DimensionUtils {
* *
* @param javaDimension Dimension ID to convert * @param javaDimension Dimension ID to convert
* @return Converted Bedrock edition dimension ID * @return Converted Bedrock edition dimension ID
*/ */ // TODO take a key
public static int javaToBedrock(String javaDimension) { public static int javaToBedrock(String javaDimension) {
return switch (javaDimension) { return switch (javaDimension) {
case BedrockDimension.NETHER_IDENTIFIER -> BedrockDimension.BEDROCK_NETHER_ID; case BedrockDimension.NETHER_IDENTIFIER -> BedrockDimension.BEDROCK_NETHER_ID;

View File

@@ -9,12 +9,12 @@ netty = "4.2.3.Final"
guava = "29.0-jre" guava = "29.0-jre"
gson = "2.3.1" # Provided by Spigot 1.8.8 gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1" websocket = "1.5.1"
protocol-connection = "3.0.0.Beta8-NO-ADVENTURE-SNAPSHOT" protocol-connection = "3.0.0.Beta8-20250929.100800-7"
protocol-common = "3.0.0.Beta8-NO-ADVENTURE-SNAPSHOT" protocol-common = "3.0.0.Beta8-20250929.100800-7"
protocol-codec = "3.0.0.Beta8-NO-ADVENTURE-SNAPSHOT" protocol-codec = "3.0.0.Beta8-20250929.100800-7"
raknet = "1.0.0.CR3-20250811.214335-20" raknet = "1.0.0.CR3-20250811.214335-20"
minecraftauth = "4.1.1" minecraftauth = "4.1.1"
mcprotocollib = "1.21.9-SNAPSHOT" mcprotocollib = "1.21.9-20250929.132357-8"
adventure = "4.24.0" adventure = "4.24.0"
adventure-platform = "4.3.0" adventure-platform = "4.3.0"
junit = "5.9.2" junit = "5.9.2"