Skip to content

Commit

Permalink
Merge pull request #615 from WaitingIdly/astral-zero-division
Browse files Browse the repository at this point in the history
Astral Sorcery Crystal Tool Division By Zero
  • Loading branch information
ACGaming authored Jan 18, 2025
2 parents 1de5646 + 1d2e189 commit 0aa4dce
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ All changes are toggleable via config files.
* **Missing Player Log Level:** Downgrades the message when completing a recipe without an initializing player from a warning to a debug
* **Sooty Marble Rendering:** Fixes Sooty Marble Pillar blocking the proper rendering of adjacent fluids due to inverted logic
* **Clear Particle Effects:** Fixes a bug where particle effects would continue to render after changing dimensions
* **Fix Division By Zero Crystal Tool:** Fixes a bug where merging Crystal Tool Properties could result in a division by zero
* **Advent of Ascension**
* **Improved Player Tick:** Improves AoA player ticking by only sending inventory changes when necessary
* **Arcane Archives**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ public static class AstralSorceryCategory
@Config.Name("Clear Particle Effects")
@Config.Comment("Fixes a bug where particle effects would continue to render after changing dimensions")
public boolean utClearEffectsOnDimensionChange = true;

@Config.Name("Fix Division By Zero Crystal Tool")
@Config.Comment("Fixes a bug where merging Crystal Tool Properties could result in a division by zero")
public boolean utEmptyPropertiesZero = true;
}

public static class AOACategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class UTMixinLoader implements ILateMixinLoader
put("mixins.mods.aoa3.json", () -> loaded("aoa3") && UTConfigMods.AOA.utImprovedPlayerTickToggle);
put("mixins.mods.arcanearchives.dupes.json", () -> loaded("arcanearchives") && UTConfigMods.ARCANE_ARCHIVES.utDuplicationFixesToggle);
put("mixins.mods.astralsorcery.json", () -> loaded("astralsorcery"));
put("mixins.mods.astralsorcery.tool.json", () -> loaded("astralsorcery") && UTConfigMods.ASTRAL_SORCERY.utEmptyPropertiesZero);
put("mixins.mods.biomesoplenty.json", () -> loaded("biomesoplenty"));
put("mixins.mods.biomesoplenty.sealevel.json", () -> loaded("biomesoplenty") && UTConfigTweaks.WORLD.utSeaLevel != 63);
put("mixins.mods.bloodmagic.dupes.json", () -> loaded("bloodmagic") && UTConfigMods.BLOOD_MAGIC.utDuplicationFixesToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package mod.acgaming.universaltweaks.mods.astralsorcery.mixin;

import java.util.List;

import hellfirepvp.astralsorcery.common.item.crystal.CrystalProperties;
import hellfirepvp.astralsorcery.common.item.crystal.ToolCrystalProperties;
import mod.acgaming.universaltweaks.config.UTConfigMods;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = ToolCrystalProperties.class, remap = false)
public abstract class UTToolCrystalPropertiesMixin
{
@Inject(method = "merge(Ljava/util/List;)Lhellfirepvp/astralsorcery/common/item/crystal/ToolCrystalProperties;", at = @At("HEAD"), cancellable = true)
private static void utEmptySkip(List<CrystalProperties> properties, CallbackInfoReturnable<ToolCrystalProperties> cir)
{
if (UTConfigMods.ASTRAL_SORCERY.utEmptyPropertiesZero && properties.isEmpty())
{
cir.setReturnValue(new ToolCrystalProperties(0, 0, 0, 0, -1));
}
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.mods.astralsorcery.tool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.mods.astralsorcery.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTToolCrystalPropertiesMixin"]
}

0 comments on commit 0aa4dce

Please sign in to comment.