SteamWar/FightSystem
Archiviert
13
1

RecordSystem (Beta) #199

Manuell gemergt
Lixfel hat 40 Commits von recordSystem nach master 2020-11-01 20:11:45 +01:00 zusammengeführt
2 geänderte Dateien mit 25 neuen und 11 gelöschten Zeilen
Nur Änderungen aus Commit 10c9cf3ae5 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -35,4 +35,6 @@ public class EventRecordListener extends BasicListener {
RecordSystem.entityMoves(e.getPlayer());
}
//TODO: Listener, if player gets out (leaves, dies or starts to spectate), alternatively: track sent players
}

Datei anzeigen

@ -21,16 +21,16 @@ public class RecordSystem {
}
/*
* PlayerJoinPacket (0x00) + int SWUserId + int EntityId
* PlayerJoinPacket (0x00) + int EntityId + int SWUserId
* EntityMovePacket (0x01) + int EntityId + double x, y, z + float pitch, yaw
* EntityDespawnsPacket (0x02) + int EntityId TODO Implementation
*
* TODO (Player-Oriented):
* ItemInHandPacket (0x03) + int EntityId
* LeftClickPacket (0x04) + int EntityId
* RightClickPacket (0x05) + int EntityId TODO Bow spanning
*
*
*
*
*
*
*
* TODO: Block Change Recordings
*
*
*
@ -45,10 +45,10 @@ public class RecordSystem {
public static void playerJoins(Player p){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
ByteBuf buf = new UnpooledUnsafeDirectByteBuf(ByteBufAllocator.DEFAULT, 8, 8); //TODO size
ByteBuf buf = getByteBuf();
buf.writeByte(0x00);
buf.writeInt(user.getId());
buf.writeInt(p.getEntityId());
buf.writeInt(user.getId());
send(buf);
entityMoves(p);
@ -57,7 +57,7 @@ public class RecordSystem {
public static void entityMoves(Entity e){
Location location = e.getLocation();
ByteBuf buf = new UnpooledUnsafeDirectByteBuf(ByteBufAllocator.DEFAULT, 8, 8); //TODO size
ByteBuf buf = getByteBuf();
buf.writeByte(0x01);
buf.writeInt(e.getEntityId());
buf.writeDouble(location.getX());
@ -68,11 +68,23 @@ public class RecordSystem {
send(buf);
}
public static void playerLeaves(Player p){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
ByteBuf buf = getByteBuf();
buf.writeByte(0x02);
buf.writeInt(p.getEntityId());
}
private static ByteBuf getByteBuf(){
return new UnpooledUnsafeDirectByteBuf(ByteBufAllocator.DEFAULT, 8, 8); //TODO size
}
private static void send(ByteBuf buf){
}
private static void checkWorldState(){
//TODO: TNT Entity position check
//TODO: Entity position transmissions
}
}