Search in sources :

Example 66 with CraftWorld

use of org.bukkit.craftbukkit.v1_16_R3.CraftWorld in project Village_Defense by Plajer.

the class ArenaInitializer1_11_R1 method spawnHalfInvisibleZombie.

@Override
public void spawnHalfInvisibleZombie(Random random) {
    Location location = zombieSpawns.get(random.nextInt(zombieSpawns.size()));
    net.minecraft.server.v1_11_R1.World McWorld = ((CraftWorld) location.getWorld()).getHandle();
    FastZombie fastZombie = new FastZombie(location.getWorld());
    fastZombie.setPosition(location.getX(), location.getY(), location.getZ());
    McWorld.addEntity(fastZombie, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) fastZombie.getBukkitEntity();
    zombie.setRemoveWhenFarAway(false);
    zombie.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
    zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
    CreatureUtils.applyHealthBar(zombie);
    this.addZombie((Zombie) fastZombie.getBukkitEntity());
    CreatureUtils.applyMetadata(fastZombie.getBukkitEntity(), this);
    super.subtractZombiesToSpawn();
}
Also used : FastZombie(pl.plajer.villagedefense3.creatures.v1_11_R1.FastZombie) Zombie(org.bukkit.entity.Zombie) TankerZombie(pl.plajer.villagedefense3.creatures.v1_11_R1.TankerZombie) HardZombie(pl.plajer.villagedefense3.creatures.v1_11_R1.HardZombie) BabyZombie(pl.plajer.villagedefense3.creatures.v1_11_R1.BabyZombie) FastZombie(pl.plajer.villagedefense3.creatures.v1_11_R1.FastZombie) PotionEffect(org.bukkit.potion.PotionEffect) ItemStack(org.bukkit.inventory.ItemStack) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld) Location(org.bukkit.Location)

Example 67 with CraftWorld

use of org.bukkit.craftbukkit.v1_16_R3.CraftWorld in project Village_Defense by Plajer.

the class ArenaInitializer1_11_R1 method spawnVillager.

public void spawnVillager(Location location) {
    net.minecraft.server.v1_11_R1.World McWorld = ((CraftWorld) location.getWorld()).getHandle();
    RidableVillager ridableVillager = new RidableVillager(location.getWorld());
    ridableVillager.setPosition(location.getX(), location.getY(), location.getZ());
    McWorld.addEntity(ridableVillager, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Villager villager = (Villager) ridableVillager.getBukkitEntity();
    villager.setRemoveWhenFarAway(false);
    this.addVillager((Villager) ridableVillager.getBukkitEntity());
    CreatureUtils.applyMetadata(ridableVillager.getBukkitEntity(), this);
}
Also used : RidableVillager(pl.plajer.villagedefense3.creatures.v1_11_R1.RidableVillager) Villager(org.bukkit.entity.Villager) RidableVillager(pl.plajer.villagedefense3.creatures.v1_11_R1.RidableVillager) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 68 with CraftWorld

use of org.bukkit.craftbukkit.v1_16_R3.CraftWorld in project Village_Defense by Plajer.

the class ArenaInitializer1_11_R1 method spawnWolf.

public void spawnWolf(Location location, Player player) {
    net.minecraft.server.v1_11_R1.World McWorld = ((CraftWorld) location.getWorld()).getHandle();
    WorkingWolf wolf = new WorkingWolf(location.getWorld());
    wolf.setPosition(location.getX(), location.getY(), location.getZ());
    McWorld.addEntity(wolf, CreatureSpawnEvent.SpawnReason.CUSTOM);
    wolf.setCustomName(ChatManager.colorMessage("In-Game.Spawned-Wolf-Name").replaceAll("%player%", player.getName()));
    wolf.setCustomNameVisible(true);
    wolf.setInvisible(false);
    ((Wolf) wolf.getBukkitEntity()).setOwner(player);
    CreatureUtils.applyMetadata(wolf.getBukkitEntity(), this);
    this.addWolf((Wolf) wolf.getBukkitEntity());
}
Also used : WorkingWolf(pl.plajer.villagedefense3.creatures.v1_11_R1.WorkingWolf) WorkingWolf(pl.plajer.villagedefense3.creatures.v1_11_R1.WorkingWolf) Wolf(org.bukkit.entity.Wolf) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 69 with CraftWorld

use of org.bukkit.craftbukkit.v1_16_R3.CraftWorld in project askyblock 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 = " + itemStack.toString());
    net.minecraft.server.v1_7_R3.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
    te.a(cis.getItem(), cis.getData());
    te.update();
}
Also used : TileEntityFlowerPot(net.minecraft.server.v1_7_R3.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_7_R3.CraftWorld) Location(org.bukkit.Location)

Example 70 with CraftWorld

use of org.bukkit.craftbukkit.v1_16_R3.CraftWorld in project askyblock by tastybento.

the class NMSHandler method setBlockSuperFast.

@SuppressWarnings("deprecation")
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_7_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_7_R3.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    try {
        Field f = chunk.getClass().getDeclaredField("sections");
        f.setAccessible(true);
        ChunkSection[] sections = (ChunkSection[]) f.get(chunk);
        ChunkSection chunksection = sections[b.getY() >> 4];
        if (chunksection == null) {
            chunksection = sections[b.getY() >> 4] = new ChunkSection(b.getY() >> 4 << 4, !chunk.world.worldProvider.f);
        }
        net.minecraft.server.v1_7_R3.Block mb = net.minecraft.server.v1_7_R3.Block.e(blockId);
        chunksection.setTypeId(b.getX() & 15, b.getY() & 15, b.getZ() & 15, mb);
        chunksection.setData(b.getX() & 15, b.getY() & 15, b.getZ() & 15, data);
        if (applyPhysics) {
            w.update(b.getX(), b.getY(), b.getZ(), mb);
        }
    } catch (Exception e) {
        // Bukkit.getLogger().info("Error");
        b.setTypeIdAndData(blockId, data, applyPhysics);
    }
}
Also used : Field(java.lang.reflect.Field) CraftWorld(org.bukkit.craftbukkit.v1_7_R3.CraftWorld) ChunkSection(net.minecraft.server.v1_7_R3.ChunkSection)

Aggregations

Location (org.bukkit.Location)55 Zombie (org.bukkit.entity.Zombie)32 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)28 CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)28 ItemStack (org.bukkit.inventory.ItemStack)27 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)23 CraftWorld (org.bukkit.craftbukkit.v1_18_R1.CraftWorld)22 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)20 ServerLevel (net.minecraft.server.level.ServerLevel)18 CraftWorld (org.bukkit.craftbukkit.v1_9_R1.CraftWorld)17 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)16 GameProfile (com.mojang.authlib.GameProfile)11 UUID (java.util.UUID)11 Scoreboard (org.bukkit.scoreboard.Scoreboard)11 Team (org.bukkit.scoreboard.Team)11 CraftWorld (org.bukkit.craftbukkit.v1_9_R2.CraftWorld)8 BabyZombie (pl.plajer.villagedefense3.creatures.v1_9_R1.BabyZombie)8 FastZombie (pl.plajer.villagedefense3.creatures.v1_9_R1.FastZombie)8 HardZombie (pl.plajer.villagedefense3.creatures.v1_9_R1.HardZombie)8 TankerZombie (pl.plajer.villagedefense3.creatures.v1_9_R1.TankerZombie)8