Search in sources :

Example 1 with SpawnDragonContext

use of org.spongepowered.common.event.tracking.phase.world.dragon.SpawnDragonContext in project SpongeCommon by SpongePowered.

the class EndDragonFightMixin_Tracker method tracker$switchToSpawnDragonState.

@Redirect(method = "tick()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/dimension/end/DragonRespawnAnimation;tick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/dimension/end/EndDragonFight;Ljava/util/List;ILnet/minecraft/core/BlockPos;)V"))
private void tracker$switchToSpawnDragonState(final DragonRespawnAnimation dragonSpawnState, final ServerLevel worldIn, final EndDragonFight manager, final List<EndCrystal> crystals, int respawnStateTicks, final BlockPos exitPortalLocation) {
    try (final SpawnDragonContext context = DragonPhase.State.SPAWN_DRAGON.createPhaseContext(PhaseTracker.SERVER)) {
        context.manager(manager).setIsRespawn(true).buildAndSwitch();
        ++respawnStateTicks;
        dragonSpawnState.tick(worldIn, manager, crystals, respawnStateTicks, exitPortalLocation);
    }
}
Also used : SpawnDragonContext(org.spongepowered.common.event.tracking.phase.world.dragon.SpawnDragonContext) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

Redirect (org.spongepowered.asm.mixin.injection.Redirect)1 SpawnDragonContext (org.spongepowered.common.event.tracking.phase.world.dragon.SpawnDragonContext)1