Merge branch 'dev/pool' into dev/world
# Conflicts: # protocol/src/main/java/mc/protocol/packets/play/client/CPlayerPositionAndLookPacket.java # protocol/src/main/java/mc/protocol/packets/play/client/PlayerLookPacket.java # protocol/src/main/java/mc/protocol/packets/play/client/PlayerPositionPacket.java # protocol/src/main/java/mc/protocol/packets/play/server/ChunkDataPacket.java # protocol/src/test/java/mc/protocol/buffer/NetByteBufReadTest.java # protocol/src/test/java/mc/protocol/buffer/NetByteBufWriteTest.java # server/src/main/resources/logback-default.xml
This commit is contained in:
@@ -129,7 +129,9 @@ public class ScenarioLogin implements PacketScenario {
|
||||
private void sendPlayerPositionAndLook(Player player) {
|
||||
var playerPositionAndLookPacket = new SPlayerPositionAndLookPacket();
|
||||
playerPositionAndLookPacket.setPosition(player.getLocation());
|
||||
playerPositionAndLookPacket.setLook(new Look().set(0f, 0f));
|
||||
Look look = new Look();
|
||||
look.set(0f, 0f);
|
||||
playerPositionAndLookPacket.setLook(look);
|
||||
playerPositionAndLookPacket.setTeleportId(random.nextInt());
|
||||
|
||||
player.getCtx().write(playerPositionAndLookPacket);
|
||||
|
||||
@@ -6,7 +6,10 @@ import mc.protocol.model.Location;
|
||||
@UtilityClass
|
||||
public class LocationUtils {
|
||||
|
||||
//TODO заменить другими инструментами
|
||||
public Location toChunkXZ(Location location) {
|
||||
return new Location().set((int) location.getX() >> 4, 0d, (int) location.getZ() >> 4);
|
||||
Location location0 = new Location();
|
||||
location0.set((int) location.getX() >> 4, 0d, (int) location.getZ() >> 4);
|
||||
return location0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,18 @@ public class SomeChunkSection implements ChunkSection {
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
if (this.y == 15) {
|
||||
if (y == 0) {
|
||||
return blocks.computeIfAbsent(new Location().set(x, y, z), location -> {
|
||||
Location location1 = new Location();
|
||||
location1.set(x, y, z);
|
||||
return blocks.computeIfAbsent(location1, location -> {
|
||||
SomeBlock block = new SomeBlock();
|
||||
block.setLocation(location);
|
||||
block.setId(3);
|
||||
return block;
|
||||
});
|
||||
} else {
|
||||
return blocks.computeIfAbsent(new Location().set(x, y, z), location -> {
|
||||
Location location1 = new Location();
|
||||
location1.set(x, y, z);
|
||||
return blocks.computeIfAbsent(location1, location -> {
|
||||
SomeBlock block = new SomeBlock();
|
||||
block.setLocation(location);
|
||||
block.setId(0);
|
||||
@@ -35,7 +39,9 @@ public class SomeChunkSection implements ChunkSection {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return blocks.computeIfAbsent(new Location().set(x, y, z), location -> {
|
||||
Location location1 = new Location();
|
||||
location1.set(x, y, z);
|
||||
return blocks.computeIfAbsent(location1, location -> {
|
||||
SomeBlock block = new SomeBlock();
|
||||
block.setLocation(location);
|
||||
block.setId(1);
|
||||
|
||||
@@ -9,7 +9,7 @@ import mc.utils.Table;
|
||||
|
||||
public class SomeWorld implements World {
|
||||
|
||||
private static final Location spawn = ProtocolObjectPool.getLocationPool().borrowObject().set(-790d, 256d, -263d + 16d);
|
||||
private static final Location spawn;
|
||||
private final Table<Integer, Integer, Chunk> chunkTable = new Table<>();
|
||||
|
||||
@Override
|
||||
@@ -36,4 +36,9 @@ public class SomeWorld implements World {
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
static {
|
||||
spawn = new Location();
|
||||
spawn.set(-790d, 256d, -263d + 16d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,10 @@
|
||||
<!--<logger name="io.netty.handler.logging.LoggingHandler" level="debug" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>-->
|
||||
<!--<logger name="mc.protocol.handler.codec.ProtocolEncoder" level="debug" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="mc.protocol.handler.codec.ProtocolDecoder" level="debug" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>-->
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user