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();
}
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);
}
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());
}
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();
}
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);
}
}
Aggregations