SteamWar/SpigotCore
Archiviert
13
0

add additional Entity data
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
zOnlyKroks 2023-01-17 13:50:55 +01:00
Ursprung 7a8762594c
Commit da9718c69c
3 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -52,7 +52,7 @@ public class RArmorStand extends REntity {
private final Size size; private final Size size;
public RArmorStand(REntityServer server, Location location, Size size) { public RArmorStand(REntityServer server, Location location, Size size) {
super(server, EntityType.ARMOR_STAND, location); super(server, EntityType.ARMOR_STAND, location,0);
this.size = size; this.size = size;
} }

Datei anzeigen

@ -64,15 +64,17 @@ public class REntity {
private boolean noGravity; private boolean noGravity;
private boolean isGlowing; private boolean isGlowing;
private int fireTick; private int fireTick;
private final int objectData;
@Getter @Getter
private String displayName; private String displayName;
protected final Map<Object, ItemStack> itemSlots; protected final Map<Object, ItemStack> itemSlots;
public REntity(REntityServer server, EntityType entityType, Location location) { public REntity(REntityServer server, EntityType entityType, Location location,int objectData) {
this(server, entityType, new UUID(random.nextLong() & -61441L | 16384L, random.nextLong() & 4611686018427387903L | -9223372036854775808L), location); this(server, entityType, new UUID(random.nextLong() & -61441L | 16384L, random.nextLong() & 4611686018427387903L | -9223372036854775808L), location,objectData);
} }
protected REntity(REntityServer server, EntityType entityType, UUID uuid, Location location) { protected REntity(REntityServer server, EntityType entityType, UUID uuid, Location location,int objectData) {
this.server = server; this.server = server;
this.entityType = entityType; this.entityType = entityType;
this.entityId = entityIdCounter--; this.entityId = entityIdCounter--;
@ -89,6 +91,8 @@ public class REntity {
this.noGravity = false; this.noGravity = false;
this.isGlowing = false; this.isGlowing = false;
this.objectData = objectData;
server.addEntity(this); server.addEntity(this);
} }
@ -369,11 +373,13 @@ public class REntity {
protected static Function<REntity, Object> spawnPacketGenerator(Class<?> spawnPacket, int posOffset) { protected static Function<REntity, Object> spawnPacketGenerator(Class<?> spawnPacket, int posOffset) {
Reflection.FieldAccessor<Integer> entityId = Reflection.getField(spawnPacket, int.class, 0); Reflection.FieldAccessor<Integer> entityId = Reflection.getField(spawnPacket, int.class, 0);
Reflection.FieldAccessor<Integer> additionalData = Reflection.getField(spawnPacket, int.class, 9);
BountifulWrapper.PositionSetter position = BountifulWrapper.impl.getPositionSetter(spawnPacket, posOffset); BountifulWrapper.PositionSetter position = BountifulWrapper.impl.getPositionSetter(spawnPacket, posOffset);
return entity -> { return entity -> {
Object packet = Reflection.newInstance(spawnPacket); Object packet = Reflection.newInstance(spawnPacket);
entityId.set(packet, entity.entityId); entityId.set(packet, entity.entityId);
additionalData.set(packet,entity.objectData);
position.set(packet, entity.x, entity.y, entity.z); position.set(packet, entity.x, entity.y, entity.z);
return packet; return packet;
}; };

Datei anzeigen

@ -76,7 +76,7 @@ public class RPlayer extends REntity {
private final String name; private final String name;
public RPlayer(REntityServer server, UUID uuid, String name, Location location) { public RPlayer(REntityServer server, UUID uuid, String name, Location location) {
super(server, EntityType.PLAYER, uuid, location); super(server, EntityType.PLAYER, uuid, location,0);
this.name = name; this.name = name;
//team.addEntry(name); //team.addEntry(name);
} }