mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Fix second setInstance method
This commit is contained in:
parent
693a5f3d72
commit
b35ab0b667
@ -845,7 +845,8 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
||||
*
|
||||
* @param instance the new instance of the entity
|
||||
* @param spawnPosition the spawn position for the entity.
|
||||
* @return
|
||||
* @return a {@link CompletableFuture} called once the entity's instance has been set,
|
||||
* this is due to chunks needing to load for players
|
||||
* @throws IllegalStateException if {@code instance} has not been registered in {@link InstanceManager}
|
||||
*/
|
||||
public CompletableFuture<Void> setInstance(@NotNull Instance instance, @NotNull Pos spawnPosition) {
|
||||
@ -872,11 +873,13 @@ public class Entity implements Viewable, Tickable, EventHandler<EntityEvent>, Da
|
||||
* Changes the entity instance.
|
||||
*
|
||||
* @param instance the new instance of the entity
|
||||
* @return a {@link CompletableFuture} called once the entity's instance has been set,
|
||||
* this is due to chunks needing to load for players
|
||||
* @throws NullPointerException if {@code instance} is null
|
||||
* @throws IllegalStateException if {@code instance} has not been registered in {@link InstanceManager}
|
||||
*/
|
||||
public void setInstance(@NotNull Instance instance) {
|
||||
setInstance(instance, this.position);
|
||||
public CompletableFuture<Void> setInstance(@NotNull Instance instance) {
|
||||
return setInstance(instance, this.position);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -560,11 +560,13 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
* if the player is not in any instance).
|
||||
*
|
||||
* @param instance the new player instance
|
||||
* @return a {@link CompletableFuture} called once the entity's instance has been set,
|
||||
* this is due to chunks needing to load for players
|
||||
* @see #setInstance(Instance, Pos)
|
||||
*/
|
||||
@Override
|
||||
public void setInstance(@NotNull Instance instance) {
|
||||
setInstance(instance, this.instance != null ? getPosition() : getRespawnPoint());
|
||||
public CompletableFuture<Void> setInstance(@NotNull Instance instance) {
|
||||
return setInstance(instance, this.instance != null ? getPosition() : getRespawnPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,6 +3,7 @@ package net.minestom.server.entity.fakeplayer;
|
||||
import com.extollit.gaming.ai.path.HydrazinePathFinder;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.attribute.Attribute;
|
||||
import net.minestom.server.coordinate.Pos;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.entity.pathfinding.NavigableEntity;
|
||||
import net.minestom.server.entity.pathfinding.Navigator;
|
||||
@ -16,6 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@ -118,10 +120,10 @@ public class FakePlayer extends Player implements NavigableEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInstance(@NotNull Instance instance) {
|
||||
public CompletableFuture<Void> setInstance(@NotNull Instance instance, @NotNull Pos spawnPosition) {
|
||||
this.navigator.setPathFinder(new HydrazinePathFinder(navigator.getPathingEntity(), instance.getInstanceSpace()));
|
||||
|
||||
super.setInstance(instance);
|
||||
return super.setInstance(instance, spawnPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user