use of org.bukkit.craftbukkit.v1_9_R2.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);
}
}
}
use of org.bukkit.craftbukkit.v1_9_R2.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;
}
use of org.bukkit.craftbukkit.v1_9_R2.CraftWorld in project MyPet by xXKeyleXx.
the class PlatformHelper method getBlockBBsInBB.
@SuppressWarnings("unchecked")
public List getBlockBBsInBB(World world, AxisAlignedBB axisalignedbb) {
UnsafeList unsafeList = new UnsafeList();
int minX = MathHelper.floor(axisalignedbb.a);
int maxX = (int) Math.ceil(axisalignedbb.d);
int minY = MathHelper.floor(axisalignedbb.b);
int maxY = (int) Math.ceil(axisalignedbb.e);
int minZ = MathHelper.floor(axisalignedbb.c);
int maxZ = (int) Math.ceil(axisalignedbb.f);
for (int x = minX; x <= maxX; x++) {
for (int z = minZ; z <= maxZ; z++) {
if (world.isChunkLoaded(x >> 4, z >> 4)) {
for (int y = minY - 1; y <= maxY; y++) {
Block block = CraftMagicNumbers.getBlock(world.getBlockAt(x, y, z));
if (block != null && block.getBlockData().getMaterial().isSolid()) {
block.a(block.getBlockData(), ((CraftWorld) world).getHandle(), new BlockPosition(x, y, z), axisalignedbb, unsafeList, null);
}
}
}
}
}
return unsafeList;
}
use of org.bukkit.craftbukkit.v1_9_R2.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;
}
use of org.bukkit.craftbukkit.v1_9_R2.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;
}
Aggregations