use of org.spongepowered.common.bridge.server.TickTaskBridge in project SpongeCommon by SpongePowered.
the class ScheduledTaskPhaseState method foldContextForThread.
@Override
public void foldContextForThread(final BasicPluginContext context, final TickTaskBridge returnValue) {
@Nullable final Object source = context.getSource();
final PluginContainer plugin = Objects.requireNonNull(context.container, "Scheduled Task has a null plugin!");
returnValue.bridge$contextShift(((context1, stackFrame) -> {
if (source != null) {
stackFrame.pushCause(source);
}
stackFrame.pushCause(plugin);
}));
}
use of org.spongepowered.common.bridge.server.TickTaskBridge in project SpongeCommon by SpongePowered.
the class MinecraftServerMixin_Tracker method tracker$associatePhaseContextWithWrappedTask.
@Inject(method = "wrapRunnable(Ljava/lang/Runnable;)Lnet/minecraft/server/TickTask;", at = @At("RETURN"))
private void tracker$associatePhaseContextWithWrappedTask(final Runnable runnable, final CallbackInfoReturnable<TickTask> cir) {
final TickTask returnValue = cir.getReturnValue();
if (!PhaseTracker.SERVER.onSidedThread()) {
final PhaseContext<@NonNull ?> phaseContext = PhaseTracker.getInstance().getPhaseContext();
if (phaseContext.isEmpty()) {
return;
}
phaseContext.foldContextForThread(((TickTaskBridge) returnValue));
}
}
Aggregations