Skip to content

Commit

Permalink
Merge pull request #620 from jchung01/mod-tweaks
Browse files Browse the repository at this point in the history
Fix crash with Woot tweak
  • Loading branch information
ACGaming authored Jan 29, 2025
2 parents 021b2bf + a8c71ba commit 8301956
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import mod.acgaming.universaltweaks.mods.tconstruct.UTTConstructEvents;
import mod.acgaming.universaltweaks.mods.tconstruct.UTTConstructMaterials;
import mod.acgaming.universaltweaks.mods.tconstruct.oredictcache.UTOreDictCache;
import mod.acgaming.universaltweaks.mods.woot.UTWootTicketManager;
import mod.acgaming.universaltweaks.tweaks.blocks.betterplacement.UTBetterPlacement;
import mod.acgaming.universaltweaks.tweaks.blocks.breakablebedrock.UTBreakableBedrock;
import mod.acgaming.universaltweaks.tweaks.blocks.dispenser.UTBlockDispenser;
Expand Down Expand Up @@ -171,6 +172,7 @@ public void init(FMLInitializationEvent event)
// Unregister reason: event handler adds to an unused map that is never cleared.
if (Loader.isModLoaded("tardis") && UTConfigMods.TARDIS.utMemoryLeakFixToggle) MinecraftForge.EVENT_BUS.unregister(ClientProxy.class);
if (Loader.isModLoaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utDuplicationFixesToggle) MinecraftForge.EVENT_BUS.register(new UTTConstructEvents());
if (Loader.isModLoaded("woot") && UTConfigMods.WOOT.utCleanupSimulatedKillsToggle) UTWootTicketManager.init();
LOGGER.info(NAME + " initialized");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public static void releaseChunk(int boxId)
}
}

public static void callback(List<ForgeChunkManager.Ticket> tickets, World world)
public static void init()
{
ForgeChunkManager.setForcedChunkLoadingCallback(Woot.instance, UTWootTicketManager::callback);
}

private static void callback(List<ForgeChunkManager.Ticket> tickets, World world)
{
int dim = world.provider.getDimension();
if (dim != Woot.wootDimensionManager.getDimensionId()) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ public class UTTartarusSchoolMixin
@Shadow
private int spawnId;

/**
* @reason Load Woot dim earlier so {@link UTWootTicketManager}'s callback doesn't fire late and clear the allocated spawn box.
*/
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lipsis/woot/loot/schools/TartarusManager;allocateSpawnBoxId()I"))
private void ut$loadWorldBeforeAllocate(ITickTracker tickTracker, World world, BlockPos origin, IFarmSetup farmSetup, CallbackInfo ci)
{
Woot.wootDimensionManager.getWorldServer(world);
}

@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lipsis/woot/loot/schools/TartarusManager;spawnInBox(Lnet/minecraft/world/World;ILipsis/woot/util/WootMobName;Lipsis/woot/util/EnumEnchantKey;)V", shift = At.Shift.AFTER))
private void ut$cleanupOnDeath(ITickTracker tickTracker, World world, BlockPos origin, IFarmSetup farmSetup, CallbackInfo ci)
{
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/mixins.mods.woot.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTEntitySpawnerMixin", "UTTartarusManagerMixin", "UTTartarusSchoolMixin", "UTWootMixin"]
"mixins": ["UTEntitySpawnerMixin", "UTTartarusManagerMixin", "UTTartarusSchoolMixin"]
}

0 comments on commit 8301956

Please sign in to comment.