Search in sources :

Example 1 with IPartSerializer

use of net.silentchaos512.gear.api.part.IPartSerializer in project Silent-Gear by SilentChaos512.

the class PartSerializers method write.

@SuppressWarnings("unchecked")
public static <T extends IGearPart> void write(T part, FriendlyByteBuf buffer) {
    ResourceLocation id = part.getId();
    ResourceLocation type = part.getSerializer().getName();
    log(() -> "write " + id + " (type " + type + ")");
    buffer.writeResourceLocation(id);
    buffer.writeResourceLocation(type);
    IPartSerializer<T> serializer = (IPartSerializer<T>) part.getSerializer();
    serializer.write(buffer, part);
}
Also used : IPartSerializer(net.silentchaos512.gear.api.part.IPartSerializer) ResourceLocation(net.minecraft.resources.ResourceLocation)

Aggregations

ResourceLocation (net.minecraft.resources.ResourceLocation)1 IPartSerializer (net.silentchaos512.gear.api.part.IPartSerializer)1