This commit is contained in:
craisinlord committed 2026-10-26 16:52:32 -05:00
1 parent 5a8cb58cb0
commit 8626d205f7
132 files changed
+18 -931

No files matched your search

-20
View File
@@ -9,7 +9,6 @@ base {
}
version = "${mod_version}+1.21.1-fabric"
// Handle duplicates from common-1.21.1's resources
tasks.withType(AbstractCopyTask).configureEach {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
@@ -19,7 +18,6 @@ java {
withSourcesJar()
}
// Add common-1.21.1's sources directly — this module compiles them itself.
sourceSets {
main {
java {
@@ -44,9 +42,6 @@ dependencies {
if (providers.gradleProperty('antarchySodiumCompatTest').orNull == 'true') {
modLocalRuntime(files("$rootDir/infinite_dimensions_jars/sodium-fabric-0.8.13+mc1.21.1.jar"))
}
// Sodium — compile-only, for portal live views drawn through Sodium's renderer. Compiled
// against the NeoForge build (official Mojang mappings, matching this module's compile
// space; Sodium's own classes are identical across loaders). Never bundled.
compileOnly(files(zipTree("$rootDir/infinite_dimensions_jars/sodium-neoforge-0.8.13+mc1.21.1.jar")
.matching { include "META-INF/jarjar/net.caffeinemc.sodium-neoforge-*-mod.jar" }))
modCompileOnly("curse.maven:intapi-${intapi_curseforge_id}:${intapi_curseforge_file_id_fabric}")
@@ -62,25 +57,12 @@ dependencies {
compileOnly(files("$rootDir/infinite_dimensions_jars/sable-neoforge-1.21.1-2.0.3.jar"))
compileOnly(files("$rootDir/infinite_dimensions_jars/stellarview-1.21.1-0.5.3-neoforge.jar"))
// Cloth Config — optional, powers the in-game settings screen (AntarchyClothConfigScreenBuilder)
// via the Mod Menu integration below. compileOnly + modLocalRuntime only: never bundled or
// required at runtime in the shipped jar. Guarded by FabricLoader.isModLoaded("cloth-config")
// in AntarchyModMenuIntegration before any Cloth Config class is touched. Reuses the
// clothconfig_curseforge_id/clothconfig_curseforge_file_id pin already in gradle.properties.
modCompileOnly("curse.maven:cloth-config-${clothconfig_curseforge_id}:${clothconfig_curseforge_file_id}")
modLocalRuntime("curse.maven:cloth-config-${clothconfig_curseforge_id}:${clothconfig_curseforge_file_id}")
// Mod Menu — optional, provides the "modmenu" fabric.mod.json entrypoint
// (AntarchyModMenuIntegration). Same soft-dependency treatment as Cloth Config above; Fabric
// Loader only ever resolves the "modmenu" entrypoint if Mod Menu itself is installed and asks
// for it, so nothing here is touched when it's absent. Reuses the mod_menu version already
// pinned in gradle.properties.
modCompileOnly "com.terraformersmc:modmenu:${mod_menu}"
modLocalRuntime "com.terraformersmc:modmenu:${mod_menu}"
// Compile against the NeoForge jar (official Mojang mappings, matches this module's compile
// space) but load the real Fabric jar at runtime — sizeable_foliage's Fabric jar ships
// intermediary-mapped, which this compileOnly classpath can't resolve directly.
compileOnly(files("$rootDir/sizeable_foliage_jars/sizeable_foliage-neoforge-1.21.1-1.0.0.jar"))
modLocalRuntime(files("$rootDir/sizeable_foliage_jars/sizeable_foliage-fabric-1.21.1-1.0.0.jar"))
@@ -118,8 +100,6 @@ tasks.named('processResources', ProcessResources).configure {
}
}
// common-1.21.1's mixins.json ships refmap-free (NeoForge needs no refmap), but Fabric
// does — inject the refmap key into fabric's own copy of the shared file after copying.
tasks.named('processResources', ProcessResources).configure {
doLast {
['antarchy-common.mixins.json'].each { configName ->
@@ -77,24 +77,10 @@ public final class AntarchyConfigModuleFabric {
}
}
/**
* Exposes the reflection-based getter/setter binding map (see {@link #buildBindings()}) so
* other Fabric-side code — namely the optional Cloth Config screen builder — can reuse the
* exact same set of persisted settings the JSON files already round-trip, instead of
* hand-authoring a separate list. Read-only: callers get/set individual values through
* {@link SettingBinding#getValue()} / {@link SettingBinding#setValue(Object)}.
*/
public static Map<String, SettingBinding> getBindings() {
return SETTINGS;
}
/**
* Re-serializes the current live value of every binding back to its JSON file. Intended for
* the optional Cloth Config screen's save handler: entries there update the live
* {@link AntarchySettings} fields immediately through their own save consumers (same as
* {@link SettingBinding#apply(Object)} does below), but nothing writes those changes to disk
* until this runs — mirrors the persistence tail of {@link #init()} above.
*/
public static void persist() {
Map<ConfigSection, JsonObject> normalized = new LinkedHashMap<>();
for (ConfigSection section : ConfigSection.values()) {
@@ -159,10 +145,6 @@ public final class AntarchyConfigModuleFabric {
};
}
/**
* Public so the optional Cloth Config screen builder (fabric.client package) can group
* entries into the same Mobs/Tools/Misc categories the JSON files already use.
*/
public enum ConfigSection {
MOBS("antarchy_mobs.json"),
TOOLS("antarchy_tools.json"),
@@ -176,14 +158,6 @@ public final class AntarchyConfigModuleFabric {
}
/**
* Public so the optional Cloth Config screen builder (fabric.client package) can reuse this
* exact binding — the same getter/setter pair and JSON section the persistence layer above
* already drives — instead of a separate hand-authored entry list. The JSON-specific
* machinery (readValue/apply/toJson/getCurrentValue) stays private and is reused internally
* by the public getValue()/setValue() wrappers below, so there's exactly one code path for
* "what is this setting's current value" and "how do I change it".
*/
public static final class SettingBinding {
private final String name;
private final Method getter;
@@ -199,27 +173,22 @@ public final class AntarchyConfigModuleFabric {
this.section = section;
}
/** The AntarchySettings property name, e.g. {@code krakenHealth}. */
public String getName() {
return name;
}
/** Which of the three JSON files (Mobs/Tools/Misc) this setting persists to. */
public ConfigSection getSection() {
return section;
}
/** The primitive/String type of the setter's single parameter (boolean/int/double/float/String). */
public Class<?> getType() {
return setterType;
}
/** The setting's current live value, boxed (Boolean/Integer/Double/Float/String). */
public Object getValue() {
return getCurrentValue();
}
/** Applies a new value immediately via reflection, same as the JSON loader does at startup. */
public void setValue(Object value) {
apply(value);
}
@@ -102,10 +102,6 @@ public final class AntarchyFabricContent {
builder.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.STRATOSHARK_FIN.get()), net.minecraft.world.item.alchemy.Potions.SLOW_FALLING);
builder.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.SPRINGBUG_LEG.get()), Potions.LEAPING);
builder.registerPotionRecipe(net.minecraft.world.item.alchemy.Potions.AWKWARD, Ingredient.of(AntarchyFabricItems.CORNEA_EAR.get()), net.minecraft.world.item.alchemy.Potions.NIGHT_VISION);
// Corn/syrup/root-beer are plain items, not Potion holders, so vanilla's Builder#expectPotion
// rejects them via registerItemRecipe/registerPotionRecipe. The actual output logic comes from
// PotionBrewingMixin -> CustomBrewingRecipes; brewing-stand slot validity for these custom items
// is handled by BrewingStandCustomIngredientMixin (Fabric doesn't expose Builder#addContainer).
});
AntarchyFabricSounds.SOUND_EVENTS.register();
@@ -97,9 +97,7 @@ public final class BloodglassManager {
}
}
} else if (!fromIsBC) {
// Count BC pieces: explicitly include the new piece (to) since getItemBySlot(slot)
// may not reflect the new item yet when onEquipItem fires on Fabric.
int bcPieces = 1; // the piece being equipped now
int bcPieces = 1;
for (EquipmentSlot s : new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}) {
if (s == slot) continue;
if (player.getItemBySlot(s).getItem() instanceof BloodCrystalArmorItem) bcPieces++;
@@ -110,7 +108,6 @@ public final class BloodglassManager {
access.antarchy$setArmorRechargeTimer(AntarchySettings.bloodCrystalArmorShieldRechargeTicks());
}
} else {
// BC → BC swap: remove old slot, queue new one
if (access.antarchy$getArmorShieldsActive() > 0) {
access.antarchy$setArmorShieldsActive(access.antarchy$getArmorShieldsActive() - 1);
} else if (access.antarchy$getArmorShieldLostCount() > 0) {
@@ -131,9 +128,6 @@ public final class BloodglassManager {
- access.antarchy$getArmorShieldLostCount());
int targetCap = Math.min(amplifier + 1, cap);
int currentCap = access.antarchy$getAppleShieldsActive() + access.antarchy$getAppleShieldLostCount();
// Only grant newly-added capacity (e.g. first application, or a higher amplifier).
// A mere duration refresh of an already-active ward must not reset shields that are
// already lost, nor restart their recharge timer.
if (targetCap > currentCap) {
access.antarchy$setAppleShieldsActive(access.antarchy$getAppleShieldsActive() + (targetCap - currentCap));
if (player instanceof ServerPlayer sp) syncBloodglass(sp);
@@ -12,19 +12,6 @@ import net.minecraft.network.chat.Component;
import java.util.EnumMap;
import java.util.Map;
/**
* Builds a Cloth Config screen directly from {@link AntarchyConfigModuleFabric}'s existing
* reflection-based binding map, so the screen and the on-disk JSON files stay in sync
* automatically — no separate hand-authored list of 350+ entries.
*
* <p>Only ever reached from {@link AntarchyModMenuIntegration#getModConfigScreenFactory()} after
* it has already confirmed Cloth Config is present, so every Cloth Config class referenced here
* is safe to touch.
*
* <p>Phase 1 scope (see the implementation plan): raw field names as labels, no min/max bounds,
* no tooltips, and fields backed by {@code ResourceKey<Level>} (the four dimension-identity
* settings) are skipped entirely rather than exposed with a widget that doesn't fit them.
*/
public final class AntarchyClothConfigScreenBuilder {
private AntarchyClothConfigScreenBuilder() {
}
@@ -4,34 +4,12 @@ import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import net.fabricmc.loader.api.FabricLoader;
/**
* Optional Mod Menu integration entrypoint — declared under the "modmenu" key in
* fabric.mod.json, never referenced anywhere else in Antarchy's own code.
*
* <p>This class is only ever loaded/instantiated by Mod Menu itself. Fabric Loader resolves
* entrypoints lazily: it reads every mod's fabric.mod.json at startup, but a class named under
* "entrypoints" is not loaded until something explicitly calls
* {@code FabricLoader.getInstance().getEntrypointContainers("modmenu", ModMenuApi.class)} for
* that key — and only Mod Menu does that. So if Mod Menu isn't installed, this class is never
* touched at all, and "modmenu" is declared as a "suggests" (not "depends") dependency in
* fabric.mod.json precisely so Antarchy loads identically either way.
*
* <p>Mod Menu and Cloth Config are independently optional, so the one runtime guard this
* integration does need is below: if Mod Menu is present but Cloth Config isn't, building the
* real screen would touch Cloth Config classes that aren't on the classpath.
*/
public final class AntarchyModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
if (!FabricLoader.getInstance().isModLoaded("cloth-config")) {
// Mod Menu always shows the config button once a non-null factory is returned, so
// there's no clean way to hide it conditionally — handing back the screen that was
// already open is the safest no-op fallback when Cloth Config isn't installed.
return parent -> parent;
}
// Method reference, not a direct call: this does not load AntarchyClothConfigScreenBuilder
// or touch any Cloth Config class until the player actually clicks the config button,
// which only happens after the isModLoaded check above has already passed.
return AntarchyClothConfigScreenBuilder::build;
}
}
@@ -26,7 +26,6 @@ public final class BloodglassHudRenderer {
if (mc.options.hideGui) return;
Player player = mc.player;
if (player == null || player.isDeadOrDying()) return;
// Don't show in creative or spectator — no health bar visible there
if (player.isCreative() || player.isSpectator()) return;
int total = BloodglassClientState.getShieldsMax();
@@ -36,21 +35,16 @@ public final class BloodglassHudRenderer {
int w = mc.getWindow().getGuiScaledWidth();
int h = mc.getWindow().getGuiScaledHeight();
// Vanilla health bar bottom row is at y = h - 39; each extra row (absorption, extra hearts) is 10px above.
// The armor protection icons sit one row above the bottom health row (h - 49).
// We place bloodglass hearts above both health+absorption stack AND the armor row.
int maxHealth = Mth.ceil(player.getMaxHealth());
int absorption = Mth.ceil(player.getAbsorptionAmount());
int healthHearts = Mth.ceil(maxHealth / 2.0f);
int absorptionHearts = Mth.ceil(absorption / 2.0f);
int totalVanillaRows = Mth.ceil((healthHearts + absorptionHearts) / 10.0f);
boolean hasArmor = player.getArmorValue() > 0;
// +1 to clear the armor icon row only when armor is actually equipped
int baseTop = h - 39 - (totalVanillaRows * 10) - (hasArmor ? 10 : 0);
int left = w / 2 - 91;
// Wrap across multiple rows if more than 10 bloodglass hearts
for (int i = 0; i < total; i++) {
int row = i / 10;
int col = i % 10;
@@ -11,9 +11,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(LivingEntity.class)
public abstract class ElytraFallFlyingMixin {
/**
* Redirect to allow any ElytraItem subclass to sustain fall flying.
*/
@Redirect(
method = "updateFallFlying",
at = @At(
@@ -12,12 +12,6 @@ import java.util.List;
import java.util.Map;
@Mixin(value = Amendment.class, remap = false)
/*
* Makes Antarchy's uranium/titanium ores and blocks much rarer in Infinite Dimensions'
* procedural dimensions. This is done natively via Infinity's own amendment system rather
* than relying on players editing infinity's config, keyed off the antarchy:infinity_dimension_rare_ores
* block tag so the list stays data-driven and native to Antarchy.
*/
public class AmendmentRareOresMixin {
@Inject(method = "getAmendmentList", at = @At("RETURN"), remap = false)
private static void antarchy$addRareOreAmendment(CallbackInfoReturnable<Map<ConfigType, List<Amendment>>> cir) {