Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 01:40:06 +01:00
rename to SimpleChangeSetSummary
Dieser Commit ist enthalten in:
Ursprung
b173c85c78
Commit
a52b645175
@ -5,6 +5,7 @@ import com.boydti.fawe.database.DBHandler;
|
|||||||
import com.boydti.fawe.database.RollbackDatabase;
|
import com.boydti.fawe.database.RollbackDatabase;
|
||||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
|
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
@ -405,35 +405,10 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
return new NBTInputStream(MainUtil.getCompressedIS(new FileInputStream(nbtfFile)));
|
return new NBTInputStream(MainUtil.getCompressedIS(new FileInputStream(nbtfFile)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DiskStorageSummary summarizeShallow() {
|
@Override
|
||||||
return new DiskStorageSummary(getOriginX(), getOriginZ());
|
public SimpleChangeSetSummary summarize(Region region, boolean shallow) {
|
||||||
}
|
|
||||||
|
|
||||||
public DiskStorageSummary summarize(Region region, boolean shallow) {
|
|
||||||
if (bdFile.exists()) {
|
if (bdFile.exists()) {
|
||||||
int ox = getOriginX();
|
return super.summarize(region, shallow);
|
||||||
int oz = getOriginZ();
|
|
||||||
DiskStorageSummary summary = summarizeShallow();
|
|
||||||
if (region != null && !region.contains(ox, oz)) {
|
|
||||||
return summary;
|
|
||||||
}
|
|
||||||
try (FaweInputStream fis = getBlockIS()) {
|
|
||||||
if (!shallow) {
|
|
||||||
int amount = (Settings.IMP.HISTORY.BUFFER_SIZE - HEADER_SIZE) / 9;
|
|
||||||
MutableFullBlockChange change = new MutableFullBlockChange(null, 0, false);
|
|
||||||
for (int i = 0; i < amount; i++) {
|
|
||||||
int x = posDel.readX(fis) + ox;
|
|
||||||
int y = posDel.readY(fis);
|
|
||||||
int z = posDel.readZ(fis) + ox;
|
|
||||||
idDel.readCombined(fis, change);
|
|
||||||
summary.add(x, z, change.to);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (EOFException ignored) {
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return summary;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import com.sk89q.jnbt.NBTInputStream;
|
|||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.history.change.Change;
|
import com.sk89q.worldedit.history.change.Change;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
@ -729,4 +730,35 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
|||||||
public Iterator<Change> forwardIterator() {
|
public Iterator<Change> forwardIterator() {
|
||||||
return getIterator(true);
|
return getIterator(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SimpleChangeSetSummary summarizeShallow() {
|
||||||
|
return new SimpleChangeSetSummary(getOriginX(), getOriginZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SimpleChangeSetSummary summarize(Region region, boolean shallow) {
|
||||||
|
int ox = getOriginX();
|
||||||
|
int oz = getOriginZ();
|
||||||
|
SimpleChangeSetSummary summary = summarizeShallow();
|
||||||
|
if (region != null && !region.contains(ox, oz)) {
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
|
try (FaweInputStream fis = getBlockIS()) {
|
||||||
|
if (!shallow) {
|
||||||
|
int amount = (Settings.IMP.HISTORY.BUFFER_SIZE - HEADER_SIZE) / 9;
|
||||||
|
MutableFullBlockChange change = new MutableFullBlockChange(null, 0, false);
|
||||||
|
for (int i = 0; i < amount; i++) {
|
||||||
|
int x = posDel.readX(fis) + ox;
|
||||||
|
int y = posDel.readY(fis);
|
||||||
|
int z = posDel.readZ(fis) + ox;
|
||||||
|
idDel.readCombined(fis, change);
|
||||||
|
summary.add(x, z, change.to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (EOFException ignored) {
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,16 @@ package com.boydti.fawe.object.changeset;
|
|||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweInputStream;
|
import com.boydti.fawe.object.FaweInputStream;
|
||||||
import com.boydti.fawe.object.FaweOutputStream;
|
import com.boydti.fawe.object.FaweOutputStream;
|
||||||
|
import com.boydti.fawe.object.change.MutableFullBlockChange;
|
||||||
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
||||||
import com.boydti.fawe.object.io.FastByteArraysInputStream;
|
import com.boydti.fawe.object.io.FastByteArraysInputStream;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -241,6 +245,5 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
|||||||
@Override
|
@Override
|
||||||
public void setRecordChanges(boolean recordChanges) {
|
public void setRecordChanges(boolean recordChanges) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import com.boydti.fawe.database.DBHandler;
|
|||||||
import com.boydti.fawe.database.RollbackDatabase;
|
import com.boydti.fawe.database.RollbackDatabase;
|
||||||
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||||
import com.boydti.fawe.object.RegionWrapper;
|
import com.boydti.fawe.object.RegionWrapper;
|
||||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren