use of dev.rosewood.rosestacker.nms.v1_16_R3.entity.DataWatcherWrapper in project RoseStacker by Rosewood-Development.
the class NMSHandlerImpl method updateEntityNameTagVisibilityForPlayer.
@Override
public void updateEntityNameTagVisibilityForPlayer(Player player, org.bukkit.entity.Entity entity, boolean customNameVisible) {
try {
List<DataWatcher.Item<?>> dataItems = Lists.newArrayList(new DataWatcher.Item<>(DataWatcherRegistry.i.a(3), customNameVisible));
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getEntityId(), new DataWatcherWrapper(dataItems), false);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
} catch (Exception e) {
e.printStackTrace();
}
}
use of dev.rosewood.rosestacker.nms.v1_16_R3.entity.DataWatcherWrapper in project RoseStacker by Rosewood-Development.
the class NMSHandlerImpl method updateEntityNameTagForPlayer.
@Override
public void updateEntityNameTagForPlayer(Player player, org.bukkit.entity.Entity entity, String customName, boolean customNameVisible) {
try {
List<DataWatcher.Item<?>> dataWatchers = new ArrayList<>();
Optional<IChatBaseComponent> nameComponent = Optional.ofNullable(CraftChatMessage.fromStringOrNull(customName));
dataWatchers.add(new DataWatcher.Item<>(DataWatcherRegistry.f.a(2), nameComponent));
dataWatchers.add(new DataWatcher.Item<>(DataWatcherRegistry.i.a(3), customNameVisible));
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getEntityId(), new DataWatcherWrapper(dataWatchers), false);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
} catch (Exception e) {
e.printStackTrace();
}
}
use of dev.rosewood.rosestacker.nms.v1_16_R3.entity.DataWatcherWrapper in project RoseStacker by Rosewood-Development.
the class HologramImpl method update.
@Override
protected void update(Player player) {
Boolean visible = this.watchers.get(player);
if (visible == null)
return;
List<DataWatcher.Item<?>> dataItems = new ArrayList<>();
Optional<IChatBaseComponent> nameComponent = Optional.of(CraftChatMessage.fromStringOrNull(this.text));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.f.a(2), nameComponent));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.i.a(3), visible));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.c.a(7), 0.5F));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.i.a(9), true));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.j.a(10), new ParticleParamBlock(Particles.BLOCK, Blocks.AIR.getBlockData())));
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(this.entityId, new DataWatcherWrapper(dataItems), false);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
use of dev.rosewood.rosestacker.nms.v1_16_R3.entity.DataWatcherWrapper in project RoseStacker by Rosewood-Development.
the class NMSHandlerImpl method updateEntityNameTagForPlayer.
@Override
public void updateEntityNameTagForPlayer(Player player, org.bukkit.entity.Entity entity, String customName, boolean customNameVisible) {
try {
List<DataWatcher.Item<?>> dataWatchers = new ArrayList<>();
Optional<IChatBaseComponent> nameComponent = Optional.ofNullable(CraftChatMessage.fromStringOrNull(customName));
dataWatchers.add(new DataWatcher.Item<>(DataWatcherRegistry.f.a(2), nameComponent));
dataWatchers.add(new DataWatcher.Item<>(DataWatcherRegistry.i.a(3), customNameVisible));
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(entity.getEntityId(), new DataWatcherWrapper(dataWatchers), false);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
} catch (Exception e) {
e.printStackTrace();
}
}
use of dev.rosewood.rosestacker.nms.v1_16_R3.entity.DataWatcherWrapper in project RoseStacker by Rosewood-Development.
the class HologramImpl method update.
@Override
protected void update(Player player) {
Boolean visible = this.watchers.get(player);
if (visible == null)
return;
List<DataWatcher.Item<?>> dataItems = new ArrayList<>();
Optional<IChatBaseComponent> nameComponent = Optional.of(CraftChatMessage.fromStringOrNull(this.text));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.f.a(2), nameComponent));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.i.a(3), visible));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.c.a(7), 0.5F));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.i.a(9), true));
dataItems.add(new DataWatcher.Item<>(DataWatcherRegistry.j.a(10), new ParticleParamBlock(Particles.BLOCK, Blocks.AIR.getBlockData())));
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(this.entityId, new DataWatcherWrapper(dataItems), false);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
Aggregations