Merge branch 'proto_1.12.2' into h2-playermanager
# Conflicts: # core/src/main/java/mc/core/EntityLocation.java # core/src/main/java/mc/core/Location.java # core/src/test/java/mc/core/TestEntityLocation.java # core/src/test/java/mc/core/TestLocation.java
This commit is contained in:
@@ -29,7 +29,7 @@ class PlayerEventListener {
|
||||
public void playerChunkLoadHandler(SC_ChunkLoadEvent event) {
|
||||
for(Integer compressXZ : event.getNeedLoadChunks()) {
|
||||
int[] xz = CompactedCoords.uncompressXZ(compressXZ);
|
||||
Chunk chunk = event.getPlayer().getLocation().getWorld().getChunk(xz[0], xz[1]);
|
||||
Chunk chunk = event.getPlayer().getWorld().getChunk(xz[0], xz[1]);
|
||||
|
||||
ChunkDataPacket packet = new ChunkDataPacket();
|
||||
packet.setX(xz[0]);
|
||||
|
||||
@@ -20,6 +20,7 @@ import mc.core.text.TextColor;
|
||||
import mc.core.text.TextStyle;
|
||||
import mc.core.utils.CompactedCoords;
|
||||
import mc.core.world.World;
|
||||
import mc.core.world.chunk.Chunk;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -50,7 +51,8 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
|
||||
Player player = playerManager.getPlayer(packet.getPlayerName())
|
||||
.orElseGet(() -> playerManager.createPlayer(
|
||||
packet.getPlayerName(),
|
||||
world.getSpawn()));
|
||||
world.getSpawn(),
|
||||
world));
|
||||
|
||||
channel.writeAndFlush(new LoginSuccessPacket(
|
||||
player.getUuid(),
|
||||
@@ -83,9 +85,10 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
|
||||
|
||||
// First Chunk
|
||||
ChunkDataPacket pkt8 = new ChunkDataPacket();
|
||||
pkt8.setX(player.getLocation().getChunk().getX());
|
||||
pkt8.setZ(player.getLocation().getChunk().getZ());
|
||||
pkt8.setChunk(player.getLocation().getChunk());
|
||||
Chunk chunk = player.getWorld().getChunk(player.getLocation());
|
||||
pkt8.setX(chunk.getX());
|
||||
pkt8.setZ(chunk.getZ());
|
||||
pkt8.setChunk(chunk);
|
||||
pkt8.setInitChunk(true);
|
||||
channel.writeAndFlush(pkt8);
|
||||
player.getLoadedChunks().add(CompactedCoords.compressXZ(0, 0));
|
||||
|
||||
@@ -55,8 +55,7 @@ public class PlayHandler extends AbstractStateHandler implements PlayStateHandle
|
||||
@Handler
|
||||
public void onPositionAndLook(Channel channel, PlayerPositionAndLookPacket packet) {
|
||||
Player player = channel.attr(ATTR_PLAYER).get();
|
||||
player.getLocation().setXYZ(packet.getLocation());
|
||||
player.getLocation().setYawPitch(packet.getLocation());
|
||||
player.getLocation().set(packet.getLocation());
|
||||
}
|
||||
|
||||
@Handler
|
||||
@@ -82,8 +81,7 @@ public class PlayHandler extends AbstractStateHandler implements PlayStateHandle
|
||||
event.setNewLocation(new EntityLocation(
|
||||
packet.getX(), packet.getY(), packet.getZ(),
|
||||
player.getLocation().getYaw(),
|
||||
player.getLocation().getPitch(),
|
||||
player.getLocation().getWorld()
|
||||
player.getLocation().getPitch()
|
||||
));
|
||||
EventBusGetter.getInstance().post(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user