apply upgraded Location & EntityLocation
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
package mc.core;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import mc.core.player.Look;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class WarpPosition implements Serializable {
|
||||
private Location location;
|
||||
private Look look;
|
||||
}
|
||||
@@ -4,11 +4,10 @@
|
||||
*/
|
||||
package mc.core.embedded;
|
||||
|
||||
import mc.core.Location;
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.chat.MessageType;
|
||||
import mc.core.network.NetChannel;
|
||||
import mc.core.network.SCPacket;
|
||||
import mc.core.player.Look;
|
||||
import mc.core.player.Player;
|
||||
import mc.core.player.PlayerManager;
|
||||
import mc.core.text.Text;
|
||||
@@ -52,7 +51,7 @@ public class FakePlayerManager implements PlayerManager {
|
||||
private static final NetChannel FAKE_NET_CHANNEL = new FakeNetChannet();
|
||||
|
||||
@Override
|
||||
public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
|
||||
public Player createPlayer(String name, EntityLocation defaultLocation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ package mc.core.events;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import mc.core.player.Look;
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.player.Player;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -15,5 +15,5 @@ import mc.core.player.Player;
|
||||
@Setter
|
||||
public class PlayerLookEvent extends EventBase {
|
||||
private final Player player;
|
||||
private Look newLook;
|
||||
private EntityLocation newLook;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package mc.core.player;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import mc.core.Config;
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.BroadcastNetChannel;
|
||||
import mc.core.network.NetChannel;
|
||||
@@ -31,13 +32,13 @@ public class InMemoryPlayerManager implements PlayerManager, Runnable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Player createPlayer(String name, Location defaultLocation, Look defaultLook) {
|
||||
public Player createPlayer(String name, EntityLocation defaultLocation) {
|
||||
SimplePlayer player = new SimplePlayer();
|
||||
player.setId(rand.nextInt(10000));
|
||||
player.setUUID(UUID.nameUUIDFromBytes(name.getBytes()));
|
||||
player.setName(name);
|
||||
player.getLocation().set(defaultLocation);
|
||||
player.getLook().set(defaultLook);
|
||||
player.getLocation().setXYZ(defaultLocation);
|
||||
player.getLocation().setYawPitch(defaultLocation);
|
||||
player.setSettings(new PlayerSettings());
|
||||
|
||||
synchronized (lock) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
package mc.core.player;
|
||||
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.NetChannel;
|
||||
|
||||
@@ -18,9 +19,7 @@ public interface Player {
|
||||
NetChannel getChannel();
|
||||
void setChannel(NetChannel channel);
|
||||
|
||||
Location getLocation();
|
||||
|
||||
Look getLook();
|
||||
EntityLocation getLocation();
|
||||
|
||||
boolean isFlying();
|
||||
void setFlying(boolean value);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
package mc.core.player;
|
||||
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.NetChannel;
|
||||
|
||||
@@ -11,7 +12,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface PlayerManager {
|
||||
Player createPlayer(String name, Location defaultLocation, Look defaultLook);
|
||||
Player createPlayer(String name, EntityLocation defaultLocation);
|
||||
void joinServer(Player player);
|
||||
void leftServer(Player player);
|
||||
Optional<Player> getPlayer(String name);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package mc.core.player;
|
||||
|
||||
import lombok.Data;
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.Location;
|
||||
import mc.core.network.NetChannel;
|
||||
|
||||
@@ -17,17 +18,13 @@ public class SimplePlayer implements Player {
|
||||
private String name;
|
||||
private boolean online = false;
|
||||
private NetChannel channel;
|
||||
private Location location = new Location(0, 0, 0);
|
||||
private Look look = new Look(0, 0);
|
||||
private EntityLocation location = new EntityLocation(0d, 0d, 0d, 0f, 0f, null);
|
||||
private boolean flying = false;
|
||||
private PlayerSettings settings;
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location.set(location);
|
||||
}
|
||||
|
||||
public void setLook(Look look) {
|
||||
this.look.set(look);
|
||||
public void setLocation(EntityLocation location) {
|
||||
this.location.setXYZ(location);
|
||||
this.location.setYawPitch(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
package mc.core.world;
|
||||
|
||||
import mc.core.WarpPosition;
|
||||
import mc.core.EntityLocation;
|
||||
import mc.core.nbt.Taggable;
|
||||
import mc.core.world.chunk.Chunk;
|
||||
|
||||
@@ -46,8 +46,8 @@ public interface World extends Taggable, Serializable{
|
||||
UUID getWorldId();
|
||||
IWorldType getWorldType();
|
||||
|
||||
WarpPosition getSpawn();
|
||||
void setSpawn(WarpPosition location);
|
||||
EntityLocation getSpawn();
|
||||
void setSpawn(EntityLocation location);
|
||||
|
||||
Chunk getChunk(int x, int y, int z);
|
||||
void setChunk(int x, int y, int z, Chunk chunk);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class BlockFactory {
|
||||
private class EmbeddedBlock extends AbstractBlock {
|
||||
EmbeddedBlock(BlockType type, int meta, int x, int y, int z) {
|
||||
super(type, meta);
|
||||
super.setLocation(new Location(x,y,z));
|
||||
super.setLocation(new Location(x,y,z, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user