Search in sources :

Example 26 with Entity

use of net.minecraft.server.v1_8_R1.Entity in project FunnyGuilds by FunnyGuilds.

the class V1_12R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_12_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 27 with Entity

use of net.minecraft.server.v1_8_R1.Entity in project FunnyGuilds by FunnyGuilds.

the class V1_16R3EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity);
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_16_R3.Entity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 28 with Entity

use of net.minecraft.server.v1_8_R1.Entity in project FunnyGuilds by FunnyGuilds.

the class V1_10R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_10_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_10_R1.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 29 with Entity

use of net.minecraft.server.v1_8_R1.Entity in project Citizens2 by CitizensDev.

the class NMSImpl method removeFromWorld.

@Override
public void removeFromWorld(org.bukkit.entity.Entity entity) {
    Preconditions.checkNotNull(entity);
    Entity nmsEntity = ((CraftEntity) entity).getHandle();
    nmsEntity.world.removeEntity(nmsEntity);
}
Also used : PathEntity(net.minecraft.server.v1_10_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity) Entity(net.minecraft.server.v1_10_R1.Entity) CraftEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity)

Example 30 with Entity

use of net.minecraft.server.v1_8_R1.Entity in project Citizens2 by CitizensDev.

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    Entity entity1 = entity.bB();
    if (entity1 != null) {
        if ((entity1.dead) || (!entity1.w(entity))) {
            entity.stopRiding();
        }
    } else {
        if (!entity.dead) {
            try {
                entity.world.g(entity);
            } catch (Throwable throwable) {
                CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
                CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
                entity.appendEntityCrashDetails(crashreportsystemdetails);
                throw new ReportedException(crashreport);
            }
        }
        boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
        if (entity.dead) {
            entity.world.removeEntity(entity);
            return true;
        } else if (!removeFromPlayerList) {
            if (!entity.world.players.contains(entity)) {
                entity.world.players.add((EntityHuman) entity);
            }
            return true;
        } else {
            entity.world.players.remove(entity);
        }
    }
    return false;
}
Also used : PathEntity(net.minecraft.server.v1_10_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity) Entity(net.minecraft.server.v1_10_R1.Entity) EntityHuman(net.minecraft.server.v1_10_R1.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_10_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_10_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_10_R1.ReportedException)

Aggregations

Entity (org.hypertrace.entity.data.service.v1.Entity)110 LivingEntity (org.bukkit.entity.LivingEntity)95 Test (org.junit.jupiter.api.Test)95 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)88 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 EnrichedEntity (org.hypertrace.entity.data.service.v1.EnrichedEntity)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 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 VideoAnnotationResults (com.google.cloud.videointelligence.v1.VideoAnnotationResults)17