Fixed some bugs and cleanup some code.

This commit is contained in:
Matthew Miller
2018-08-13 22:18:12 +10:00
parent f96487a2d1
commit e0e7778536
22 changed files with 92 additions and 394 deletions

View File

@ -26,6 +26,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -35,10 +36,10 @@ import com.sk89q.worldedit.world.block.BlockTypes;
*/
public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTool {
private BlockStateHolder primary;
private BlockStateHolder secondary;
private Pattern primary;
private Pattern secondary;
public LongRangeBuildTool(BlockStateHolder primary, BlockStateHolder secondary) {
public LongRangeBuildTool(Pattern secondary, Pattern primary) {
super("worldedit.tool.lrbuild");
this.primary = primary;
this.secondary = secondary;
@ -55,7 +56,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
if (pos == null) return false;
EditSession eS = session.createEditSession(player);
try {
if (secondary.getBlockType() == BlockTypes.AIR) {
BlockStateHolder applied = secondary.apply(pos.toVector());
if (applied.getBlockType() == BlockTypes.AIR) {
eS.setBlock(pos.toVector(), secondary);
} else {
eS.setBlock(pos.getDirection(), secondary);
@ -74,7 +76,8 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
if (pos == null) return false;
EditSession eS = session.createEditSession(player);
try {
if (primary.getBlockType() == BlockTypes.AIR) {
BlockStateHolder applied = primary.apply(pos.toVector());
if (applied.getBlockType() == BlockTypes.AIR) {
eS.setBlock(pos.toVector(), primary);
} else {
eS.setBlock(pos.getDirection(), primary);