Skip to content

Commit

Permalink
✨ Add back support for Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Autovw committed Nov 19, 2024
1 parent 52d208d commit ed7ba64
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 151 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"#advancednetherite:tier/armor/netherite_emerald",
"#advancednetherite:tier/armor/netherite_diamond"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"#advancednetherite:tier/armor/netherite_iron",
"#advancednetherite:tier/armor/netherite_diamond"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"values": [
"#advancednetherite:tier/armor/netherite_gold",
"#advancednetherite:tier/armor/netherite_diamond"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"#advancednetherite:pacify_piglins_armor"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected ObjectArrayList<ItemStack> 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)));
}
Expand Down
143 changes: 0 additions & 143 deletions Forge/src/main/java/com/autovw/advancednetherite/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,166 +86,24 @@ 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()
{
return this.additionalDropsConfig;
}
}

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -30,7 +28,7 @@ plugins {

rootProject.name = 'AdvancedNetherite'
include("Common")
//include("Forge")
include("Forge")
include("NeoForge")
include("Fabric")

0 comments on commit ed7ba64

Please sign in to comment.