当前位置: 首页>>代码示例>>Java>>正文


Java Schematic类代码示例

本文整理汇总了Java中com.boydti.fawe.object.schematic.Schematic的典型用法代码示例。如果您正苦于以下问题:Java Schematic类的具体用法?Java Schematic怎么用?Java Schematic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Schematic类属于com.boydti.fawe.object.schematic包,在下文中一共展示了Schematic类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import com.boydti.fawe.object.schematic.Schematic; //导入依赖的package包/类
@Override
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
    ClipboardHolder holder = clipboards.get(PseudoRandom.random.random(clipboards.size()));
    AffineTransform transform = new AffineTransform();
    if (randomRotate) {
        transform = transform.rotateY(PseudoRandom.random.random(4) * 90);
        holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
    }
    if (randomFlip) {
        transform = transform.scale(new Vector(1, 0, 0).multiply(-2).add(1, 1, 1));
    }
    if (!transform.isIdentity()) {
        holder.setTransform(transform);
    }
    Clipboard clipboard = holder.getClipboard();
    Schematic schematic = new Schematic(clipboard);
    Transform newTransform = holder.getTransform();
    if (newTransform.isIdentity()) {
        schematic.paste(extent, setPosition, false);
    } else {
        schematic.paste(extent, worldData, setPosition, false, newTransform);
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:25,代码来源:RandomFullClipboardPattern.java

示例2: spawn

import com.boydti.fawe.object.schematic.Schematic; //导入依赖的package包/类
@Override
public boolean spawn(PseudoRandom random, int x, int z) throws WorldEditException {
    mutable.mutX(x);
    mutable.mutZ(z);
    int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
    if (y == -1) return false;
    mutable.mutY(y);
    if (!mask.test(mutable)) {
        return false;
    }
    mutable.mutY(y + 1);
    ClipboardHolder holder = clipboards.get(PseudoRandom.random.random(clipboards.size()));
    if (randomRotate) {
        holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
    }
    Clipboard clipboard = holder.getClipboard();
    Schematic schematic = new Schematic(clipboard);
    Transform transform = holder.getTransform();
    if (transform.isIdentity()) {
        schematic.paste(extent, mutable, false);
    } else {
        schematic.paste(extent, worldData, mutable, false, transform);
    }
    mutable.mutY(y);
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:SchemGen.java

示例3: execute

import com.boydti.fawe.object.schematic.Schematic; //导入依赖的package包/类
@Override
protected void execute(Event e) {
	File file;

	if (name.getSingle(e).startsWith("/")) {
		file = new File(
				(name.getSingle(e) + ".schematic").replaceAll("/", Matcher.quoteReplacement(File.separator)));
	} else {
		file = new File(

				("plugins/WorldEdit/schematics/" + (name.getSingle(e).contains(".") ? name.getSingle(e)
						: new StringBuilder(String.valueOf(name.getSingle(e))).append(".schematic").toString()))
								.replaceAll("/", Matcher.quoteReplacement(File.separator)));
	}

	Vector v = new Vector(loc.getSingle(e).getBlockX(), loc.getSingle(e).getBlockY(), loc.getSingle(e).getBlockZ());
	Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit"),
			new Runnable() {

				@Override
				public void run() {
					try {
						Boolean excludeair = false;
						if (exair != null) {
							excludeair = exair.getSingle(e);
						}
						Schematic schem = FaweAPI.load(file);
						EditSession ext = schem.paste(new BukkitWorld(loc.getSingle(e).getWorld()), v, false,
								excludeair, null);

					} catch (IOException e1) {
						main core = (main) Bukkit.getPluginManager().getPlugin("SharpSK");
						core.getLogger().warning("Failed to paste schematic: " + "\"" + name.getSingle(e) + "\""
								+ " An error occurred");
						return;
					}
				}

			});
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:41,代码来源:EffFAWEPasteSchematic.java

示例4: regenerate

import com.boydti.fawe.object.schematic.Schematic; //导入依赖的package包/类
@Override
public void regenerate(Floor floor, EditSession session, RegenerationCause cause) {
    Clipboard clipboard = floor.getClipboard();
    Schematic faweSchematic = new Schematic(clipboard);

    Region region = clipboard.getRegion();
    World world = region.getWorld();
    if (world == null) {
        throw new IllegalStateException("World of floor " + floor.getName() + " is null!");
    }

    faweSchematic.paste(world, region.getMinimumPoint(), false, false, (Transform) null);
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:14,代码来源:FAWEFloorRegenerator.java

示例5: addSchems

import com.boydti.fawe.object.schematic.Schematic; //导入依赖的package包/类
public void addSchems(BufferedImage img, Mask mask, WorldData worldData, List<ClipboardHolder> clipboards, int rarity, int distance, boolean randomRotate) throws WorldEditException {
    if (img.getWidth() != getWidth() || img.getHeight() != getLength())
        throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
    double doubleRarity = rarity / 100d;
    int index = 0;
    AffineTransform identity = new AffineTransform();
    LocalBlockVector2DSet placed = new LocalBlockVector2DSet();
    for (int z = 0; z < getLength(); z++) {
        mutable.mutZ(z);
        for (int x = 0; x < getWidth(); x++, index++) {
            int y = heights.getByte(index) & 0xFF;
            int height = img.getRGB(x, z) & 0xFF;
            if (height == 0 || PseudoRandom.random.nextInt(256) > height * doubleRarity) {
                continue;
            }
            mutable.mutX(x);
            mutable.mutY(y);
            if (!mask.test(mutable)) {
                continue;
            }
            if (placed.containsRadius(x, z, distance)) {
                continue;
            }
            placed.add(x, z);
            ClipboardHolder holder = clipboards.get(PseudoRandom.random.random(clipboards.size()));
            if (randomRotate) {
                int rotate = PseudoRandom.random.random(4) * 90;
                if (rotate != 0) {
                    holder.setTransform(new AffineTransform().rotateY(PseudoRandom.random.random(4) * 90));
                } else {
                    holder.setTransform(identity);
                }
            }
            Clipboard clipboard = holder.getClipboard();
            Schematic schematic = new Schematic(clipboard);
            Transform transform = holder.getTransform();
            if (transform.isIdentity()) {
                schematic.paste(this, mutable, false);
            } else {
                schematic.paste(this, worldData, mutable, false, transform);
            }
            if (x + distance < getWidth()) {
                x += distance;
                index += distance;
            } else {
                break;
            }
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:51,代码来源:HeightMapMCAGenerator.java

示例6: load

import com.boydti.fawe.object.schematic.Schematic; //导入依赖的package包/类
/**
 * Just forwards to ClipboardFormat.SCHEMATIC.load(file)
 *
 * @param file
 * @return
 * @see com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat
 * @see com.boydti.fawe.object.schematic.Schematic
 */
public static Schematic load(File file) throws IOException {
    return ClipboardFormat.SCHEMATIC.load(file);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:FaweAPI.java


注:本文中的com.boydti.fawe.object.schematic.Schematic类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。