mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-07-05 16:40:04 +00:00
31 lines
997 B
Java
31 lines
997 B
Java
|
package com.boydti.fawe.object.pattern;
|
||
|
|
||
|
import com.boydti.fawe.FaweCache;
|
||
|
import com.sk89q.worldedit.Vector;
|
||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||
|
import com.sk89q.worldedit.world.block.BlockState;
|
||
|
import com.sk89q.worldedit.extent.Extent;
|
||
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||
|
|
||
|
|
||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||
|
|
||
|
public class DataPattern extends AbstractExtentPattern {
|
||
|
private final Pattern pattern;
|
||
|
|
||
|
public DataPattern(Extent extent, Pattern parent) {
|
||
|
super(extent);
|
||
|
checkNotNull(parent);
|
||
|
this.pattern = parent;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public BlockStateHolder apply(Vector position) {
|
||
|
BlockStateHolder oldBlock = getExtent().getBlock(position);
|
||
|
BlockStateHolder newBlock = pattern.apply(position);
|
||
|
return oldBlock.withPropertyId(newBlock.getInternalPropertiesId());
|
||
|
}
|
||
|
}
|