use of me.jellysquid.mods.lithium.common.entity.NavigatingEntity in project lithium-fabric by CaffeineMC.
the class ServerEntityHandlerMixin method startListeningOnEntityLoad.
@Redirect(method = "startTracking(Lnet/minecraft/entity/Entity;)V", at = @At(value = "INVOKE", target = "Ljava/util/Set;add(Ljava/lang/Object;)Z"))
private boolean startListeningOnEntityLoad(Set<MobEntity> set, Object mobEntityObj) {
MobEntity mobEntity = (MobEntity) mobEntityObj;
EntityNavigation navigation = mobEntity.getNavigation();
((NavigatingEntity) mobEntity).setRegisteredToWorld(navigation);
if (navigation.getCurrentPath() != null) {
((ServerWorldExtended) this.outer).setNavigationActive(mobEntity);
}
return set.add(mobEntity);
}
use of me.jellysquid.mods.lithium.common.entity.NavigatingEntity in project lithium-fabric by CaffeineMC.
the class ServerEntityHandlerMixin method stopListeningOnEntityUnload.
@Redirect(method = "stopTracking(Lnet/minecraft/entity/Entity;)V", at = @At(value = "INVOKE", target = "Ljava/util/Set;remove(Ljava/lang/Object;)Z"))
private boolean stopListeningOnEntityUnload(Set<MobEntity> set, Object mobEntityObj) {
MobEntity mobEntity = (MobEntity) mobEntityObj;
NavigatingEntity navigatingEntity = (NavigatingEntity) mobEntity;
if (navigatingEntity.isRegisteredToWorld()) {
EntityNavigation registeredNavigation = navigatingEntity.getRegisteredNavigation();
if (registeredNavigation.getCurrentPath() != null) {
((ServerWorldExtended) this.outer).setNavigationInactive(mobEntity);
}
navigatingEntity.setRegisteredToWorld(null);
}
return set.remove(mobEntity);
}
Aggregations