Skip to content

Commit

Permalink
Update for API changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Huey kitskub@gmail.com
  • Loading branch information
kitskub committed Aug 24, 2013
1 parent a3aa12c commit 9e65cd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public void handleServer(ServerSession session, PlayerStatusMessage message) {
gamemode = human.getGameMode();
} else {
gamemode = data.get(VanillaData.GAMEMODE);
human.setGamemode(gamemode);
human.setGamemode(gamemode, false);
}
final PlayerLoginRequestMessage idMsg = new PlayerLoginRequestMessage(entityId, worldType.toString(), gamemode.getId(), (byte) dimension.getId(), difficulty.getId(), (byte) server.getMaxPlayers());
session.send(true, idMsg);
session.setState(Session.State.GAME);

final Point position = session.getPlayer().getPhysics().getPosition();
PlayerSpawnPositionMessage pspMsg = new PlayerSpawnPositionMessage((int) position.getX(), (int) position.getY(), (int) position.getZ(), session.getPlayer().getNetwork().getRepositionManager());
session.send(pspMsg);
session.send(true, pspMsg);
session.setState(Session.State.GAME);
} else if (message.getStatus() == PlayerStatusMessage.RESPAWN) {
Player player = session.getPlayer();
Point point = player.getWorld().getSpawnPoint().getPosition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void handleServer(ServerSession session, PlayerLookMessage message) {

Player holder = session.getPlayer();

holder.getPhysics().setRotation(QuaternionMath.rotation(message.getPitch(), message.getYaw(), 0));
holder.getPhysics().setTransform(new Transform(holder.getPhysics().getPosition(), QuaternionMath.rotation(message.getPitch(), message.getYaw(), 0), holder.getPhysics().getScale()), false);
Human human = holder.get(Human.class);
if (human != null) {
human.setOnGround(message.isOnGround());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.spout.api.entity.Player;
import org.spout.api.geo.World;
import org.spout.api.geo.discrete.Point;
import org.spout.api.geo.discrete.Transform;
import org.spout.api.material.BlockMaterial;
import org.spout.api.material.block.BlockFace;
import org.spout.api.protocol.ClientSession;
Expand Down Expand Up @@ -72,9 +73,6 @@ public PositionTracker call() {

@Override
public void handleClient(ClientSession session, PlayerPositionMessage message) {
if (!session.hasPlayer()) {
return;
}
Player player = session.getPlayer();

World world = session.getEngine().getDefaultWorld();
Expand Down Expand Up @@ -103,7 +101,7 @@ public void handleServer(ServerSession session, PlayerPositionMessage message) {
if (!position.equals(newPosition)) {
final Human human = holder.get(Human.class);
// TODO: live?
holder.getPhysics().setPosition(newPosition);
holder.getPhysics().setTransform(new Transform(newPosition, holder.getPhysics().getRotation(), holder.getPhysics().getScale()), false);

//Don't use client onGround value, calculate ourselves
//MC Client is on ground if y value is whole number, or half step (e.g 55.0, or 65.5)
Expand Down

0 comments on commit 9e65cd7

Please sign in to comment.