3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00

Allow ^ mask to be used between blocks that may have different properties, only keeping the shared properties

Fixes #1092
Dieser Commit ist enthalten in:
dordsor21 2021-06-10 12:46:19 +01:00
Ursprung dd217fcb70
Commit 71130025e8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
3 geänderte Dateien mit 6 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import com.google.common.collect.Maps;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
@ -47,7 +48,9 @@ public class StateApplyingPattern extends AbstractExtentPattern {
BlockState block = getExtent().getBlock(position);
for (Entry<Property<Object>, Object> entry : cache
.computeIfAbsent(block.getBlockType(), (b -> resolveProperties(states, b))).entrySet()) {
block = block.with(entry.getKey(), entry.getValue());
if (block.getBlockType().hasProperty(entry.getKey().getKey())) {
block = block.with(entry.getKey(), entry.getValue());
}
}
return block.toBaseBlock();
}

Datei anzeigen

@ -41,12 +41,7 @@ public class TypeApplyingPattern extends AbstractExtentPattern {
@Override
public BaseBlock apply(BlockVector3 position) {
BlockState oldBlock = getExtent().getBlock(position);
BlockState newBlock = blockState;
for (Entry<Property<?>, Object> entry : oldBlock.getStates().entrySet()) {
@SuppressWarnings("unchecked")
Property<Object> prop = (Property<Object>) entry.getKey();
newBlock = newBlock.with(prop, entry.getValue());
}
BlockState newBlock = blockState.withProperties(oldBlock);
return newBlock.toBaseBlock();
}
}

Datei anzeigen

@ -308,7 +308,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
newState = newState.with(key, other.getState(key));
}
}
return this;
return newState;
}
@Override