Auto Network Lib
Auto Network Lib is a library for automatic network packet serialization that significantly simplifies the process of working with network messages in Minecraft mods.
Main Features
The library automatically handles serialization and deserialization of fields in network packets, freeing developers from writing repetitive code. All packet operations are automatically executed in the main game thread, ensuring proper interaction with game logic.
Supported Data Types
Built-in support includes most common data types:
- Primitive types: int, long, float, double, boolean, char, byte, short
- Wrapper types: Integer, Long, Float, Double, Boolean, Character, Byte, Short
- Strings: String
- Game objects: NBTTagCompound, ItemStack, BlockPos, Vec3d, Color3f
Collection Handling
The library supports automatic serialization of various Java collections:
- Lists: List
, ArrayList , Stack , Vector , LinkedList - Sets: Set
, HashSet - Maps: Map<T,K>, HashMap<T,K>
- One-dimensional arrays of any type
It also handles complex nested structures, for example:
- HashMap<Integer, List
> - List<List<List
>> - HashMap<List
, List >
Extensibility and Performance
For unsupported data types, you can add custom serializers. The library is optimized for high performance: reflection is used only during the first packet serialization, and method handles are employed for data reading and writing instead of standard reflection for faster operation.