mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2026-01-06 15:42:03 +00:00
Move to Java Edition 1.20.2 (#104)
This commit is contained in:
@@ -48,11 +48,11 @@ dependencies {
|
||||
exclude group: "org.ow2.asm", module: "*" // From Events lib
|
||||
}
|
||||
|
||||
include(modImplementation('cloud.commandframework:cloud-fabric:1.8.3') {
|
||||
include(modImplementation('cloud.commandframework:cloud-fabric:1.8.4') {
|
||||
because "Commands library implementation for Fabric"
|
||||
})
|
||||
|
||||
include(modImplementation('net.kyori:adventure-platform-fabric:5.8.0-SNAPSHOT') {
|
||||
include(modImplementation('net.kyori:adventure-platform-fabric:5.10.0') {
|
||||
because "Chat library implementation for Fabric that includes methods for communicating with the server"
|
||||
// Thanks to zml for this fix
|
||||
// The package modifies Brigadier which causes a LinkageError at runtime if included
|
||||
@@ -159,7 +159,7 @@ modrinth {
|
||||
syncBodyFrom = rootProject.file("README.md").text
|
||||
|
||||
uploadFile = tasks.getByPath("remappedShadowJar")
|
||||
gameVersions.addAll("1.19.4", "1.20")
|
||||
gameVersions.addAll("1.20.2")
|
||||
|
||||
loaders = ["fabric"]
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.19.4
|
||||
loader_version=0.14.17
|
||||
minecraft_version=1.20.2
|
||||
loader_version=0.14.22
|
||||
# Mod Properties
|
||||
mod_version=2.2.0-SNAPSHOT
|
||||
maven_group=org.geysermc.floodgate
|
||||
archives_base_name=floodgate-fabric
|
||||
# Dependencies
|
||||
# check this on https://modmuss50.me/fabric.html
|
||||
fabric_version=0.76.0+1.19.4
|
||||
fabric_version=0.89.2+1.20.2
|
||||
# Our stuff
|
||||
lombok_version=1.18.20
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.geysermc.floodgate.addon.data;
|
||||
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.util.AttributeKey;
|
||||
@@ -13,7 +14,6 @@ import org.geysermc.floodgate.MinecraftServerHolder;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.mixin.ConnectionMixin;
|
||||
import org.geysermc.floodgate.mixin.ClientIntentionPacketMixinInterface;
|
||||
import org.geysermc.floodgate.mixin_interface.ServerLoginPacketListenerSetter;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
@@ -78,7 +78,7 @@ public final class FabricDataHandler extends CommonDataHandler {
|
||||
if (packet instanceof ClientIntentionPacket intentionPacket) {
|
||||
ctx.pipeline().addAfter("splitter", "floodgate_packet_blocker", blocker);
|
||||
networkManager = (Connection) ctx.channel().pipeline().get("packet_handler");
|
||||
handle(packet, intentionPacket.getHostName());
|
||||
handle(packet, intentionPacket.hostName());
|
||||
return false;
|
||||
}
|
||||
return !checkAndHandleLogin(packet);
|
||||
@@ -93,7 +93,7 @@ public final class FabricDataHandler extends CommonDataHandler {
|
||||
}
|
||||
|
||||
// we have to fake the offline player (login) cycle
|
||||
if (!(networkManager.getPacketListener() instanceof ServerLoginPacketListenerImpl)) {
|
||||
if (!(networkManager.getPacketListener() instanceof ServerLoginPacketListenerImpl packetListener)) {
|
||||
// player is not in the login state, abort
|
||||
ctx.pipeline().remove(this);
|
||||
return true;
|
||||
@@ -102,25 +102,9 @@ public final class FabricDataHandler extends CommonDataHandler {
|
||||
GameProfile gameProfile = new GameProfile(player.getCorrectUniqueId(), player.getCorrectUsername());
|
||||
|
||||
if (player.isLinked() && player.getCorrectUniqueId().version() == 4) {
|
||||
Thread texturesThread = new Thread("Bedrock Linked Player Texture Download") {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
MinecraftServerHolder.get().getSessionService()
|
||||
.fillProfileProperties(gameProfile, true);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Unable to get Bedrock linked player textures for " + gameProfile.getName(), e);
|
||||
}
|
||||
((ServerLoginPacketListenerSetter) networkManager.getPacketListener())
|
||||
.setGameProfile(gameProfile);
|
||||
((ServerLoginPacketListenerSetter) networkManager.getPacketListener()).setLoginState();
|
||||
}
|
||||
};
|
||||
texturesThread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
|
||||
texturesThread.start();
|
||||
verifyLinkedPlayerAsync(packetListener, gameProfile);
|
||||
} else {
|
||||
((ServerLoginPacketListenerSetter) networkManager.getPacketListener()).setGameProfile(gameProfile);
|
||||
((ServerLoginPacketListenerSetter) networkManager.getPacketListener()).setLoginState();
|
||||
packetListener.startClientVerification(gameProfile);
|
||||
}
|
||||
|
||||
ctx.pipeline().remove(this);
|
||||
@@ -129,12 +113,37 @@ public final class FabricDataHandler extends CommonDataHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new thread that fetches the linked player's textures,
|
||||
* and then starts client verification with the more accurate game profile.
|
||||
*
|
||||
* @param packetListener the login packet listener for this connection
|
||||
* @param gameProfile the player's initial profile. it will NOT be mutated.
|
||||
*/
|
||||
private void verifyLinkedPlayerAsync(ServerLoginPacketListenerImpl packetListener, GameProfile gameProfile) {
|
||||
Thread texturesThread = new Thread("Bedrock Linked Player Texture Download") {
|
||||
@Override
|
||||
public void run() {
|
||||
GameProfile effectiveProfile = gameProfile;
|
||||
try {
|
||||
MinecraftSessionService service = MinecraftServerHolder.get().getSessionService();
|
||||
effectiveProfile = service.fetchProfile(effectiveProfile.getId(), true).profile();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Unable to get Bedrock linked player textures for " + effectiveProfile.getName(), e);
|
||||
}
|
||||
packetListener.startClientVerification(effectiveProfile);
|
||||
}
|
||||
};
|
||||
texturesThread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
|
||||
texturesThread.start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
super.exceptionCaught(ctx, cause);
|
||||
if (config.isDebug()) {
|
||||
cause.printStackTrace();
|
||||
LOGGER.error("Exception caught in FabricDataHandler", cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package org.geysermc.floodgate.mixin;
|
||||
|
||||
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
|
||||
import org.geysermc.floodgate.mixin_interface.ServerLoginPacketListenerSetter;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(ServerLoginPacketListenerImpl.class)
|
||||
public abstract class ServerLoginPacketListenerImplMixin implements ServerLoginPacketListenerSetter {
|
||||
@Shadow
|
||||
ServerLoginPacketListenerImpl.State state;
|
||||
|
||||
@Accessor("gameProfile")
|
||||
public abstract void setGameProfile(GameProfile profile);
|
||||
|
||||
@Override
|
||||
public void setLoginState() {
|
||||
this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package org.geysermc.floodgate.mixin_interface;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public interface ServerLoginPacketListenerSetter {
|
||||
void setGameProfile(GameProfile profile);
|
||||
|
||||
void setLoginState();
|
||||
}
|
||||
@@ -24,8 +24,8 @@
|
||||
"floodgate.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.6",
|
||||
"fabricloader": ">=0.14.22",
|
||||
"fabric": "*",
|
||||
"minecraft": ">=1.19.4"
|
||||
"minecraft": ">=1.20.2"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
accessWidener v1 named
|
||||
|
||||
# To change login state
|
||||
accessible class net/minecraft/server/network/ServerLoginPacketListenerImpl$State
|
||||
# For setting gameprofile and starting connection verification
|
||||
accessible method net/minecraft/server/network/ServerLoginPacketListenerImpl startClientVerification (Lcom/mojang/authlib/GameProfile;)V
|
||||
# For player skin refreshing
|
||||
accessible class net/minecraft/server/level/ChunkMap$TrackedEntity
|
||||
# To access skins
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
"ClientIntentionPacketMixinInterface",
|
||||
"ClientIntentionPacketMixin",
|
||||
"ConnectionMixin",
|
||||
"ServerConnectionListenerMixin",
|
||||
"ServerLoginPacketListenerImplMixin"
|
||||
"ServerConnectionListenerMixin"
|
||||
],
|
||||
"plugin": "org.geysermc.floodgate.util.MixinConfigPlugin",
|
||||
"injectors": {
|
||||
|
||||
Reference in New Issue
Block a user