Skip to content

Commit

Permalink
Suppress Tinkers Modifier exception
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-evelyn committed Nov 27, 2024
1 parent 0a5f528 commit 5a6fbb2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx2G

# Mod Properties
mod_version = 0.0.46
mod_version = 0.0.47
maven_group = dev.ithundxr
archives_base_name = RailwaysTweaks

Expand Down
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());
}
}
1 change: 1 addition & 0 deletions src/main/resources/railwaystweaks.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"compat.create.SchematicannonBlockEntityMixin",
"compat.dcintegration.DiscordEventListenerMixin",
"compat.enchancement.SlideComponentMixin",
"compat.tconstruct.LazyModifierMixin",
"compat.tconstruct.SimpleChannelAccessor"
],
"client": [
Expand Down

0 comments on commit 5a6fbb2

Please sign in to comment.