* @param data to set to
* @return True if a block got changed, False if not
*/
public static boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, Material type, int data) {
boolean result = y >= 0 && y <= chunk.getWorld().getMaxHeight();
WorldServer world = CommonNMS.getNative(chunk.getWorld());
Block typeBlock = CommonNMS.getBlock(type);
if (result) {
result = ChunkRef.setBlock(Conversion.toChunkHandle.convert(chunk), x, y, z, typeBlock, data);
world.methodProfiler.a("checkLight");
world.z(x, y, z);
world.methodProfiler.b();
}
if (result) {
world.applyPhysics(x, y, z, typeBlock);
}
return result;
}