From 83f4eef00e29aed234618cf6d5c00d26cd4302fb Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 13 Jun 2023 00:28:00 +0900 Subject: [PATCH 1/2] Fix server causing error with NEI --- build.gradle | 14 ++++--- .../fox/spiteful/avaritia/compat/Compat.java | 9 ---- .../compat/botania/ItemInfinitatoCostume.java | 2 +- .../avaritia/compat/botania/Tsundere.java | 7 ---- .../compat/nei/NEI_Avaritia_Config.java | 41 +++++++++++++++++++ .../avaritia/compat/nei/NotEnough.java | 24 ----------- 6 files changed, 50 insertions(+), 47 deletions(-) create mode 100644 src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java delete mode 100644 src/main/java/fox/spiteful/avaritia/compat/nei/NotEnough.java diff --git a/build.gradle b/build.gradle index a8b7532d..39309904 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1684218858 +//version: 1685785062 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -1276,12 +1276,14 @@ tasks.register('faq') { description = 'Prints frequently asked questions about building a project' doLast { - print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " + - "versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" + - "The links can be found in repositories.gradle and build.gradle:repositories, " + - "not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.\n\n" + + print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " + + "Or you can manually check if the versions are still on the distributing sites - " + + "the links can be found in repositories.gradle and build.gradle:repositories, " + + "but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" + "If your build fails to recognize the syntax of new Java versions, enable Jabel in your " + - "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties.") + "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " + + "However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " + + "Java 9 or later.") } } diff --git a/src/main/java/fox/spiteful/avaritia/compat/Compat.java b/src/main/java/fox/spiteful/avaritia/compat/Compat.java index 84037d8e..af837996 100644 --- a/src/main/java/fox/spiteful/avaritia/compat/Compat.java +++ b/src/main/java/fox/spiteful/avaritia/compat/Compat.java @@ -17,7 +17,6 @@ import fox.spiteful.avaritia.compat.botania.Tsundere; import fox.spiteful.avaritia.compat.forestry.Ranger; import fox.spiteful.avaritia.compat.minetweaker.Tweak; -import fox.spiteful.avaritia.compat.nei.NotEnough; import fox.spiteful.avaritia.compat.tails.InfiniteFoxes; import fox.spiteful.avaritia.compat.thaumcraft.Lucrum; import fox.spiteful.avaritia.compat.ticon.Tonkers; @@ -64,14 +63,6 @@ public static void census() { } public static void compatify() { - if (nei) { - try { - NotEnough.items(); - } catch (Throwable e) { - Lumberjack.log(Level.INFO, e, "Avaritia had Too Many Items."); - } - } - if (tweak) { try { Tweak.registrate(); diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/ItemInfinitatoCostume.java b/src/main/java/fox/spiteful/avaritia/compat/botania/ItemInfinitatoCostume.java index 374d001b..b6a3688d 100644 --- a/src/main/java/fox/spiteful/avaritia/compat/botania/ItemInfinitatoCostume.java +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/ItemInfinitatoCostume.java @@ -12,7 +12,7 @@ public class ItemInfinitatoCostume extends Item { - private static final String[] types = new String[] { "armstrong", "moon", "egbert", "francis" }; + public static final String[] types = new String[] { "armstrong", "moon", "egbert", "francis" }; @SideOnly(Side.CLIENT) public IIcon[] icons; diff --git a/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java b/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java index e3e4f91d..55e71aac 100644 --- a/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java +++ b/src/main/java/fox/spiteful/avaritia/compat/botania/Tsundere.java @@ -5,12 +5,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.registry.GameRegistry; import fox.spiteful.avaritia.blocks.LudicrousBlocks; import fox.spiteful.avaritia.compat.Compat; -import fox.spiteful.avaritia.compat.nei.NotEnough; import fox.spiteful.avaritia.crafting.ExtremeCraftingManager; import fox.spiteful.avaritia.crafting.ExtremeShapedRecipe; import fox.spiteful.avaritia.items.LudicrousItems; @@ -71,11 +69,6 @@ public static void baka() throws Compat.ItemNotFoundException { GameRegistry.registerTileEntity(TileInfinitato.class, "Avaritia_Infinitato"); costumes = new ItemInfinitatoCostume(); GameRegistry.registerItem(costumes, "costumes"); - if (Compat.nei) { - try { - NotEnough.hide(new ItemStack(costumes, 1, OreDictionary.WILDCARD_VALUE)); - } catch (Throwable e) {} - } Block potato = Compat.getBlock("Botania", "tinyPotato"); diff --git a/src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java b/src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java new file mode 100644 index 00000000..3082a129 --- /dev/null +++ b/src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java @@ -0,0 +1,41 @@ +package fox.spiteful.avaritia.compat.nei; + +import net.minecraft.item.ItemStack; + +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import fox.spiteful.avaritia.compat.botania.ItemInfinitatoCostume; +import fox.spiteful.avaritia.compat.botania.Tsundere; + +@SuppressWarnings("unused") +public class NEI_Avaritia_Config implements IConfigureNEI { + + @Override + public void loadConfig() { + ExtremeShapedRecipeHandler shaped = new ExtremeShapedRecipeHandler(); + ExtremeShapelessRecipeHandler shapeless = new ExtremeShapelessRecipeHandler(); + CompressionHandler compress = new CompressionHandler(); + API.registerRecipeHandler(shaped); + API.registerRecipeHandler(shapeless); + API.registerRecipeHandler(compress); + API.registerUsageHandler(shaped); + API.registerUsageHandler(shapeless); + API.registerUsageHandler(compress); + + if (Tsundere.costumes != null) { + for (int i = 0; i < ItemInfinitatoCostume.types.length; i++) { + API.hideItem(new ItemStack(Tsundere.costumes, 1, i)); + } + } + } + + @Override + public String getName() { + return "Avaritia NEI plugin"; + } + + @Override + public String getVersion() { + return ""; + } +} diff --git a/src/main/java/fox/spiteful/avaritia/compat/nei/NotEnough.java b/src/main/java/fox/spiteful/avaritia/compat/nei/NotEnough.java deleted file mode 100644 index 0e1aba55..00000000 --- a/src/main/java/fox/spiteful/avaritia/compat/nei/NotEnough.java +++ /dev/null @@ -1,24 +0,0 @@ -package fox.spiteful.avaritia.compat.nei; - -import net.minecraft.item.ItemStack; - -import codechicken.nei.api.API; - -public class NotEnough { - - public static void items() { - ExtremeShapedRecipeHandler shaped = new ExtremeShapedRecipeHandler(); - ExtremeShapelessRecipeHandler shapeless = new ExtremeShapelessRecipeHandler(); - CompressionHandler compress = new CompressionHandler(); - API.registerRecipeHandler(shaped); - API.registerRecipeHandler(shapeless); - API.registerRecipeHandler(compress); - API.registerUsageHandler(shaped); - API.registerUsageHandler(shapeless); - API.registerUsageHandler(compress); - } - - public static void hide(ItemStack stack) { - API.hideItem(stack); - } -} From 53226919a5efed79e0c78805ab9e26ddf27124b4 Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 13 Jun 2023 02:22:55 +0900 Subject: [PATCH 2/2] Don't use snake-case --- .../nei/{NEI_Avaritia_Config.java => NEIAvaritiaConfig.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/java/fox/spiteful/avaritia/compat/nei/{NEI_Avaritia_Config.java => NEIAvaritiaConfig.java} (95%) diff --git a/src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java b/src/main/java/fox/spiteful/avaritia/compat/nei/NEIAvaritiaConfig.java similarity index 95% rename from src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java rename to src/main/java/fox/spiteful/avaritia/compat/nei/NEIAvaritiaConfig.java index 3082a129..b09dbde8 100644 --- a/src/main/java/fox/spiteful/avaritia/compat/nei/NEI_Avaritia_Config.java +++ b/src/main/java/fox/spiteful/avaritia/compat/nei/NEIAvaritiaConfig.java @@ -8,7 +8,7 @@ import fox.spiteful.avaritia.compat.botania.Tsundere; @SuppressWarnings("unused") -public class NEI_Avaritia_Config implements IConfigureNEI { +public class NEIAvaritiaConfig implements IConfigureNEI { @Override public void loadConfig() {