From ed7ba646c8fe74812546dabc4c468a1acc64142d Mon Sep 17 00:00:00 2001 From: Autovw <68228006+Autovw@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:09:16 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20back=20support=20for=20Forge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tags/item/pacify_endermen_armor.json | 6 + .../tags/item/pacify_phantoms_armor.json | 6 + .../tags/item/pacify_piglins_armor.json | 6 + .../tags/item/piglin_safe_armor.json | 5 + .../common/loot/MobDropsLootModifier.java | 2 +- .../advancednetherite/config/Config.java | 143 ------------------ .../providers/ModItemTagsProvider.java | 14 ++ Forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 6 +- settings.gradle | 4 +- 10 files changed, 43 insertions(+), 151 deletions(-) create mode 100644 Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_endermen_armor.json create mode 100644 Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_phantoms_armor.json create mode 100644 Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_piglins_armor.json create mode 100644 Forge/src/generated/resources/data/minecraft/tags/item/piglin_safe_armor.json diff --git a/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_endermen_armor.json b/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_endermen_armor.json new file mode 100644 index 00000000..517fa0e6 --- /dev/null +++ b/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_endermen_armor.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#advancednetherite:tier/armor/netherite_emerald", + "#advancednetherite:tier/armor/netherite_diamond" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_phantoms_armor.json b/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_phantoms_armor.json new file mode 100644 index 00000000..02e143eb --- /dev/null +++ b/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_phantoms_armor.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#advancednetherite:tier/armor/netherite_iron", + "#advancednetherite:tier/armor/netherite_diamond" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_piglins_armor.json b/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_piglins_armor.json new file mode 100644 index 00000000..8d369c84 --- /dev/null +++ b/Forge/src/generated/resources/data/advancednetherite/tags/item/pacify_piglins_armor.json @@ -0,0 +1,6 @@ +{ + "values": [ + "#advancednetherite:tier/armor/netherite_gold", + "#advancednetherite:tier/armor/netherite_diamond" + ] +} \ No newline at end of file diff --git a/Forge/src/generated/resources/data/minecraft/tags/item/piglin_safe_armor.json b/Forge/src/generated/resources/data/minecraft/tags/item/piglin_safe_armor.json new file mode 100644 index 00000000..06f9fc5f --- /dev/null +++ b/Forge/src/generated/resources/data/minecraft/tags/item/piglin_safe_armor.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#advancednetherite:pacify_piglins_armor" + ] +} \ No newline at end of file diff --git a/Forge/src/main/java/com/autovw/advancednetherite/common/loot/MobDropsLootModifier.java b/Forge/src/main/java/com/autovw/advancednetherite/common/loot/MobDropsLootModifier.java index 6015ab6e..7dbc6a85 100644 --- a/Forge/src/main/java/com/autovw/advancednetherite/common/loot/MobDropsLootModifier.java +++ b/Forge/src/main/java/com/autovw/advancednetherite/common/loot/MobDropsLootModifier.java @@ -51,7 +51,7 @@ protected ObjectArrayList doApply(LootTable lootTable, ObjectArrayLis ItemStack useItem = player.getMainHandItem(); // used to check if the player uses the correct weapon RandomSource random = context.getRandom(); // random generator - if ((useItem.is(ModItems.NETHERITE_IRON_SWORD) || useItem.is(ModItems.NETHERITE_DIAMOND_SWORD) && victim.getType() == EntityType.PHANTOM && random.nextFloat() <= ConfigHelper.get().getServer().getAdditionalDropProperties().getAdditionalPhantomDropChance()) + if ((useItem.is(ModItems.NETHERITE_IRON_SWORD) || useItem.is(ModItems.NETHERITE_DIAMOND_SWORD)) && victim.getType() == EntityType.PHANTOM && random.nextFloat() <= ConfigHelper.get().getServer().getAdditionalDropProperties().getAdditionalPhantomDropChance()) { generatedLoot.add(new ItemStack(Items.PHANTOM_MEMBRANE, random.nextIntBetweenInclusive(0, 2))); } diff --git a/Forge/src/main/java/com/autovw/advancednetherite/config/Config.java b/Forge/src/main/java/com/autovw/advancednetherite/config/Config.java index 829b4044..c8b2b6a0 100644 --- a/Forge/src/main/java/com/autovw/advancednetherite/config/Config.java +++ b/Forge/src/main/java/com/autovw/advancednetherite/config/Config.java @@ -2,7 +2,6 @@ import com.autovw.advancednetherite.api.annotation.Internal; import com.autovw.advancednetherite.config.common.IAdditionalDropsConfig; -import com.autovw.advancednetherite.config.common.IArmorConfig; import com.autovw.advancednetherite.config.server.IAdditionalDropPropertiesConfig; import com.autovw.advancednetherite.config.server.IToolPropertiesConfig; import net.minecraftforge.common.ForgeConfigSpec; @@ -87,25 +86,17 @@ public boolean forceDisableDetailArmorBarSupport() // COMMON config public static class Common implements ICommonConfig { - public final ArmorConfig armorConfig; public final AdditionalDropsConfig additionalDropsConfig; public Common(ForgeConfigSpec.Builder builder) { builder.translation("config.advancednetherite.common").push("common"); { - this.armorConfig = new ArmorConfig(builder); this.additionalDropsConfig = new AdditionalDropsConfig(builder); } builder.pop(); } - @Override - public IArmorConfig getArmor() - { - return this.armorConfig; - } - @Override public IAdditionalDropsConfig getAdditionalDrops() { @@ -113,140 +104,6 @@ public IAdditionalDropsConfig getAdditionalDrops() } } - public static class ArmorConfig implements IArmorConfig - { - public static ForgeConfigSpec.BooleanValue ironPhantomPassiveArmor; - public static ForgeConfigSpec.BooleanValue ironPiglinPassiveArmor; - public static ForgeConfigSpec.BooleanValue ironEndermanPassiveArmor; - - public static ForgeConfigSpec.BooleanValue goldPhantomPassiveArmor; - public static ForgeConfigSpec.BooleanValue goldPiglinPassiveArmor; - public static ForgeConfigSpec.BooleanValue goldEndermanPassiveArmor; - - public static ForgeConfigSpec.BooleanValue emeraldPhantomPassiveArmor; - public static ForgeConfigSpec.BooleanValue emeraldPiglinPassiveArmor; - public static ForgeConfigSpec.BooleanValue emeraldEndermanPassiveArmor; - - public static ForgeConfigSpec.BooleanValue diamondPhantomPassiveArmor; - public static ForgeConfigSpec.BooleanValue diamondPiglinPassiveArmor; - public static ForgeConfigSpec.BooleanValue diamondEndermanPassiveArmor; - - public ArmorConfig(ForgeConfigSpec.Builder builder) - { - builder.comment("Configure properties related to armor perks here").push("armor_perks"); - { - // Netherite-Iron Armor - builder.comment("Configure properties related to Netherite-Iron armor here").push("netherite_iron_armor"); - { - ironPhantomPassiveArmor = builder.comment("If true, Phantoms behave neutral towards players wearing Netherite-Iron armor. True by default.").define("ironPhantomPassiveArmor", true); - ironPiglinPassiveArmor = builder.comment("If true, Piglins behave neutral towards players wearing Netherite-Iron armor. False by default.").define("ironPiglinPassiveArmor", false); - ironEndermanPassiveArmor = builder.comment("If true, Endermen behave neutral towards players wearing Netherite-Iron armor. False by default.").define("ironEndermanPassiveArmor", false); - } - builder.pop(); - - // Netherite-Gold Armor - builder.comment("Configure properties related to Netherite-Gold armor here").push("netherite_gold_armor"); - { - goldPhantomPassiveArmor = builder.comment("If true, Phantoms behave neutral towards players wearing Netherite-Gold armor. False by default.").define("goldPhantomPassiveArmor", false); - goldPiglinPassiveArmor = builder.comment("If true, Piglins behave neutral towards players wearing Netherite-Gold armor. True by default.").define("goldPiglinPassiveArmor", true); - goldEndermanPassiveArmor = builder.comment("If true, Endermen behave neutral towards players wearing Netherite-Gold armor. False by default.").define("goldEndermanPassiveArmor", false); - } - builder.pop(); - - // Netherite-Emerald Armor - builder.comment("Configure properties related to Netherite-Emerald armor here").push("netherite_emerald_armor"); - { - emeraldPhantomPassiveArmor = builder.comment("If true, Phantoms behave neutral towards players wearing Netherite-Emerald armor. False by default.").define("emeraldPhantomPassiveArmor", false); - emeraldPiglinPassiveArmor = builder.comment("If true, Piglins behave neutral towards players wearing Netherite-Emerald armor. False by default.").define("emeraldPiglinPassiveArmor", false); - emeraldEndermanPassiveArmor = builder.comment("If true, Endermen behave neutral towards players wearing Netherite-Emerald armor. True by default.").define("emeraldEndermanPassiveArmor", true); - } - builder.pop(); - - // Netherite-Diamond Armor - builder.comment("Configure properties related to Netherite-Diamond armor here").push("netherite_diamond_armor"); - { - diamondPhantomPassiveArmor = builder.comment("If true, Phantoms behave neutral towards players wearing Netherite-Diamond armor. True by default.").define("diamondPhantomPassiveArmor", true); - diamondPiglinPassiveArmor = builder.comment("If true, Piglins behave neutral towards players wearing Netherite-Diamond armor. True by default.").define("diamondPiglinPassiveArmor", true); - diamondEndermanPassiveArmor = builder.comment("If true, Endermen behave neutral towards players wearing Netherite-Diamond armor. True by default.").define("diamondEndermanPassiveArmor", true); - } - builder.pop(); - } - builder.pop(); - } - - @Override - public boolean isIronPhantomPassiveArmor() - { - return ArmorConfig.ironPhantomPassiveArmor.get(); - } - - @Override - public boolean isIronPiglinPassiveArmor() - { - return ArmorConfig.ironPiglinPassiveArmor.get(); - } - - @Override - public boolean isIronEndermanPassiveArmor() - { - return ArmorConfig.ironEndermanPassiveArmor.get(); - } - - @Override - public boolean isGoldPhantomPassiveArmor() - { - return ArmorConfig.goldPhantomPassiveArmor.get(); - } - - @Override - public boolean isGoldPiglinPassiveArmor() - { - return ArmorConfig.goldPiglinPassiveArmor.get(); - } - - @Override - public boolean isGoldEndermanPassiveArmor() - { - return ArmorConfig.goldEndermanPassiveArmor.get(); - } - - @Override - public boolean isEmeraldPhantomPassiveArmor() - { - return ArmorConfig.emeraldPhantomPassiveArmor.get(); - } - - @Override - public boolean isEmeraldPiglinPassiveArmor() - { - return ArmorConfig.emeraldPiglinPassiveArmor.get(); - } - - @Override - public boolean isEmeraldEndermanPassiveArmor() - { - return ArmorConfig.emeraldEndermanPassiveArmor.get(); - } - - @Override - public boolean isDiamondPhantomPassiveArmor() - { - return ArmorConfig.diamondPhantomPassiveArmor.get(); - } - - @Override - public boolean isDiamondPiglinPassiveArmor() - { - return ArmorConfig.diamondPiglinPassiveArmor.get(); - } - - @Override - public boolean isDiamondEndermanPassiveArmor() - { - return ArmorConfig.diamondEndermanPassiveArmor.get(); - } - } - public static class AdditionalDropsConfig implements IAdditionalDropsConfig { public static ForgeConfigSpec.BooleanValue enableAdditionalCropDrops; diff --git a/Forge/src/main/java/com/autovw/advancednetherite/datagen/providers/ModItemTagsProvider.java b/Forge/src/main/java/com/autovw/advancednetherite/datagen/providers/ModItemTagsProvider.java index cb4cc772..ecd54078 100644 --- a/Forge/src/main/java/com/autovw/advancednetherite/datagen/providers/ModItemTagsProvider.java +++ b/Forge/src/main/java/com/autovw/advancednetherite/datagen/providers/ModItemTagsProvider.java @@ -243,6 +243,17 @@ protected void addTags(HolderLookup.Provider lookupProvider) tag(ModTags.REPAIRS_NETHERITE_DIAMOND_TOOLS) .add(ModItems.NETHERITE_DIAMOND_INGOT); + // Pacify armor tags + tag(ModTags.PACIFY_PHANTOMS_ARMOR) + .addTag(ModTags.TIER_ARMOR_NETHERITE_IRON) + .addTag(ModTags.TIER_ARMOR_NETHERITE_DIAMOND); + tag(ModTags.PACIFY_PIGLINS_ARMOR) + .addTag(ModTags.TIER_ARMOR_NETHERITE_GOLD) + .addTag(ModTags.TIER_ARMOR_NETHERITE_DIAMOND); + tag(ModTags.PACIFY_ENDERMEN_ARMOR) + .addTag(ModTags.TIER_ARMOR_NETHERITE_EMERALD) + .addTag(ModTags.TIER_ARMOR_NETHERITE_DIAMOND); + /* Vanilla tags */ tag(ItemTags.BEACON_PAYMENT_ITEMS).addTag(ModTags.NETHERITE_INGOTS); @@ -259,6 +270,9 @@ protected void addTags(HolderLookup.Provider lookupProvider) .add(ModItems.NETHERITE_GOLD_SHOVEL) .add(ModItems.NETHERITE_GOLD_SWORD); + tag(ItemTags.PIGLIN_SAFE_ARMOR) + .addTag(ModTags.PACIFY_PIGLINS_ARMOR); + tag(ItemTags.CLUSTER_MAX_HARVESTABLES) .add(ModItems.NETHERITE_IRON_PICKAXE) .add(ModItems.NETHERITE_GOLD_PICKAXE) diff --git a/Forge/src/main/resources/META-INF/mods.toml b/Forge/src/main/resources/META-INF/mods.toml index 1ecb4a46..1e9518fe 100644 --- a/Forge/src/main/resources/META-INF/mods.toml +++ b/Forge/src/main/resources/META-INF/mods.toml @@ -20,7 +20,7 @@ Visit the GitHub Wiki for more information on everything this mod adds. [[dependencies.advancednetherite]] modId="forge" mandatory=true -versionRange="[53.0.0,)" +versionRange="[53.0.16,)" ordering="NONE" side="BOTH" [[dependencies.advancednetherite]] diff --git a/gradle.properties b/gradle.properties index 92678b6d..98c7a753 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,14 +13,14 @@ mod_author=Autovw minecraft_version=1.21.3 # Forge -forge_version=53.0.7 +forge_version=53.0.21 # NeoForge -neoforge_version=21.3.7-beta +neoforge_version=21.3.34-beta # Fabric fabric_loader_version=0.16.7 -fabric_api_version=0.107.0+1.21.3 +fabric_api_version=0.109.0+1.21.3 # Forge mod dependencies detailab_forge_version=3920487 diff --git a/settings.gradle b/settings.gradle index 64b5fbfe..7215e06a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,12 +2,10 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() - /* maven { name = 'Forge' url = 'https://maven.minecraftforge.net/' } - */ maven { name = 'NeoForge' url = 'https://maven.neoforged.net/releases' @@ -30,7 +28,7 @@ plugins { rootProject.name = 'AdvancedNetherite' include("Common") -//include("Forge") +include("Forge") include("NeoForge") include("Fabric")