mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-03 09:29:34 +01:00
Support new packet constructor
This commit is contained in:
parent
484b4c8a9f
commit
644d58c80e
@ -25,6 +25,7 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.comphenix.protocol.injector.PacketConstructor;
|
import com.comphenix.protocol.injector.PacketConstructor;
|
||||||
import com.comphenix.protocol.reflect.IntEnum;
|
import com.comphenix.protocol.reflect.IntEnum;
|
||||||
|
import com.gmail.filoghost.holographicdisplays.util.NMSVersion;
|
||||||
|
|
||||||
public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
||||||
public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY;
|
public static final PacketType TYPE = PacketType.Play.Server.SPAWN_ENTITY;
|
||||||
@ -90,10 +91,20 @@ public class WrapperPlayServerSpawnEntity extends AbstractPacket {
|
|||||||
|
|
||||||
// Useful constructor
|
// Useful constructor
|
||||||
private static PacketContainer fromEntity(Entity entity, int type, int objectData) {
|
private static PacketContainer fromEntity(Entity entity, int type, int objectData) {
|
||||||
if (entityConstructor == null)
|
if (entityConstructor == null) {
|
||||||
|
if (NMSVersion.isGreaterEqualThan(NMSVersion.v1_14_R1)) {
|
||||||
|
entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity, objectData);
|
||||||
|
} else {
|
||||||
entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity, type, objectData);
|
entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, entity, type, objectData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NMSVersion.isGreaterEqualThan(NMSVersion.v1_14_R1)) {
|
||||||
|
return entityConstructor.createPacket(entity, objectData);
|
||||||
|
} else {
|
||||||
return entityConstructor.createPacket(entity, type, objectData);
|
return entityConstructor.createPacket(entity, type, objectData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve entity ID of the Object.
|
* Retrieve entity ID of the Object.
|
||||||
|
Loading…
Reference in New Issue
Block a user