mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
all hsitory types can summarize
This commit is contained in:
parent
195c4a7647
commit
9623c5cb3f
@ -399,6 +399,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
return new SimpleChangeSetSummary(getOriginX(), getOriginZ());
|
return new SimpleChangeSetSummary(getOriginX(), getOriginZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SimpleChangeSetSummary summarize(Region region, boolean shallow) {
|
public SimpleChangeSetSummary summarize(Region region, boolean shallow) {
|
||||||
if (bdFile.exists()) {
|
if (bdFile.exists()) {
|
||||||
int ox = getOriginX();
|
int ox = getOriginX();
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
package com.boydti.fawe.object.changeset;
|
||||||
|
|
||||||
import com.sk89q.worldedit.history.changeset.ChangeSetSummary;
|
import com.sk89q.worldedit.history.changeset.ChangeSetSummary;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
@ -14,6 +16,14 @@ public class SimpleChangeSetSummary implements ChangeSetSummary {
|
|||||||
public int maxX;
|
public int maxX;
|
||||||
public int maxZ;
|
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) {
|
public SimpleChangeSetSummary(int x, int z) {
|
||||||
blocks = new int[BlockTypesCache.states.length];
|
blocks = new int[BlockTypesCache.states.length];
|
||||||
minX = x;
|
minX = x;
|
@ -21,8 +21,12 @@ package com.sk89q.worldedit.history.changeset;
|
|||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.sk89q.worldedit.history.change.BlockChange;
|
||||||
import com.sk89q.worldedit.history.change.Change;
|
import com.sk89q.worldedit.history.change.Change;
|
||||||
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -70,4 +74,16 @@ public class ArrayListHistory implements ChangeSet {
|
|||||||
return changes.size();
|
return changes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChangeSetSummary summarize(Region region, boolean shallow) {
|
||||||
|
SimpleChangeSetSummary summary = new SimpleChangeSetSummary();
|
||||||
|
for (Change change : changes) {
|
||||||
|
if (change instanceof BlockChange) {
|
||||||
|
BlockChange blockChange = (BlockChange) change;
|
||||||
|
BlockVector3 pos = blockChange.getPosition();
|
||||||
|
summary.add(pos.getX(), pos.getZ(), blockChange.getCurrent().getOrdinal());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,19 +97,13 @@ public interface ChangeSet extends Closeable {
|
|||||||
*/
|
*/
|
||||||
default void delete() {}
|
default void delete() {}
|
||||||
|
|
||||||
ChangeSetSummary summarize(Region region, boolean shallow) {
|
/**
|
||||||
return new ChangeSetSummary() {
|
* Get a summary of this changeset
|
||||||
@Override
|
* @param region
|
||||||
public Map<BlockState, Integer> getBlocks() {
|
* @param shallow
|
||||||
return Collections.emptyMap();
|
* @return
|
||||||
}
|
*/
|
||||||
|
ChangeSetSummary summarize(Region region, boolean shallow);
|
||||||
@Override
|
|
||||||
public int getSize() {
|
|
||||||
return size();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the changeset is empty (i.e. size == 0)
|
* Get if the changeset is empty (i.e. size == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user