mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Allow ^
mask to be used between blocks that may have different properties, only keeping the shared properties
Fixes #1092
This commit is contained in:
parent
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,8 +48,10 @@ 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()) {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user