Archived
0

видно новых игроков и их передвижения

This commit is contained in:
2018-05-12 00:32:45 +03:00
parent b915b50cd8
commit 8a9183bd6d
12 changed files with 274 additions and 6 deletions

View File

@@ -7,8 +7,8 @@ package mc.core;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
@Data
public class Location {
private double x, y, z;
@@ -16,6 +16,20 @@ public class Location {
return new Location(location.x, location.y, location.z);
}
public void set(Location location) {
this.x = location.x;
this.y = location.y;
this.z = location.z;
}
public Location diff(Location location) {
return new Location(
this.x - location.x,
this.y - location.y,
this.z - location.z
);
}
public int getBlockX() {
return (int) x;
}

View File

@@ -32,4 +32,14 @@ public class BroadcastNetChannel implements NetChannel {
public void writeAndFlush(final SCPacket pkt) {
playerStream.forEach(player -> player.getChannel().writeAndFlush(pkt));
}
@Override
public void write(SCPacket pkt) {
playerStream.forEach(player -> player.getChannel().write(pkt));
}
@Override
public void flush() {
playerStream.forEach(player -> player.getChannel().flush());
}
}

View File

@@ -10,4 +10,6 @@ public interface NetChannel {
void sendChatMessage(String message);
void writeAndFlush(SCPacket pkt);
void write(SCPacket pkt);
void flush();
}

View File

@@ -15,4 +15,9 @@ public class Look {
public static Look copy(Look look) {
return new Look(look.yaw, look.pitch);
}
public void set(Look look) {
this.yaw = look.yaw;
this.pitch = look.pitch;
}
}