SteamWar/BauSystem2.0
Archiviert
12
0

Add AbstractEntity.sendEntity

Add AbstractEntity.sendEntityDestroy
Dieser Commit ist enthalten in:
yoyosource 2021-04-18 12:47:32 +02:00
Ursprung da80a00c2a
Commit d473245d9b
4 geänderte Dateien mit 10 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -52,7 +52,7 @@ class SimulatorEntity_15 extends BaseEntity_15 implements AbstractSimulatorEntit
return false; return false;
} }
sendDestroy(player); sendEntityDestroy(player);
die(); die();
return true; return true;
} }

Datei anzeigen

@ -46,7 +46,7 @@ class TraceEntity_15 extends BaseEntity_15 implements AbstractTraceEntity {
this.setCustomName(new ChatComponentText("Bumm")); this.setCustomName(new ChatComponentText("Bumm"));
this.exploded = true; this.exploded = true;
if (referenceCounter.increment() > 0) { if (referenceCounter.increment() > 0) {
sendDestroy(player); sendEntityDestroy(player);
} }
} else if (referenceCounter.increment() > 0) { } else if (referenceCounter.increment() > 0) {
return; return;
@ -61,7 +61,7 @@ class TraceEntity_15 extends BaseEntity_15 implements AbstractTraceEntity {
return false; return false;
} }
sendDestroy(player); sendEntityDestroy(player);
die(); die();
return true; return true;
} }

Datei anzeigen

@ -28,7 +28,7 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class BaseEntity_15 extends EntityFallingBlock { public class BaseEntity_15 extends EntityFallingBlock implements AbstractEntity {
private static final Vec3D ZERO = new Vec3D(0, 0, 0); private static final Vec3D ZERO = new Vec3D(0, 0, 0);
@ -44,7 +44,7 @@ public class BaseEntity_15 extends EntityFallingBlock {
this.ticksLived = -12000; this.ticksLived = -12000;
} }
protected void sendEntity(Player player) { public void sendEntity(Player player) {
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(iBlockData), ZERO); PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(iBlockData), ZERO);
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection; PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
playerConnection.sendPacket(packetPlayOutSpawnEntity); playerConnection.sendPacket(packetPlayOutSpawnEntity);
@ -53,7 +53,7 @@ public class BaseEntity_15 extends EntityFallingBlock {
playerConnection.sendPacket(packetPlayOutEntityMetadata); playerConnection.sendPacket(packetPlayOutEntityMetadata);
} }
protected void sendDestroy(Player player) { public void sendEntityDestroy(Player player) {
PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId()); PacketPlayOutEntityDestroy packetPlayOutEntityDestroy = new PacketPlayOutEntityDestroy(getId());
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityDestroy);
} }

Datei anzeigen

@ -19,5 +19,9 @@
package de.steamwar.bausystem.shared; package de.steamwar.bausystem.shared;
import org.bukkit.entity.Player;
public interface AbstractEntity { public interface AbstractEntity {
void sendEntity(Player player);
void sendEntityDestroy(Player player);
} }