SteamWar/FightSystem
Archiviert
13
1

Test spawn, remove debug
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-03-04 23:05:09 +01:00
Ursprung 1f755a776b
Commit 3946a44937

Datei anzeigen

@ -129,6 +129,8 @@ public class REntity {
private int fireTick;
private boolean sneaks;
private boolean playerSpawned = false;
public REntity(int internalId, int userId){
this.internalId = internalId;
this.entityType = EntityType.PLAYER;
@ -144,11 +146,9 @@ public class REntity {
this.uuid = user.getUUID();
this.name = user.getUserName();
System.out.println(name + " joins");
entities.put(internalId, this);
ProtocolAPI.broadcastPacket(getPlayerInfoPacket());
ProtocolAPI.broadcastPacket(getNamedSpawnPacket());
team.addEntry(name);
}
@ -167,14 +167,14 @@ public class REntity {
this.locX = locX;
this.locY = locY;
this.locZ = locZ;
if(entityType == EntityType.PLAYER && !playerSpawned) {
ProtocolAPI.broadcastPacket(getNamedSpawnPacket());
playerSpawned = true;
}
this.yaw = (byte)((int)(yaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(pitch * 256.0F / 360.0F));
this.headYaw = headYaw;
if(entityType == EntityType.PLAYER) {
System.out.println("Player moves " + locX + " " + locY + " " + locZ);
}
ProtocolAPI.broadcastPacket(getTeleportPacket());
ProtocolAPI.broadcastPacket(getHeadRotationPacket());
}
@ -337,10 +337,16 @@ public class REntity {
public static final Class<?> namedSpawnPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutNamedEntitySpawn");
private static final Reflection.FieldAccessor<Integer> namedSpawnEntity = Reflection.getField(namedSpawnPacket, int.class, 0);
private static final Reflection.FieldAccessor<UUID> namedSpawnUUID = Reflection.getField(namedSpawnPacket, UUID.class, 0);
private static final Reflection.FieldAccessor<Double> namedSpawnX = Reflection.getField(namedSpawnPacket, double.class, 0);
private static final Reflection.FieldAccessor<Double> namedSpawnY = Reflection.getField(namedSpawnPacket, double.class, 1);
private static final Reflection.FieldAccessor<Double> namedSpawnZ = Reflection.getField(namedSpawnPacket, double.class, 2);
private Object getNamedSpawnPacket(){
Object packet = Reflection.newInstance(namedSpawnPacket);
namedSpawnEntity.set(packet, entityId);
namedSpawnUUID.set(packet, uuid);
namedSpawnX.set(packet, locX);
namedSpawnX.set(packet, locY);
namedSpawnX.set(packet, locZ);
FlatteningWrapper.impl.setNamedSpawnPacketDataWatcher(packet);
return packet;
}