Skip to content

Commit

Permalink
Merge pull request #432 from WaitingIdly/direct-crash
Browse files Browse the repository at this point in the history
make Extra Utilities 2 Machine Block drops mutable
  • Loading branch information
ACGaming authored Apr 11, 2024
2 parents 282faf5 + 5d7af9a commit 443e38a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ All changes are toggleable via config files.
* **Disable Digger AI Debug:** Disables leftover debug logging inside the digger AI of the beta builds
* **Extra Utilities 2**
* **Duplication Fixes:** Fixes various duplication exploits
* **Mutable Machine Block Drops:** Fixes Machine Block drops being immutable, causing a crash on attempting to remove entries from the list.
* **Forestry**
* **Arborist Villager Trades:** Adds custom emerald to germling trades to the arborist villager
* **Disable Bee Damage Armor Bypass:** Disables damage caused by bees bypassing player armor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@ public static class ExtraUtilitiesCategory
@Config.Name("Duplication Fixes")
@Config.Comment("Fixes various duplication exploits")
public boolean utDuplicationFixesToggle = true;

@Config.RequiresMcRestart
@Config.Name("Mutable Machine Block Drops")
@Config.Comment("Fixes Machine Block drops being immutable, causing a crash on attempting to remove entries from the list")
public boolean utMutableBlockDrops = true;
}

public static class ForestryCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.mods.elenaidodge2.json");
configs.add("mixins.mods.epicsiegemod.json");
configs.add("mixins.mods.erebus.json");
configs.add("mixins.mods.extrautilities.mutabledrops.json");
configs.add("mixins.mods.extrautilities.dupes.json");
configs.add("mixins.mods.forestry.cocoa.json");
configs.add("mixins.mods.forestry.dupes.json");
Expand Down Expand Up @@ -153,6 +154,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return Loader.isModLoaded("epicsiegemod");
case "mixins.mods.erebus.json":
return Loader.isModLoaded("erebus");
case "mixins.mods.extrautilities.mutabledrops.json":
return Loader.isModLoaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utMutableBlockDrops;
case "mixins.mods.extrautilities.dupes.json":
return Loader.isModLoaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utDuplicationFixesToggle;
case "mixins.mods.forestry.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mod.acgaming.universaltweaks.mods.extrautilities.mutabledrops.mixin;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.rwtema.extrautils2.machine.BlockMachine;
import mod.acgaming.universaltweaks.config.UTConfigMods;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import java.util.ArrayList;
import java.util.List;

// Courtesy of WaitingIdly
@Mixin(value = BlockMachine.class, remap = false)
public abstract class UTMutableBlockMachineDrops
{
@ModifyReturnValue(method = "getDrops", at = @At(value = "RETURN"))
private List<ItemStack> utEnforceMutableDrops(List<ItemStack> original)
{
if (!UTConfigMods.EXTRA_UTILITIES.utMutableBlockDrops) return original;
return new ArrayList<>(original);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.mods.extrautilities.mutabledrops.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTMutableBlockMachineDrops"]
}

0 comments on commit 443e38a

Please sign in to comment.