Search in sources :

Example 21 with CraftWorld

use of org.bukkit.craftbukkit.v1_7_R3.CraftWorld in project MyPet by xXKeyleXx.

the class CustomInventory method dropContentAt.

public void dropContentAt(Location loc) {
    World world = ((CraftWorld) loc.getWorld()).getHandle();
    for (int i = 0; i < this.getSize(); i++) {
        ItemStack is = this.splitWithoutUpdate(i);
        if (is != null) {
            is = is.cloneItemStack();
            EntityItem itemEntity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), is);
            itemEntity.pickupDelay = 20;
            world.addEntity(itemEntity);
        }
    }
}
Also used : CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 22 with CraftWorld

use of org.bukkit.craftbukkit.v1_7_R3.CraftWorld 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_9_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_9_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_9_R1.CraftWorld)

Example 23 with CraftWorld

use of org.bukkit.craftbukkit.v1_7_R3.CraftWorld 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 : CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld) World(net.minecraft.server.v1_9_R2.World) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 24 with CraftWorld

use of org.bukkit.craftbukkit.v1_7_R3.CraftWorld 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 : CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld) World(net.minecraft.server.v1_10_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 25 with CraftWorld

use of org.bukkit.craftbukkit.v1_7_R3.CraftWorld 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_11_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Aggregations

Location (org.bukkit.Location)13 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)10 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)9 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)9 CraftWorld (org.bukkit.craftbukkit.v1_9_R2.CraftWorld)9 CraftWorld (org.bukkit.craftbukkit.v1_7_R4.CraftWorld)5 CraftWorld (org.bukkit.craftbukkit.v1_8_R1.CraftWorld)5 CraftWorld (org.bukkit.craftbukkit.v1_8_R2.CraftWorld)5 GameProfile (com.mojang.authlib.GameProfile)4 Property (com.mojang.authlib.properties.Property)4 BigInteger (java.math.BigInteger)4 MessageDigest (java.security.MessageDigest)4 UUID (java.util.UUID)4 PlayerProfile (net.aufdemrand.denizen.nms.util.PlayerProfile)4 CraftWorld (org.bukkit.craftbukkit.v1_9_R1.CraftWorld)4 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)3 Scoreboard (org.bukkit.scoreboard.Scoreboard)3 Team (org.bukkit.scoreboard.Team)3 Field (java.lang.reflect.Field)2 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2