mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-13 12:48:35 +00:00
Refactor vector system to be cleaner
- Move Vector, etc. into `.math` package - Drop many methods that will be auto-promoted anyways, eg. with `divide(int)` and `divide(double)` the first is now gone. - Take Block vectors into their own class hierarchy - Make it clear throughout the API what takes blockvectors - many more improvements
This commit is contained in:
@ -27,6 +27,7 @@ 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.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -55,11 +56,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
if (pos == null) return false;
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
BlockStateHolder applied = secondary.apply(pos.toVector());
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = secondary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(pos.toVector(), secondary);
|
||||
eS.setBlock(blockPoint, secondary);
|
||||
} else {
|
||||
eS.setBlock(pos.getDirection(), secondary);
|
||||
eS.setBlock(pos.getDirection().toBlockPoint(), secondary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -75,11 +77,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
||||
if (pos == null) return false;
|
||||
try (EditSession eS = session.createEditSession(player)) {
|
||||
eS.disableBuffering();
|
||||
BlockStateHolder applied = primary.apply(pos.toVector());
|
||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
||||
BlockStateHolder applied = primary.apply(blockPoint);
|
||||
if (applied.getBlockType().getMaterial().isAir()) {
|
||||
eS.setBlock(pos.toVector(), primary);
|
||||
eS.setBlock(blockPoint, primary);
|
||||
} else {
|
||||
eS.setBlock(pos.getDirection(), primary);
|
||||
eS.setBlock(pos.getDirection().toBlockPoint(), primary);
|
||||
}
|
||||
return true;
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
|
Reference in New Issue
Block a user