Search in sources :

Example 36 with CraftWorld

use of org.bukkit.craftbukkit.v1_18_R2.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();
}
Also used : TileEntityFlowerPot(net.minecraft.server.v1_7_R4.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_7_R4.CraftWorld) Location(org.bukkit.Location)

Example 37 with CraftWorld

use of org.bukkit.craftbukkit.v1_18_R2.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();
    }
}
Also used : EntityLightning(net.minecraft.server.v1_15_R1.EntityLightning) CraftLightningStrike(org.bukkit.craftbukkit.v1_15_R1.entity.CraftLightningStrike) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld) Location(org.bukkit.Location)

Example 38 with CraftWorld

use of org.bukkit.craftbukkit.v1_18_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 + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_16_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Example 39 with CraftWorld

use of org.bukkit.craftbukkit.v1_18_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 && 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);
        }
    }
}
Also used : CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftItemStack(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 40 with CraftWorld

use of org.bukkit.craftbukkit.v1_18_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 + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") 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)

Aggregations

ServerLevel (net.minecraft.server.level.ServerLevel)63 Location (org.bukkit.Location)56 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)42 ItemStack (org.bukkit.inventory.ItemStack)42 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)40 BlockPos (net.minecraft.core.BlockPos)36 Zombie (org.bukkit.entity.Zombie)32 LivingEntity (org.bukkit.entity.LivingEntity)29 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)28 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)28 ItemEntity (net.minecraft.world.entity.item.ItemEntity)27 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)26 HangingEntity (net.minecraft.world.entity.decoration.HangingEntity)25 FallingBlockEntity (net.minecraft.world.entity.item.FallingBlockEntity)25 FireworkRocketEntity (net.minecraft.world.entity.projectile.FireworkRocketEntity)25 SignBlockEntity (net.minecraft.world.level.block.entity.SignBlockEntity)25 Entity (org.bukkit.entity.Entity)25 HumanEntity (org.bukkit.entity.HumanEntity)25 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)23 CraftWorld (org.bukkit.craftbukkit.v1_9_R1.CraftWorld)17