Search in sources :

Example 31 with Entity

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

the class LlamaSpitController method createEntity.

@Override
protected Entity createEntity(Location at, NPC npc) {
    WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
    final EntityLlamaSpitNPC handle = new EntityLlamaSpitNPC(ws, npc);
    handle.setPositionRotation(at.getX(), at.getY(), at.getZ(), at.getPitch(), at.getYaw());
    return handle.getBukkitEntity();
}
Also used : WorldServer(net.minecraft.server.v1_11_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 32 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Village_Defense by Plajer.

the class RidableIronGolem method g.

@Override
public void g(float f, float f1) {
    EntityLiving entityliving = (EntityLiving) bw();
    if (entityliving == null) {
        // search first human passenger
        for (final Entity e : passengers) {
            if (e instanceof EntityHuman) {
                entityliving = (EntityLiving) e;
                break;
            }
        }
        if (entityliving == null) {
            this.l((float) 0.12);
            super.g(f, f1);
            return;
        }
    }
    this.lastYaw = this.yaw = entityliving.yaw;
    this.pitch = entityliving.pitch * 0.5F;
    this.setYawPitch(this.yaw, this.pitch);
    this.aQ = this.aO = this.yaw;
    f = entityliving.be * 0.75F;
    f1 = entityliving.bf;
    if (f1 <= 0.0f) {
        f1 *= 0.25F;
    }
    this.l((float) 0.12);
    super.g(f, f1);
    P = (float) 1.0;
}
Also used : Entity(net.minecraft.server.v1_11_R1.Entity) EntityHuman(net.minecraft.server.v1_11_R1.EntityHuman) EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving)

Example 33 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project Village_Defense by Plajer.

the class RidableIronGolem method a.

public void a(float f, float f1, float f2) {
    EntityLiving entityliving = null;
    for (final Entity e : passengers) {
        if (e instanceof EntityHuman) {
            entityliving = (EntityLiving) e;
            break;
        }
    }
    if (entityliving == null) {
        this.P = 0.5F;
        this.aR = 0.02F;
        this.k((float) 0.12);
        super.a(f, f1, f2);
        return;
    }
    this.lastYaw = this.yaw = entityliving.yaw;
    this.pitch = entityliving.pitch * 0.5F;
    this.setYawPitch(this.yaw, this.pitch);
    this.aO = this.aM = this.yaw;
    f = entityliving.be * 0.5F * 0.75F;
    f2 = entityliving.bg;
    if (f2 <= 0.0f) {
        f2 *= 0.25F;
    }
    k(0.12f);
    super.a(f, f1, f2);
    P = (float) 1.0;
}
Also used : Entity(net.minecraft.server.v1_12_R1.Entity) EntityHuman(net.minecraft.server.v1_12_R1.EntityHuman) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving)

Example 34 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project java-docs-samples by GoogleCloudPlatform.

the class Analyze method analyzeEntitiesFile.

/**
 * Identifies entities in the contents of the object at the given GCS {@code path}.
 */
public static void analyzeEntitiesFile(String gcsUri) throws Exception {
    // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
    try (LanguageServiceClient language = LanguageServiceClient.create()) {
        // set the GCS Content URI path to the file to be analyzed
        Document doc = Document.newBuilder().setGcsContentUri(gcsUri).setType(Type.PLAIN_TEXT).build();
        AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder().setDocument(doc).setEncodingType(EncodingType.UTF16).build();
        AnalyzeEntitiesResponse response = language.analyzeEntities(request);
        // Print the response
        for (Entity entity : response.getEntitiesList()) {
            System.out.printf("Entity: %s", entity.getName());
            System.out.printf("Salience: %.3f\n", entity.getSalience());
            System.out.println("Metadata: ");
            for (Map.Entry<String, String> entry : entity.getMetadataMap().entrySet()) {
                System.out.printf("%s : %s", entry.getKey(), entry.getValue());
            }
            for (EntityMention mention : entity.getMentionsList()) {
                System.out.printf("Begin offset: %d\n", mention.getText().getBeginOffset());
                System.out.printf("Content: %s\n", mention.getText().getContent());
                System.out.printf("Type: %s\n\n", mention.getType());
            }
        }
    }
// [END analyze_entities_gcs]
}
Also used : LanguageServiceClient(com.google.cloud.language.v1.LanguageServiceClient) Entity(com.google.cloud.language.v1.Entity) AnalyzeEntitiesRequest(com.google.cloud.language.v1.AnalyzeEntitiesRequest) EntityMention(com.google.cloud.language.v1.EntityMention) AnalyzeEntitiesResponse(com.google.cloud.language.v1.AnalyzeEntitiesResponse) Document(com.google.cloud.language.v1.Document) Map(java.util.Map)

Example 35 with Entity

use of net.minecraft.server.v1_11_R1.Entity in project java-docs-samples by GoogleCloudPlatform.

the class Analyze method entitySentimentFile.

/**
 * Identifies the entity sentiments in the the GCS hosted file using the Language Beta API.
 */
public static void entitySentimentFile(String gcsUri) throws Exception {
    // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
    try (LanguageServiceClient language = LanguageServiceClient.create()) {
        Document doc = Document.newBuilder().setGcsContentUri(gcsUri).setType(Type.PLAIN_TEXT).build();
        AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder().setDocument(doc).setEncodingType(EncodingType.UTF16).build();
        // Detect entity sentiments in the given file
        AnalyzeEntitySentimentResponse response = language.analyzeEntitySentiment(request);
        // Print the response
        for (Entity entity : response.getEntitiesList()) {
            System.out.printf("Entity: %s\n", entity.getName());
            System.out.printf("Salience: %.3f\n", entity.getSalience());
            System.out.printf("Sentiment : %s\n", entity.getSentiment());
            for (EntityMention mention : entity.getMentionsList()) {
                System.out.printf("Begin offset: %d\n", mention.getText().getBeginOffset());
                System.out.printf("Content: %s\n", mention.getText().getContent());
                System.out.printf("Magnitude: %.3f\n", mention.getSentiment().getMagnitude());
                System.out.printf("Sentiment score : %.3f\n", mention.getSentiment().getScore());
                System.out.printf("Type: %s\n\n", mention.getType());
            }
        }
    }
// [END entity_sentiment_file]
}
Also used : LanguageServiceClient(com.google.cloud.language.v1.LanguageServiceClient) Entity(com.google.cloud.language.v1.Entity) EntityMention(com.google.cloud.language.v1.EntityMention) AnalyzeEntitySentimentRequest(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) Document(com.google.cloud.language.v1.Document) AnalyzeEntitySentimentResponse(com.google.cloud.language.v1.AnalyzeEntitySentimentResponse)

Aggregations

SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)41 LivingEntity (org.bukkit.entity.LivingEntity)41 CraftEntity (org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity)17 net.minecraft.world.entity (net.minecraft.world.entity)16 org.bukkit.entity (org.bukkit.entity)16 Entity (net.minecraft.server.v1_12_R1.Entity)13 Entity (com.google.datastore.v1.Entity)12 Entity (net.minecraft.server.v1_11_R1.Entity)12 Entity (net.minecraft.server.v1_8_R3.Entity)11 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)10 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)9 PathEntity (net.minecraft.server.v1_8_R3.PathEntity)9 CraftEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)9 Entity (net.minecraft.server.v1_10_R1.Entity)8 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)8 Mob (net.minecraft.world.entity.Mob)8 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)8 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)8 Test (org.junit.Test)8 Key (com.google.datastore.v1.Key)7