mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
Use Fastutil
This commit is contained in:
parent
8b4a2aaac8
commit
dfb471df99
2 changed files with 16 additions and 7 deletions
7
pom.xml
7
pom.xml
|
@ -91,6 +91,13 @@
|
||||||
<groupId>com.github.spotbugs</groupId>
|
<groupId>com.github.spotbugs</groupId>
|
||||||
<artifactId>spotbugs-annotations</artifactId>
|
<artifactId>spotbugs-annotations</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nukkitx.fastutil</groupId>
|
||||||
|
<artifactId>fastutil-int-object-maps</artifactId>
|
||||||
|
<version>8.5.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.github.steveice10.packetlib.codec.PacketCodecHelper;
|
||||||
import com.github.steveice10.packetlib.codec.PacketDefinition;
|
import com.github.steveice10.packetlib.codec.PacketDefinition;
|
||||||
import com.github.steveice10.packetlib.codec.PacketSerializer;
|
import com.github.steveice10.packetlib.codec.PacketSerializer;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -17,8 +19,8 @@ import java.util.Map;
|
||||||
* All implementations must have a constructor that takes in a {@link ByteBuf}.
|
* All implementations must have a constructor that takes in a {@link ByteBuf}.
|
||||||
*/
|
*/
|
||||||
public abstract class PacketProtocol {
|
public abstract class PacketProtocol {
|
||||||
private final Map<Integer, PacketDefinition<? extends Packet, ?>> serverbound = new HashMap<>();
|
private final Int2ObjectMap<PacketDefinition<? extends Packet, ?>> serverbound = new Int2ObjectOpenHashMap<>();
|
||||||
private final Map<Integer, PacketDefinition<? extends Packet, ?>> clientbound = new HashMap<>();
|
private final Int2ObjectMap<PacketDefinition<? extends Packet, ?>> clientbound = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
private final Map<Class<? extends Packet>, Integer> clientboundIds = new IdentityHashMap<>();
|
private final Map<Class<? extends Packet>, Integer> clientboundIds = new IdentityHashMap<>();
|
||||||
private final Map<Class<? extends Packet>, Integer> serverboundIds = new IdentityHashMap<>();
|
private final Map<Class<? extends Packet>, Integer> serverboundIds = new IdentityHashMap<>();
|
||||||
|
|
Loading…
Reference in a new issue