Search in sources :

Example 6 with World

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

Example 7 with World

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

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

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

Example 10 with World

use of net.minecraft.server.v1_9_R1.World in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_9_R1 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_9_R1.Block block = net.minecraft.server.v1_9_R1.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null blocks -> full ?
        return null;
    }
    final BlockPosition pos = new BlockPosition(x, y, z);
    final AxisAlignedBB bb = block.a(world.getType(pos), world, pos);
    if (bb == null) {
        // Special case.
        return new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 };
    // return null;
    }
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { bb.a, bb.b, bb.c, bb.d, bb.e, bb.f };
}
Also used : AxisAlignedBB(net.minecraft.server.v1_9_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_9_R1.BlockPosition)

Aggregations

CraftPlayer (org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer)5 Player (org.bukkit.entity.Player)5 PacketPlayOutTitle (net.minecraft.server.v1_9_R1.PacketPlayOutTitle)4 BlockPosition (net.minecraft.server.v1_9_R1.BlockPosition)3 CraftWorld (org.bukkit.craftbukkit.v1_9_R1.CraftWorld)3 World (net.minecraft.server.v1_7_R4.World)2 IBlockData (net.minecraft.server.v1_9_R1.IBlockData)2 World (net.minecraft.server.v1_10_R1.World)1 World (net.minecraft.server.v1_11_R1.World)1 World (net.minecraft.server.v1_12_R1.World)1 EntityArrow (net.minecraft.server.v1_7_R4.EntityArrow)1 World (net.minecraft.server.v1_8_R1.World)1 World (net.minecraft.server.v1_8_R2.World)1 World (net.minecraft.server.v1_8_R3.World)1 AxisAlignedBB (net.minecraft.server.v1_9_R1.AxisAlignedBB)1 PacketPlayOutChat (net.minecraft.server.v1_9_R1.PacketPlayOutChat)1 World (net.minecraft.server.v1_9_R1.World)1 World (net.minecraft.server.v1_9_R2.World)1 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)1 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)1