cn.nukkit.entity.projectile.EntityEnderPearl Java Examples

The following examples show how to use cn.nukkit.entity.projectile.EntityEnderPearl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Server.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
private void registerEntities() {
    //mob
    Entity.registerEntity("Blaze", EntityBlaze.class);
    Entity.registerEntity("CaveSpider", EntityCaveSpider.class);
    Entity.registerEntity("Creeper", EntityCreeper.class);
    Entity.registerEntity("Enderman", EntityEnderman.class);
    Entity.registerEntity("Endermite", EntityEndermite.class);
    Entity.registerEntity("Evoker", EntityEvoker.class);
    Entity.registerEntity("Ghast", EntityGhast.class);
    Entity.registerEntity("Guardian", EntityGuardian.class);
    Entity.registerEntity("Hask", EntityHask.class);
    Entity.registerEntity("MagmaCube", EntityMagmaCube.class);
    Entity.registerEntity("Shulker", EntityShulker.class);
    Entity.registerEntity("Silverfish", EntitySilverfish.class);
    Entity.registerEntity("Skeleton", EntitySkeleton.class);
    Entity.registerEntity("Slime", EntitySlime.class);
    Entity.registerEntity("Spider", EntitySpider.class);
    Entity.registerEntity("Stray", EntityStray.class);
    Entity.registerEntity("Vex", EntityVex.class);
    Entity.registerEntity("Vindicator", EntityVindicator.class);
    Entity.registerEntity("Witch", EntityWitch.class);
    Entity.registerEntity("WitherSkeleton", EntityWitherSkeleton.class);
    Entity.registerEntity("Zombie", EntityZombie.class);
    Entity.registerEntity("ZombiePigman", EntityZombiePigman.class);
    Entity.registerEntity("ZombieVillager", EntityZombieVillager.class);
    //passive
    Entity.registerEntity("Bat", EntityBat.class);
    Entity.registerEntity("Chicken", EntityChicken.class);
    Entity.registerEntity("Cow", EntityCow.class);
    Entity.registerEntity("Donkey", EntityDonkey.class);
    Entity.registerEntity("Horse", EntityHorse.class);
    Entity.registerEntity("IronGolem", EntityIronGolem.class);
    Entity.registerEntity("Llama", EntityLlama.class);
    Entity.registerEntity("Mooshroom", EntityMooshroom.class);
    Entity.registerEntity("Mule", EntityMule.class);
    Entity.registerEntity("Ocelot", EntityOcelot.class);
    Entity.registerEntity("Parrot", EntityParrot.class);
    Entity.registerEntity("Pig", EntityPig.class);
    Entity.registerEntity("PolarBear", EntityPolarBear.class);
    Entity.registerEntity("Rabbit", EntityRabbit.class);
    Entity.registerEntity("Sheep", EntitySheep.class);
    Entity.registerEntity("SkeletonHorse", EntitySkeletonHorse.class);
    Entity.registerEntity("SnowGolem", EntitySnowGolem.class);
    Entity.registerEntity("Squid", EntitySquid.class);
    Entity.registerEntity("Villager", EntityVillager.class);
    Entity.registerEntity("Wolf", EntityWolf.class);
    Entity.registerEntity("ZombieHorse", EntityZombieHorse.class);

    //Bosses
    Entity.registerEntity("ElderGuardian", EntityElderGuardian.class);
    Entity.registerEntity("EnderDragon", EntityEnderDragon.class);
    Entity.registerEntity("EnderWither", EntityWither.class);

    //item
    Entity.registerEntity("ArmorStand", EntityArmorStand.class);
    Entity.registerEntity("EnderCrystal", EntityEnderCrystal.class);
    Entity.registerEntity("FallingSand", EntityFallingBlock.class);
    Entity.registerEntity("PrimedTnt", EntityPrimedTNT.class);
    Entity.registerEntity("Painting", EntityPainting.class);
    Entity.registerEntity("XpOrb", EntityXPOrb.class);
    Entity.registerEntity("MinecartRideable", EntityMinecartEmpty.class);
    Entity.registerEntity("MinecartChest", EntityMinecartChest.class);
    Entity.registerEntity("MinecartHopper", EntityMinecartHopper.class);
    Entity.registerEntity("MinecartTnt", EntityMinecartTNT.class);
    Entity.registerEntity("Boat", EntityBoat.class);

    //projectile
    Entity.registerEntity("Arrow", EntityArrow.class);
    Entity.registerEntity("DragonFireball", EntityDragonFireball.class);
    Entity.registerEntity("Egg", EntityEgg.class);
    Entity.registerEntity("EnderPearl", EntityEnderPearl.class);
    Entity.registerEntity("ThrownExpBottle", EntityExpBottle.class);
    Entity.registerEntity("Fireball", EntityFireball.class);
    Entity.registerEntity("FireworkRocket", EntityFireworkRocket.class);
    Entity.registerEntity("FishingHook", EntityFishingHook.class);
    Entity.registerEntity("ThrownPotion", EntityPotion.class);
    Entity.registerEntity("ThrownLingeringPotion", EntityPotionLingering.class);
    Entity.registerEntity("ShulkerBullet", EntityShulkerBullet.class);
    Entity.registerEntity("Snowball", EntitySnowball.class);

    //weather
    Entity.registerEntity("Lightning", EntityLightning.class);

    //other
    Entity.registerEntity("Human", EntityHuman.class, true);
}
 
Example #2
Source File: ProjectileItem.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public boolean onClickAir(Player player, Vector3 directionVector) {
    CompoundTag nbt = new CompoundTag()
            .putList(new ListTag<DoubleTag>("Pos")
                    .add(new DoubleTag("", player.x))
                    .add(new DoubleTag("", player.y + player.getEyeHeight() - 0.30000000149011612))
                    .add(new DoubleTag("", player.z)))
            .putList(new ListTag<DoubleTag>("Motion")
                    .add(new DoubleTag("", directionVector.x))
                    .add(new DoubleTag("", directionVector.y))
                    .add(new DoubleTag("", directionVector.z)))
            .putList(new ListTag<FloatTag>("Rotation")
                    .add(new FloatTag("", (float) player.yaw))
                    .add(new FloatTag("", (float) player.pitch)));

    this.correctNBT(nbt);

    Entity projectile = Entity.createEntity(this.getProjectileEntityType(), player.getLevel().getChunk(player.getFloorX() >> 4, player.getFloorZ() >> 4), nbt, player);
    if (projectile != null) {
        if (projectile instanceof EntityEnderPearl) {
            if (player.getServer().getTick() - player.getLastEnderPearlThrowingTick() < 20) {
                projectile.kill();
                return false;
            }
        }

        projectile.setMotion(projectile.getMotion().multiply(this.getThrowForce()));

        if (projectile instanceof EntityProjectile) {
            ProjectileLaunchEvent ev = new ProjectileLaunchEvent((EntityProjectile) projectile);

            player.getServer().getPluginManager().callEvent(ev);
            if (ev.isCancelled()) {
                projectile.kill();
            } else {
                if (!player.isCreative()) {
                    this.count--;
                }
                if (projectile instanceof EntityEnderPearl) {
                    player.onThrowEnderPearl();
                }
                projectile.spawnToAll();
                player.getLevel().addLevelSoundEvent(player, LevelSoundEventPacket.SOUND_BOW);
            }
        }
    } else {
        return false;
    }
    return true;
}
 
Example #3
Source File: Server.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
private void registerEntities() {
    Entity.registerEntity("Arrow", EntityArrow.class);
    Entity.registerEntity("Item", EntityItem.class);
    Entity.registerEntity("FallingSand", EntityFallingBlock.class);
    Entity.registerEntity("PrimedTnt", EntityPrimedTNT.class);
    Entity.registerEntity("Snowball", EntitySnowball.class);
    Entity.registerEntity("EnderPearl", EntityEnderPearl.class);
    Entity.registerEntity("Painting", EntityPainting.class);
    //Monsters
    Entity.registerEntity("Creeper", EntityCreeper.class);
    Entity.registerEntity("Blaze", EntityBlaze.class);
    Entity.registerEntity("CaveSpider", EntityCaveSpider.class);
    Entity.registerEntity("ElderGuardian", EntityElderGuardian.class);
    Entity.registerEntity("EnderDragon", EntityEnderDragon.class);
    Entity.registerEntity("Enderman", EntityEnderman.class);
    Entity.registerEntity("Endermite", EntityEndermite.class);
    Entity.registerEntity("Evoker", EntityEvoker.class);
    Entity.registerEntity("Ghast", EntityGhast.class);
    Entity.registerEntity("Guardian", EntityGuardian.class);
    Entity.registerEntity("Husk", EntityHusk.class);
    Entity.registerEntity("MagmaCube", EntityMagmaCube.class);
    Entity.registerEntity("Shulker", EntityShulker.class);
    Entity.registerEntity("Silverfish", EntitySilverfish.class);
    Entity.registerEntity("Skeleton", EntitySkeleton.class);
    Entity.registerEntity("SkeletonHorse", EntitySkeletonHorse.class);
    Entity.registerEntity("Slime", EntitySlime.class);
    Entity.registerEntity("Spider", EntitySpider.class);
    Entity.registerEntity("Stray", EntityStray.class);
    Entity.registerEntity("Vindicator", EntityVindicator.class);
    Entity.registerEntity("Vex", EntityVex.class);
    Entity.registerEntity("WitherSkeleton", EntityWitherSkeleton.class);
    Entity.registerEntity("Wither", EntityWither.class);
    Entity.registerEntity("Witch", EntityWitch.class);
    Entity.registerEntity("ZombiePigman", EntityZombiePigman.class);
    Entity.registerEntity("ZombieVillager", EntityZombieVillager.class);
    Entity.registerEntity("Zombie", EntityZombie.class);

    //Passive
    Entity.registerEntity("Bat", EntityBat.class);
    Entity.registerEntity("Chicken", EntityChicken.class);
    Entity.registerEntity("Cow", EntityCow.class);
    Entity.registerEntity("Donkey", EntityDonkey.class);
    Entity.registerEntity("Horse", EntityHorse.class);
    Entity.registerEntity("Llama", EntityLlama.class);
    Entity.registerEntity("Mooshroom", EntityMooshroom.class);
    Entity.registerEntity("Mule", EntityMule.class);
    Entity.registerEntity("PolarBear", EntityPolarBear.class);
    Entity.registerEntity("Pig", EntityPig.class);
    Entity.registerEntity("Rabbit", EntityRabbit.class);
    Entity.registerEntity("Sheep", EntitySheep.class);
    Entity.registerEntity("Squid", EntitySquid.class);
    Entity.registerEntity("Wolf", EntityWolf.class);
    Entity.registerEntity("Ocelot", EntityOcelot.class);
    Entity.registerEntity("Villager", EntityVillager.class);

    Entity.registerEntity("ThrownExpBottle", EntityExpBottle.class);
    Entity.registerEntity("XpOrb", EntityXPOrb.class);
    Entity.registerEntity("ThrownPotion", EntityPotion.class);
    Entity.registerEntity("Egg", EntityEgg.class);

    Entity.registerEntity("Human", EntityHuman.class, true);

    Entity.registerEntity("MinecartRideable", EntityMinecartEmpty.class);
    // TODO: 2016/1/30 all finds of minecart
    Entity.registerEntity("Boat", EntityBoat.class);

    //Entity.registerEntity("Lightning", EntityLightning.class); lightning shouldn't be saved as entity
}