mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-25 03:55:35 +01:00
Fix identical states being recorded as a change
This commit is contained in:
parent
47cbc2bc8c
commit
c22063edb6
@ -56,36 +56,33 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BaseBlock block) throws WorldEditException {
|
||||
if (extent.setBlock(x, y, z, block)) {
|
||||
int combined = queue.getCombinedId4DataDebug(x, y, z, 0, session);
|
||||
int id = (combined >> 4);
|
||||
if (id == block.getId()) {
|
||||
if (!FaweCache.hasData(id)) {
|
||||
return false;
|
||||
}
|
||||
int data = combined & 0xF;
|
||||
if (data == block.getData()) {
|
||||
return false;
|
||||
}
|
||||
int combined = queue.getCombinedId4DataDebug(x, y, z, 0, session);
|
||||
int id = (combined >> 4);
|
||||
if (id == block.getId()) {
|
||||
if (!FaweCache.hasData(id)) {
|
||||
return false;
|
||||
}
|
||||
if (!FaweCache.hasNBT(id)) {
|
||||
if (FaweCache.hasNBT(block.getId())) {
|
||||
this.changeSet.add(x, y, z, combined, block);
|
||||
} else {
|
||||
this.changeSet.add(x, y, z, combined, (block.getId() << 4) + block.getData());
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
CompoundTag tag = queue.getTileEntity(x, y, z);
|
||||
this.changeSet.add(x, y, z, new BaseBlock(id, combined & 0xF, tag), block);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
this.changeSet.add(x, y, z, combined, block);
|
||||
}
|
||||
int data = combined & 0xF;
|
||||
if (data == block.getData()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (!FaweCache.hasNBT(id)) {
|
||||
if (FaweCache.hasNBT(block.getId())) {
|
||||
this.changeSet.add(x, y, z, combined, block);
|
||||
} else {
|
||||
this.changeSet.add(x, y, z, combined, (block.getId() << 4) + block.getData());
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
CompoundTag tag = queue.getTileEntity(x, y, z);
|
||||
this.changeSet.add(x, y, z, new BaseBlock(id, combined & 0xF, tag), block);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
this.changeSet.add(x, y, z, combined, block);
|
||||
}
|
||||
}
|
||||
return extent.setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -448,6 +448,10 @@ public class LocalSession {
|
||||
if (editSession.size() == 0 || editSession.hasFastMode()) {
|
||||
return;
|
||||
}
|
||||
FaweChangeSet changeSet = (FaweChangeSet) editSession.getChangeSet();
|
||||
if (changeSet.size() == 0) {
|
||||
return;
|
||||
}
|
||||
FawePlayer fp = editSession.getPlayer();
|
||||
if (fp != null) {
|
||||
loadSessionHistoryFromDisk(fp.getUUID(), editSession.getWorld());
|
||||
@ -461,18 +465,17 @@ public class LocalSession {
|
||||
while (iter.hasNext()) {
|
||||
Object item = iter.next();
|
||||
if (++i > cutoffIndex) {
|
||||
FaweChangeSet changeSet;
|
||||
FaweChangeSet oldChangeSet;
|
||||
if (item instanceof FaweChangeSet) {
|
||||
changeSet = (FaweChangeSet) item;
|
||||
oldChangeSet = (FaweChangeSet) item;
|
||||
} else {
|
||||
changeSet = getChangeSet(item);
|
||||
oldChangeSet = getChangeSet(item);
|
||||
}
|
||||
historySize -= MainUtil.getSize(changeSet);
|
||||
historySize -= MainUtil.getSize(oldChangeSet);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
FaweChangeSet changeSet = (FaweChangeSet) editSession.getChangeSet();
|
||||
historySize += MainUtil.getSize(changeSet);
|
||||
if (append) {
|
||||
history.add(changeSet);
|
||||
|
Loading…
Reference in New Issue
Block a user