2018-08-12 14:03:07 +00:00
|
|
|
package com.boydti.fawe.object.pattern;
|
|
|
|
|
|
|
|
import com.boydti.fawe.FaweCache;
|
2018-12-27 00:39:10 +00:00
|
|
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
2018-08-12 14:03:07 +00:00
|
|
|
import com.sk89q.worldedit.world.block.BlockState;
|
|
|
|
import com.sk89q.worldedit.extent.Extent;
|
|
|
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
2018-12-23 16:19:33 +00:00
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
2018-08-12 14:03:07 +00:00
|
|
|
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
|
2018-12-27 00:39:10 +00:00
|
|
|
public BaseBlock apply(BlockVector3 position) {
|
|
|
|
BaseBlock oldBlock = getExtent().getFullBlock(position);
|
|
|
|
BaseBlock newBlock = pattern.apply(position);
|
|
|
|
return oldBlock.withPropertyId(newBlock.getInternalPropertiesId()).toBaseBlock();
|
2018-08-12 14:03:07 +00:00
|
|
|
}
|
|
|
|
}
|