Search in sources :

Example 1 with EntityNavigationExtended

use of me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended in project roadrunner by MaxNeedsSnacks.

the class ServerWorldMixin method stopListeningOnEntityUnload.

@Redirect(// forge replaces this with their own method
method = "removeEntityComplete", remap = false, at = @At(value = "INVOKE", target = "Ljava/util/Set;remove(Ljava/lang/Object;)Z"))
private boolean stopListeningOnEntityUnload(Set<EntityNavigation> set, Object navigation) {
    EntityNavigation entityNavigation = (EntityNavigation) navigation;
    ((EntityNavigationExtended) entityNavigation).setRegisteredToWorld(false);
    this.activeEntityNavigations.remove(entityNavigation);
    return set.remove(entityNavigation);
}
Also used : EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation) EntityNavigationExtended(me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 2 with EntityNavigationExtended

use of me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended in project roadrunner by MaxNeedsSnacks.

the class ServerWorldMixin method startListeningOnEntityLoad.

@Redirect(method = "loadEntityUnchecked", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/MobEntity;getNavigation()Lnet/minecraft/entity/ai/pathing/EntityNavigation;"))
private EntityNavigation startListeningOnEntityLoad(MobEntity mobEntity) {
    EntityNavigation navigation = mobEntity.getNavigation();
    ((EntityNavigationExtended) navigation).setRegisteredToWorld(true);
    if (navigation.getCurrentPath() != null) {
        this.activeEntityNavigations.add(navigation);
    }
    return navigation;
}
Also used : EntityNavigation(net.minecraft.entity.ai.pathing.EntityNavigation) EntityNavigationExtended(me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

EntityNavigationExtended (me.jellysquid.mods.lithium.common.entity.EntityNavigationExtended)2 EntityNavigation (net.minecraft.entity.ai.pathing.EntityNavigation)2 Redirect (org.spongepowered.asm.mixin.injection.Redirect)2