SteamWar/BauSystem
Archiviert
13
0

Tracer-entity #147

Manuell gemergt
YoyoNow hat 47 Commits von Tracer-entity nach master 2020-12-27 22:16:04 +01:00 zusammengeführt
Nur Änderungen aus Commit 6c89fec5a1 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -50,21 +50,10 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
@Override @Override
public AbstractTraceEntity display(Player player) { public AbstractTraceEntity display(Player player) {
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0); PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0, 0);
// Todo:
// Reflection needed?
setValue("c", packetPlayOutSpawnEntity, position.getX());
setValue("d", packetPlayOutSpawnEntity, position.getY());
setValue("e", packetPlayOutSpawnEntity, position.getZ());
setValue("f", packetPlayOutSpawnEntity, 0);
setValue("g", packetPlayOutSpawnEntity, 0);
setValue("h", packetPlayOutSpawnEntity, 0);
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
playerConnection.sendPacket(packetPlayOutSpawnEntity); playerConnection.sendPacket(packetPlayOutSpawnEntity);
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
playerConnection.sendPacket(packetPlayOutEntityTeleport);
if (tnt) { if (tnt) {
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true); PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
playerConnection.sendPacket(packetPlayOutEntityMetadata); playerConnection.sendPacket(packetPlayOutEntityMetadata);
@ -81,14 +70,4 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
return this; return this;
} }
private static void setValue(String field, Object object, Object value) {
try {
Field f = object.getClass().getDeclaredField(field);
f.setAccessible(true);
f.set(object, value);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new SecurityException(e);
}
}
} }