本文整理汇总了Java中com.sk89q.worldedit.EditSession.getWorld方法的典型用法代码示例。如果您正苦于以下问题:Java EditSession.getWorld方法的具体用法?Java EditSession.getWorld怎么用?Java EditSession.getWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.EditSession
的用法示例。
在下文中一共展示了EditSession.getWorld方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
int radius = (int) size;
CuboidRegionSelector selector = new CuboidRegionSelector(editSession.getWorld(), position.subtract(radius, radius, radius), position.add(radius, radius, radius));
String replaced = command.replace("{x}", position.getBlockX() + "")
.replace("{y}", Integer.toString(position.getBlockY()))
.replace("{z}", Integer.toString(position.getBlockZ()))
.replace("{world}", editSession.getQueue().getWorldName())
.replace("{size}", Integer.toString(radius));
FawePlayer fp = editSession.getPlayer();
Player player = fp.getPlayer();
WorldVectorFace face = player.getBlockTraceFace(256, true);
if (face == null) {
position = position.add(0, 1, 1);
} else {
position = face.getFaceVector();
}
fp.setSelection(selector);
PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position)));
List<String> cmds = StringMan.split(replaced, ';');
for (String cmd : cmds) {
CommandEvent event = new CommandEvent(wePlayer, cmd);
CommandManager.getInstance().handleCommandOnCurrentThread(event);
}
}
示例2: apply
import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public void apply(EditSession editSession, LocalBlockVectorSet placed, Vector position, Pattern p, double size) throws MaxChangedBlocksException {
int radius = getDistance();
CuboidRegionSelector selector = new CuboidRegionSelector(editSession.getWorld(), position.subtract(radius, radius, radius), position.add(radius, radius, radius));
String replaced = command.replace("{x}", position.getBlockX() + "")
.replace("{y}", Integer.toString(position.getBlockY()))
.replace("{z}", Integer.toString(position.getBlockZ()))
.replace("{world}", editSession.getQueue().getWorldName())
.replace("{size}", Integer.toString(radius));
FawePlayer fp = editSession.getPlayer();
Player player = fp.getPlayer();
fp.setSelection(selector);
PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position)));
List<String> cmds = StringMan.split(replaced, ';');
for (String cmd : cmds) {
CommandEvent event = new CommandEvent(wePlayer, cmd);
CommandManager.getInstance().handleCommandOnCurrentThread(event);
}
}
示例3: build
import com.sk89q.worldedit.EditSession; //导入方法依赖的package包/类
@Override
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
new MaskTraverser(mask).reset(editSession);
SchemGen gen = new SchemGen(mask, editSession, editSession.getWorldData(), clipboards, randomRotate);
CuboidRegion cuboid = new CuboidRegion(editSession.getWorld(), position.subtract(size, size, size), position.add(size, size, size));
try {
editSession.addSchems(cuboid, mask, editSession.getWorldData(), clipboards, rarity, randomRotate);
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
}