use of net.minecraft.server.v1_12_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();
}
use of net.minecraft.server.v1_12_R1.Entity in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCBDev method standsOnEntity.
@Override
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ) {
try {
// TODO: Find some simplification!
final net.minecraft.server.v1_12_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
final AxisAlignedBB box = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
@SuppressWarnings("rawtypes") final List list = world.getEntities(mcEntity, box);
@SuppressWarnings("rawtypes") final Iterator iterator = list.iterator();
while (iterator.hasNext()) {
final net.minecraft.server.v1_12_R1.Entity other = (net.minecraft.server.v1_12_R1.Entity) iterator.next();
if (mcEntity == other || !(other instanceof EntityBoat) && !(other instanceof EntityShulker)) {
// && !(other instanceof EntityMinecart)) continue;
continue;
}
if (minY >= other.locY && minY - other.locY <= 0.7) {
return true;
}
// Still check this for some reason.
final AxisAlignedBB otherBox = other.getBoundingBox();
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) {
continue;
} else {
return true;
}
}
} catch (Throwable t) {
// Ignore exceptions (Context: DisguiseCraft).
}
return false;
}
use of net.minecraft.server.v1_12_R1.Entity in project beam by apache.
the class V1ReadIT method writeEntitiesToDatastore.
// Creates entities and write them to datastore
private static void writeEntitiesToDatastore(V1TestOptions options, String project, String ancestor, long numEntities) throws Exception {
Datastore datastore = getDatastore(options, project);
// Write test entities to datastore
V1TestWriter writer = new V1TestWriter(datastore, new UpsertMutationBuilder());
Key ancestorKey = makeAncestorKey(options.getNamespace(), options.getKind(), ancestor);
for (long i = 0; i < numEntities; i++) {
Entity entity = makeEntity(i, ancestorKey, options.getKind(), options.getNamespace(), 0);
writer.write(entity);
}
writer.close();
}
use of net.minecraft.server.v1_12_R1.Entity in project beam by apache.
the class V1TestUtil method deleteAllEntities.
/**
* Delete all entities with the given ancestor.
*/
static void deleteAllEntities(V1TestOptions options, String project, String ancestor) throws Exception {
Datastore datastore = getDatastore(options, project);
Query query = V1TestUtil.makeAncestorKindQuery(options.getKind(), options.getNamespace(), ancestor);
V1TestReader reader = new V1TestReader(datastore, query, options.getNamespace());
V1TestWriter writer = new V1TestWriter(datastore, new DeleteMutationBuilder());
long numEntities = 0;
while (reader.advance()) {
Entity entity = reader.getCurrent();
numEntities++;
writer.write(entity);
}
writer.close();
LOG.info("Successfully deleted {} entities", numEntities);
}
use of net.minecraft.server.v1_12_R1.Entity in project beam by apache.
the class DatastoreV1Test method makeLatestTimestampResponse.
/** Builds a response of the given timestamp. */
private static RunQueryResponse makeLatestTimestampResponse(long timestamp) {
RunQueryResponse.Builder timestampResponse = RunQueryResponse.newBuilder();
Entity.Builder entity = Entity.newBuilder();
entity.setKey(makeKey("dummyKind", "dummyId"));
entity.putProperties("timestamp", makeValue(new Date(timestamp * 1000)).build());
EntityResult.Builder entityResult = EntityResult.newBuilder();
entityResult.setEntity(entity);
QueryResultBatch.Builder batch = QueryResultBatch.newBuilder();
batch.addEntityResults(entityResult);
timestampResponse.setBatch(batch);
return timestampResponse.build();
}
Aggregations