Skip to content

Commit

Permalink
test: fix up test
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Aug 8, 2023
1 parent 3361a4a commit e916c8b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ private void loadWorlds() {
.worldData(worldData)
.setWorldGenerator(new FlatWorldGenerator())
.setWorldStorage(new AllayNonPersistentWorldStorage())
.setWorldType(WorldType.FLAT)
.build());
}

Expand Down
30 changes: 14 additions & 16 deletions Allay-Server/src/main/java/cn/allay/server/client/AllayClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -519,29 +519,27 @@ public PacketSignal handle(SubChunkRequestPacket packet) {
return PacketSignal.HANDLED;
}

@Override
public PacketSignal handle(MovePlayerPacket packet) {
var pos = packet.getPosition();
var rot = packet.getRotation();
playerEntity.setLocation(new Location3d(
pos.getX(),
pos.getY(),
pos.getZ(),
rot.getX(),
rot.getY(),
rot.getZ(),
getLocation().world()
));
return PacketSignal.HANDLED;
}

@Override
public PacketSignal handle(PlayerAuthInputPacket packet) {
handleMovement(packet);
handleBlockAction(packet.getPlayerActions());
handleInputData(packet.getInputData());
return PacketSignal.HANDLED;
}

protected void handleMovement(PlayerAuthInputPacket packet) {
var newPos = packet.getPosition();
var newRot = packet.getRotation();
playerEntity.getLocation().world().getEntityPhysicsService()
.offerScheduledMove(
playerEntity,
new Location3d(
newPos.getX(), newPos.getY(), newPos.getZ(),
newRot.getX(), newRot.getY(), newRot.getZ(),
getLocation().world())
);
}

protected void handleBlockAction(List<PlayerBlockActionData> blockActions) {
if (blockActions.isEmpty()) return;
for (var action : blockActions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
import cn.allay.api.math.Location3dc;
import cn.allay.api.world.World;
import cn.allay.api.world.entity.EntityPhysicsService;
import com.google.common.collect.Sets;
import it.unimi.dsi.fastutil.Pair;
import it.unimi.dsi.fastutil.booleans.BooleanObjectImmutablePair;
import it.unimi.dsi.fastutil.doubles.DoubleBooleanImmutablePair;
import it.unimi.dsi.fastutil.doubles.DoubleBooleanMutablePair;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket;
import org.joml.Vector2d;
import org.joml.Vector3d;
Expand Down

0 comments on commit e916c8b

Please sign in to comment.