fix: Location (setWorld)
This commit is contained in:
@@ -38,6 +38,7 @@ public class InMemoryPlayerManager implements PlayerManager, Runnable {
|
||||
player.setName(name);
|
||||
player.getLocation().setXYZ(defaultLocation);
|
||||
player.getLocation().setYawPitch(defaultLocation);
|
||||
player.getLocation().setWorld(defaultLocation.getWorld());
|
||||
player.setSettings(new PlayerSettings());
|
||||
|
||||
synchronized (lock) {
|
||||
|
||||
@@ -7,6 +7,7 @@ package mc.world.flat;
|
||||
import com.flowpowered.nbt.Tag;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.world.IWorldType;
|
||||
import mc.core.world.Region;
|
||||
@@ -17,6 +18,7 @@ import mc.core.world.chunk.ChunkSection;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Slf4j
|
||||
public class FlatWorld implements World {
|
||||
|
||||
@Getter
|
||||
@@ -26,9 +28,7 @@ public class FlatWorld implements World {
|
||||
@Setter
|
||||
private String name;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private EntityLocation spawn = new EntityLocation(0d, 6d, 0d, 0f, 0f, this);
|
||||
private EntityLocation spawn;
|
||||
private ChunkSection chunkSection = new SimpleChunkSection();
|
||||
|
||||
@Override
|
||||
@@ -36,6 +36,22 @@ public class FlatWorld implements World {
|
||||
return WorldType.GENERAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLocation getSpawn() {
|
||||
if (this.spawn == null) {
|
||||
log.warn("Spawn is not defined! Set spawn [0, 6, 0]");
|
||||
this.spawn = new EntityLocation(0d, 6d, 0d, 0f, 0f, this);
|
||||
}
|
||||
|
||||
return this.spawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpawn(EntityLocation location) {
|
||||
this.spawn = location;
|
||||
this.spawn.setWorld(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkSection getChunk(int x, int y, int z) {
|
||||
return chunkSection;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class PlayHandler extends AbstractStateHandler implements PlayStateHandle
|
||||
packet.getX(), packet.getY(), packet.getZ(),
|
||||
player.getLocation().getYaw(),
|
||||
player.getLocation().getPitch(),
|
||||
null
|
||||
player.getLocation().getWorld()
|
||||
));
|
||||
EventBusGetter.INSTANCE.post(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user