Skip to content

Commit 5b245f8

Browse files
committed
Update to Fabric 1.21.11
1 parent 76bd6fe commit 5b245f8

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ subprojects {
1010
apply(plugin = "maven-publish")
1111

1212
group = "wtf.choco"
13-
version = "0.1.2"
13+
version = "0.1.3"
1414

1515
java {
1616
toolchain {

networking-fabric/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id("fabric-loom") version "1.11-SNAPSHOT"
2+
id("fabric-loom") version "1.13-SNAPSHOT"
33
id("com.gradleup.shadow") version "9.2.0"
44
}
55

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
minecraft_version=1.21.9
2-
fabric_version=0.134.0+1.21.9
1+
minecraft_version=1.21.11
2+
fabric_version=0.140.0+1.21.11
33
loader_version=0.17.2

networking-fabric/src/main/java/wtf/choco/network/fabric/FabricChannelRegistrar.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
77
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
88
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
9-
import net.minecraft.resources.ResourceLocation;
9+
import net.minecraft.resources.Identifier;
1010
import net.minecraft.server.MinecraftServer;
1111
import net.minecraft.server.level.ServerPlayer;
1212

@@ -30,12 +30,12 @@
3030
* @param <S> the serverbound message listener type
3131
* @param <C> the clientbound message listener type
3232
*
33-
* @see #onUnknownClientboundMessage(ResourceLocation, byte[], int)
34-
* @see #onUnknownServerboundMessage(MinecraftServer, ServerPlayer, ResourceLocation, byte[], int)
35-
* @see #onClientboundMessageReadException(ResourceLocation, byte[], Throwable)
36-
* @see #onServerboundMessageReadException(MinecraftServer, ServerPlayer, ResourceLocation, byte[], Throwable)
37-
* @see #onSuccessfulClientboundMessage(ResourceLocation, Message)
38-
* @see #onSuccessfulServerboundMessage(MinecraftServer, ServerPlayer, ResourceLocation, Message)
33+
* @see #onUnknownClientboundMessage(Identifier, byte[], int)
34+
* @see #onUnknownServerboundMessage(MinecraftServer, ServerPlayer, Identifier, byte[], int)
35+
* @see #onClientboundMessageReadException(Identifier, byte[], Throwable)
36+
* @see #onServerboundMessageReadException(MinecraftServer, ServerPlayer, Identifier, byte[], Throwable)
37+
* @see #onSuccessfulClientboundMessage(Identifier, Message)
38+
* @see #onSuccessfulServerboundMessage(MinecraftServer, ServerPlayer, Identifier, Message)
3939
*/
4040
public abstract class FabricChannelRegistrar<S extends ServerboundMessageListener, C extends ClientboundMessageListener> implements ChannelRegistrar<S, C> {
4141

@@ -79,7 +79,7 @@ public void registerClientboundMessageHandler(@NotNull NamespacedKey channel, @N
7979
return;
8080
}
8181

82-
ResourceLocation channelKey = ResourceLocation.fromNamespaceAndPath(channel.namespace(), channel.key());
82+
Identifier channelKey = Identifier.fromNamespaceAndPath(channel.namespace(), channel.key());
8383
ClientPlayNetworking.registerGlobalReceiver(payloadType, (payload, context) -> {
8484
MessageByteBuffer buffer = new MessageByteBuffer(protocol, payload.data());
8585

@@ -111,7 +111,7 @@ public void registerServerboundMessageHandler(@NotNull NamespacedKey channel, @N
111111
return;
112112
}
113113

114-
ResourceLocation channelKey = ResourceLocation.fromNamespaceAndPath(channel.namespace(), channel.key());
114+
Identifier channelKey = Identifier.fromNamespaceAndPath(channel.namespace(), channel.key());
115115
ServerPlayNetworking.registerGlobalReceiver(payloadType, (payload, context) -> {
116116
MessageByteBuffer buffer = new MessageByteBuffer(protocol, payload.data());
117117

@@ -145,7 +145,7 @@ public void registerServerboundMessageHandler(@NotNull NamespacedKey channel, @N
145145
* @param data the raw byte data payload from the message (including the message id)
146146
* @param messageId the message id that was read from the message data
147147
*/
148-
protected void onUnknownClientboundMessage(@NotNull ResourceLocation channel, byte @NotNull [] data, int messageId) {
148+
protected void onUnknownClientboundMessage(@NotNull Identifier channel, byte @NotNull [] data, int messageId) {
149149
this.logger.warn("Received unknown packet with id " + messageId + " from server on channel \"" + channel + "\". Ignoring.");
150150
}
151151

@@ -159,7 +159,7 @@ protected void onUnknownClientboundMessage(@NotNull ResourceLocation channel, by
159159
* @param data the raw byte data payload from the message (including the message id)
160160
* @param messageId the message id that was read from the message data
161161
*/
162-
protected void onUnknownServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull ResourceLocation channel, byte @NotNull [] data, int messageId) {
162+
protected void onUnknownServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull Identifier channel, byte @NotNull [] data, int messageId) {
163163
this.logger.warn("Received unknown packet with id " + messageId + " from " + sender.getName().getString() + " on channel \"" + channel + "\". Ignoring.");
164164
}
165165

@@ -171,7 +171,7 @@ protected void onUnknownServerboundMessage(@NotNull MinecraftServer server, @Not
171171
* @param data the raw byte data payload from the message
172172
* @param e the exception that was thrown
173173
*/
174-
protected void onClientboundMessageReadException(@NotNull ResourceLocation channel, byte @NotNull [] data, @NotNull Throwable e) {
174+
protected void onClientboundMessageReadException(@NotNull Identifier channel, byte @NotNull [] data, @NotNull Throwable e) {
175175
this.logger.warn("Failed to read message sent from server on channel \"" + channel + "\". Received erroneous data.");
176176
e.printStackTrace();
177177
}
@@ -186,7 +186,7 @@ protected void onClientboundMessageReadException(@NotNull ResourceLocation chann
186186
* @param data the raw byte data payload from the message
187187
* @param e the exception that was thrown
188188
*/
189-
protected void onServerboundMessageReadException(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull ResourceLocation channel, byte @NotNull [] data, @NotNull Throwable e) {
189+
protected void onServerboundMessageReadException(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull Identifier channel, byte @NotNull [] data, @NotNull Throwable e) {
190190
this.logger.warn("Failed to read message sent by " + sender.getName().getString() + " on channel \"" + channel + "\". Received erroneous data.");
191191
e.printStackTrace();
192192
}
@@ -217,7 +217,7 @@ protected void onServerboundMessageReadException(@NotNull MinecraftServer server
217217
* }
218218
*
219219
* {@literal @Override}
220-
* protected MyClientboundMessageListener onSuccessfulClientboundMessage(ResourceLocation channel, {@literal Message<MyClientboundMessageListener>} message) {
220+
* protected MyClientboundMessageListener onSuccessfulClientboundMessage(Identifier channel, {@literal Message<MyClientboundMessageListener>} message) {
221221
* return MyMod.MESSAGE_LISTENER; // That's it. The FabricChannelRegistrar will handle the listening
222222
* }
223223
*
@@ -243,7 +243,7 @@ protected void onServerboundMessageReadException(@NotNull MinecraftServer server
243243
* null if the message should not be handled
244244
*/
245245
@Nullable
246-
protected C onSuccessfulClientboundMessage(@NotNull ResourceLocation channel, @NotNull Message<C> message) {
246+
protected C onSuccessfulClientboundMessage(@NotNull Identifier channel, @NotNull Message<C> message) {
247247
this.logger.info("Received message from server (" + message.getClass().getName() + ") but it was not handled. Did you override onSuccessfulClientboundMessage()?");
248248
return null;
249249
}
@@ -278,7 +278,7 @@ protected C onSuccessfulClientboundMessage(@NotNull ResourceLocation channel, @N
278278
* super(protocol, logger, false); // false = on the server
279279
* }
280280
*
281-
* protected MyServerboundMessageListener onSuccessfulServerboundMessage(MinecraftServer server, ServerPlayer player, ResourceLocation channel, {@literal Message<MyServerboundMessageListener>} message) {
281+
* protected MyServerboundMessageListener onSuccessfulServerboundMessage(MinecraftServer server, ServerPlayer player, Identifier channel, {@literal Message<MyServerboundMessageListener>} message) {
282282
* return MyMod.getInstance().getMessageListener(player); // That's it. The FabricChannelRegistrar will handle the listening
283283
* }
284284
*
@@ -306,15 +306,15 @@ protected C onSuccessfulClientboundMessage(@NotNull ResourceLocation channel, @N
306306
* null if the message should not be handled
307307
*/
308308
@Nullable
309-
protected S onSuccessfulServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull ResourceLocation channel, @NotNull Message<S> message) {
309+
protected S onSuccessfulServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull Identifier channel, @NotNull Message<S> message) {
310310
this.logger.info("Received message from " + player.getName().getString() + " (" + message.getClass().getName() + ") but it was not handled. Did you override onSuccessfulServerboundMessage()?");
311311
return null;
312312
}
313313

314314
private CustomPacketPayload.Type<RawDataPayload> initTypeIfNecessary(NamespacedKey channel) {
315315
CustomPacketPayload.Type<RawDataPayload> type = RawDataPayload.getType();
316316
if (type == null) {
317-
RawDataPayload.setType(type = new CustomPacketPayload.Type<>(ResourceLocation.parse(channel.toString())));
317+
RawDataPayload.setType(type = new CustomPacketPayload.Type<>(Identifier.parse(channel.toString())));
318318
}
319319
return type;
320320
}

networking-fabric/src/main/java/wtf/choco/network/fabric/FabricClientChannelRegistrar.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package wtf.choco.network.fabric;
22

3-
import net.minecraft.resources.ResourceLocation;
3+
import net.minecraft.resources.Identifier;
44
import net.minecraft.server.MinecraftServer;
55
import net.minecraft.server.level.ServerPlayer;
66

@@ -26,9 +26,9 @@
2626
* @param <S> the serverbound message listener type
2727
* @param <C> the clientbound message listener type
2828
*
29-
* @see #onUnknownClientboundMessage(ResourceLocation, byte[], int)
30-
* @see #onClientboundMessageReadException(ResourceLocation, byte[], Throwable)
31-
* @see #onSuccessfulMessage(ResourceLocation, Message)
29+
* @see #onUnknownClientboundMessage(Identifier, byte[], int)
30+
* @see #onClientboundMessageReadException(Identifier, byte[], Throwable)
31+
* @see #onSuccessfulMessage(Identifier, Message)
3232
*/
3333
public abstract class FabricClientChannelRegistrar<S extends ServerboundMessageListener, C extends ClientboundMessageListener> extends FabricChannelRegistrar<S, C> {
3434

@@ -43,21 +43,21 @@ public final void registerServerboundMessageHandler(@NotNull NamespacedKey chann
4343
}
4444

4545
@Override
46-
protected final void onUnknownServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull ResourceLocation channel, byte @NotNull [] data, int messageId) { }
46+
protected final void onUnknownServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull Identifier channel, byte @NotNull [] data, int messageId) { }
4747

4848
@Override
49-
protected final void onServerboundMessageReadException(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull ResourceLocation channel, byte @NotNull [] data, @NotNull Throwable e) { }
49+
protected final void onServerboundMessageReadException(@NotNull MinecraftServer server, @NotNull ServerPlayer sender, @NotNull Identifier channel, byte @NotNull [] data, @NotNull Throwable e) { }
5050

5151
@Nullable
5252
@Override
53-
protected final S onSuccessfulServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull ResourceLocation channel, @NotNull Message<S> message) {
53+
protected final S onSuccessfulServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull Identifier channel, @NotNull Message<S> message) {
5454
return null;
5555
}
5656

5757
// Deferring onSuccesfulClientboundMessage() to an abstract onSuccessfulMessage()
5858
@Nullable
5959
@Override
60-
protected final C onSuccessfulClientboundMessage(@NotNull ResourceLocation channel, @NotNull Message<C> message) {
60+
protected final C onSuccessfulClientboundMessage(@NotNull Identifier channel, @NotNull Message<C> message) {
6161
return onSuccessfulMessage(channel, message);
6262
}
6363

@@ -87,7 +87,7 @@ protected final C onSuccessfulClientboundMessage(@NotNull ResourceLocation chann
8787
* }
8888
*
8989
* {@literal @Override}
90-
* protected MyClientboundMessageListener onSuccessfulMessage(ResourceLocation channel, {@literal Message<MyClientboundMessageListener>} message) {
90+
* protected MyClientboundMessageListener onSuccessfulMessage(Identifier channel, {@literal Message<MyClientboundMessageListener>} message) {
9191
* return MyMod.MESSAGE_LISTENER; // That's it. The FabricChannelRegistrar will handle the listening
9292
* }
9393
*
@@ -113,6 +113,6 @@ protected final C onSuccessfulClientboundMessage(@NotNull ResourceLocation chann
113113
* null if the message should not be handled
114114
*/
115115
@Nullable
116-
protected abstract C onSuccessfulMessage(@NotNull ResourceLocation channel, @NotNull Message<C> message);
116+
protected abstract C onSuccessfulMessage(@NotNull Identifier channel, @NotNull Message<C> message);
117117

118118
}

networking-fabric/src/main/java/wtf/choco/network/fabric/FabricServerChannelRegistrar.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package wtf.choco.network.fabric;
22

3-
import net.minecraft.resources.ResourceLocation;
3+
import net.minecraft.resources.Identifier;
44
import net.minecraft.server.MinecraftServer;
55
import net.minecraft.server.level.ServerPlayer;
66

@@ -26,9 +26,9 @@
2626
* @param <S> the serverbound message listener type
2727
* @param <C> the clientbound message listener type
2828
*
29-
* @see #onUnknownServerboundMessage(MinecraftServer, ServerPlayer, ResourceLocation, byte[], int)
30-
* @see #onServerboundMessageReadException(MinecraftServer, ServerPlayer, ResourceLocation, byte[], Throwable)
31-
* @see #onSuccessfulMessage(MinecraftServer, ServerPlayer, ResourceLocation, Message)
29+
* @see #onUnknownServerboundMessage(MinecraftServer, ServerPlayer, Identifier, byte[], int)
30+
* @see #onServerboundMessageReadException(MinecraftServer, ServerPlayer, Identifier, byte[], Throwable)
31+
* @see #onSuccessfulMessage(MinecraftServer, ServerPlayer, Identifier, Message)
3232
*/
3333
public abstract class FabricServerChannelRegistrar<S extends ServerboundMessageListener, C extends ClientboundMessageListener> extends FabricChannelRegistrar<S, C> {
3434

@@ -43,21 +43,21 @@ public final void registerClientboundMessageHandler(@NotNull NamespacedKey chann
4343
}
4444

4545
@Override
46-
protected final void onUnknownClientboundMessage(@NotNull ResourceLocation channel, byte @NotNull [] data, int messageId) { }
46+
protected final void onUnknownClientboundMessage(@NotNull Identifier channel, byte @NotNull [] data, int messageId) { }
4747

4848
@Override
49-
protected final void onClientboundMessageReadException(@NotNull ResourceLocation channel, byte @NotNull [] data, @NotNull Throwable e) { }
49+
protected final void onClientboundMessageReadException(@NotNull Identifier channel, byte @NotNull [] data, @NotNull Throwable e) { }
5050

5151
@Nullable
5252
@Override
53-
protected final C onSuccessfulClientboundMessage(@NotNull ResourceLocation channel, @NotNull Message<C> message) {
53+
protected final C onSuccessfulClientboundMessage(@NotNull Identifier channel, @NotNull Message<C> message) {
5454
return null;
5555
}
5656

5757
// Deferring onSuccesfulServerboundMessage() to an abstract onSuccessfulMessage()
5858
@Nullable
5959
@Override
60-
protected final S onSuccessfulServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull ResourceLocation channel, @NotNull Message<S> message) {
60+
protected final S onSuccessfulServerboundMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull Identifier channel, @NotNull Message<S> message) {
6161
return onSuccessfulMessage(server, player, channel, message);
6262
}
6363

@@ -92,7 +92,7 @@ protected final S onSuccessfulServerboundMessage(@NotNull MinecraftServer server
9292
* }
9393
*
9494
* {@literal @Override}
95-
* protected MyServerboundMessageListener onSuccessfulMessage(MinecraftServer server, ServerPlayer player, ResourceLocation channel, {@literal Message<MyServerboundMessageListener>} message) {
95+
* protected MyServerboundMessageListener onSuccessfulMessage(MinecraftServer server, ServerPlayer player, Identifier channel, {@literal Message<MyServerboundMessageListener>} message) {
9696
* return MyMod.getInstance().getMessageListener(player); // That's it. The FabricChannelRegistrar will handle the listening
9797
* }
9898
*
@@ -120,6 +120,6 @@ protected final S onSuccessfulServerboundMessage(@NotNull MinecraftServer server
120120
* null if the message should not be handled
121121
*/
122122
@Nullable
123-
protected abstract S onSuccessfulMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull ResourceLocation channel, @NotNull Message<S> message);
123+
protected abstract S onSuccessfulMessage(@NotNull MinecraftServer server, @NotNull ServerPlayer player, @NotNull Identifier channel, @NotNull Message<S> message);
124124

125125
}

0 commit comments

Comments
 (0)