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.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
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.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -47,7 +48,9 @@ public class StateApplyingPattern extends AbstractExtentPattern {
|
|||||||
BlockState block = getExtent().getBlock(position);
|
BlockState block = getExtent().getBlock(position);
|
||||||
for (Entry<Property<Object>, Object> entry : cache
|
for (Entry<Property<Object>, Object> entry : cache
|
||||||
.computeIfAbsent(block.getBlockType(), (b -> resolveProperties(states, b))).entrySet()) {
|
.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();
|
return block.toBaseBlock();
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,7 @@ public class TypeApplyingPattern extends AbstractExtentPattern {
|
|||||||
@Override
|
@Override
|
||||||
public BaseBlock apply(BlockVector3 position) {
|
public BaseBlock apply(BlockVector3 position) {
|
||||||
BlockState oldBlock = getExtent().getBlock(position);
|
BlockState oldBlock = getExtent().getBlock(position);
|
||||||
BlockState newBlock = blockState;
|
BlockState newBlock = blockState.withProperties(oldBlock);
|
||||||
for (Entry<Property<?>, Object> entry : oldBlock.getStates().entrySet()) {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Property<Object> prop = (Property<Object>) entry.getKey();
|
|
||||||
newBlock = newBlock.with(prop, entry.getValue());
|
|
||||||
}
|
|
||||||
return newBlock.toBaseBlock();
|
return newBlock.toBaseBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
|||||||
newState = newState.with(key, other.getState(key));
|
newState = newState.with(key, other.getState(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren