use of org.bukkit.craftbukkit.v1_8_R1.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_8_R1.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_8_R1.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);
}
}
use of org.bukkit.craftbukkit.v1_8_R1.CraftWorld in project askyblock by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_10_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_10_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_10_R1.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
use of org.bukkit.craftbukkit.v1_8_R1.CraftWorld in project askyblock by tastybento.
the class NMSHandler method setBlockSuperFast.
@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_8_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
net.minecraft.server.v1_8_R3.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
int combined = blockId + (data << 12);
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
if (applyPhysics) {
w.setTypeAndData(bp, ibd, 3);
} else {
w.setTypeAndData(bp, ibd, 2);
}
chunk.a(bp, ibd);
}
Aggregations