Skip to content

Commit

Permalink
Merge pull request #609 from Rongmario/main
Browse files Browse the repository at this point in the history
Fix for Better with Mods' crash as it assumes all beacons are BWM beacons when reading NBT from disk
  • Loading branch information
ACGaming authored Dec 23, 2024
2 parents cf0c1e0 + 831f97d commit bb7f93f
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ All changes are toggleable via config files.
* **Botania**
* **Duplication Fixes:** Fixes various duplication exploits
* **Fancy Skybox:** Enables the Botania Garden of Glass skybox for custom dimensions
* **Better with Mods**
* **Beacon NBT Loading Fix:** Fixes BWM beacons reading null tags from vanilla beacons
* **CB Multipart**
* **Memory Leak Fix:** Fixes a memory leak associated with EntityPlayer
* **Chisel**
Expand Down
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ final def mod_dependencies = [
'curse.maven:biomes-o-plenty-220318:2842510' : [debug_biomes_o_plenty],
'curse.maven:blood-magic-224791:2822288' : [debug_blood_magic],
'curse.maven:botania-225643:3330934' : [debug_botania],
'curse.maven:bwm-suite-246760:5702821' : [debug_bwm],
'curse.maven:ceramics-250617:3158763' : [debug_ceramics],
'curse.maven:chameleon-230497:2450900' : [debug_storage_drawers],
'curse.maven:chickens-241941:2537643' : [debug_chickens],
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ debug_binnies_mods = false
debug_biomes_o_plenty = false
debug_blood_magic = false
debug_botania = false
debug_bwm = false
debug_ceramics = false
debug_chickens = false
debug_chisel = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public class UTConfigMods
@Config.Name("Botania")
public static final BotaniaCategory BOTANIA = new BotaniaCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.bwm")
@Config.Name("Better with Mods")
public static final BWMCategory BWM = new BWMCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.cbmultipart")
@Config.Name("CB Multipart/Forge Multipart CBE")
public static final CBMultipartCategory CB_MULTIPART = new CBMultipartCategory();
Expand Down Expand Up @@ -403,6 +407,13 @@ public static class BotaniaCategory
public boolean utDuplicationFixesToggle = true;
}

public static class BWMCategory
{
@Config.Name("Beacon NBT Loading Fix")
@Config.Comment("Fixes BWM beacons reading null tags from vanilla beacons")
public boolean utBeaconNBTLoadingFix = true;
}

public static class CBMultipartCategory
{
@Config.RequiresMcRestart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class UTMixinLoader implements ILateMixinLoader
put("mixins.mods.bloodmagic.json", () -> loaded("bloodmagic"));
put("mixins.mods.botania.dupes.json", () -> loaded("botania") && UTConfigMods.BOTANIA.utDuplicationFixesToggle);
put("mixins.mods.botania.json", () -> loaded("botania"));
put("mixins.mods.bwm.json", () -> loaded("betterwithmods") && UTConfigMods.BWM.utBeaconNBTLoadingFix);
put("mixins.mods.cbmultipart.json", () -> loaded("forgemultipartcbe") && UTConfigMods.CB_MULTIPART.utMemoryLeakFixToggle);
put("mixins.mods.ceramics.json", () -> loaded("ceramics"));
put("mixins.mods.chisel.tcomplement.dupes.json", () -> loaded("chisel") && loaded("tcomplement") && UTConfigMods.CHISEL.utDuplicationFixesToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package mod.acgaming.universaltweaks.mods.bwm.mixin;

import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

import betterwithmods.common.blocks.tile.TileEntityBeacon;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

// Courtesy of Rongmario
@Mixin(TileEntityBeacon.class)
public class UTTileEntityBeaconMixin extends TileEntity
{
@WrapOperation(method = "readFromNBT", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NBTUtil;readBlockState(Lnet/minecraft/nbt/NBTTagCompound;)Lnet/minecraft/block/state/IBlockState;"))
private IBlockState readBlockState(NBTTagCompound tag, Operation<IBlockState> original)
{
if (tag == null)
{
return Blocks.AIR.getDefaultState(); // Conforms to normal behavior (BWM doesn't even do anything with the type field!)
}
return original.call(tag);
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.mods.bwm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.mods.bwm.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTTileEntityBeaconMixin"]
}

0 comments on commit bb7f93f

Please sign in to comment.