The constructor PacketType(PacketType.Protocol, PacketType.Sender, int, int) is undefined
FierraCodes opened this issue ยท 1 comments
Making a minecraft client with custom packets.
Describe the question
The constructor PacketType(PacketType.Protocol, PacketType.Sender, int, int) is undefined, Should be PacketType(PacketType.Protocol, PacketType.Sender, String[], String[])
API method(s) used
I forgot, abandoned this project and reworking it now
Expected behavior
No errors with packetId being an integer
Code
private static void registerPacket(Class<? extends DEMCPacket> packetClass, int packetId, Sender sender) {
PacketType packetType = new PacketType(Protocol.PLAY, sender, packetId, packetId);
packetToType.put(packetClass, packetType);
final EnumProtocol protocol = EnumProtocol.PLAY;
final EnumProtocolDirection direction = packetType.isClient() ? EnumProtocolDirection.SERVERBOUND : EnumProtocolDirection.CLIENTBOUND;
try {
Map<EnumProtocolDirection, BiMap<Integer, Class<? extends Packet<?>>>> theMap = (Map<EnumProtocolDirection, BiMap<Integer, Class<? extends Packet<?>>>>) FieldUtils.readField(protocol, "j", true);
BiMap<Integer, Class<? extends Packet<?>>> biMap = theMap.get(direction);
biMap.put(packetId, (Class<? extends Packet<?>>) packetClass);
theMap.put(direction, biMap);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
Map<Class<?>, EnumProtocol> map = (Map<Class<?>, EnumProtocol>) Accessors.getFieldAccessor(EnumProtocol.class, Map.class, true).get(protocol);
map.put(packetClass, protocol);
}