@SuppressWarnings("deprecation") @Override public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) { net.minecraft.server.v1_7_R4.World w = ((CraftWorld) b.getWorld()).getHandle(); net.minecraft.server.v1_7_R4.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_R4.Block mb = net.minecraft.server.v1_7_R4.Block.getById(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); } }
@Override public boolean setBlockFast(World world, int x, int y, int z, int blockId, byte data) { net.minecraft.server.v1_7_R4.World w = ((CraftWorld) world).getHandle(); Chunk chunk = w.getChunkAt(x >> 4, z >> 4); return chunk.a(x & 0x0f, y, z & 0x0f, Block.getById(blockId), data); }