refactory Location's
This commit is contained in:
@@ -45,8 +45,7 @@ public class TeleportManager {
|
||||
public void apply(int teleportId) {
|
||||
if (teleportMap.containsKey(teleportId)) {
|
||||
TpData data = teleportMap.remove(teleportId);
|
||||
data.player.getLocation().setXYZ(data.newLocation);
|
||||
data.player.getLocation().setYawPitch(data.newLocation);
|
||||
data.player.getLocation().set(data.newLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package mc.core.network.proto_1_12_2.packets;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import mc.core.Location;
|
||||
import mc.core.world.block.BlockLocation;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
import mc.core.network.proto_1_12_2.Direction;
|
||||
@@ -11,7 +11,7 @@ import mc.core.utils.CompactedCoords;
|
||||
@Getter
|
||||
@ToString
|
||||
public class PlayerBlockPlacementPacket implements CSPacket {
|
||||
private Location location;
|
||||
private BlockLocation location;
|
||||
private Direction face;
|
||||
/** true - main hand; false - off hand */
|
||||
private boolean hand;
|
||||
@@ -21,7 +21,7 @@ public class PlayerBlockPlacementPacket implements CSPacket {
|
||||
public void readSelf(NetInputStream netStream) {
|
||||
long compactedCoords = netStream.readLong();
|
||||
double[] xyz = CompactedCoords.uncompressXYZ(compactedCoords);
|
||||
location = new Location(xyz[0], xyz[1], xyz[2], null);
|
||||
location = new BlockLocation((int)xyz[0], (int)xyz[1], (int)xyz[2]); //FIXME
|
||||
face = Direction.getById(netStream.readVarInt());
|
||||
hand = (netStream.readVarInt() == 1);
|
||||
cursorX = netStream.readFloat();
|
||||
|
||||
@@ -3,7 +3,7 @@ package mc.core.network.proto_1_12_2.packets;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import mc.core.Location;
|
||||
import mc.core.world.block.BlockLocation;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
import mc.core.network.proto_1_12_2.Direction;
|
||||
@@ -42,7 +42,7 @@ public class PlayerDiggingPacket implements CSPacket {
|
||||
}
|
||||
|
||||
private Status status;
|
||||
private Location location;
|
||||
private BlockLocation location;
|
||||
private Direction face;
|
||||
|
||||
@Override
|
||||
@@ -50,7 +50,7 @@ public class PlayerDiggingPacket implements CSPacket {
|
||||
status = Status.getById(netStream.readVarInt());
|
||||
long compactCoord = netStream.readLong();
|
||||
double[] xyz = CompactedCoords.uncompressXYZ(compactCoord);
|
||||
location = new Location(xyz[0], xyz[1], xyz[2], null);
|
||||
location = new BlockLocation((int)xyz[0], (int)xyz[1], (int)xyz[2]); //FIXME
|
||||
face = Direction.getById(netStream.readByte());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,7 @@ public class PlayerPositionAndLookPacket implements SCPacket, CSPacket {
|
||||
netStream.readDouble(),
|
||||
netStream.readDouble(),
|
||||
netStream.readFloat(),
|
||||
netStream.readFloat(),
|
||||
null
|
||||
netStream.readFloat()
|
||||
);
|
||||
|
||||
this.onGround = netStream.readBoolean();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
package mc.core.network.proto_1_12_2.packets;
|
||||
|
||||
import mc.core.Location;
|
||||
import mc.core.world.block.BlockLocation;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TabCompletePacket implements CSPacket {
|
||||
private String text;
|
||||
private boolean assumeCommand;
|
||||
private boolean hasPosition;
|
||||
private Location location;
|
||||
private BlockLocation location;
|
||||
|
||||
@Override
|
||||
public void readSelf(NetInputStream netStream) {
|
||||
@@ -27,7 +27,7 @@ public class TabCompletePacket implements CSPacket {
|
||||
double y = (compactValue >> 26) & 0xFFF;
|
||||
double z = compactValue << 38 >> 38; // is normal?
|
||||
|
||||
this.location = new Location(x, y, z, null);
|
||||
this.location = new BlockLocation((int)x, (int)y, (int)z); //FIXME
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ public class TestChunkdataPacket {
|
||||
|
||||
BlockFactory blockFactory = new BlockFactory();
|
||||
|
||||
if (y == 0) return blockFactory.create(BlockType.BEDROCK, x, y, z, null);
|
||||
else if (y >= 1 && y <= 2) return blockFactory.create(BlockType.DIRT, x, y, z, null);
|
||||
else if (y == 3) return blockFactory.create(BlockType.GRASS, x, y, z, null);
|
||||
else return blockFactory.create(BlockType.AIR, x, y, z, null);
|
||||
if (y == 0) return blockFactory.create(BlockType.BEDROCK, x, y, z);
|
||||
else if (y >= 1 && y <= 2) return blockFactory.create(BlockType.DIRT, x, y, z);
|
||||
else if (y == 3) return blockFactory.create(BlockType.GRASS, x, y, z);
|
||||
else return blockFactory.create(BlockType.AIR, x, y, z);
|
||||
});
|
||||
|
||||
world = mock(World.class);
|
||||
|
||||
Reference in New Issue
Block a user