Search in sources :

Example 6 with TimingBridge

use of org.spongepowered.common.bridge.TimingBridge in project SpongeCommon by SpongePowered.

the class ServerLevelMixin_Tracker method tracker$wrapNormalEntityTick.

@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;guardEntityTick(Ljava/util/function/Consumer;Lnet/minecraft/world/entity/Entity;)V"), slice = @Slice(from = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiling/ProfilerFiller;push(Ljava/lang/String;)V", args = "ldc=tick"), to = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiling/ProfilerFiller;push(Ljava/lang/String;)V", args = "ldc=remove")))
private void tracker$wrapNormalEntityTick(final ServerLevel level, final Consumer<Entity> entityUpdateConsumer, final Entity entity) {
    final Timing entityTickTiming = ((TimingBridge) entity.getType()).bridge$timings();
    entityTickTiming.startTiming();
    final PhaseContext<@NonNull ?> currentState = PhaseTracker.SERVER.getPhaseContext();
    TrackingUtil.tickEntity(entityUpdateConsumer, entity);
    entityTickTiming.stopTiming();
}
Also used : Timing(co.aikar.timings.Timing) TimingBridge(org.spongepowered.common.bridge.TimingBridge) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

Timing (co.aikar.timings.Timing)6 TimingBridge (org.spongepowered.common.bridge.TimingBridge)6 ServerLevel (net.minecraft.server.level.ServerLevel)2 TickableBlockEntity (net.minecraft.world.level.block.entity.TickableBlockEntity)2 BlockSnapshot (org.spongepowered.api.block.BlockSnapshot)2 BlockState (org.spongepowered.api.block.BlockState)2 BlockEntity (org.spongepowered.api.block.entity.BlockEntity)2 Entity (org.spongepowered.api.entity.Entity)2 TickBlockEvent (org.spongepowered.api.event.block.TickBlockEvent)2 LocatableBlock (org.spongepowered.api.world.LocatableBlock)2 Redirect (org.spongepowered.asm.mixin.injection.Redirect)2 SpongeBlockSnapshot (org.spongepowered.common.block.SpongeBlockSnapshot)2 CreatorTrackedBridge (org.spongepowered.common.bridge.CreatorTrackedBridge)2 EntityTickContext (org.spongepowered.common.event.tracking.phase.tick.EntityTickContext)2 TileEntityTickContext (org.spongepowered.common.event.tracking.phase.tick.TileEntityTickContext)2 SpongeLocatableBlockBuilder (org.spongepowered.common.world.server.SpongeLocatableBlockBuilder)2 BlockTickContext (org.spongepowered.common.event.tracking.phase.tick.BlockTickContext)1 FluidTickContext (org.spongepowered.common.event.tracking.phase.tick.FluidTickContext)1