use of net.minecraft.server.v1_9_R2.Entity in project RoseStacker by Rosewood-Development.
the class NMSHandlerImpl method createNewEntityUnspawned.
@Override
public LivingEntity createNewEntityUnspawned(EntityType entityType, Location location, SpawnReason spawnReason) {
World world = location.getWorld();
if (world == null)
return null;
Class<? extends org.bukkit.entity.Entity> entityClass = entityType.getEntityClass();
if (entityClass == null || !LivingEntity.class.isAssignableFrom(entityClass))
throw new IllegalArgumentException("EntityType must be of a LivingEntity");
EntityTypes<? extends Entity> nmsEntityType = IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(entityType.getKey()));
Entity nmsEntity = this.createCreature(nmsEntityType, ((CraftWorld) world).getHandle(), null, null, null, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), this.toNmsSpawnReason(spawnReason));
return nmsEntity == null ? null : (LivingEntity) nmsEntity.getBukkitEntity();
}
use of net.minecraft.server.v1_9_R2.Entity in project NoCheatPlus by NoCheatPlus.
the class BlockCacheSpigotCB1_9_R2 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_9_R2.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_9_R2.Entity other = (net.minecraft.server.v1_9_R2.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_9_R2.Entity in project NoCheatPlus by NoCheatPlus.
the class MCAccessSpigotCB1_9_R2 method getHeight.
@Override
public double getHeight(final Entity entity) {
final net.minecraft.server.v1_9_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
AxisAlignedBB boundingBox = mcEntity.getBoundingBox();
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.getHeadHeight(), boundingBox.e - boundingBox.b));
if (entity instanceof LivingEntity) {
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
} else {
return entityHeight;
}
}
use of net.minecraft.server.v1_9_R2.Entity in project jmix-docs by Haulmont.
the class DataGridScreen method createCloseButton.
// end::details-generator[]
// tag::create-close-button[]
protected Component createCloseButton(Customer entity) {
Button closeButton = uiComponents.create(Button.class);
closeButton.setIcon("font-icon:TIMES");
BaseAction closeAction = new BaseAction("closeAction").withHandler(actionPerformedEvent -> detailsGrid.setDetailsVisible(entity, false)).withCaption("");
closeButton.setAction(closeAction);
return closeButton;
}
use of net.minecraft.server.v1_9_R2.Entity in project nomulus by google.
the class BulkDeleteDatastorePipeline method setupPipeline.
// org.apache.beam.sdk.transforms.Reshuffle
@SuppressWarnings("deprecation")
private void setupPipeline(Pipeline pipeline) {
checkState(!FORBIDDEN_PROJECTS.contains(options.getProject()), "Bulk delete is forbidden in %s", options.getProject());
// Pre-allocated tags to label entities by kind. In the case of delete-all, we must use a guess.
TupleTagList deletionTags;
PCollection<String> kindsToDelete;
if (options.getKindsToDelete().equals("*")) {
deletionTags = getDeletionTags(options.getNumOfKindsHint());
kindsToDelete = pipeline.apply("DiscoverEntityKinds", discoverEntityKinds(options.getProject()));
} else {
ImmutableList<String> kindsToDeleteParam = parseKindsToDelete(options);
checkState(!kindsToDeleteParam.contains("*"), "The --kindsToDelete argument should not contain both '*' and other kinds.");
deletionTags = getDeletionTags(kindsToDeleteParam.size());
kindsToDelete = pipeline.apply("UseProvidedKinds", Create.of(kindsToDeleteParam));
}
// Map each kind to a tag. The "SplitByKind" stage below will group entities by kind using
// this mapping. In practice, this has been effective at avoiding entity group contentions.
PCollectionView<Map<String, TupleTag<Entity>>> kindToTagMapping = mapKindsToDeletionTags(kindsToDelete, deletionTags).apply("GetKindsToTagMap", View.asMap());
PCollectionTuple entities = kindsToDelete.apply("GenerateQueries", ParDo.of(new GenerateQueries())).apply("ReadEntities", DatastoreV1.read().withProjectId(options.getProject())).apply("SplitByKind", ParDo.of(new SplitEntities(kindToTagMapping)).withSideInputs(kindToTagMapping).withOutputTags(getOneDeletionTag("placeholder"), deletionTags));
for (TupleTag<?> tag : deletionTags.getAll()) {
entities.get((TupleTag<Entity>) tag).apply("RebalanceLoad", Reshuffle.viaRandomKey()).apply("DeleteEntities_" + tag.getId(), DatastoreIO.v1().deleteEntity().withProjectId(options.getProject()));
}
}
Aggregations