Search in sources :

Example 56 with World

use of net.minecraft.server.v1_15_R1.World in project PaperDev by Kamillaova.

the class CraftRabbit method setRabbitType.

@Override
public void setRabbitType(Type type) {
    EntityRabbit entity = getHandle();
    if (getRabbitType() == Type.THE_KILLER_BUNNY) {
        // Reset goals and target finders.
        World world = ((CraftWorld) this.getWorld()).getHandle();
        entity.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
        entity.targetSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
        entity.initializePathFinderGoals();
    }
    entity.setRabbitType(CraftMagicMapping.toMagic(type));
}
Also used : EntityRabbit(net.minecraft.server.v1_12_R1.EntityRabbit) PathfinderGoalSelector(net.minecraft.server.v1_12_R1.PathfinderGoalSelector) World(net.minecraft.server.v1_12_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 57 with World

use of net.minecraft.server.v1_15_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 58 with World

use of net.minecraft.server.v1_15_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_12_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 59 with World

use of net.minecraft.server.v1_15_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + entityClass.getName() + " is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_7_R4.World) CraftWorld(org.bukkit.craftbukkit.v1_7_R4.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_7_R4.CraftWorld)

Example 60 with World

use of net.minecraft.server.v1_15_R1.World in project MyPet by xXKeyleXx.

the class RangedAttack method shootProjectile.

public void shootProjectile(EntityLiving target, float damage, Projectiles projectile) {
    World world = target.world;
    if (projectile == Projectiles.Arrow) {
        EntityArrow arrow = new MyPetArrow(world, entityMyPet, target, 1.6F, 1);
        arrow.b(damage);
        arrow.setCritical(false);
        double distanceX = target.locX - entityMyPet.locX;
        double distanceY = target.locY + target.getHeadHeight() - 1.100000023841858D - arrow.locY;
        double distanceZ = target.locZ - entityMyPet.locZ;
        float distance20percent = MathHelper.sqrt(distanceX * distanceX + distanceZ * distanceZ) * 0.2F;
        arrow.shoot(distanceX, distanceY + distance20percent, distanceZ, 1.6F, 1);
        entityMyPet.makeSound("random.bow", 1.0F, 1.0F / (entityMyPet.getRandom().nextFloat() * 0.4F + 0.8F));
        world.addEntity(arrow);
    } else if (projectile == Projectiles.Snowball) {
        MyPetSnowball snowball = new MyPetSnowball(world, entityMyPet);
        double distanceX = target.locX - entityMyPet.locX;
        double distanceY = target.locY + target.getHeadHeight() - 1.100000023841858D - snowball.locY;
        double distanceZ = target.locZ - entityMyPet.locZ;
        float distance20percent = MathHelper.sqrt(distanceX * distanceX + distanceZ * distanceZ) * 0.2F;
        snowball.setDamage(damage);
        snowball.shoot(distanceX, distanceY + distance20percent, distanceZ, 1.6F, 1);
        entityMyPet.makeSound("random.bow", 0.5F, 0.4F / (entityMyPet.getRandom().nextFloat() * 0.4F + 0.8F));
        world.addEntity(snowball);
    } else if (projectile == Projectiles.Egg) {
        MyPetEgg egg = new MyPetEgg(world, entityMyPet);
        double distanceX = target.locX - entityMyPet.locX;
        double distanceY = target.locY + target.getHeadHeight() - 1.100000023841858D - egg.locY;
        double distanceZ = target.locZ - entityMyPet.locZ;
        float distance20percent = MathHelper.sqrt(distanceX * distanceX + distanceZ * distanceZ) * 0.2F;
        egg.setDamage(damage);
        egg.shoot(distanceX, distanceY + distance20percent, distanceZ, 1.6F, 1);
        entityMyPet.makeSound("random.bow", 0.5F, 0.4F / (entityMyPet.getRandom().nextFloat() * 0.4F + 0.8F));
        world.addEntity(egg);
    } else if (projectile == Projectiles.LargeFireball) {
        double distanceX = this.target.locX - entityMyPet.locX;
        double distanceY = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (0.5D + entityMyPet.locY + (double) (entityMyPet.length / 2.0F));
        double distanceZ = this.target.locZ - entityMyPet.locZ;
        MyPetLargeFireball largeFireball = new MyPetLargeFireball(world, entityMyPet, distanceX, distanceY, distanceZ);
        largeFireball.locY = (entityMyPet.locY + entityMyPet.length / 2.0F + 0.5D);
        largeFireball.setDamage(damage);
        world.addEntity(largeFireball);
        world.makeSound(entityMyPet.locX + 0.5D, entityMyPet.locY + 0.5D, entityMyPet.locZ + 0.5D, "mob.ghast.fireball", 1.0F + entityMyPet.getRandom().nextFloat(), entityMyPet.getRandom().nextFloat() * 0.7F + 0.3F);
    } else if (projectile == Projectiles.SmallFireball) {
        double distanceX = this.target.locX - entityMyPet.locX;
        double distanceY = this.target.boundingBox.b + (this.target.length / 2.0F) - (0.5D + entityMyPet.locY + (entityMyPet.length / 2.0F));
        double distanceZ = this.target.locZ - entityMyPet.locZ;
        MyPetSmallFireball smallFireball = new MyPetSmallFireball(world, entityMyPet, distanceX, distanceY, distanceZ);
        smallFireball.locY = (entityMyPet.locY + entityMyPet.length / 2.0F + 0.5D);
        smallFireball.setDamage(damage);
        world.addEntity(smallFireball);
        world.makeSound(entityMyPet.locX + 0.5D, entityMyPet.locY + 0.5D, entityMyPet.locZ + 0.5D, "mob.ghast.fireball", 1.0F + entityMyPet.getRandom().nextFloat(), entityMyPet.getRandom().nextFloat() * 0.7F + 0.3F);
    } else if (projectile == Projectiles.WitherSkull) {
        double distanceX = this.target.locX - entityMyPet.locX;
        double distanceY = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (0.5D + entityMyPet.locY + (double) (entityMyPet.length / 2.0F));
        double distanceZ = this.target.locZ - entityMyPet.locZ;
        MyPetWitherSkull witherSkull = new MyPetWitherSkull(world, entityMyPet, distanceX, distanceY, distanceZ);
        witherSkull.locY = (entityMyPet.locY + entityMyPet.length / 2.0F + 0.5D);
        witherSkull.setDamage(damage);
        world.addEntity(witherSkull);
        world.makeSound(entityMyPet.locX + 0.5D, entityMyPet.locY + 0.5D, entityMyPet.locZ + 0.5D, "mob.wither.shoot", 1.0F + entityMyPet.getRandom().nextFloat(), entityMyPet.getRandom().nextFloat() * 0.7F + 0.3F);
    }
}
Also used : EntityArrow(net.minecraft.server.v1_7_R4.EntityArrow) World(net.minecraft.server.v1_7_R4.World)

Aggregations

Location (org.bukkit.Location)27 World (net.minecraft.server.v1_16_R3.World)16 World (net.minecraft.server.v1_12_R1.World)15 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)15 World (net.minecraft.server.v1_8_R3.World)14 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)14 ArrayList (java.util.ArrayList)12 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)11 List (java.util.List)10 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)10 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)10 CraftWorld (org.bukkit.craftbukkit.v1_15_R1.CraftWorld)10 WildLoadersPlugin (com.bgsoftware.wildloaders.WildLoadersPlugin)8 Hologram (com.bgsoftware.wildloaders.api.holograms.Hologram)8 ChunkLoader (com.bgsoftware.wildloaders.api.loaders.ChunkLoader)8 ChunkLoaderNPC (com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC)8 ITileEntityChunkLoader (com.bgsoftware.wildloaders.loaders.ITileEntityChunkLoader)8 WChunkLoader (com.bgsoftware.wildloaders.loaders.WChunkLoader)8 Collection (java.util.Collection)8