From 7d923e6675dc681261e3cbd5fb0c81263209dbc6 Mon Sep 17 00:00:00 2001 From: Lulonaut <67191924+Lulonaut@users.noreply.github.com> Date: Mon, 21 Mar 2022 18:13:18 +0100 Subject: add custom skull loading back (#96) --- .../notenoughupdates/NotEnoughUpdates.java | 148 +++++++++------------ 1 file changed, 60 insertions(+), 88 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 0ed68e06..951e7335 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1,17 +1,5 @@ package io.github.moulberry.notenoughupdates; -import java.awt.Color; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Set; - import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -24,22 +12,9 @@ import io.github.moulberry.notenoughupdates.listener.ChatListener; import io.github.moulberry.notenoughupdates.listener.ItemTooltipListener; import io.github.moulberry.notenoughupdates.listener.NEUEventListener; import io.github.moulberry.notenoughupdates.listener.RenderListener; -import io.github.moulberry.notenoughupdates.miscfeatures.CrystalOverlay; -import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver; -import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; -import io.github.moulberry.notenoughupdates.miscfeatures.DwarvenMinesWaypoints; -import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers; -import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls; -import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper; -import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns; -import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager; -import io.github.moulberry.notenoughupdates.miscfeatures.MiningStuff; -import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere; -import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay; -import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; -import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; -import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; +import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes; +import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBlockSounds; import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.DwarvenMinesTextures; import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay; import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector; @@ -53,17 +28,14 @@ import io.github.moulberry.notenoughupdates.util.Utils; import io.github.moulberry.notenoughupdates.util.XPInformation; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.settings.KeyBinding; import net.minecraft.event.ClickEvent; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.Scoreboard; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.BiomeGenHell; -import net.minecraft.world.biome.BiomeGenJungle; -import net.minecraft.world.biome.BiomeGenMesa; -import net.minecraft.world.biome.BiomeGenSnow; +import net.minecraft.world.biome.*; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Mod; @@ -72,6 +44,12 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; +import java.awt.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Set; + @Mod(modid = NotEnoughUpdates.MODID, version = NotEnoughUpdates.VERSION, clientSideOnly = true) public class NotEnoughUpdates { public static final String MODID = "notenoughupdates"; @@ -79,60 +57,6 @@ public class NotEnoughUpdates { public static final String PRE_VERSION = "0.0"; public static final int VERSION_ID = 20100; public static final int PRE_VERSION_ID = 0; - - public static NotEnoughUpdates INSTANCE = null; - - public NEUManager manager; - public NEUOverlay overlay; - public NEUConfig config; - - private File configFile; - - public File getConfigFile() { - return this.configFile; - } - - public void newConfigFile() { - this.configFile = new File(NotEnoughUpdates.INSTANCE.getNeuDir(), "configNew.json"); - } - - private static final long CHAT_MSG_COOLDOWN = 200; - private long lastChatMessage = 0; - private long secondLastChatMessage = 0; - private String currChatMessage = null; - - //Stolen from Biscut and used for detecting whether in skyblock - private static final Set SKYBLOCK_IN_ALL_LANGUAGES = - Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58", "\u7A7A\u5CF6\u751F\u5B58"); - - public GuiScreen openGui = null; - public long lastOpenedGui = 0; - - public Commands commands; - - public static HashMap petRarityToColourMap = new HashMap() {{ - put("UNKNOWN", EnumChatFormatting.RED.toString()); - put("COMMON", EnumChatFormatting.WHITE.toString()); - put("UNCOMMON", EnumChatFormatting.GREEN.toString()); - put("RARE", EnumChatFormatting.BLUE.toString()); - put("EPIC", EnumChatFormatting.DARK_PURPLE.toString()); - put("LEGENDARY", EnumChatFormatting.GOLD.toString()); - put("MYTHIC", EnumChatFormatting.LIGHT_PURPLE.toString()); - }}; - - public static ProfileViewer profileViewer; - - public boolean packDevEnabled = false; - - private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); - private File neuDir; - - public File getNeuDir() { - return this.neuDir; - } - - public Color[][] colourMap = null; - /** * Registers the biomes for the crystal hollows here so optifine knows they exists */ @@ -166,6 +90,48 @@ public class NotEnoughUpdates { .setBiomeName("NeuCrystalHollowsCrystalNucleus") .setFillerBlockMetadata(5470985) .setTemperatureRainfall(0.95F, 0.9F); + private static final long CHAT_MSG_COOLDOWN = 200; + //Stolen from Biscut and used for detecting whether in skyblock + private static final Set SKYBLOCK_IN_ALL_LANGUAGES = + Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58", "\u7A7A\u5CF6\u751F\u5B58"); + public static NotEnoughUpdates INSTANCE = null; + public static HashMap petRarityToColourMap = new HashMap() {{ + put("UNKNOWN", EnumChatFormatting.RED.toString()); + put("COMMON", EnumChatFormatting.WHITE.toString()); + put("UNCOMMON", EnumChatFormatting.GREEN.toString()); + put("RARE", EnumChatFormatting.BLUE.toString()); + put("EPIC", EnumChatFormatting.DARK_PURPLE.toString()); + put("LEGENDARY", EnumChatFormatting.GOLD.toString()); + put("MYTHIC", EnumChatFormatting.LIGHT_PURPLE.toString()); + }}; + public static ProfileViewer profileViewer; + private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); + public NEUManager manager; + public NEUOverlay overlay; + public NEUConfig config; + public GuiScreen openGui = null; + public long lastOpenedGui = 0; + public Commands commands; + public boolean packDevEnabled = false; + public Color[][] colourMap = null; + private File configFile; + private long lastChatMessage = 0; + private long secondLastChatMessage = 0; + private String currChatMessage = null; + private File neuDir; + private boolean hasSkyblockScoreboard; + + public File getConfigFile() { + return this.configFile; + } + + public void newConfigFile() { + this.configFile = new File(NotEnoughUpdates.INSTANCE.getNeuDir(), "configNew.json"); + } + + public File getNeuDir() { + return this.neuDir; + } /** * Instantiates NEUIo, NEUManager and NEUOverlay instances. Registers keybinds and adds a shutdown hook to clear tmp folder. @@ -249,6 +215,14 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(new CrystalOverlay()); MinecraftForge.EVENT_BUS.register(new ItemCooldowns()); + if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) { + IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); + manager.registerReloadListener(CustomSkulls.getInstance()); + manager.registerReloadListener(NPCRetexturing.getInstance()); + manager.registerReloadListener(new ItemCustomizeManager.ReloadListener()); + manager.registerReloadListener(new CustomBlockSounds.ReloaderListener()); + } + this.commands = new Commands(); BackgroundBlur.registerListener(); @@ -410,8 +384,6 @@ public class NotEnoughUpdates { return hasSkyblockScoreboard(); } - private boolean hasSkyblockScoreboard; - public boolean hasSkyblockScoreboard() { return hasSkyblockScoreboard; } -- cgit