Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Aug 27, 2024
1 parent 2000ba9 commit 46f99a0
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/commonnetwork/CommonNetworkMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static <T> PacketRegistrar registerPacket(ResourceLocation packetIdentifi
}
}

public static <T, B extends FriendlyByteBuf> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<B, T> codec, Consumer<PacketContext<T>> handler)
public static <T> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<? extends FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler)
{
if (INSTANCE != null)
{
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/commonnetwork/api/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static <T> PacketRegistrar registerPacket(ResourceLocation packetIdentifi
* @param <T> - The class type
* @return The registrar for chaining registrations.
*/
public static <T, B extends FriendlyByteBuf> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<B, T> codec, Consumer<PacketContext<T>> handler)
public static <T> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<? extends FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler)
{
return CommonNetworkMod.registerPacket(type, packetClass, codec, handler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public <T> PacketRegistrar registerPacket(ResourceLocation id, Class<T> packetCl
}

@Override
public <T, B extends FriendlyByteBuf> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<B, T> codec, Consumer<PacketContext<T>> handler)
public <T> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<? extends FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler)
{
PacketContainer<T> container = new PacketContainer<>(type, packetClass, codec, handler);
QUEUED_PACKET_MAP.put(packetClass, container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public interface PacketRegistrar
* @param <T> - The class type
* @return The registrar for chaining registrations.
*/
<T, B extends FriendlyByteBuf> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<B, T> codec, Consumer<PacketContext<T>> handler);
<T> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<? extends FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler);

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public <T> PacketRegistrar registerPacket(ResourceLocation packetIdentifier, Cla
}

@Override
public <T, B extends FriendlyByteBuf> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<B, T> codec, Consumer<PacketContext<T>> handler)
public <T> PacketRegistrar registerPacket(CustomPacketPayload.Type<? extends CustomPacketPayload> type, Class<T> packetClass, StreamCodec<? extends FriendlyByteBuf, T> codec, Consumer<PacketContext<T>> handler)
{
PacketContainer<T> container = new PacketContainer<>(type, packetClass, codec, handler);
PACKET_MAP.put(packetClass, container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public <K extends CustomPacketPayload> CustomPacketPayload.Type<K> getType()
return (CustomPacketPayload.Type<K>) type();
}


//TODO: Removing for mc 1.21.2 or 1.22, will also be able to remove the wrapping of the decoder.
@SuppressWarnings("unchecked")
public <K extends FriendlyByteBuf> StreamCodec<K, CommonPacketWrapper> getCodec()
Expand Down

0 comments on commit 46f99a0

Please sign in to comment.