Search in sources :

Example 96 with Entity

use of org.hypertrace.entity.data.service.v1.Entity in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Optional<Entity> entity = EntityTypes.a(tag, world);
    if (!entity.isPresent()) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.get().setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity.get(), SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity.get(), (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_14_R1.Entity) NBTTagCompound(net.minecraft.server.v1_14_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_14_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) World(net.minecraft.server.v1_14_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 97 with Entity

use of org.hypertrace.entity.data.service.v1.Entity in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Optional<Entity> entity = EntityTypes.a(tag, world);
    if (!entity.isPresent()) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.get().setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity.get(), SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity.get(), (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_15_R1.Entity) NBTTagCompound(net.minecraft.server.v1_15_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_15_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) World(net.minecraft.server.v1_15_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Example 98 with Entity

use of org.hypertrace.entity.data.service.v1.Entity in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@SuppressWarnings("resource")
@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Optional<Entity> entity = EntityTypes.a(tag, world);
    if (!entity.isPresent()) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.get().setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity.get(), SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity.get(), (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_16_R2.Entity) NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_16_R2.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer) World(net.minecraft.server.v1_16_R2.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Example 99 with Entity

use of org.hypertrace.entity.data.service.v1.Entity in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Entity entity = EntityTypes.a(tag, world);
    if (entity == null) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity, SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity, (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_8_R1.Entity) NBTTagCompound(net.minecraft.server.v1_8_R1.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_8_R1.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer) World(net.minecraft.server.v1_8_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld)

Example 100 with Entity

use of org.hypertrace.entity.data.service.v1.Entity in project SilkSpawners by timbru31.

the class NMSHandler method spawnEntity.

@Override
public void spawnEntity(final org.bukkit.World w, final String entityID, final double x, final double y, final double z, final Player player) {
    final NBTTagCompound tag = new NBTTagCompound();
    tag.setString("id", entityID);
    final World world = ((CraftWorld) w).getHandle();
    final Entity entity = EntityTypes.a(tag, world);
    if (entity == null) {
        Bukkit.getLogger().warning("[SilkSpawners] Failed to spawn, falling through. You should report this (entity == null)!");
        return;
    }
    final float yaw = world.random.nextFloat() * (-180 - 180) + 180;
    entity.setPositionRotation(x, y, z, yaw, 0);
    world.addEntity(entity, SpawnReason.SPAWNER_EGG);
    final PacketPlayOutEntityHeadRotation rotation = new PacketPlayOutEntityHeadRotation(entity, (byte) yaw);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(rotation);
}
Also used : Entity(net.minecraft.server.v1_9_R2.Entity) NBTTagCompound(net.minecraft.server.v1_9_R2.NBTTagCompound) PacketPlayOutEntityHeadRotation(net.minecraft.server.v1_9_R2.PacketPlayOutEntityHeadRotation) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld) World(net.minecraft.server.v1_9_R2.World) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Aggregations

Entity (org.hypertrace.entity.data.service.v1.Entity)110 Test (org.junit.jupiter.api.Test)97 LivingEntity (org.bukkit.entity.LivingEntity)94 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)88 EnrichedEntity (org.hypertrace.entity.data.service.v1.EnrichedEntity)34 Entity (com.google.datastore.v1.Entity)33 ArrayList (java.util.ArrayList)32 net.minecraft.world.entity (net.minecraft.world.entity)32 org.bukkit.entity (org.bukkit.entity)32 Location (org.bukkit.Location)29 Event (org.hypertrace.core.datamodel.Event)27 AttributeValue (org.hypertrace.core.datamodel.AttributeValue)22 BackendInfo (org.hypertrace.traceenricher.enrichment.enrichers.resolver.backend.BackendInfo)21 Entity (net.minecraft.server.v1_16_R3.Entity)19 AttributeValue (org.hypertrace.entity.data.service.v1.AttributeValue)19 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)18 AnnotateVideoProgress (com.google.cloud.videointelligence.v1.AnnotateVideoProgress)17 AnnotateVideoRequest (com.google.cloud.videointelligence.v1.AnnotateVideoRequest)17 AnnotateVideoResponse (com.google.cloud.videointelligence.v1.AnnotateVideoResponse)17 Entity (com.google.cloud.videointelligence.v1.Entity)17