Search in sources :

Example 1 with IMixinNextTickListEntry

use of org.spongepowered.common.interfaces.IMixinNextTickListEntry in project SpongeCommon by SpongePowered.

the class MixinWorldServer method onCreateScheduledBlockUpdate.

/*@Redirect(method = "updateBlockTick",
            at = @At(value = "INVOKE", target = "Lnet/minecraft/world/NextTickListEntry;setPriority(I)V"))
    private void onUpdateScheduledBlock(NextTickListEntry sbu, int priority) {
        this.onCreateScheduledBlockUpdate(sbu, priority);
    }*/
@// really scheduleUpdate
Redirect(// really scheduleUpdate
method = "updateBlockTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/NextTickListEntry;setPriority(I)V"))
private void onCreateScheduledBlockUpdate(NextTickListEntry sbu, int priority) {
    final PhaseTracker phaseTracker = PhaseTracker.getInstance();
    final IPhaseState phaseState = phaseTracker.getCurrentState();
    if (phaseState.ignoresScheduledUpdates()) {
        this.tmpScheduledObj = sbu;
        return;
    }
    sbu.setPriority(priority);
    ((IMixinNextTickListEntry) sbu).setWorld((WorldServer) (Object) this);
    this.tmpScheduledObj = sbu;
}
Also used : PhaseTracker(org.spongepowered.common.event.tracking.PhaseTracker) IMixinNextTickListEntry(org.spongepowered.common.interfaces.IMixinNextTickListEntry) IPhaseState(org.spongepowered.common.event.tracking.IPhaseState) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

Redirect (org.spongepowered.asm.mixin.injection.Redirect)1 IPhaseState (org.spongepowered.common.event.tracking.IPhaseState)1 PhaseTracker (org.spongepowered.common.event.tracking.PhaseTracker)1 IMixinNextTickListEntry (org.spongepowered.common.interfaces.IMixinNextTickListEntry)1