mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Merge remote-tracking branch 'origin/wip' into 1.15
This commit is contained in:
@ -4,6 +4,7 @@ import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.extent.LightingExtent;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
@ -343,7 +344,7 @@ public class FaweAPI {
|
||||
for (File file : files) {
|
||||
UUID uuid = UUID.fromString(file.getParentFile().getName());
|
||||
DiskStorageHistory dsh = new DiskStorageHistory(world, uuid, Integer.parseInt(file.getName().split("\\.")[0]));
|
||||
DiskStorageHistory.DiskStorageSummary summary = dsh.summarize(boundsPlus, shallow);
|
||||
SimpleChangeSetSummary summary = dsh.summarize(boundsPlus, shallow);
|
||||
RegionWrapper region = new RegionWrapper(summary.minX, summary.maxX, summary.minZ, summary.maxZ);
|
||||
boolean encompassed = false;
|
||||
boolean isIn = false;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.boydti.fawe.beta.implementation.processors;
|
||||
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
public abstract class ExtentBatchProcessorHolder extends BatchProcessorHolder implements Extent {
|
||||
@ -12,13 +12,13 @@ public abstract class ExtentBatchProcessorHolder extends BatchProcessorHolder im
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(FaweChangeSet changeSet) {
|
||||
public Extent enableHistory(AbstractChangeSet changeSet) {
|
||||
return this.addProcessor(changeSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
this.remove(FaweChangeSet.class);
|
||||
this.remove(AbstractChangeSet.class);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,8 @@ package com.boydti.fawe.beta.implementation.processors;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ExtentFilterBlock;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
@ -14,11 +12,9 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.function.generator.GenBase;
|
||||
import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
@ -9,13 +9,12 @@ import com.boydti.fawe.beta.implementation.filter.CountFilter;
|
||||
import com.boydti.fawe.beta.implementation.filter.DistrFilter;
|
||||
import com.boydti.fawe.beta.implementation.processors.BatchProcessorHolder;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
|
||||
import com.boydti.fawe.object.extent.NullExtent;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
@ -79,7 +78,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(FaweChangeSet changeSet) {
|
||||
public Extent enableHistory(AbstractChangeSet changeSet) {
|
||||
return super.enableHistory(changeSet);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.boydti.fawe.logging;
|
||||
|
||||
import com.boydti.fawe.object.changeset.AbstractDelegateChangeSet;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
//import org.primesoft.blockshub.IBlocksHubApi;
|
||||
//import org.primesoft.blockshub.api.IPlayer;
|
||||
@ -11,7 +11,7 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
|
||||
|
||||
private static boolean initialized = false;
|
||||
|
||||
public static FaweChangeSet wrap(Player player, FaweChangeSet parent) {
|
||||
public static AbstractChangeSet wrap(Player player, AbstractChangeSet parent) {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
// api = (IBlocksHubApi) Fawe.imp().getBlocksHubApi();
|
||||
@ -30,7 +30,7 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
|
||||
// private final MutableBlockData oldBlock;
|
||||
// private final MutableBlockData newBlock;
|
||||
|
||||
private LoggingChangeSet(Player player, FaweChangeSet parent) {
|
||||
private LoggingChangeSet(Player player, AbstractChangeSet parent) {
|
||||
super(parent);
|
||||
// String world = player.getLocation().world;
|
||||
// try {
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.boydti.fawe.logging.rollback;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -56,6 +54,7 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
|
||||
this.blockSize = (int) size;
|
||||
this.command = command;
|
||||
this.closed = true;
|
||||
System.out.println("Size " + size);
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
@ -63,8 +62,8 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DiskStorageSummary summarizeShallow() {
|
||||
DiskStorageSummary summary = super.summarizeShallow();
|
||||
protected SimpleChangeSetSummary summarizeShallow() {
|
||||
SimpleChangeSetSummary summary = super.summarizeShallow();
|
||||
summary.minX = this.minX;
|
||||
summary.minZ = this.minZ;
|
||||
summary.maxX = this.maxX;
|
||||
|
@ -2,7 +2,7 @@ package com.boydti.fawe.object;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -25,7 +25,7 @@ import javax.annotation.Nullable;
|
||||
*/
|
||||
public class HistoryExtent extends AbstractDelegateExtent {
|
||||
|
||||
private FaweChangeSet changeSet;
|
||||
private AbstractChangeSet changeSet;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -33,18 +33,18 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
* @param extent the extent
|
||||
* @param changeSet the change set
|
||||
*/
|
||||
public HistoryExtent(Extent extent, FaweChangeSet changeSet) {
|
||||
public HistoryExtent(Extent extent, AbstractChangeSet changeSet) {
|
||||
super(extent);
|
||||
checkNotNull(changeSet);
|
||||
this.changeSet = changeSet;
|
||||
}
|
||||
|
||||
public FaweChangeSet getChangeSet() {
|
||||
public AbstractChangeSet getChangeSet() {
|
||||
return changeSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChangeSet(FaweChangeSet fcs) {
|
||||
public void setChangeSet(AbstractChangeSet fcs) {
|
||||
this.changeSet = fcs;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.boydti.fawe.object;
|
||||
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
@ -9,7 +9,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class NullChangeSet extends FaweChangeSet {
|
||||
public class NullChangeSet extends AbstractChangeSet {
|
||||
public NullChangeSet(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
@ -63,10 +63,12 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
public boolean perform(final Player player, LocalSession session, boolean rightClick) {
|
||||
if (!session.isToolControlEnabled() || !player.hasPermission("worldedit.tool.inspect")) {
|
||||
player.print(Caption.of("", "worldedit.tool.inspect"));
|
||||
System.out.println("No tool control");
|
||||
return false;
|
||||
}
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of("fawe.error.setting.disable", ("history.use-database (Import with /history import )")));
|
||||
System.out.println("No db");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
@ -76,14 +78,17 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
final int z = target.getBlockZ();
|
||||
World world = player.getWorld();
|
||||
RollbackDatabase db = DBHandler.IMP.getDatabase(world);
|
||||
System.out.println("World " + world.getName());
|
||||
int count = 0;
|
||||
for (Supplier<RollbackOptimizedHistory> supplier : db.getEdits(target, false)) {
|
||||
System.out.println("History " + db);
|
||||
count++;
|
||||
RollbackOptimizedHistory edit = supplier.get();
|
||||
Iterator<MutableFullBlockChange> iter = edit.getFullBlockIterator(null, 0, false);
|
||||
while (iter.hasNext()) {
|
||||
MutableFullBlockChange change = iter.next();
|
||||
if (change.x != x || change.y != y || change.z != z) {
|
||||
System.out.println("Not pos " + change.x + "," + change.y + "," + change.z + " | " + x + "," + y + "," + z);
|
||||
continue;
|
||||
}
|
||||
int from = change.from;
|
||||
@ -107,7 +112,10 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
|
||||
} catch (IOException e) {
|
||||
System.out.println("IOE");
|
||||
throw new RuntimeException(e);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("E throw");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.sk89q.worldedit.history.change.BlockChange;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.history.change.EntityCreate;
|
||||
import com.sk89q.worldedit.history.change.EntityRemove;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSetSummary;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -16,13 +17,12 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
public final FaweChangeSet parent;
|
||||
public class AbstractDelegateChangeSet extends AbstractChangeSet {
|
||||
public final AbstractChangeSet parent;
|
||||
|
||||
public AbstractDelegateChangeSet(FaweChangeSet parent) {
|
||||
public AbstractDelegateChangeSet(AbstractChangeSet parent) {
|
||||
super(parent.getWorld());
|
||||
this.parent = parent;
|
||||
this.waitingCombined = parent.waitingCombined;
|
||||
@ -44,7 +44,7 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
public final FaweChangeSet getParent() {
|
||||
public final AbstractChangeSet getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
@ -118,6 +118,11 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
parent.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeSetSummary summarize(Region region, boolean shallow) {
|
||||
return parent.summarize(region, shallow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession toEditSession(Player player) {
|
||||
return parent.toEditSession(player);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.boydti.fawe.object.changeset;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
@ -24,7 +23,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
private int[] missingBlocks = new int[BlockTypes.size()];
|
||||
private BlockBag blockBag;
|
||||
|
||||
public BlockBagChangeSet(FaweChangeSet parent, BlockBag blockBag, boolean mine) {
|
||||
public BlockBagChangeSet(AbstractChangeSet parent, BlockBag blockBag, boolean mine) {
|
||||
super(parent);
|
||||
this.blockBag = blockBag;
|
||||
this.mine = mine;
|
||||
|
@ -7,14 +7,19 @@ import com.boydti.fawe.object.change.CFIChange;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSetSummary;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CFIChangeSet extends FaweChangeSet {
|
||||
public class CFIChangeSet extends AbstractChangeSet {
|
||||
|
||||
private final File file;
|
||||
|
||||
|
@ -7,30 +7,20 @@ import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.object.FaweInputStream;
|
||||
import com.boydti.fawe.object.FaweOutputStream;
|
||||
import com.boydti.fawe.object.IntegerPair;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.change.MutableFullBlockChange;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Countable;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -434,79 +424,6 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
return new IntegerPair(ox, oz);
|
||||
}
|
||||
|
||||
public static class DiskStorageSummary {
|
||||
|
||||
public int[] blocks;
|
||||
|
||||
public int minX;
|
||||
public int minZ;
|
||||
|
||||
public int maxX;
|
||||
public int maxZ;
|
||||
|
||||
public DiskStorageSummary(int x, int z) {
|
||||
blocks = new int[BlockTypesCache.states.length];
|
||||
minX = x;
|
||||
maxX = x;
|
||||
minZ = z;
|
||||
maxZ = z;
|
||||
}
|
||||
|
||||
public void add(int x, int z, int id) {
|
||||
blocks[id]++;
|
||||
if (x < minX) {
|
||||
minX = x;
|
||||
} else if (x > maxX) {
|
||||
maxX = x;
|
||||
}
|
||||
if (z < minZ) {
|
||||
minZ = z;
|
||||
} else if (z > maxZ) {
|
||||
maxZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<BlockState, Integer> getBlocks() {
|
||||
HashMap<BlockState, Integer> map = new HashMap<>();
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i] != 0) {
|
||||
BlockState state = BlockTypesCache.states[i];
|
||||
map.put(state, blocks[i]);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<Countable<BlockState>> getBlockDistributionWithData() {
|
||||
ArrayList<Countable<BlockState>> list = new ArrayList<>();
|
||||
for (Map.Entry<BlockState, Integer> entry : getBlocks().entrySet()) {
|
||||
list.add(new Countable<>(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<BlockState, Double> getPercents() {
|
||||
Map<BlockState, Integer> map = getBlocks();
|
||||
int count = getSize();
|
||||
Map<BlockState, Double> newMap = new HashMap<>();
|
||||
for (Map.Entry<BlockState, Integer> entry : map.entrySet()) {
|
||||
BlockState id = entry.getKey();
|
||||
int changes = entry.getValue();
|
||||
double percent = (changes * 1000L / count) / 10d;
|
||||
newMap.put(id, percent);
|
||||
}
|
||||
return newMap;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
int count = 0;
|
||||
for (int block : blocks) {
|
||||
count += block;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecordingChanges() {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -28,7 +28,7 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
public abstract class FaweStreamChangeSet extends AbstractChangeSet {
|
||||
|
||||
public static final int HEADER_SIZE = 9;
|
||||
private int mode;
|
||||
|
@ -0,0 +1,69 @@
|
||||
package com.boydti.fawe.object.changeset;
|
||||
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSetSummary;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SimpleChangeSetSummary implements ChangeSetSummary {
|
||||
public int[] blocks;
|
||||
|
||||
public int minX;
|
||||
public int minZ;
|
||||
|
||||
public int maxX;
|
||||
public int maxZ;
|
||||
|
||||
public SimpleChangeSetSummary() {
|
||||
blocks = new int[BlockTypesCache.states.length];
|
||||
this.minX = Integer.MAX_VALUE;
|
||||
this.minZ = Integer.MAX_VALUE;
|
||||
this.maxX = Integer.MIN_VALUE;
|
||||
this.maxZ = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
public SimpleChangeSetSummary(int x, int z) {
|
||||
blocks = new int[BlockTypesCache.states.length];
|
||||
minX = x;
|
||||
maxX = x;
|
||||
minZ = z;
|
||||
maxZ = z;
|
||||
}
|
||||
|
||||
public void add(int x, int z, int id) {
|
||||
blocks[id]++;
|
||||
if (x < minX) {
|
||||
minX = x;
|
||||
} else if (x > maxX) {
|
||||
maxX = x;
|
||||
}
|
||||
if (z < minZ) {
|
||||
minZ = z;
|
||||
} else if (z > maxZ) {
|
||||
maxZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<BlockState, Integer> getBlocks() {
|
||||
HashMap<BlockState, Integer> map = new HashMap<>();
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
if (blocks[i] != 0) {
|
||||
BlockState state = BlockTypesCache.states[i];
|
||||
map.put(state, blocks[i]);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
int count = 0;
|
||||
for (int block : blocks) {
|
||||
count += block;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
@ -40,11 +40,13 @@ public class YieldIterable<T> implements Iterable<T>, Consumer<T>, Closeable {
|
||||
buffer = queue.poll(50, TimeUnit.MILLISECONDS);
|
||||
if (buffer == END_MARKER) {
|
||||
interrupted = true;
|
||||
buffer = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
interrupted = true;
|
||||
buffer = null;
|
||||
}
|
||||
return buffer != null;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||
import com.boydti.fawe.object.changeset.BlockBagChangeSet;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
|
||||
import com.boydti.fawe.object.extent.FaweRegionExtent;
|
||||
import com.boydti.fawe.object.extent.MultiRegionExtent;
|
||||
@ -49,7 +49,7 @@ public class EditSessionBuilder {
|
||||
private String worldName;
|
||||
private Player player;
|
||||
private FaweLimit limit;
|
||||
private FaweChangeSet changeSet;
|
||||
private AbstractChangeSet changeSet;
|
||||
private Region[] allowedRegions;
|
||||
private Boolean autoQueue;
|
||||
private Boolean fastmode;
|
||||
@ -116,7 +116,7 @@ public class EditSessionBuilder {
|
||||
return setDirty();
|
||||
}
|
||||
|
||||
public EditSessionBuilder changeSet(@Nullable FaweChangeSet changeSet) {
|
||||
public EditSessionBuilder changeSet(@Nullable AbstractChangeSet changeSet) {
|
||||
this.changeSet = changeSet;
|
||||
return setDirty();
|
||||
}
|
||||
@ -265,7 +265,7 @@ public class EditSessionBuilder {
|
||||
return extent;
|
||||
}
|
||||
|
||||
private FaweChangeSet changeTask;
|
||||
private AbstractChangeSet changeTask;
|
||||
private int maxY;
|
||||
private Extent bypassHistory;
|
||||
private Extent bypassAll;
|
||||
@ -493,7 +493,7 @@ public class EditSessionBuilder {
|
||||
return player;
|
||||
}
|
||||
|
||||
public FaweChangeSet getChangeTask() {
|
||||
public AbstractChangeSet getChangeTask() {
|
||||
return changeTask;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,17 @@ public class StringMan {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static String humanReadableByteCountBin(long bytes) {
|
||||
long b = bytes == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(bytes);
|
||||
return b < 1024L ? bytes + " B"
|
||||
: b <= 0xfffccccccccccccL >> 40 ? String.format("%.1f KiB", bytes / 0x1p10)
|
||||
: b <= 0xfffccccccccccccL >> 30 ? String.format("%.1f MiB", bytes / 0x1p20)
|
||||
: b <= 0xfffccccccccccccL >> 20 ? String.format("%.1f GiB", bytes / 0x1p30)
|
||||
: b <= 0xfffccccccccccccL >> 10 ? String.format("%.1f TiB", bytes / 0x1p40)
|
||||
: b <= 0xfffccccccccccccL ? String.format("%.1f PiB", (bytes >> 10) / 0x1p40)
|
||||
: String.format("%.1f EiB", (bytes >> 20) / 0x1p40);
|
||||
}
|
||||
|
||||
public static String prettyFormat(double d) {
|
||||
if (d == Double.MIN_VALUE || d == Double.NEGATIVE_INFINITY) return "-∞";
|
||||
if (d == Double.MAX_VALUE || d == Double.POSITIVE_INFINITY) return "∞";
|
||||
|
Reference in New Issue
Block a user