use of net.minecraft.server.v1_12_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;
}
use of net.minecraft.server.v1_12_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;
}
use of net.minecraft.server.v1_12_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]
}
use of net.minecraft.server.v1_12_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]
}
use of net.minecraft.server.v1_12_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;
}
Aggregations