Skip to content

Commit

Permalink
uses @pseudo to dealt with LithiumServerTickScheduler, maybe safer bu…
Browse files Browse the repository at this point in the history
…t idk
  • Loading branch information
Fallen-Breath committed Dec 4, 2020
1 parent c96bda9 commit 32ff9c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class CarpetTISAdditionMixinPlugin implements IMixinConfigPlugin
{
private final Logger LOGGER = LogManager.getLogger();
private static final String LITHIUM_MOD_ID = "lithium";
public static final String SERVER_TICK_SCHEDULER_MIXIN_DEFAULT = ".ServerTickSchedulerMixin";
public static final String SERVER_TICK_SCHEDULER_MIXIN_LITHIUM = ".LithiumServerTickSchedulerMixin";

@Override
Expand All @@ -35,10 +34,6 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName)
// it's quite a naive implementation now, but since there are not that many demands it's fine i think
// might refactor it if more judgement are needed to be done
boolean isLithiumLoaded = FabricLoader.getInstance().isModLoaded(LITHIUM_MOD_ID);
if (mixinClassName.endsWith(SERVER_TICK_SCHEDULER_MIXIN_DEFAULT))
{
return !isLithiumLoaded;
}
if (mixinClassName.endsWith(SERVER_TICK_SCHEDULER_MIXIN_LITHIUM))
{
return isLithiumLoaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.world.TickPriority;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -22,6 +23,7 @@
import java.util.function.Function;
import java.util.function.Predicate;

@Pseudo
@Mixin(LithiumServerTickScheduler.class)
public abstract class LithiumServerTickSchedulerMixin<T> extends ServerTickScheduler<T>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import carpettisaddition.CarpetTISAdditionSettings;
import me.jellysquid.mods.lithium.common.world.scheduler.LithiumServerTickScheduler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Pseudo
@Mixin(value = LithiumServerTickScheduler.class, priority = 998)
public abstract class LithiumServerTickSchedulerMixin<T>
{
Expand Down

0 comments on commit 32ff9c7

Please sign in to comment.