Fix issues pre-1.21.9

Signed-off-by: Irmo van den Berge <irmo.vandenberge@mailbox.org>
This commit is contained in:
Irmo van den Berge committed 2025-10-07 21:14:20 +02:00
1 parent 88deb63e3c
commit cdb56e56df
2 files changed
+17 -2

No files matched your search

@@ -11,6 +11,7 @@ import com.google.common.collect.Multimap;
class GameProfile {
public static (GameProfileHandle) GameProfile createNew(UUID uuid, String name, Multimap<String, PropertyHandle> properties) {
#if version >= 1.21.9
com.mojang.authlib.properties.PropertyMap propertyMap;
if (properties.isEmpty()) {
propertyMap = com.mojang.authlib.properties.PropertyMap.EMPTY;
@@ -32,6 +33,20 @@ class GameProfile {
// Construct an (immutable) profile
return new GameProfile(uuid, name, propertyMap);
#else
// Construct a new mutable profile
GameProfile profile = new GameProfile(uuid, name);
// Copy key-values over
java.util.Iterator iter = properties.entries().iterator();
while (iter.hasNext()) {
java.util.Map$Entry entry = (java.util.Map$Entry) iter.next();
PropertyHandle value = (PropertyHandle) entry.getValue();
profile.getProperties().put((String) entry.getKey(), (com.mojang.authlib.properties.Property) value.getRaw());
}
return profile;
#endif
}
#if version >= 1.21.9
@@ -3288,9 +3288,9 @@ class PacketPlayOutSpawnPosition extends Packet {
// Pack it into a RespawnConfig object
// For older versions of Minecraft we use our own proxy class
#if version >= 1.21.5
return new EntityPlayer$RespawnConfig(null, position, yaw, true);
return new net.minecraft.server.level.EntityPlayer$RespawnConfig(null, position, yaw, true);
#else
return new EntityPlayer$RespawnConfig(null, null, position, yaw, true);
return new net.minecraft.server.level.EntityPlayer$RespawnConfig(null, null, position, yaw, true);
#endif
}
#endif