Search in sources :

Example 6 with DataWatcherWrapper

use of dev.rosewood.rosestacker.nms.v1_16_R2.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();
    }
}
Also used : PacketPlayOutEntityMetadata(net.minecraft.server.v1_16_R2.PacketPlayOutEntityMetadata) DataWatcherWrapper(dev.rosewood.rosestacker.nms.v1_16_R2.entity.DataWatcherWrapper) CraftPlayer(org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer) DataWatcher(net.minecraft.server.v1_16_R2.DataWatcher)

Aggregations

ArrayList (java.util.ArrayList)4 DataWatcherWrapper (dev.rosewood.rosestacker.nms.v1_16_R2.entity.DataWatcherWrapper)3 DataWatcherWrapper (dev.rosewood.rosestacker.nms.v1_16_R3.entity.DataWatcherWrapper)3 DataWatcher (net.minecraft.server.v1_16_R2.DataWatcher)3 PacketPlayOutEntityMetadata (net.minecraft.server.v1_16_R2.PacketPlayOutEntityMetadata)3 DataWatcher (net.minecraft.server.v1_16_R3.DataWatcher)3 PacketPlayOutEntityMetadata (net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata)3 CraftPlayer (org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer)3 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)3 IChatBaseComponent (net.minecraft.server.v1_16_R2.IChatBaseComponent)2 IChatBaseComponent (net.minecraft.server.v1_16_R3.IChatBaseComponent)2 ParticleParamBlock (net.minecraft.server.v1_16_R2.ParticleParamBlock)1 ParticleParamBlock (net.minecraft.server.v1_16_R3.ParticleParamBlock)1