-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a5f528
commit 5a6fbb2
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/dev/ithundxr/railwaystweaks/mixin/compat/tconstruct/LazyModifierMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package dev.ithundxr.railwaystweaks.mixin.compat.tconstruct; | ||
|
||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import slimeknights.tconstruct.library.modifiers.Modifier; | ||
import slimeknights.tconstruct.library.modifiers.ModifierId; | ||
import slimeknights.tconstruct.library.modifiers.ModifierManager; | ||
import slimeknights.tconstruct.library.modifiers.util.LazyModifier; | ||
|
||
@Mixin(LazyModifier.class) | ||
public class LazyModifierMixin { | ||
|
||
@Shadow @Final protected ModifierId id; | ||
|
||
@Inject( | ||
method = "get()Lslimeknights/tconstruct/library/modifiers/Modifier;", | ||
at = @At("HEAD"), | ||
cancellable = true, | ||
remap = false | ||
) | ||
private void railwayTweaks$suppressException(CallbackInfoReturnable<Modifier> cir) { | ||
if (!ModifierManager.INSTANCE.isDynamicModifiersLoaded()) | ||
cir.setReturnValue(ModifierManager.INSTANCE.getDefaultValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters