use of org.bukkit.craftbukkit.v1_10_R1.CraftWorld in project Denizen-For-Bukkit by DenizenScript.
the class CustomEntityHelper_v1_10_R1 method spawnFakeArrow.
@Override
public FakeArrow spawnFakeArrow(Location location) {
CraftWorld world = (CraftWorld) location.getWorld();
EntityFakeArrow_v1_10_R1 arrow = new EntityFakeArrow_v1_10_R1(world, location);
return arrow.getBukkitEntity();
}
use of org.bukkit.craftbukkit.v1_10_R1.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_10_R1.CraftWorld in project MyPet by xXKeyleXx.
the class EntityMySnowman method addAirBlocksInBB.
private void addAirBlocksInBB(org.bukkit.World bukkitWorld, AxisAlignedBB axisalignedbb) {
int minX = MathHelper.floor(axisalignedbb.a - 0.1);
int maxX = MathHelper.floor(axisalignedbb.d + 1.1D);
int minY = MathHelper.floor(axisalignedbb.b - 0.1);
int maxY = MathHelper.floor(axisalignedbb.e + 1.1D);
int minZ = MathHelper.floor(axisalignedbb.c - 0.1);
int maxZ = MathHelper.floor(axisalignedbb.f + 1.1D);
WorldServer world = ((CraftWorld) bukkitWorld).getHandle();
for (int x = minX; x < maxX; x++) {
for (int z = minZ; z < maxZ; z++) {
if (bukkitWorld.isChunkLoaded(x, z)) {
for (int y = minY - 1; y < maxY; y++) {
Block block = world.getType(new BlockPosition(x, y, z)).getBlock();
if (block == Blocks.AIR) {
snowMap.put(new Location(bukkitWorld, x, y, z), 10);
}
}
}
}
}
}
use of org.bukkit.craftbukkit.v1_10_R1.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 != ItemStack.a) {
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_10_R1.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