видно новых игроков и их передвижения
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ public interface NetChannel {
|
||||
void sendChatMessage(String message);
|
||||
|
||||
void writeAndFlush(SCPacket pkt);
|
||||
void write(SCPacket pkt);
|
||||
void flush();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user