Skip to content

Commit

Permalink
fix: morpheus not properly waking players, not awarding buffs for sle…
Browse files Browse the repository at this point in the history
…eping (#412)

* fix: morpheus not properly waking players

* refactor: move from accessor to access transformer

* address reviews

---------

Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
leumasme and Dream-Master authored Sep 1, 2024
1 parent 3e494dc commit bbec8c1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
transformedModCompileOnly("curse.maven:extra-utilities-225561:2264384")
transformedModCompileOnly(rfg.deobf("curse.maven:extratic-72728:2299292"))
transformedModCompileOnly(rfg.deobf("curse.maven:journeymap-32274:4500658"))
transformedModCompileOnly(rfg.deobf("curse.maven:morpheus-69118:2280761"))
transformedModCompileOnly(deobf('https://dist.creeper.host/ichun/filespg/PortalGun-4.0.0-beta-6.jar'))
transformedModCompileOnly("curse.maven:travellers-gear-224440:2262113")
transformedModCompileOnly(rfg.deobf("curse.maven:witchery-69673:2234410"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,13 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean java12MineChemCompat;

// Morpheus

@Config.Comment("Fix not properly waking players if not everyone is sleeping")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixMorpheusWaking;

// Optifine

@Config.Comment("Forces the chunk loading option from optifine to default since other values can crash the game")
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,12 @@ public enum Mixins {
// Candycraft
FIX_SUGARBLOCK_NPE(new Builder("Fix NPE when interacting with sugar block")
.addMixinClasses("candycraft.MixinBlockSugar").setPhase(Phase.LATE).setSide(Side.BOTH)
.setApplyIf(() -> FixesConfig.fixCandycraftBlockSugarNPE).addTargetedMod(TargetedMod.CANDYCRAFT));
.setApplyIf(() -> FixesConfig.fixCandycraftBlockSugarNPE).addTargetedMod(TargetedMod.CANDYCRAFT)),

// Morpheus
FIX_NOT_WAKING_PLAYERS(new Builder("Fix players not being woken properly when not everyone is sleeping")
.addMixinClasses("morpheus.MixinMorpheusWakePlayers").setPhase(Phase.LATE).setSide(Side.SERVER)
.setApplyIf(() -> FixesConfig.fixMorpheusWaking).addTargetedMod(TargetedMod.MORPHEUS));

private final List<String> mixinClasses;
private final List<TargetedMod> targetedMods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public enum TargetedMod {
LWJGL3IFY("lwjgl3ify", "me.eigenraven.lwjgl3ify.core.Lwjgl3ifyCoremod", "lwjgl3ify"),
MINECHEM("Minechem", null, "minechem"),
MINEFACTORY_RELOADED("MineFactory Reloaded", null, "MineFactoryReloaded"),
MORPHEUS("Morpheus", null, "Morpheus"),
MRTJPCORE("MrTJPCore", null, "MrTJPCoreMod"),
NOTENOUGHITEMS("NotEnoughItems", "codechicken.nei.asm.NEICorePlugin", "NotEnoughItems"),
OPTIFINE("Optifine", "optifine.OptiFineForgeTweaker", "Optifine"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.mitchej123.hodgepodge.mixins.late.morpheus;

import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.quetzi.morpheus.SleepChecker;

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.CallbackInfo;

@Mixin(value = SleepChecker.class, remap = false)
public class MixinMorpheusWakePlayers {

@Inject(
method = "advanceToMorning",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/WorldProvider;resetRainAndThunder()V",
shift = At.Shift.BEFORE,
remap = true))
private void hodgepodge$fixWakePlayers(World world, CallbackInfo c) {
if (!(world instanceof WorldServer worldServer)) return;
worldServer.wakeAllPlayers();
}
}
1 change: 1 addition & 0 deletions src/main/resources/META-INF/hodgepodge_at.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ public net.minecraft.client.resources.AbstractResourcePack field_110597_b # reso
public net.minecraft.client.resources.FallbackResourceManager field_110540_a # resourcePacks
public net.minecraft.client.resources.FileResourcePack field_110600_d # resourcePackZipFile
public net.minecraft.client.resources.SimpleReloadableResourceManager field_110548_a # domainResourceManagers
public net.minecraft.world.WorldServer func_73053_d()V # wakeAllPlayers()

0 comments on commit bbec8c1

Please sign in to comment.