Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Blocks should now be fully removed correctly so that they don't drop items.
Dieser Commit ist enthalten in:
Ursprung
d6d6624a04
Commit
2e3c3404d4
@ -48,15 +48,23 @@ public class EditSession {
|
||||
/**
|
||||
* Stores the original blocks before modification.
|
||||
*/
|
||||
private DoubleArrayList<BlockVector,BaseBlock> original = new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
private DoubleArrayList<BlockVector,BaseBlock> original =
|
||||
new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
/**
|
||||
* Stores the current blocks.
|
||||
*/
|
||||
private DoubleArrayList<BlockVector,BaseBlock> current = new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
private DoubleArrayList<BlockVector,BaseBlock> current =
|
||||
new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
/**
|
||||
* Queue.
|
||||
* Blocks that should be placed before last.
|
||||
*/
|
||||
private DoubleArrayList<BlockVector,BaseBlock> queue = new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
private DoubleArrayList<BlockVector,BaseBlock> queueAfter =
|
||||
new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
/**
|
||||
* Blocks that should be placed last.
|
||||
*/
|
||||
private DoubleArrayList<BlockVector,BaseBlock> queueLast =
|
||||
new DoubleArrayList<BlockVector,BaseBlock>();
|
||||
/**
|
||||
* The maximum number of blocks to change at a time. If this number is
|
||||
* exceeded, a MaxChangedBlocksException exception will be
|
||||
@ -194,13 +202,16 @@ public class EditSession {
|
||||
*/
|
||||
private boolean smartSetBlock(Vector pt, BaseBlock block) {
|
||||
if (queued) {
|
||||
if (!block.isAir() && BlockType.shouldPlaceLast(block.getID())
|
||||
&& rawGetBlock(pt.add(0, -1, 0)).isAir()) {
|
||||
queue.put(pt.toBlockVector(), block);
|
||||
// Place torches, etc. last
|
||||
if (BlockType.shouldPlaceLast(block.getID())) {
|
||||
queueLast.put(pt.toBlockVector(), block);
|
||||
return getBlock(pt).getID() != block.getID();
|
||||
// Destroy torches, etc. first
|
||||
} else if (BlockType.shouldPlaceLast(getBlock(pt).getID())) {
|
||||
rawSetBlock(pt, new BaseBlock(0));
|
||||
} else {
|
||||
queueAfter.put(pt.toBlockVector(), block);
|
||||
return getBlock(pt).getID() != block.getID();
|
||||
} else if (block.isAir()
|
||||
&& BlockType.shouldPlaceLast(rawGetBlock(pt.add(0, 1, 0)).getID())) {
|
||||
rawSetBlock(pt.add(0, 1, 0), new BaseBlock(0)); // Prevent items from being dropped
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,10 +348,18 @@ public class EditSession {
|
||||
public void flushQueue() {
|
||||
if (!queued) { return; }
|
||||
|
||||
for (Map.Entry<BlockVector,BaseBlock> entry : queue) {
|
||||
for (Map.Entry<BlockVector,BaseBlock> entry : queueAfter) {
|
||||
BlockVector pt = (BlockVector)entry.getKey();
|
||||
rawSetBlock(pt, (BaseBlock)entry.getValue());
|
||||
}
|
||||
|
||||
for (Map.Entry<BlockVector,BaseBlock> entry : queueLast) {
|
||||
BlockVector pt = (BlockVector)entry.getKey();
|
||||
rawSetBlock(pt, (BaseBlock)entry.getValue());
|
||||
}
|
||||
|
||||
queueAfter.clear();
|
||||
queueLast.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,6 +60,14 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
||||
return listA.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the list.
|
||||
*/
|
||||
public void clear() {
|
||||
listA.clear();
|
||||
listB.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an entry set.
|
||||
*
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren