mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Update to Fabric 1.20.2
This commit is contained in:
1 parent
743ea6e057
commit
861a81f501
4 files changed
+19
-12
No files matched your search
@@ -15,8 +15,8 @@ dependencies {
|
||||
minecraft(libs.fabricMinecraft)
|
||||
mappings(loom.officialMojangMappings())
|
||||
modImplementation(libs.fabricLoader)
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.83.0+1.20.1")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api-deprecated:0.83.0+1.20.1") // LuckPerms needs to work at dev time
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.89.3+1.20.2")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api-deprecated:0.89.3+1.20.2") // LuckPerms needs to work at dev time
|
||||
|
||||
carbon(projects.carbonchatCommon) {
|
||||
exclude("net.kyori", "adventure-api")
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -52,7 +53,7 @@ abstract class PlayerListMixin {
|
||||
public Map<Thread, Pair<Component, Boolean>> carbon$joinMsg = new ConcurrentHashMap<>();
|
||||
|
||||
@Redirect(
|
||||
method = "placeNewPlayer(Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;)V",
|
||||
method = "placeNewPlayer",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/players/PlayerList;broadcastSystemMessage(Lnet/minecraft/network/chat/Component;Z)V"
|
||||
@@ -64,10 +65,10 @@ abstract class PlayerListMixin {
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "placeNewPlayer(Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;)V",
|
||||
method = "placeNewPlayer",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
public void injectJoin(final Connection connection, final ServerPlayer serverPlayer, final CallbackInfo ci) {
|
||||
public void injectJoin(final Connection connection, final ServerPlayer serverPlayer, final CommonListenerCookie cookie, final CallbackInfo ci) {
|
||||
final @Nullable Pair<Component, Boolean> remove = this.carbon$joinMsg.remove(Thread.currentThread());
|
||||
if (remove != null) {
|
||||
final PlayerStatusMessageEvents.MessageEvent event = PlayerStatusMessageEvents.MessageEvent.of(
|
||||
|
||||
+10
-4
@@ -21,28 +21,34 @@ package net.draycia.carbon.fabric.mixin;
|
||||
|
||||
import net.draycia.carbon.fabric.callback.PlayerStatusMessageEvents;
|
||||
import net.kyori.adventure.platform.fabric.FabricServerAudiences;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.game.ServerGamePacketListener;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
import net.minecraft.server.network.ServerCommonPacketListenerImpl;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ServerGamePacketListenerImpl.class)
|
||||
abstract class ServerGamePacketListenerImplMixin implements ServerGamePacketListener {
|
||||
abstract class ServerGamePacketListenerImplMixin extends ServerCommonPacketListenerImpl implements ServerGamePacketListener {
|
||||
|
||||
@Shadow @Final private MinecraftServer server;
|
||||
//@Shadow @Final private MinecraftServer server;
|
||||
|
||||
@Shadow public ServerPlayer player;
|
||||
|
||||
public ServerGamePacketListenerImplMixin(final MinecraftServer minecraftServer, final Connection connection, final CommonListenerCookie commonListenerCookie) {
|
||||
super(minecraftServer, connection, commonListenerCookie);
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "onDisconnect(Lnet/minecraft/network/chat/Component;)V",
|
||||
method = "removePlayerFromWorld()V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/players/PlayerList;broadcastSystemMessage(Lnet/minecraft/network/chat/Component;Z)V"
|
||||
|
||||
@@ -34,9 +34,9 @@ versions:
|
||||
guice: 5.1.0
|
||||
velocityApi: 3.2.0-SNAPSHOT
|
||||
geantyref: 1.3.11
|
||||
minecraft: 1.20.1
|
||||
fabricLoader: 0.14.21
|
||||
adventurePlatformFabric: 5.9.0
|
||||
minecraft: 1.20.2
|
||||
fabricLoader: 0.14.22
|
||||
adventurePlatformFabric: 5.10.0
|
||||
luckPermsApi: 5.3
|
||||
essentialsx: 2.19.3
|
||||
discordsrv: 1.26.0
|
||||
|
||||
Reference in new issue
Block a user