use of org.bukkit.craftbukkit.v1_17_R1.CraftWorld in project acidisland by tastybento.
the class NMSHandler method setFlowerPotBlock.
/* (non-Javadoc)
* @see com.wasteofplastic.askyblock.nms.NMSAbstraction#setBlock(org.bukkit.block.Block, org.bukkit.inventory.ItemStack)
* Credis: Mister_Frans (THANK YOU VERY MUCH !)
*/
@Override
public void setFlowerPotBlock(Block block, ItemStack itemStack) {
Location loc = block.getLocation();
CraftWorld cw = (CraftWorld) block.getWorld();
TileEntityFlowerPot te = (TileEntityFlowerPot) cw.getHandle().getTileEntity(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
// Bukkit.getLogger().info("Debug: flowerpot materialdata = " + (new ItemStack(potItem, 1,(short) potItemData).toString()));
net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
te.a(cis.getItem(), cis.getData());
te.update();
}
use of org.bukkit.craftbukkit.v1_17_R1.CraftWorld in project solinia3-core by mixxit.
the class SpecialEffectUtils method playLightningStrike.
public static void playLightningStrike(Entity entity) {
try {
Location loc = entity.getLocation();
net.minecraft.server.v1_15_R1.WorldServer world = ((CraftWorld) loc.getWorld()).getHandle();
EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true, true);
world.strikeLightning(lightning);
new CraftLightningStrike(world.getServer(), lightning);
return;
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.bukkit.craftbukkit.v1_17_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 + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
e.printStackTrace();
}
return petEntity;
}
use of org.bukkit.craftbukkit.v1_17_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 && CraftMagicNumbers.getMaterial(is.getItem()) != org.bukkit.Material.AIR) {
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_17_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 + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
e.printStackTrace();
}
return petEntity;
}
Aggregations