}
}
}
private void purge(Vector3i pos, byte oldValue) {
Block block = world.getBlockAt(pos);
increaseQueues[rules.getMaxValue() - oldValue].remove(pos);
byte fixedValue = rules.getFixedValue(block, pos);
if (fixedValue > 0) {
increase(pos, fixedValue);
} else {
world.setValueAt(pos, NO_VALUE);
}
for (Side side : Side.values()) {
byte expectedValue = rules.propagateValue(oldValue, side, block);
Vector3i adjPos = side.getAdjacentPos(pos);
if (rules.canSpreadOutOf(block, side)) {
byte adjValue = world.getValueAt(adjPos);
if (adjValue == expectedValue) {
Block adjBlock = world.getBlockAt(adjPos);
if (rules.canSpreadInto(adjBlock, side.reverse())) {
reduce(adjPos, expectedValue);
}
} else if (adjValue > 0) {
queueSpreadValue(adjPos, adjValue);