Search in sources :

Example 66 with Entity

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();
}
Also used : Entity(net.minecraft.server.v1_16_R2.Entity) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R2.entity.CraftLivingEntity) LivingEntity(org.bukkit.entity.LivingEntity) TileEntity(net.minecraft.server.v1_16_R2.TileEntity) GroupDataEntity(net.minecraft.server.v1_16_R2.GroupDataEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity) BlockPosition(net.minecraft.server.v1_16_R2.BlockPosition) World(org.bukkit.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Example 67 with Entity

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;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_9_R2.AxisAlignedBB) Entity(org.bukkit.entity.Entity) CraftEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity) EntityBoat(net.minecraft.server.v1_9_R2.EntityBoat) CraftEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity) Iterator(java.util.Iterator) List(java.util.List) EntityShulker(net.minecraft.server.v1_9_R2.EntityShulker)

Example 68 with Entity

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;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_9_R2.AxisAlignedBB) LivingEntity(org.bukkit.entity.LivingEntity) CraftEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity)

Example 69 with Entity

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;
}
Also used : CollectionLoader(io.jmix.ui.model.CollectionLoader) ValueSource(io.jmix.ui.component.data.ValueSource) ThemeClassNames(io.jmix.ui.theme.ThemeClassNames) CollectionContainer(io.jmix.ui.model.CollectionContainer) Date(java.util.Date) Collection(java.util.Collection) Autowired(org.springframework.beans.factory.annotation.Autowired) ContainerDataGridItems(io.jmix.ui.component.data.datagrid.ContainerDataGridItems) ExcelExportAction(io.jmix.uiexport.action.ExcelExportAction) Notifications(io.jmix.ui.Notifications) JmixIcon(io.jmix.ui.icon.JmixIcon) DateUtils(org.apache.commons.lang3.time.DateUtils) UiComponents(io.jmix.ui.UiComponents) Icons(io.jmix.ui.icon.Icons) io.jmix.ui.screen(io.jmix.ui.screen) ui.ex1.entity(ui.ex1.entity) Map(java.util.Map) BaseAction(io.jmix.ui.action.BaseAction) Named(javax.inject.Named) io.jmix.ui.component(io.jmix.ui.component) BaseAction(io.jmix.ui.action.BaseAction)

Example 70 with Entity

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()));
    }
}
Also used : Entity(com.google.datastore.v1.Entity) TupleTagList(org.apache.beam.sdk.values.TupleTagList) PCollectionTuple(org.apache.beam.sdk.values.PCollectionTuple) Map(java.util.Map)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)95 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)88 net.minecraft.world.entity (net.minecraft.world.entity)32 org.bukkit.entity (org.bukkit.entity)32 Entity (com.google.datastore.v1.Entity)31 Location (org.bukkit.Location)30 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)21 Entity (net.minecraft.server.v1_12_R1.Entity)20 Entity (net.minecraft.server.v1_16_R3.Entity)19 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)18 Entity (net.minecraft.server.v1_8_R3.Entity)17 Entity (net.minecraft.server.v1_11_R1.Entity)16 Mob (net.minecraft.world.entity.Mob)16 CraftEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity)16 org.bukkit.craftbukkit.v1_17_R1.entity (org.bukkit.craftbukkit.v1_17_R1.entity)16 Player (org.bukkit.entity.Player)15 PathEntity (net.minecraft.server.v1_16_R3.PathEntity)13 Entity (net.minecraft.server.v1_15_R1.Entity)12 Entity (net.minecraft.server.v1_13_R2.Entity)11