本文整理汇总了Java中com.sk89q.worldedit.MaxChangedBlocksException类的典型用法代码示例。如果您正苦于以下问题:Java MaxChangedBlocksException类的具体用法?Java MaxChangedBlocksException怎么用?Java MaxChangedBlocksException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaxChangedBlocksException类属于com.sk89q.worldedit包,在下文中一共展示了MaxChangedBlocksException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: swap
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
EditSession sessionA = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionB = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion regionA = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
CuboidRegion regionB = new CuboidRegion(new Vector(pos3.getX(), pos3.getY(), pos3.getZ()), new Vector(pos4.getX(), pos4.getY(), pos4.getZ()));
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, sessionB, regionB.getMinimumPoint());
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, sessionA, regionA.getMinimumPoint());
try {
Operations.completeLegacy(copyA);
Operations.completeLegacy(copyB);
sessionA.flushQueue();
sessionB.flushQueue();
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
TaskManager.IMP.task(whenDone);
}
});
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:FaweChunkManager.java
示例2: copyRegion
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
EditSession from = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession to = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, new Vector(pos3.getX(), pos3.getY(), pos3.getZ()));
try {
Operations.completeLegacy(copy);
to.flushQueue();
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
TaskManager.IMP.task(whenDone);
}
});
return true;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:21,代码来源:FaweChunkManager.java
示例3: build
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的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);
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:CommandBrush.java
示例4: pastePositionDirect
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
/**
* Paste structure at the provided position on the curve. The position will not be position-corrected
* but will be passed directly to the interpolation algorithm.
* @param position The position on the curve. Must be between 0.0 and 1.0 (both inclusive)
* @return The amount of blocks that have been changed
* @throws MaxChangedBlocksException Thrown by WorldEdit if the limit of block changes for the {@link EditSession} has been reached
*/
public int pastePositionDirect(double position) throws MaxChangedBlocksException {
Preconditions.checkArgument(position >= 0);
Preconditions.checkArgument(position <= 1);
// Calculate position from spline
Vector target = interpolation.getPosition(position);
Vector offset = target.subtract(target.round());
target = target.subtract(offset);
// Calculate rotation from spline
Vector deriv = interpolation.get1stDerivative(position);
Vector2D deriv2D = new Vector2D(deriv.getX(), deriv.getZ()).normalize();
double angle = Math.toDegrees(
Math.atan2(direction.getZ(), direction.getX()) - Math.atan2(deriv2D.getZ(), deriv2D.getX())
);
return pasteBlocks(target, offset, angle);
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:27,代码来源:Spline.java
示例5: build
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@Override
public void build(EditSession editSession, Vector pos2, final Pattern pattern, double size) throws MaxChangedBlocksException {
boolean visual = (editSession.getExtent() instanceof VisualExtent);
if (pos1 == null || pos2.equals(pos1)) {
if (!visual) {
pos1 = pos2;
BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), pos2);
}
return;
}
Vector vertex = getVertex(pos1, pos2, slack);
List<Vector> nodes = Arrays.asList(pos1, vertex, pos2);
editSession.drawSpline(pattern, nodes, 0, 0, 0, 10, size, !shell);
if (!visual) {
BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
if (!select) {
pos1 = null;
return;
} else {
pos1 = pos2;
}
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:CatenaryBrush.java
示例6: apply
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的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);
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:21,代码来源:ScatterCommand.java
示例7: build
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@Override
public void build(EditSession editSession, Vector position, final Pattern pattern, double size) throws MaxChangedBlocksException {
boolean visual = (editSession.getExtent() instanceof VisualExtent);
if (pos1 == null) {
if (!visual) {
pos1 = position;
BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), position);
}
return;
}
editSession.drawLine(pattern, pos1, position, size, !shell, flat);
if (!visual) {
BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
if (!select) {
pos1 = null;
return;
} else {
pos1 = position;
}
}
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:22,代码来源:LineBrush.java
示例8: pasteWithWE
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
public static void pasteWithWE(Player p, File f) throws DataException {
SpongePlayer sp = SpongeWorldEdit.inst().wrapPlayer(p);
SpongeWorld ws = SpongeWorldEdit.inst().getWorld(p.getWorld());
LocalSession session = SpongeWorldEdit.inst().getSession(p);
Closer closer = Closer.create();
try {
ClipboardFormat format = ClipboardFormat.findByAlias("schematic");
FileInputStream fis = closer.register(new FileInputStream(f));
BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
ClipboardReader reader = format.getReader(bis);
WorldData worldData = ws.getWorldData();
Clipboard clipboard = reader.read(ws.getWorldData());
session.setClipboard(new ClipboardHolder(clipboard, worldData));
ClipboardHolder holder = session.getClipboard();
Operation op = holder.createPaste(session.createEditSession(sp), ws.getWorldData()).to(session.getPlacementPosition(sp)).build();
Operations.completeLegacy(op);
} catch (IOException | MaxChangedBlocksException | EmptyClipboardException | IncompleteRegionException e) {
e.printStackTrace();
}
}
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:26,代码来源:WEListener.java
示例9: showStartingPlatform
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
private void showStartingPlatform(boolean present) {
Location<World> platformLocation = startingLocation.add(0, -1, 0);
EditSession editor = WorldEdit.getInstance().getEditSessionFactory().getEditSession(
new WorldResolver(getRegion().getExtent()).getWorldEditWorld(),
-1
);
com.sk89q.worldedit.Vector origin = new com.sk89q.worldedit.Vector(
platformLocation.getX(), platformLocation.getY(), platformLocation.getZ()
);
BaseBlock targetBlock;
if (present) {
targetBlock = WorldEdit.getInstance().getBaseBlockFactory().getBaseBlock(BlockID.STAINED_GLASS, 15);
} else {
targetBlock = WorldEdit.getInstance().getBaseBlockFactory().getBaseBlock(BlockID.AIR);
}
try {
editor.makeCylinder(origin, new SingleBlockPattern(targetBlock), 12, 1, true);
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
开发者ID:Skelril,项目名称:Skree,代码行数:26,代码来源:SkyWarsInstance.java
示例10: execute
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
public Integer execute(ICancelabeEditSession editSession) throws MaxChangedBlocksException {
try {
ClipboardReader reader = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file));
WorldData worldData = bukkitWorld.getWorldData();
Clipboard clipboard = reader.read(worldData);
ClipboardHolder holder = new ClipboardHolder(clipboard, worldData);
editSession.enableQueue();
editSession.setFastMode(true);
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
final Operation operation = holder
.createPaste(editSession, worldData)
.to(to)
.ignoreAirBlocks(true)
.build();
Operations.completeBlindly(operation);
editSession.flushQueue();
} catch (IOException e) {
log.log(Level.WARNING, "Error trying to paste " + file, e);
}
return 32768;
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:AWE330Adaptor.java
示例11: execute
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
public Integer execute(CancelabeEditSession editSession) throws MaxChangedBlocksException {
try {
ClipboardReader reader = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file));
WorldData worldData = bukkitWorld.getWorldData();
Clipboard clipboard = reader.read(worldData);
ClipboardHolder holder = new ClipboardHolder(clipboard, worldData);
editSession.enableQueue();
editSession.setFastMode(true);
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
final Operation operation = holder
.createPaste(editSession, worldData)
.to(to)
.ignoreAirBlocks(true)
.build();
Operations.completeBlindly(operation);
editSession.flushQueue();
} catch (IOException e) {
log.log(Level.WARNING, "Error trying to paste " + file, e);
}
return 0;
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:AWE211Adaptor.java
示例12: execute
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
public Integer execute(CancelabeEditSession editSession) throws MaxChangedBlocksException {
try {
ClipboardReader reader = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file));
WorldData worldData = bukkitWorld.getWorldData();
Clipboard clipboard = reader.read(worldData);
ClipboardHolder holder = new ClipboardHolder(clipboard, worldData);
editSession.enableQueue();
editSession.setFastMode(true);
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
final Operation operation = holder
.createPaste(editSession, worldData)
.to(to)
.ignoreAirBlocks(true)
.build();
Operations.completeBlindly(operation);
editSession.flushQueue();
} catch (IOException e) {
log.log(Level.WARNING, "Error trying to paste " + file, e);
}
return 32768;
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:AWE311Adaptor.java
示例13: loadIslandSchematic
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@Override
public void loadIslandSchematic(final File file, final Location origin, final PlayerPerk playerPerk) {
plugin.async(new Runnable() {
@Override
public void run() {
boolean noAir = false;
boolean entities = true;
Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
EditSession editSession = getEditSession(playerPerk, origin);
try {
SchematicFormat.getFormat(file)
.load(file)
.paste(editSession, to, noAir, entities);
editSession.flushQueue();
} catch (MaxChangedBlocksException | IOException | DataException e) {
log.log(Level.INFO, "Unable to paste schematic " + file, e);
}
}
});
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:21,代码来源:FAWEAdaptor.java
示例14: execute
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@Override
protected boolean execute() {
while (!regions.isEmpty()) {
final Region region = regions.remove(0);
LocalWorld localWorld = BukkitUtil.getLocalWorld(world);
final EditSession editSession = WorldEditHandler.createEditSession(localWorld, region.getArea() * 255);
editSession.enableQueue();
editSession.setFastMode(true);
try {
editSession.setBlocks(region, AIR);
} catch (MaxChangedBlocksException e) {
log.log(Level.INFO, "Warning: we got MaxChangedBlocks from WE, please increase it!");
}
editSession.flushQueue();
//editSession.commit();
if (!tick()) {
break;
}
}
return regions.isEmpty();
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:22,代码来源:WorldEditClear.java
示例15: resetNext
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
public void resetNext() {
build = true;
Util.debug("reset next!");
Bukkit.getScheduler().callSyncMethod(SurvivalGames.instance, new Callable<Void>() {
@Override
public Void call() {
for(Entry<Vector, BaseBlock> map : cReset.entrySet()) {
try {
es.setBlock(map.getKey(), map.getValue());
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
}
cReset.clear();
build = false;
return null;
}
});
}
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:20,代码来源:Reset.java
示例16: clearOldRegions
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void clearOldRegions() {
for (String planetName : centreCoordinates.keySet()){
ProtectedRegion wgRegion = rgMgr.getRegion(planetName);
if(wgRegion == null){
print("No WG region forund for planet '"+planetName+"', skipping region deletion.");
continue;
}
com.sk89q.worldedit.LocalWorld weWorld = BukkitUtil.getLocalWorld(world);
EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
Region weRegion = new Polygonal2DRegion(weWorld,
wgRegion.getPoints(),
wgRegion.getMinimumPoint().getBlockY(),
wgRegion.getMaximumPoint().getBlockY());
try {
es.setBlocks(weRegion, new BaseBlock(BlockID.AIR));
} catch (MaxChangedBlocksException e) {
// should never happen as limit is -1
print("Error deleting blocks with WE for planet '"+planetName+"', max block limit reached.");
}
rgMgr.removeRegion(planetName);
}
}
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:24,代码来源:SQOrbitsPlanetMover.java
示例17: render
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
public void render(BlockFace facing, int number,
Vector origin, Player player,
BlockLoger loger, IColorMap colorMap, ClippingRegion clipping)
throws MaxChangedBlocksException {
if (!m_blocks.containsKey(facing)) {
facing = BlockFace.SELF;
}
if (!m_blocks.containsKey(facing)) {
return;
}
VariantBlock[] entry = m_blocks.get(facing);
if (entry.length == 0) {
return;
}
entry[number % entry.length].render(origin, player, loger, colorMap, clipping);
}
开发者ID:SBPrime,项目名称:MCPainter,代码行数:20,代码来源:FacingBlock.java
示例18: set
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
private boolean set(String blockPattern, LocalWorld curr_world, AbstractRegion we_region, boolean isEffecient) throws InvalidItemException, UnknownItemException, MaxChangedBlocksException {
Pattern pattern = getBlockPattern(blockPattern);
if (isEffecient) {
if (pattern instanceof RandomFillPattern) {
return false;
}
if (curr_world.getBlock(we_region.getMinimumPoint()) == ((SingleBlockPattern) pattern).getBlock()) {
return true;
}
}
if (pattern instanceof SingleBlockPattern) {
we.getWorldEdit().getEditSessionFactory().getEditSession(curr_world, maxBlocks).setBlocks(we_region, ((SingleBlockPattern) pattern).getBlock());
}
else {
we.getWorldEdit().getEditSessionFactory().getEditSession(curr_world, maxBlocks).setBlocks(we_region, pattern);
}
return true;
}
开发者ID:illegalprime,项目名称:Zeus,代码行数:23,代码来源:ZeusWorldEdit.java
示例19: tset
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
private boolean tset(String block1Pattern, String block2Pattern, LocalWorld curr_world, AbstractRegion tset_region) throws InvalidItemException, UnknownItemException, MaxChangedBlocksException {
Pattern patternOne = getBlockPattern(block1Pattern);
Pattern patternTwo = getBlockPattern(block2Pattern);
if ((patternOne instanceof RandomFillPattern) || (patternTwo instanceof RandomFillPattern)) {
return false;
}
if (curr_world.getBlock(tset_region.getMinimumPoint()).equalsFuzzy(((SingleBlockPattern) patternOne).getBlock())) {
we.getWorldEdit().getEditSessionFactory().getEditSession(curr_world, maxBlocks).setBlocks(tset_region, ((SingleBlockPattern) patternTwo).getBlock());
}
else {
we.getWorldEdit().getEditSessionFactory().getEditSession(curr_world, maxBlocks).setBlocks(tset_region, ((SingleBlockPattern) patternOne).getBlock());
}
return true;
}
开发者ID:illegalprime,项目名称:Zeus,代码行数:17,代码来源:ZeusWorldEdit.java
示例20: place
import com.sk89q.worldedit.MaxChangedBlocksException; //导入依赖的package包/类
/**
* Place the waiting lobby in the world
*/
public void place()
{
this.logger.info("Generating lobby...");
if (this.file.exists())
{
try
{
Vector vector = new Vector(0, 190, 0);
World world = Bukkit.getWorld("world");
world.loadChunk(0, 0);
BukkitWorld bwf = new BukkitWorld(world);
this.editSession = new EditSession(bwf, -1);
this.editSession.setFastMode(true);
CuboidClipboard c1 = SchematicFormat.MCEDIT.load(this.file);
c1.paste(this.editSession, vector, true);
}
catch (MaxChangedBlocksException | IOException | DataException ex)
{
this.logger.log(Level.SEVERE, "Error in world", ex);
}
}
else
{
this.logger.severe("File does not exist. Abort...");
}
this.logger.info("Done.");
}
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:38,代码来源:LobbyPopulator.java
注:本文中的com.sk89q.worldedit.MaxChangedBlocksException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论