use of me.jellysquid.mods.lithium.common.world.ServerWorldExtended in project lithium-fabric by CaffeineMC.
the class MobEntityMixin method updateNavigationRegistration.
@Override
public void updateNavigationRegistration() {
if (this.isRegisteredToWorld()) {
EntityNavigation navigation = this.getNavigation();
if (this.registeredNavigation != navigation) {
((ServerWorldExtended) this.world).setNavigationInactive((MobEntity) (Object) this);
this.registeredNavigation = navigation;
if (navigation.getCurrentPath() != null) {
((ServerWorldExtended) this.world).setNavigationActive((MobEntity) (Object) this);
}
}
}
}
use of me.jellysquid.mods.lithium.common.world.ServerWorldExtended 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.world.ServerWorldExtended 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