Search in sources :

Example 1 with World

use of net.minecraft.server.v1_13_R2.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_8_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld)

Example 2 with World

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

Example 3 with World

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

Example 4 with World

use of net.minecraft.server.v1_13_R2.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 : 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 5 with World

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

Aggregations

Location (org.bukkit.Location)26 World (net.minecraft.server.v1_16_R3.World)16 World (net.minecraft.server.v1_12_R1.World)14 World (net.minecraft.server.v1_8_R3.World)14 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_16_R3.CraftWorld)14 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)14 ArrayList (java.util.ArrayList)11 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 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 Collections (java.util.Collections)8