geforkt von Mirrors/FastAsyncWorldEdit
Allow ^
mask to be used between blocks that may have different properties, only keeping the shared properties
Fixes #1092
Dieser Commit ist enthalten in:
Ursprung
dd217fcb70
Commit
71130025e8
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
||||
newState = newState.with(key, other.getState(key));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
return newState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren