// Path: src/main/java/uk/kihira/tails/common/LibraryEntryData.java
// public class LibraryEntryData {
//     @Expose public final Outfit outfit;
//     @Expose public String entryName = "";
//     @Expose public final String comment = "";
//     @Expose public boolean favourite;
//     @Expose public final long creationDate;
//     @Expose public final UUID creatorUUID;
//     /**
//      * Name is used purely for display purposes.
//      */
//     @Expose public String creatorName;
//     public boolean remoteEntry = false;
// 
//     public LibraryEntryData(UUID creatorUUID, String creatorName, String name, Outfit outfit) {
//         this.entryName = name;
//         this.outfit = outfit;
//         this.creationDate = Calendar.getInstance().getTimeInMillis();
//         this.creatorUUID = creatorUUID;
//         this.creatorName = creatorName;
//     }
// 
//     @SuppressWarnings("RedundantIfStatement")
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         LibraryEntryData data = (LibraryEntryData) o;
// 
//         if (creationDate != data.creationDate) return false;
//         if (favourite != data.favourite) return false;
//         if (!comment.equals(data.comment)) return false;
//         if (!creatorUUID.equals(data.creatorUUID)) return false;
//         if (entryName != null ? !entryName.equals(data.entryName) : data.entryName != null) return false;
//         if (outfit != null ? !outfit.equals(data.outfit) : data.outfit != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = outfit != null ? outfit.hashCode() : 0;
//         result = 31 * result + (entryName != null ? entryName.hashCode() : 0);
//         result = 31 * result + comment.hashCode();
//         result = 31 * result + creatorUUID.hashCode();
//         result = 31 * result + (favourite ? 1 : 0);
//         result = 31 * result + (int) (creationDate ^ (creationDate >>> 32));
//         return result;
//     }
// }
// 
// Path: src/main/java/uk/kihira/tails/common/Tails.java
// @Mod(Tails.MOD_ID)
// public class Tails 
// {
//     public static final String MOD_ID = "tails";
//     public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
//     public static final Gson GSON = new GsonBuilder().create();
//     public static final boolean DEBUG = true;
// 
//     public static boolean hasRemote;
// 
//     public static CommonProxy proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> CommonProxy::new);
// 
//     public Tails()
//     {
//         FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
//         FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onConfigChange);
//         MinecraftForge.EVENT_BUS.addListener(this::addReloadListener);
//     }
// 
//     private void setup(final FMLCommonSetupEvent event)
//     {
//         proxy.preInit();
//         Config.loadConfig();
// 
//         PartRegistry.loadAllPartsFromResources();
//     }
// 
//     private void addReloadListener(final AddReloadListenerEvent event)
//     {
//         event.addListener((stage, resourceManager, preparationsProfiler, reloadProfiler, backgroundExecutor, gameExecutor) ->
//                 CompletableFuture.runAsync(() -> proxy.onResourceManagerReload()));
//     }
// 
//     public void onConfigChange(final ModConfigEvent event)
//     {
//         if (event.getConfig().getModId().equals(Tails.MOD_ID)) 
//         {
//             Config.loadConfig();
//         }
//     }
// 
//     public static void setLocalOutfit(final Outfit outfit)
//     {
//         Config.localOutfit.set(outfit);
//         Config.configuration.save();
//     }
// }


import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
import uk.kihira.tails.common.LibraryEntryData;
import uk.kihira.tails.common.Tails;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkDirection;
import net.minecraftforge.fml.network.NetworkEvent.Context;
import java.util.List;
import java.util.function.Supplier;
        this.delete = delete;
    }

    public LibraryEntriesMessage(PacketBuffer buf) 
    {
        try 
        {
            this.entries = Tails.GSON.fromJson(buf.readString(), new TypeToken<List<LibraryEntryData>>() {}.getType());
        } catch (JsonParseException e) 
        {
            Tails.LOGGER.catching(e);
        }
        this.delete = buf.readBoolean();
    }

    public void encode(PacketBuffer buf) 
    {
        buf.writeString(Tails.GSON.toJson(this.entries, new TypeToken<List<LibraryEntryData>>() {}.getType()));
        buf.writeBoolean(this.delete);
    }

    public void handle(Supplier<Context> ctx) 
    {
        ctx.get().enqueueWork(() -> 
        {
            if (ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT) 
            {
                //Yeah this isn't exactly a nice way of doing this.
                for (LibraryEntryData entry : this.entries) 
                {
// Path: src/main/java/uk/kihira/tails/common/LibraryEntryData.java
// public class LibraryEntryData {
//     @Expose public final Outfit outfit;
//     @Expose public String entryName = "";
//     @Expose public final String comment = "";
//     @Expose public boolean favourite;
//     @Expose public final long creationDate;
//     @Expose public final UUID creatorUUID;
//     /**
//      * Name is used purely for display purposes.
//      */
//     @Expose public String creatorName;
//     public boolean remoteEntry = false;
// 
//     public LibraryEntryData(UUID creatorUUID, String creatorName, String name, Outfit outfit) {
//         this.entryName = name;
//         this.outfit = outfit;
//         this.creationDate = Calendar.getInstance().getTimeInMillis();
//         this.creatorUUID = creatorUUID;
//         this.creatorName = creatorName;
//     }
// 
//     @SuppressWarnings("RedundantIfStatement")
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         LibraryEntryData data = (LibraryEntryData) o;
// 
//         if (creationDate != data.creationDate) return false;
//         if (favourite != data.favourite) return false;
//         if (!comment.equals(data.comment)) return false;
//         if (!creatorUUID.equals(data.creatorUUID)) return false;
//         if (entryName != null ? !entryName.equals(data.entryName) : data.entryName != null) return false;
//         if (outfit != null ? !outfit.equals(data.outfit) : data.outfit != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = outfit != null ? outfit.hashCode() : 0;
//         result = 31 * result + (entryName != null ? entryName.hashCode() : 0);
//         result = 31 * result + comment.hashCode();
//         result = 31 * result + creatorUUID.hashCode();
//         result = 31 * result + (favourite ? 1 : 0);
//         result = 31 * result + (int) (creationDate ^ (creationDate >>> 32));
//         return result;
//     }
// }
// 
// Path: src/main/java/uk/kihira/tails/common/Tails.java
// @Mod(Tails.MOD_ID)
// public class Tails 
// {
//     public static final String MOD_ID = "tails";
//     public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
//     public static final Gson GSON = new GsonBuilder().create();
//     public static final boolean DEBUG = true;
// 
//     public static boolean hasRemote;
// 
//     public static CommonProxy proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> CommonProxy::new);
// 
//     public Tails()
//     {
//         FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
//         FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onConfigChange);
//         MinecraftForge.EVENT_BUS.addListener(this::addReloadListener);
//     }
// 
//     private void setup(final FMLCommonSetupEvent event)
//     {
//         proxy.preInit();
//         Config.loadConfig();
// 
//         PartRegistry.loadAllPartsFromResources();
//     }
// 
//     private void addReloadListener(final AddReloadListenerEvent event)
//     {
//         event.addListener((stage, resourceManager, preparationsProfiler, reloadProfiler, backgroundExecutor, gameExecutor) ->
//                 CompletableFuture.runAsync(() -> proxy.onResourceManagerReload()));
//     }
// 
//     public void onConfigChange(final ModConfigEvent event)
//     {
//         if (event.getConfig().getModId().equals(Tails.MOD_ID)) 
//         {
//             Config.loadConfig();
//         }
//     }
// 
//     public static void setLocalOutfit(final Outfit outfit)
//     {
//         Config.localOutfit.set(outfit);
//         Config.configuration.save();
//     }
// }


// Path: src/main/java/uk/kihira/tails/common/network/LibraryEntriesMessage.java
import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
import uk.kihira.tails.common.LibraryEntryData;
import uk.kihira.tails.common.Tails;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkDirection;
import net.minecraftforge.fml.network.NetworkEvent.Context;
import java.util.List;
import java.util.function.Supplier;

        this.delete = delete;
    }

    public LibraryEntriesMessage(PacketBuffer buf) 
    {
        try 
        {
            this.entries = Tails.GSON.fromJson(buf.readString(), new TypeToken<List<LibraryEntryData>>() {}.getType());
        } catch (JsonParseException e) 
        {
            Tails.LOGGER.catching(e);
        }
        this.delete = buf.readBoolean();
    }

    public void encode(PacketBuffer buf) 
    {
        buf.writeString(Tails.GSON.toJson(this.entries, new TypeToken<List<LibraryEntryData>>() {}.getType()));
        buf.writeBoolean(this.delete);
    }

    public void handle(Supplier<Context> ctx) 
    {
        ctx.get().enqueueWork(() -> 
        {
            if (ctx.get().getDirection() == NetworkDirection.PLAY_TO_CLIENT) 
            {
                //Yeah this isn't exactly a nice way of doing this.
                for (LibraryEntryData entry : this.entries) 
                {
                    entry.remoteEntry = true;