@Override
publicvoid onSend
(SentPacket packet
){ if(packet.
getPacket()instanceof PacketPlayOutSpawnEntity
){// instanceof requires an import of the Packet, therefore not Version save // Currently spawning an entity. } }
@EventHandler
public void onPacketSend(PacketSendEvent e) {
if (e.getPacket() instanceof PacketPlayOutSpawnEntity) {// instanceof requires an import of the Packet, therefore not Version save
// Currently spawning an entity.
}
}
2.) version save (recommended)
Code (Text):
@EventHandler
public void onPacketSend(PacketSendEvent e) {
if(e.getPacketName().equals("PacketPlayOutSpawnEntity")) {
// Currently spawning an entity.
}
}
@Override
publicvoid onSend
(SentPacket packet
){ if(packet.
getPacketName().
equals("PacketPlayOutSpawnEntity")){ packet.
setPacketValue("f",
<EntityID
>);//f is the Field in the packet which defines the Entity-type as an Integer } }
@EventHandler
public void onPacketSend(PacketSendEvent e) {
if(e.getPacketName().equals("PacketPlayOutSpawnEntity")) {
e.setPacketValue("f", <EntityID>);//f is the Field in the packet which defines the Entity-type as an Integer
}
}