geforkt von Mirrors/FastAsyncWorldEdit
minor tweak for mutable vectors
Dieser Commit ist enthalten in:
Ursprung
2165bb127f
Commit
92a7bd5e44
@ -113,7 +113,7 @@ public interface IBukkitAdapter {
|
|||||||
*/
|
*/
|
||||||
default org.bukkit.Location adapt(Location location) {
|
default org.bukkit.Location adapt(Location location) {
|
||||||
checkNotNull(location);
|
checkNotNull(location);
|
||||||
Vector3 position = location.toVector();
|
Vector3 position = location;
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
adapt((World) location.getExtent()),
|
adapt((World) location.getExtent()),
|
||||||
position.getX(), position.getY(), position.getZ(),
|
position.getX(), position.getY(), position.getZ(),
|
||||||
|
@ -16,6 +16,7 @@ import com.boydti.fawe.util.image.Drawable;
|
|||||||
import com.boydti.fawe.util.image.ImageViewer;
|
import com.boydti.fawe.util.image.ImageViewer;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
@ -24,8 +25,6 @@ import com.sk89q.worldedit.function.operation.Operation;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
|
||||||
import com.sk89q.worldedit.math.Vector2;
|
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
@ -51,7 +50,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
// TODO FIXME
|
// TODO FIXME
|
||||||
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
|
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld {
|
||||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
private final ThreadLocal<int[]> indexStore = new ThreadLocal<int[]>() {
|
private final ThreadLocal<int[]> indexStore = new ThreadLocal<int[]>() {
|
||||||
@Override
|
@Override
|
||||||
@ -528,7 +527,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights[index] & 0xFF;
|
int y = heights[index] & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
int newHeight = table.average(x, z, index);
|
int newHeight = table.average(x, z, index);
|
||||||
setLayerHeightRaw(index, newHeight);
|
setLayerHeightRaw(index, newHeight);
|
||||||
}
|
}
|
||||||
@ -583,7 +582,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
}
|
}
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (!mask.test(mutable.toBlockVector3())) {
|
if (!mask.test(mutable)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (placed.containsRadius(x, z, distance)) {
|
if (placed.containsRadius(x, z, distance)) {
|
||||||
@ -603,9 +602,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
Schematic schematic = new Schematic(clipboard);
|
Schematic schematic = new Schematic(clipboard);
|
||||||
Transform transform = holder.getTransform();
|
Transform transform = holder.getTransform();
|
||||||
if (transform.isIdentity()) {
|
if (transform.isIdentity()) {
|
||||||
schematic.paste(this, mutable.toBlockVector3(), false);
|
schematic.paste(this, mutable, false);
|
||||||
} else {
|
} else {
|
||||||
schematic.paste(this, mutable.toBlockVector3(), false, transform);
|
schematic.paste(this, mutable, false, transform);
|
||||||
}
|
}
|
||||||
if (x + distance < getWidth()) {
|
if (x + distance < getWidth()) {
|
||||||
x += distance;
|
x += distance;
|
||||||
@ -631,7 +630,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
}
|
}
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (!mask.test(mutable.toBlockVector3())) {
|
if (!mask.test(mutable)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (placed.containsRadius(x, z, distance)) {
|
if (placed.containsRadius(x, z, distance)) {
|
||||||
@ -652,9 +651,9 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
Schematic schematic = new Schematic(clipboard);
|
Schematic schematic = new Schematic(clipboard);
|
||||||
Transform transform = holder.getTransform();
|
Transform transform = holder.getTransform();
|
||||||
if (transform.isIdentity()) {
|
if (transform.isIdentity()) {
|
||||||
schematic.paste(this, mutable.toBlockVector3(), false);
|
schematic.paste(this, mutable, false);
|
||||||
} else {
|
} else {
|
||||||
schematic.paste(this, mutable.toBlockVector3(), false, transform);
|
schematic.paste(this, mutable, false, transform);
|
||||||
}
|
}
|
||||||
if (x + distance < getWidth()) {
|
if (x + distance < getWidth()) {
|
||||||
x += distance;
|
x += distance;
|
||||||
@ -1135,7 +1134,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
if (mask != null) {
|
if (mask != null) {
|
||||||
mutable.mutX(z);
|
mutable.mutX(z);
|
||||||
mutable.mutY(heights.getByte(index) & 0xFF);
|
mutable.mutY(heights.getByte(index) & 0xFF);
|
||||||
if (!mask.test(mutable.toBlockVector3())) continue;
|
if (!mask.test(mutable)) continue;
|
||||||
}
|
}
|
||||||
if (imgMask != null) {
|
if (imgMask != null) {
|
||||||
int height = imgMask.getRGB(x, z) & 0xFF;
|
int height = imgMask.getRGB(x, z) & 0xFF;
|
||||||
@ -1256,7 +1255,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
for (int x = 0; x < getWidth(); x++, index++) {
|
for (int x = 0; x < getWidth(); x++, index++) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(heights.getByte(index) & 0xFF);
|
mutable.mutY(heights.getByte(index) & 0xFF);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
int color = img.getRGB(x, z);
|
int color = img.getRGB(x, z);
|
||||||
BlockType block = textureUtil.getNearestBlock(color);
|
BlockType block = textureUtil.getNearestBlock(color);
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
@ -1332,7 +1331,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
biomes.setByte(index, biome);
|
biomes.setByte(index, biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1362,7 +1361,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
.nextInt(256) <= height) {
|
.nextInt(256) <= height) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(height);
|
mutable.mutY(height);
|
||||||
overlayArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
overlayArr[index] = pattern.apply(mutable).getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1390,7 +1389,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
.nextInt(256) <= height) {
|
.nextInt(256) <= height) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(height);
|
mutable.mutY(height);
|
||||||
mainArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
mainArr[index] = pattern.apply(mutable).getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1416,7 +1415,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
.nextInt(256) <= height) {
|
.nextInt(256) <= height) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(height);
|
mutable.mutY(height);
|
||||||
floorArr[index] = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
floorArr[index] = pattern.apply(mutable).getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1444,7 +1443,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
.nextInt(256) <= height) {
|
.nextInt(256) <= height) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(height);
|
mutable.mutY(height);
|
||||||
int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
int combined = pattern.apply(mutable).getInternalId();
|
||||||
mainArr[index] = combined;
|
mainArr[index] = combined;
|
||||||
floorArr[index] = combined;
|
floorArr[index] = combined;
|
||||||
}
|
}
|
||||||
@ -1466,8 +1465,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
overlay.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
|
overlay.setInt(index, pattern.apply(mutable).getInternalId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1485,8 +1484,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
floor.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
|
floor.setInt(index, pattern.apply(mutable).getInternalId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1505,8 +1504,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
main.setInt(index, pattern.apply(mutable.toBlockVector3()).getInternalId());
|
main.setInt(index, pattern.apply(mutable).getInternalId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1525,8 +1524,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
int combined = pattern.apply(mutable.toBlockVector3()).getInternalId();
|
int combined = pattern.apply(mutable).getInternalId();
|
||||||
floor.setInt(index, combined);
|
floor.setInt(index, combined);
|
||||||
main.setInt(index, combined);
|
main.setInt(index, combined);
|
||||||
}
|
}
|
||||||
@ -1552,7 +1551,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
floorArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
|
floorArr[index] = value.apply(mutable).getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1573,7 +1572,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
int combined = value.apply(mutable.toBlockVector3()).getInternalId();
|
int combined = value.apply(mutable).getInternalId();
|
||||||
mainArr[index] = combined;
|
mainArr[index] = combined;
|
||||||
floorArr[index] = combined;
|
floorArr[index] = combined;
|
||||||
}
|
}
|
||||||
@ -1595,7 +1594,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
mainArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
|
mainArr[index] = value.apply(mutable).getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1616,7 +1615,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
overlayArr[index] = value.apply(mutable.toBlockVector3()).getInternalId();
|
overlayArr[index] = value.apply(mutable).getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2003,7 +2002,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
overlay.setInt(index, combined);
|
overlay.setInt(index, combined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2018,7 +2017,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
floor.setInt(index, combined);
|
floor.setInt(index, combined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2034,7 +2033,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
main.setInt(index, combined);
|
main.setInt(index, combined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2050,7 +2049,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
int y = heights.getByte(index) & 0xFF;
|
int y = heights.getByte(index) & 0xFF;
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (mask.test(mutable.toBlockVector3())) {
|
if (mask.test(mutable)) {
|
||||||
floor.setInt(index, combined);
|
floor.setInt(index, combined);
|
||||||
main.setInt(index, combined);
|
main.setInt(index, combined);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class MappedReplacePatternFilter extends MCAFilterCounter {
|
|||||||
// map[block.getCombined()] = pattern;
|
// map[block.getCombined()] = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private final MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
// private final MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) {
|
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package com.boydti.fawe.jnbt.anvil.generator;
|
package com.boydti.fawe.jnbt.anvil.generator;
|
||||||
|
|
||||||
import com.boydti.fawe.object.PseudoRandom;
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public class OreGen extends Resource {
|
|||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
private final Extent extent;
|
private final Extent extent;
|
||||||
private final Mask mask;
|
private final Mask mask;
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
private double ONE_2 = 1 / 2F;
|
private double ONE_2 = 1 / 2F;
|
||||||
private double ONE_8 = 1 / 8F;
|
private double ONE_8 = 1 / 8F;
|
||||||
@ -43,7 +42,7 @@ public class OreGen extends Resource {
|
|||||||
@Override
|
@Override
|
||||||
public boolean spawn(Random rand, int x, int z) throws WorldEditException {
|
public boolean spawn(Random rand, int x, int z) throws WorldEditException {
|
||||||
int y = rand.nextInt(maxY - minY) + minY;
|
int y = rand.nextInt(maxY - minY) + minY;
|
||||||
if (!mask.test(mutable.setComponents(x, y, z).toBlockVector3())) {
|
if (!mask.test(mutable.setComponents(x, y, z))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
double f = rand.nextDouble() * Math.PI;
|
double f = rand.nextDouble() * Math.PI;
|
||||||
@ -106,8 +105,8 @@ public class OreGen extends Resource {
|
|||||||
double dz = (zz + 0.5D - d9) * id11o2;
|
double dz = (zz + 0.5D - d9) * id11o2;
|
||||||
double dxyz2 = dxy2 + dz * dz;
|
double dxyz2 = dxy2 + dz * dz;
|
||||||
if ((dxyz2 < 1)) {
|
if ((dxyz2 < 1)) {
|
||||||
if (mask.test(mutable.toBlockVector3()))
|
if (mask.test(mutable))
|
||||||
pattern.apply(extent, mutable.toBlockVector3(), mutable.toBlockVector3());
|
pattern.apply(extent, mutable, mutable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.boydti.fawe.jnbt.anvil.generator;
|
|||||||
|
|
||||||
import com.boydti.fawe.object.PseudoRandom;
|
import com.boydti.fawe.object.PseudoRandom;
|
||||||
import com.boydti.fawe.object.schematic.Schematic;
|
import com.boydti.fawe.object.schematic.Schematic;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
@ -20,7 +20,7 @@ public class SchemGen extends Resource {
|
|||||||
private final boolean randomRotate;
|
private final boolean randomRotate;
|
||||||
private final Mask mask;
|
private final Mask mask;
|
||||||
|
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public SchemGen(Mask mask, Extent extent, List<ClipboardHolder> clipboards, boolean randomRotate) {
|
public SchemGen(Mask mask, Extent extent, List<ClipboardHolder> clipboards, boolean randomRotate) {
|
||||||
this.mask = mask;
|
this.mask = mask;
|
||||||
@ -36,7 +36,7 @@ public class SchemGen extends Resource {
|
|||||||
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
|
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), 0, 255);
|
||||||
if (y == -1) return false;
|
if (y == -1) return false;
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
if (!mask.test(mutable.toBlockVector3())) {
|
if (!mask.test(mutable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mutable.mutY(y + 1);
|
mutable.mutY(y + 1);
|
||||||
@ -48,9 +48,9 @@ public class SchemGen extends Resource {
|
|||||||
Schematic schematic = new Schematic(clipboard);
|
Schematic schematic = new Schematic(clipboard);
|
||||||
Transform transform = holder.getTransform();
|
Transform transform = holder.getTransform();
|
||||||
if (transform.isIdentity()) {
|
if (transform.isIdentity()) {
|
||||||
schematic.paste(extent, mutable.toBlockVector3(), false);
|
schematic.paste(extent, mutable, false);
|
||||||
} else {
|
} else {
|
||||||
schematic.paste(extent, mutable.toBlockVector3(), false, transform);
|
schematic.paste(extent, mutable, false, transform);
|
||||||
}
|
}
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
return true;
|
return true;
|
||||||
|
@ -27,7 +27,7 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
|
|||||||
|
|
||||||
// public static IBlocksHubApi api;
|
// public static IBlocksHubApi api;
|
||||||
//
|
//
|
||||||
// private final MutableVector loc;
|
// private final MutableVector3 loc;
|
||||||
// private final IPlayer player;
|
// private final IPlayer player;
|
||||||
// private IWorld world;
|
// private IWorld world;
|
||||||
// private final MutableBlockData oldBlock;
|
// private final MutableBlockData oldBlock;
|
||||||
@ -46,7 +46,7 @@ public class LoggingChangeSet extends AbstractDelegateChangeSet {
|
|||||||
// } catch (Throwable ignore) {
|
// } catch (Throwable ignore) {
|
||||||
// this.world = api.getWorld(world);
|
// this.world = api.getWorld(world);
|
||||||
// }
|
// }
|
||||||
// this.loc = new MutableVector();
|
// this.loc = new MutableVector3();
|
||||||
// this.oldBlock = new MutableBlockData();
|
// this.oldBlock = new MutableBlockData();
|
||||||
// this.newBlock = new MutableBlockData();
|
// this.newBlock = new MutableBlockData();
|
||||||
// this.player = api.getPlayer(player.getUUID());
|
// this.player = api.getPlayer(player.getUUID());
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
//
|
//
|
||||||
//import org.primesoft.blockshub.api.Vector;
|
//import org.primesoft.blockshub.api.Vector;
|
||||||
//
|
//
|
||||||
//public class MutableVector extends Vector {
|
//public class MutableVector3 extends Vector {
|
||||||
//
|
//
|
||||||
// public double x, y, z;
|
// public double x, y, z;
|
||||||
//
|
//
|
||||||
// public MutableVector() {
|
// public MutableVector3() {
|
||||||
// super(0, 0, 0);
|
// super(0, 0, 0);
|
||||||
// this.x = 0;
|
// this.x = 0;
|
||||||
// this.y = 0;
|
// this.y = 0;
|
||||||
|
@ -18,7 +18,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
@ -273,7 +273,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
|||||||
default void forEachBlockInChunk(int cx, int cz, RunnableVal2<BlockVector3, BaseBlock> onEach) {
|
default void forEachBlockInChunk(int cx, int cz, RunnableVal2<BlockVector3, BaseBlock> onEach) {
|
||||||
int bx = cx << 4;
|
int bx = cx << 4;
|
||||||
int bz = cz << 4;
|
int bz = cz << 4;
|
||||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
int xx = x + bx;
|
int xx = x + bx;
|
||||||
mutable.mutX(xx);
|
mutable.mutX(xx);
|
||||||
@ -290,9 +290,9 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
|||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
CompoundTag tile = getTileEntity(x, y, z);
|
CompoundTag tile = getTileEntity(x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
onEach.run(mutable.toBlockVector3(), block.toBaseBlock(tile));
|
onEach.run(mutable, block.toBaseBlock(tile));
|
||||||
} else {
|
} else {
|
||||||
onEach.run(mutable.toBlockVector3(), block);
|
onEach.run(mutable, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
|||||||
default void forEachTileInChunk(int cx, int cz, RunnableVal2<BlockVector3, BaseBlock> onEach) {
|
default void forEachTileInChunk(int cx, int cz, RunnableVal2<BlockVector3, BaseBlock> onEach) {
|
||||||
int bx = cx << 4;
|
int bx = cx << 4;
|
||||||
int bz = cz << 4;
|
int bz = cz << 4;
|
||||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
int xx = x + bx;
|
int xx = x + bx;
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
@ -320,7 +320,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
|||||||
mutable.mutZ(zz);
|
mutable.mutZ(zz);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
|
BaseBlock block = BaseBlock.getFromInternalId(combined, tile);
|
||||||
onEach.run(mutable.toBlockVector3(), block);
|
onEach.run(mutable, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
|||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
@ -72,7 +71,7 @@ public class BlobBrush implements Brush {
|
|||||||
double manScaleY = (1.25 + seedY * 0.5);
|
double manScaleY = (1.25 + seedY * 0.5);
|
||||||
double manScaleZ = (1.25 + seedZ * 0.5);
|
double manScaleZ = (1.25 + seedZ * 0.5);
|
||||||
|
|
||||||
MutableVector mutable = new MutableVector();
|
MutableVector3 mutable = new MutableVector3();
|
||||||
double roughness = 1 - sphericity;
|
double roughness = 1 - sphericity;
|
||||||
for (int xr = -sizeInt; xr <= sizeInt; xr++) {
|
for (int xr = -sizeInt; xr <= sizeInt; xr++) {
|
||||||
mutable.mutX(xr);
|
mutable.mutX(xr);
|
||||||
@ -80,7 +79,7 @@ public class BlobBrush implements Brush {
|
|||||||
mutable.mutY(yr);
|
mutable.mutY(yr);
|
||||||
for (int zr = -sizeInt; zr <= sizeInt; zr++) {
|
for (int zr = -sizeInt; zr <= sizeInt; zr++) {
|
||||||
mutable.mutZ(zr);
|
mutable.mutZ(zr);
|
||||||
Vector3 pt = transform.apply(mutable.toVector3());
|
Vector3 pt = transform.apply(mutable);
|
||||||
int x = MathMan.roundInt(pt.getX());
|
int x = MathMan.roundInt(pt.getX());
|
||||||
int y = MathMan.roundInt(pt.getY());
|
int y = MathMan.roundInt(pt.getY());
|
||||||
int z = MathMan.roundInt(pt.getZ());
|
int z = MathMan.roundInt(pt.getZ());
|
||||||
|
@ -19,7 +19,7 @@ public class CircleBrush implements Brush {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||||
Vector3 normal = position.toVector3().subtract(player.getLocation().toVector());
|
Vector3 normal = position.toVector3().subtract(player.getLocation());
|
||||||
editSession.makeCircle(position, pattern, size, size, size, false, normal);
|
editSession.makeCircle(position, pattern, size, size, size, false, normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,16 +6,14 @@ import com.boydti.fawe.util.TextureUtil;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@ -89,7 +87,7 @@ public class ImageBrush implements Brush {
|
|||||||
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX((pitch - 90) % 360).inverse();
|
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX((pitch - 90) % 360).inverse();
|
||||||
|
|
||||||
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
||||||
private final MutableVector mutable = new MutableVector();
|
private final MutableVector3 mutable = new MutableVector3();
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (solid.test(vector)) {
|
if (solid.test(vector)) {
|
||||||
@ -97,11 +95,11 @@ public class ImageBrush implements Brush {
|
|||||||
int dy = vector.getBlockY() - cy;
|
int dy = vector.getBlockY() - cy;
|
||||||
int dz = vector.getBlockZ() - cz;
|
int dz = vector.getBlockZ() - cz;
|
||||||
|
|
||||||
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5).toVector3());
|
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5));
|
||||||
int x1 = (int) (pos1.getX() * scale + centerX);
|
int x1 = (int) (pos1.getX() * scale + centerX);
|
||||||
int z1 = (int) (pos1.getZ() * scale + centerZ);
|
int z1 = (int) (pos1.getZ() * scale + centerZ);
|
||||||
|
|
||||||
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5).toVector3());
|
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5));
|
||||||
int x2 = (int) (pos2.getX() * scale + centerX);
|
int x2 = (int) (pos2.getX() * scale + centerX);
|
||||||
int z2 = (int) (pos2.getZ() * scale + centerZ);
|
int z2 = (int) (pos2.getZ() * scale + centerZ);
|
||||||
if (x2 < x1) {
|
if (x2 < x1) {
|
||||||
|
@ -53,9 +53,9 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
|||||||
int range = this.range > -1 ? getRange() : MAX_RANGE;
|
int range = this.range > -1 ? getRange() : MAX_RANGE;
|
||||||
if (adjacent) {
|
if (adjacent) {
|
||||||
Location face = player.getBlockTraceFace(range, true);
|
Location face = player.getBlockTraceFace(range, true);
|
||||||
return face.toVector().add(face.getDirection());
|
return face.add(face.getDirection());
|
||||||
} else {
|
} else {
|
||||||
return player.getBlockTrace(getRange(), true).toVector();
|
return player.getBlockTrace(getRange(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
|
||||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||||
@ -16,8 +15,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
@ -27,7 +25,7 @@ public class LayerBrush implements Brush {
|
|||||||
|
|
||||||
private final BlockStateHolder[] layers;
|
private final BlockStateHolder[] layers;
|
||||||
private RecursiveVisitor visitor;
|
private RecursiveVisitor visitor;
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public LayerBrush(BlockStateHolder[] layers) {
|
public LayerBrush(BlockStateHolder[] layers) {
|
||||||
this.layers = layers;
|
this.layers = layers;
|
||||||
@ -53,9 +51,9 @@ public class LayerBrush implements Brush {
|
|||||||
int previous2 = layers[depth - 2].getInternalId();
|
int previous2 = layers[depth - 2].getInternalId();
|
||||||
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
|
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
|
||||||
if (visitor.isVisited(mutable.toBlockVector3()) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) {
|
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous) {
|
||||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2, pos.getBlockZ() + dir.getBlockZ() * 2);
|
mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2, pos.getBlockZ() + dir.getBlockZ() * 2);
|
||||||
if (visitor.isVisited(mutable.toBlockVector3()) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
|
if (visitor.isVisited(mutable) && queue.getCachedCombinedId4Data(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,10 +10,10 @@ import com.sk89q.worldedit.function.mask.Masks;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
public class ShatterBrush extends ScatterBrush {
|
public class ShatterBrush extends ScatterBrush {
|
||||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public ShatterBrush(int count) {
|
public ShatterBrush(int count) {
|
||||||
super(count, 1);
|
super(count, 1);
|
||||||
@ -76,8 +76,8 @@ public class ShatterBrush extends ScatterBrush {
|
|||||||
int dz = position.getBlockZ() - z2;
|
int dz = position.getBlockZ() - z2;
|
||||||
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
||||||
if (dSqr <= radius2) {
|
if (dSqr <= radius2) {
|
||||||
MutableBlockVector v = mutable.setComponents(x2, y2, z2);
|
MutableBlockVector3 v = mutable.setComponents(x2, y2, z2);
|
||||||
BlockVector3 bv = v.toBlockVector3();
|
BlockVector3 bv = v;
|
||||||
if (surfaceTest.test(bv) && finalMask.test(bv)) {
|
if (surfaceTest.test(bv) && finalMask.test(bv)) {
|
||||||
// (collision) If it's visited and part of another frontier, set the block
|
// (collision) If it's visited and part of another frontier, set the block
|
||||||
if (!placed.add(x2, y2, z2)) {
|
if (!placed.add(x2, y2, z2)) {
|
||||||
|
@ -17,7 +17,7 @@ import com.sk89q.worldedit.function.mask.MaskIntersection;
|
|||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.interpolation.Node;
|
import com.sk89q.worldedit.math.interpolation.Node;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -151,13 +151,13 @@ public class SplineBrush implements Brush, ResettableTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
||||||
MutableVector sum = new MutableVector();
|
MutableVector3 sum = new MutableVector3();
|
||||||
for (BlockVector3 p : points) {
|
for (BlockVector3 p : points) {
|
||||||
sum.mutX(sum.getX() + p.getX());
|
sum.mutX(sum.getX() + p.getX());
|
||||||
sum.mutY(sum.getY() + p.getY());
|
sum.mutY(sum.getY() + p.getY());
|
||||||
sum.mutZ(sum.getZ() + p.getZ());
|
sum.mutZ(sum.getZ() + p.getZ());
|
||||||
}
|
}
|
||||||
return sum.multiply(1.0 / points.size()).toVector3();
|
return sum.multiply(1.0 / points.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockVector3 normal(Collection<BlockVector3> points, BlockVector3 centroid) {
|
private BlockVector3 normal(Collection<BlockVector3> points, BlockVector3 centroid) {
|
||||||
@ -179,7 +179,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
|||||||
double yz = 0.0;
|
double yz = 0.0;
|
||||||
double zz = 0.0;
|
double zz = 0.0;
|
||||||
|
|
||||||
MutableVector r = new MutableVector();
|
MutableVector3 r = new MutableVector3();
|
||||||
for (BlockVector3 p : points) {
|
for (BlockVector3 p : points) {
|
||||||
r.mutX((p.getX() - centroid.getX()));
|
r.mutX((p.getX() - centroid.getX()));
|
||||||
r.mutY((p.getY() - centroid.getY()));
|
r.mutY((p.getY() - centroid.getY()));
|
||||||
|
@ -15,8 +15,7 @@ import com.sk89q.worldedit.function.operation.Operations;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@ -54,7 +53,7 @@ public class StencilBrush extends HeightBrush {
|
|||||||
|
|
||||||
|
|
||||||
Player player = editSession.getPlayer().getPlayer();
|
Player player = editSession.getPlayer().getPlayer();
|
||||||
// BlockVector3 pos = player.getLocation().toVector();
|
// BlockVector3 pos = player.getLocation();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +64,7 @@ public class StencilBrush extends HeightBrush {
|
|||||||
|
|
||||||
|
|
||||||
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
||||||
private final MutableVector mutable = new MutableVector();
|
private final MutableVector3 mutable = new MutableVector3();
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (solid.test(vector)) {
|
if (solid.test(vector)) {
|
||||||
@ -73,7 +72,7 @@ public class StencilBrush extends HeightBrush {
|
|||||||
int dy = vector.getBlockY() - cy;
|
int dy = vector.getBlockY() - cy;
|
||||||
int dz = vector.getBlockZ() - cz;
|
int dz = vector.getBlockZ() - cz;
|
||||||
|
|
||||||
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz).toVector3());
|
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
||||||
dx = MathMan.roundInt(srcPos.getX());
|
dx = MathMan.roundInt(srcPos.getX());
|
||||||
dz = MathMan.roundInt(srcPos.getZ());
|
dz = MathMan.roundInt(srcPos.getZ());
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import com.sk89q.worldedit.*;
|
|||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
|
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
|
||||||
import com.sk89q.worldedit.math.interpolation.Node;
|
import com.sk89q.worldedit.math.interpolation.Node;
|
||||||
@ -60,7 +60,7 @@ public class SurfaceSpline implements Brush {
|
|||||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
|
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
|
||||||
if (tipy == -1) continue;
|
if (tipy == -1) continue;
|
||||||
if (radius == 0) {
|
if (radius == 0) {
|
||||||
BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz).toBlockVector3();
|
BlockVector3 set = MutableBlockVector3.get(tipx, tipy, tipz);
|
||||||
try {
|
try {
|
||||||
pattern.apply(editSession, set, set);
|
pattern.apply(editSession, set, set);
|
||||||
} catch (WorldEditException e) {
|
} catch (WorldEditException e) {
|
||||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.object.PseudoRandom;
|
|||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||||
@ -31,7 +30,7 @@ public interface HeightMap {
|
|||||||
int iterations = 1;
|
int iterations = 1;
|
||||||
Location min = new Location(session.getWorld(), pos.subtract(size, maxY, size).toVector3());
|
Location min = new Location(session.getWorld(), pos.subtract(size, maxY, size).toVector3());
|
||||||
BlockVector3 max = pos.add(size, maxY, size);
|
BlockVector3 max = pos.add(size, maxY, size);
|
||||||
Region region = new CuboidRegion(session.getWorld(), min.toVector().toBlockPoint(), max);
|
Region region = new CuboidRegion(session.getWorld(), min.toBlockPoint(), max);
|
||||||
com.sk89q.worldedit.math.convolution.HeightMap heightMap = new com.sk89q.worldedit.math.convolution.HeightMap(session, region, data[0], layers);
|
com.sk89q.worldedit.math.convolution.HeightMap heightMap = new com.sk89q.worldedit.math.convolution.HeightMap(session, region, data[0], layers);
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package com.boydti.fawe.object.brush.heightmap;
|
package com.boydti.fawe.object.brush.heightmap;
|
||||||
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
|
|
||||||
public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
||||||
private AffineTransform transform;
|
private AffineTransform transform;
|
||||||
private MutableVector mutable;
|
private MutableVector3 mutable;
|
||||||
|
|
||||||
public RotatableHeightMap(HeightMap parent) {
|
public RotatableHeightMap(HeightMap parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
mutable = new MutableVector();
|
mutable = new MutableVector3();
|
||||||
this.transform = new AffineTransform();
|
this.transform = new AffineTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
|||||||
public double getHeight(int x, int z) {
|
public double getHeight(int x, int z) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutZ(z);
|
mutable.mutZ(z);
|
||||||
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z).toVector3()).toBlockPoint();
|
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint();
|
||||||
return super.getHeight(pos.getBlockX(), pos.getBlockZ());
|
return super.getHeight(pos.getBlockX(), pos.getBlockZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,10 +3,9 @@ package com.boydti.fawe.object.brush.heightmap;
|
|||||||
import com.boydti.fawe.object.IntegerPair;
|
import com.boydti.fawe.object.IntegerPair;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@ -77,10 +76,10 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
|||||||
int xx = pos.getBlockX();
|
int xx = pos.getBlockX();
|
||||||
int zz = pos.getBlockZ();
|
int zz = pos.getBlockZ();
|
||||||
int highestY = minY;
|
int highestY = minY;
|
||||||
MutableBlockVector bv = new MutableBlockVector(pos);
|
MutableBlockVector3 bv = new MutableBlockVector3(pos);
|
||||||
for (int y = minY; y <= maxY; y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
bv.mutY(y);
|
bv.mutY(y);
|
||||||
BlockStateHolder block = clipboard.getBlock(bv.toBlockVector3());
|
BlockStateHolder block = clipboard.getBlock(bv);
|
||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
highestY = y + 1;
|
highestY = y + 1;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import com.sk89q.worldedit.command.tool.brush.Brush;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.interpolation.Interpolation;
|
import com.sk89q.worldedit.math.interpolation.Interpolation;
|
||||||
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
|
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
|
||||||
@ -95,10 +95,10 @@ public class SweepBrush implements Brush, ResettableTool {
|
|||||||
double blockDistance = 1d / splineLength;
|
double blockDistance = 1d / splineLength;
|
||||||
double step = blockDistance / quality;
|
double step = blockDistance / quality;
|
||||||
double accumulation = 0;
|
double accumulation = 0;
|
||||||
MutableVector last = new MutableVector(0, 0, 0);
|
MutableVector3 last = new MutableVector3(0, 0, 0);
|
||||||
for (double pos = 0D; pos <= 1D; pos += step) {
|
for (double pos = 0D; pos <= 1D; pos += step) {
|
||||||
Vector3 gradient = interpol.get1stDerivative(pos);
|
Vector3 gradient = interpol.get1stDerivative(pos);
|
||||||
if (last == null) last = new MutableVector(interpol.get1stDerivative(pos));
|
if (last == null) last = new MutableVector3(interpol.get1stDerivative(pos));
|
||||||
double dist = MathMan.sqrtApprox(last.distanceSq(gradient));
|
double dist = MathMan.sqrtApprox(last.distanceSq(gradient));
|
||||||
last.mutX(gradient.getX());
|
last.mutX(gradient.getX());
|
||||||
last.mutY(gradient.getY());
|
last.mutY(gradient.getY());
|
||||||
|
@ -3,12 +3,12 @@ package com.boydti.fawe.object.change;
|
|||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.history.UndoContext;
|
import com.sk89q.worldedit.history.UndoContext;
|
||||||
import com.sk89q.worldedit.history.change.Change;
|
import com.sk89q.worldedit.history.change.Change;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
|
|
||||||
public class MutableBiomeChange implements Change {
|
public class MutableBiomeChange implements Change {
|
||||||
|
|
||||||
private MutableBlockVector2D mutable = new MutableBlockVector2D();
|
private MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||||
private BaseBiome from;
|
private BaseBiome from;
|
||||||
private BaseBiome to;
|
private BaseBiome to;
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ public class MutableBiomeChange implements Change {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void undo(UndoContext context) throws WorldEditException {
|
public void undo(UndoContext context) throws WorldEditException {
|
||||||
context.getExtent().setBiome(mutable.toBlockVector2(), from);
|
context.getExtent().setBiome(mutable, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void redo(UndoContext context) throws WorldEditException {
|
public void redo(UndoContext context) throws WorldEditException {
|
||||||
context.getExtent().setBiome(mutable.toBlockVector2(), to);
|
context.getExtent().setBiome(mutable, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
package com.boydti.fawe.object.clipboard;
|
package com.boydti.fawe.object.clipboard;
|
||||||
|
|
||||||
import com.boydti.fawe.util.ReflectionUtils;
|
import com.boydti.fawe.util.ReflectionUtils;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
@ -29,7 +27,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
|||||||
public final int mx, my, mz;
|
public final int mx, my, mz;
|
||||||
private final boolean hasBiomes;
|
private final boolean hasBiomes;
|
||||||
private final boolean hasEntities;
|
private final boolean hasEntities;
|
||||||
private MutableBlockVector2D mutableBlockVector2D = new MutableBlockVector2D();
|
private MutableBlockVector2 MutableBlockVector2 = new MutableBlockVector2();
|
||||||
public final Extent extent;
|
public final Extent extent;
|
||||||
|
|
||||||
public WorldCopyClipboard(Extent editSession, Region region) {
|
public WorldCopyClipboard(Extent editSession, Region region) {
|
||||||
@ -58,7 +56,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBiome getBiome(int x, int z) {
|
public BaseBiome getBiome(int x, int z) {
|
||||||
return extent.getBiome(mutableBlockVector2D.setComponents(mx + x, mz + z).toBlockVector2());
|
return extent.getBiome(MutableBlockVector2.setComponents(mx + x, mz + z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -76,7 +74,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
|||||||
public void forEach(BlockReader task, boolean air) {
|
public void forEach(BlockReader task, boolean air) {
|
||||||
BlockVector3 min = region.getMinimumPoint();
|
BlockVector3 min = region.getMinimumPoint();
|
||||||
BlockVector3 max = region.getMaximumPoint();
|
BlockVector3 max = region.getMaximumPoint();
|
||||||
MutableBlockVector pos = new MutableBlockVector();
|
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||||
if (region instanceof CuboidRegion) {
|
if (region instanceof CuboidRegion) {
|
||||||
if (air) {
|
if (air) {
|
||||||
((CuboidRegion) region).setUseOldIterator(true);
|
((CuboidRegion) region).setUseOldIterator(true);
|
||||||
@ -137,9 +135,9 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
|||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
||||||
pos.mutX(x);
|
pos.mutX(x);
|
||||||
int xx = pos.getBlockX() - mx;
|
int xx = pos.getBlockX() - mx;
|
||||||
if (region.contains(pos.toBlockVector3())) {
|
if (region.contains(pos)) {
|
||||||
// BlockState block = getBlockAbs(x, y, z);
|
// BlockState block = getBlockAbs(x, y, z);
|
||||||
BaseBlock block = extent.getFullBlock(pos.toBlockVector3());
|
BaseBlock block = extent.getFullBlock(pos);
|
||||||
if (!air && block.getBlockType().getMaterial().isAir()) {
|
if (!air && block.getBlockType().getMaterial().isAir()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.boydti.fawe.object.collection;
|
|||||||
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
@ -43,14 +43,14 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
|
|||||||
int newSize = count + size;
|
int newSize = count + size;
|
||||||
if (newSize > index) {
|
if (newSize > index) {
|
||||||
int localIndex = index - count;
|
int localIndex = index - count;
|
||||||
MutableBlockVector pos = new MutableBlockVector(set.getIndex(localIndex));
|
MutableBlockVector3 pos = new MutableBlockVector3(set.getIndex(localIndex));
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
int pair = entry.getIntKey();
|
int pair = entry.getIntKey();
|
||||||
int cx = MathMan.unpairX(pair);
|
int cx = MathMan.unpairX(pair);
|
||||||
int cz = MathMan.unpairY(pair);
|
int cz = MathMan.unpairY(pair);
|
||||||
pos.mutX((cx << 11) + pos.getBlockX());
|
pos.mutX((cx << 11) + pos.getBlockX());
|
||||||
pos.mutZ((cz << 11) + pos.getBlockZ());
|
pos.mutZ((cz << 11) + pos.getBlockZ());
|
||||||
return pos.toBlockVector3();
|
return pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
count += newSize;
|
count += newSize;
|
||||||
@ -92,7 +92,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
|
|||||||
return new Iterator<BlockVector3>() {
|
return new Iterator<BlockVector3>() {
|
||||||
Int2ObjectMap.Entry<LocalBlockVectorSet> entry = entries.next();
|
Int2ObjectMap.Entry<LocalBlockVectorSet> entry = entries.next();
|
||||||
Iterator<BlockVector3> entryIter = entry.getValue().iterator();
|
Iterator<BlockVector3> entryIter = entry.getValue().iterator();
|
||||||
MutableBlockVector mutable = new MutableBlockVector();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
@ -117,7 +117,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
|
|||||||
int pair = entry.getIntKey();
|
int pair = entry.getIntKey();
|
||||||
int cx = MathMan.unpairX(pair);
|
int cx = MathMan.unpairX(pair);
|
||||||
int cz = MathMan.unpairY(pair);
|
int cz = MathMan.unpairY(pair);
|
||||||
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ()).toBlockVector3();
|
return mutable.setComponents((cx << 11) + localPos.getBlockX(), localPos.getBlockY(), (cz << 11) + localPos.getBlockZ());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.boydti.fawe.object.collection;
|
|||||||
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -15,7 +15,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
||||||
private final SparseBitSet set;
|
private final SparseBitSet set;
|
||||||
private final MutableBlockVector2D mutable = new MutableBlockVector2D();
|
private final MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||||
|
|
||||||
public LocalBlockVector2DSet() {
|
public LocalBlockVector2DSet() {
|
||||||
this.set = new SparseBitSet();
|
this.set = new SparseBitSet();
|
||||||
@ -102,7 +102,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
|||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
int x = MathMan.unpairSearchCoordsX(index);
|
int x = MathMan.unpairSearchCoordsX(index);
|
||||||
int y = MathMan.unpairSearchCoordsY(index);
|
int y = MathMan.unpairSearchCoordsY(index);
|
||||||
return mutable.setComponents(x, y).toBlockVector2();
|
return mutable.setComponents(x, y);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
|||||||
mutable.setComponents(x, y);
|
mutable.setComponents(x, y);
|
||||||
previous = index;
|
previous = index;
|
||||||
index = set.nextSetBit(index + 1);
|
index = set.nextSetBit(index + 1);
|
||||||
return mutable.toBlockVector2();
|
return mutable;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.boydti.fawe.object.collection;
|
|||||||
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -117,7 +117,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
|||||||
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
||||||
int y = b1;
|
int y = b1;
|
||||||
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
|
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
|
||||||
return MutableBlockVector.get(x, y, z).toBlockVector3();
|
return MutableBlockVector3.get(x, y, z);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
|||||||
return new Iterator<BlockVector3>() {
|
return new Iterator<BlockVector3>() {
|
||||||
int index = set.nextSetBit(0);
|
int index = set.nextSetBit(0);
|
||||||
int previous = -1;
|
int previous = -1;
|
||||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
@ -151,7 +151,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
|||||||
mutable.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21));
|
mutable.mutZ(offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21));
|
||||||
previous = index;
|
previous = index;
|
||||||
index = set.nextSetBit(index + 1);
|
index = set.nextSetBit(index + 1);
|
||||||
return mutable.toBlockVector3();
|
return mutable;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
int size = size();
|
int size = size();
|
||||||
int index = -1;
|
int index = -1;
|
||||||
MutableBlockVector mVec = MutableBlockVector.get(0, 0, 0);
|
MutableBlockVector3 mVec = MutableBlockVector3.get(0, 0, 0);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
index = set.nextSetBit(index + 1);
|
index = set.nextSetBit(index + 1);
|
||||||
int b1 = (index & 0xFF);
|
int b1 = (index & 0xFF);
|
||||||
@ -310,7 +310,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
|
|||||||
public void forEach(BlockVectorSetVisitor visitor) {
|
public void forEach(BlockVectorSetVisitor visitor) {
|
||||||
int size = size();
|
int size = size();
|
||||||
int index = -1;
|
int index = -1;
|
||||||
BlockVector3 mVec = MutableBlockVector.get(0, 0, 0).toBlockVector3();
|
BlockVector3 mVec = MutableBlockVector3.get(0, 0, 0);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
index = set.nextSetBit(index + 1);
|
index = set.nextSetBit(index + 1);
|
||||||
int b1 = (index & 0xFF);
|
int b1 = (index & 0xFF);
|
||||||
|
@ -7,14 +7,13 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
public class BlockTranslateExtent extends AbstractDelegateExtent {
|
public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||||
private final int dx, dy, dz;
|
private final int dx, dy, dz;
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public BlockTranslateExtent(Extent extent, int dx, int dy, int dz) {
|
public BlockTranslateExtent(Extent extent, int dx, int dy, int dz) {
|
||||||
super(extent);
|
super(extent);
|
||||||
@ -28,7 +27,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
|||||||
mutable.mutX((location.getX() + dx));
|
mutable.mutX((location.getX() + dx));
|
||||||
mutable.mutY((location.getY() + dy));
|
mutable.mutY((location.getY() + dy));
|
||||||
mutable.mutZ((location.getZ() + dz));
|
mutable.mutZ((location.getZ() + dz));
|
||||||
return getExtent().setBlock(mutable.toBlockVector3(), block);
|
return getExtent().setBlock(mutable, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
package com.boydti.fawe.object.extent;
|
package com.boydti.fawe.object.extent;
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
public class OffsetExtent extends ResettableExtent {
|
public class OffsetExtent extends ResettableExtent {
|
||||||
private final int dx, dy, dz;
|
private final int dx, dy, dz;
|
||||||
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
|
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||||
|
|
||||||
public OffsetExtent(Extent parent, int dx, int dy, int dz) {
|
public OffsetExtent(Extent parent, int dx, int dy, int dz) {
|
||||||
super(parent);
|
super(parent);
|
||||||
@ -22,7 +21,7 @@ public class OffsetExtent extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||||
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz).toBlockVector2(), biome);
|
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,7 +41,7 @@ public class OffsetExtent extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResettableExtent setExtent(Extent extent) {
|
public ResettableExtent setExtent(Extent extent) {
|
||||||
mutable = new MutableBlockVector2D();
|
mutable = new MutableBlockVector2();
|
||||||
return super.setExtent(extent);
|
return super.setExtent(extent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,15 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
public class PositionTransformExtent extends ResettableExtent {
|
public class PositionTransformExtent extends ResettableExtent {
|
||||||
|
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private transient BlockVector3 min;
|
private transient BlockVector3 min;
|
||||||
private Transform transform;
|
private Transform transform;
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResettableExtent setExtent(Extent extent) {
|
public ResettableExtent setExtent(Extent extent) {
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
min = null;
|
min = null;
|
||||||
return super.setExtent(extent);
|
return super.setExtent(extent);
|
||||||
}
|
}
|
||||||
@ -42,7 +41,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
mutable.mutX(((pos.getX() - min.getX())));
|
mutable.mutX(((pos.getX() - min.getX())));
|
||||||
mutable.mutY(((pos.getY() - min.getY())));
|
mutable.mutY(((pos.getY() - min.getY())));
|
||||||
mutable.mutZ(((pos.getZ() - min.getZ())));
|
mutable.mutZ(((pos.getZ() - min.getZ())));
|
||||||
MutableVector tmp = new MutableVector(transform.apply(mutable.toVector3()));
|
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||||
BlockVector3 result = min.add(tmp.toBlockPoint());
|
BlockVector3 result = min.add(tmp.toBlockPoint());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -72,7 +71,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.getBlockX());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.getBlockZ());
|
||||||
mutable.mutY(0);
|
mutable.mutY(0);
|
||||||
return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
|
return super.getBiome(getPos(mutable).toBlockVector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,7 +90,7 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.getBlockX());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.getBlockZ());
|
||||||
mutable.mutY(0);
|
mutable.mutY(0);
|
||||||
return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
|
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransform(Transform transform) {
|
public void setTransform(Transform transform) {
|
||||||
|
@ -2,11 +2,10 @@ package com.boydti.fawe.object.extent;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ import java.util.SplittableRandom;
|
|||||||
|
|
||||||
public class RandomOffsetTransform extends ResettableExtent {
|
public class RandomOffsetTransform extends ResettableExtent {
|
||||||
private transient SplittableRandom random;
|
private transient SplittableRandom random;
|
||||||
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
|
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||||
|
|
||||||
private final int dx, dy, dz;
|
private final int dx, dy, dz;
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ public class RandomOffsetTransform extends ResettableExtent {
|
|||||||
public boolean setBiome(BlockVector2 pos, BaseBiome biome) {
|
public boolean setBiome(BlockVector2 pos, BaseBiome biome) {
|
||||||
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
||||||
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
||||||
return getExtent().setBiome(mutable.setComponents(x, z).toBlockVector2(), biome);
|
return getExtent().setBiome(mutable.setComponents(x, z), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -52,7 +51,7 @@ public class RandomOffsetTransform extends ResettableExtent {
|
|||||||
@Override
|
@Override
|
||||||
public ResettableExtent setExtent(Extent extent) {
|
public ResettableExtent setExtent(Extent extent) {
|
||||||
random = new SplittableRandom();
|
random = new SplittableRandom();
|
||||||
mutable = new MutableBlockVector2D();
|
mutable = new MutableBlockVector2();
|
||||||
return super.setExtent(extent);
|
return super.setExtent(extent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,12 @@ package com.boydti.fawe.object.extent;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
@ -16,7 +15,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ScaleTransform extends ResettableExtent {
|
public class ScaleTransform extends ResettableExtent {
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private transient int maxy;
|
private transient int maxy;
|
||||||
private transient BlockVector3 min;
|
private transient BlockVector3 min;
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
public ResettableExtent setExtent(Extent extent) {
|
public ResettableExtent setExtent(Extent extent) {
|
||||||
min = null;
|
min = null;
|
||||||
maxy = extent.getMaximumPoint().getBlockY();
|
maxy = extent.getMaximumPoint().getBlockY();
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
return super.setExtent(extent);
|
return super.setExtent(extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
mutable.mutX((min.getX() + (pos.getX() - min.getX()) * dx));
|
mutable.mutX((min.getX() + (pos.getX() - min.getX()) * dx));
|
||||||
mutable.mutY((min.getY() + (pos.getY() - min.getY()) * dy));
|
mutable.mutY((min.getY() + (pos.getY() - min.getY()) * dy));
|
||||||
mutable.mutZ((min.getZ() + (pos.getZ() - min.getZ()) * dz));
|
mutable.mutZ((min.getZ() + (pos.getZ() - min.getZ()) * dz));
|
||||||
return mutable.toBlockVector3();
|
return mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockVector3 getPos(int x, int y, int z) {
|
private BlockVector3 getPos(int x, int y, int z) {
|
||||||
@ -56,14 +55,14 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
mutable.mutX((min.getX() + (x - min.getX()) * dx));
|
mutable.mutX((min.getX() + (x - min.getX()) * dx));
|
||||||
mutable.mutY((min.getY() + (y - min.getY()) * dy));
|
mutable.mutY((min.getY() + (y - min.getY()) * dy));
|
||||||
mutable.mutZ((min.getZ() + (z - min.getZ()) * dz));
|
mutable.mutZ((min.getZ() + (z - min.getZ()) * dz));
|
||||||
return mutable.toBlockVector3();
|
return mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableBlockVector pos = new MutableBlockVector(getPos(location));
|
MutableBlockVector3 pos = new MutableBlockVector3(getPos(location));
|
||||||
double sx = pos.getX();
|
double sx = pos.getX();
|
||||||
double sy = pos.getY();
|
double sy = pos.getY();
|
||||||
double sz = pos.getZ();
|
double sz = pos.getZ();
|
||||||
@ -73,7 +72,7 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
||||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||||
result |= super.setBlock(pos.toBlockVector3(), block);
|
result |= super.setBlock(pos, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +82,7 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableBlockVector pos = new MutableBlockVector(getPos(position.getBlockX(), 0, position.getBlockZ()));
|
MutableBlockVector3 pos = new MutableBlockVector3(getPos(position.getBlockX(), 0, position.getBlockZ()));
|
||||||
double sx = pos.getX();
|
double sx = pos.getX();
|
||||||
double sz = pos.getZ();
|
double sz = pos.getZ();
|
||||||
double ex = pos.getX() + dx;
|
double ex = pos.getX() + dx;
|
||||||
@ -99,7 +98,7 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x1, int y1, int z1, BlockStateHolder block) throws WorldEditException {
|
public boolean setBlock(int x1, int y1, int z1, BlockStateHolder block) throws WorldEditException {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableBlockVector pos = new MutableBlockVector(getPos(x1, y1, z1));
|
MutableBlockVector3 pos = new MutableBlockVector3(getPos(x1, y1, z1));
|
||||||
double sx = pos.getX();
|
double sx = pos.getX();
|
||||||
double sy = pos.getY();
|
double sy = pos.getY();
|
||||||
double sz = pos.getZ();
|
double sz = pos.getZ();
|
||||||
@ -109,7 +108,7 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
||||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
||||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
||||||
result |= super.setBlock(pos.toBlockVector3(), block);
|
result |= super.setBlock(pos, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,10 @@ package com.boydti.fawe.object.extent;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
|
|
||||||
public class SourceMaskExtent extends TemporalExtent {
|
public class SourceMaskExtent extends TemporalExtent {
|
||||||
private Mask mask;
|
private Mask mask;
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,6 +53,6 @@ public class SourceMaskExtent extends TemporalExtent {
|
|||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
mutable.mutZ(z);
|
mutable.mutZ(z);
|
||||||
return mask.test(mutable.toBlockVector3()) && super.setBlock(x, y, z, block);
|
return mask.test(mutable) && super.setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,14 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
|
||||||
|
|
||||||
public class TransformExtent extends BlockTransformExtent {
|
public class TransformExtent extends BlockTransformExtent {
|
||||||
|
|
||||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private BlockVector3 min;
|
private BlockVector3 min;
|
||||||
private int maxy;
|
private int maxy;
|
||||||
|
|
||||||
@ -58,7 +56,7 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
mutable.mutX(((pos.getX() - min.getX())));
|
mutable.mutX(((pos.getX() - min.getX())));
|
||||||
mutable.mutY(((pos.getY() - min.getY())));
|
mutable.mutY(((pos.getY() - min.getY())));
|
||||||
mutable.mutZ(((pos.getZ() - min.getZ())));
|
mutable.mutZ(((pos.getZ() - min.getZ())));
|
||||||
MutableVector tmp = new MutableVector(getTransform().apply(mutable.toVector3()));
|
MutableVector3 tmp = new MutableVector3(getTransform().apply(mutable.toVector3()));
|
||||||
tmp.mutX((tmp.getX() + min.getX()));
|
tmp.mutX((tmp.getX() + min.getX()));
|
||||||
tmp.mutY((tmp.getY() + min.getY()));
|
tmp.mutY((tmp.getY() + min.getY()));
|
||||||
tmp.mutZ((tmp.getZ() + min.getZ()));
|
tmp.mutZ((tmp.getZ() + min.getZ()));
|
||||||
@ -72,7 +70,7 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
mutable.mutX(((x - min.getX())));
|
mutable.mutX(((x - min.getX())));
|
||||||
mutable.mutY(((y - min.getY())));
|
mutable.mutY(((y - min.getY())));
|
||||||
mutable.mutZ(((z - min.getZ())));
|
mutable.mutZ(((z - min.getZ())));
|
||||||
MutableVector tmp = new MutableVector(getTransform().apply(mutable.toVector3()));
|
MutableVector3 tmp = new MutableVector3(getTransform().apply(mutable.toVector3()));
|
||||||
tmp.mutX((tmp.getX() + min.getX()));
|
tmp.mutX((tmp.getX() + min.getX()));
|
||||||
tmp.mutY((tmp.getY() + min.getY()));
|
tmp.mutY((tmp.getY() + min.getY()));
|
||||||
tmp.mutZ((tmp.getZ() + min.getZ()));
|
tmp.mutZ((tmp.getZ() + min.getZ()));
|
||||||
@ -104,7 +102,7 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.getBlockX());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.getBlockZ());
|
||||||
mutable.mutY(0);
|
mutable.mutY(0);
|
||||||
return super.getBiome(getPos(mutable.toBlockVector3()).toBlockVector2());
|
return super.getBiome(getPos(mutable).toBlockVector2());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,6 +121,6 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.getBlockX());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.getBlockZ());
|
||||||
mutable.mutY(0);
|
mutable.mutY(0);
|
||||||
return super.setBiome(getPos(mutable.toBlockVector3()).toBlockVector2(), biome);
|
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
public class SurfaceRegionFunction implements FlatRegionFunction {
|
public class SurfaceRegionFunction implements FlatRegionFunction {
|
||||||
private final Extent extent;
|
private final Extent extent;
|
||||||
@ -13,7 +13,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
|||||||
private final int minY;
|
private final int minY;
|
||||||
private final int maxY;
|
private final int maxY;
|
||||||
private int lastY;
|
private int lastY;
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public SurfaceRegionFunction(Extent extent, RegionFunction function, int minY, int maxY) {
|
public SurfaceRegionFunction(Extent extent, RegionFunction function, int minY, int maxY) {
|
||||||
this.extent = extent;
|
this.extent = extent;
|
||||||
@ -30,7 +30,7 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
|||||||
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
||||||
if (layer != -1) {
|
if (layer != -1) {
|
||||||
lastY = layer;
|
lastY = layer;
|
||||||
return function.apply(mutable.setComponents(x, layer, z).toBlockVector3());
|
return function.apply(mutable.setComponents(x, layer, z));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,17 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
|
|
||||||
public class BiomeCopy implements RegionFunction {
|
public class BiomeCopy implements RegionFunction {
|
||||||
protected final Extent source;
|
protected final Extent source;
|
||||||
protected final Extent destination;
|
protected final Extent destination;
|
||||||
private final MutableBlockVector2D mPos2d;
|
private final MutableBlockVector2 mPos2d;
|
||||||
|
|
||||||
public BiomeCopy(Extent source, Extent destination) {
|
public BiomeCopy(Extent source, Extent destination) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.mPos2d = new MutableBlockVector2D();
|
this.mPos2d = new MutableBlockVector2();
|
||||||
this.mPos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
this.mPos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public class BiomeCopy implements RegionFunction {
|
|||||||
int z = position.getBlockZ();
|
int z = position.getBlockZ();
|
||||||
if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) {
|
if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) {
|
||||||
mPos2d.setComponents(x, z);
|
mPos2d.setComponents(x, z);
|
||||||
BlockVector2 bv = mPos2d.toBlockVector2();
|
BlockVector2 bv = mPos2d;
|
||||||
return destination.setBiome( bv, source.getBiome(bv));
|
return destination.setBiome( bv, source.getBiome(bv));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -3,7 +3,7 @@ package com.boydti.fawe.object.mask;
|
|||||||
import com.sk89q.worldedit.function.mask.AbstractMask;
|
import com.sk89q.worldedit.function.mask.AbstractMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just an optimized version of the Adjacent Mask for single adjacency
|
* Just an optimized version of the Adjacent Mask for single adjacency
|
||||||
@ -11,16 +11,16 @@ import com.sk89q.worldedit.math.MutableBlockVector;
|
|||||||
public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
||||||
|
|
||||||
private final CachedMask mask;
|
private final CachedMask mask;
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public AdjacentAnyMask(Mask mask) {
|
public AdjacentAnyMask(Mask mask) {
|
||||||
this.mask = CachedMask.cache(mask);
|
this.mask = CachedMask.cache(mask);
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CachedMask getParentMask() {
|
public CachedMask getParentMask() {
|
||||||
@ -75,6 +75,6 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
|||||||
if (y > 0 && mask.test(x, y - 1, z)) {
|
if (y > 0 && mask.test(x, y - 1, z)) {
|
||||||
mutable.setComponents(0, -1, 0);
|
mutable.setComponents(0, -1, 0);
|
||||||
}
|
}
|
||||||
return (mutable.getX() == 0 && mutable.getY() == 0 && mutable.getZ() == 0) ? null : mutable.toBlockVector3();
|
return (mutable.getX() == 0 && mutable.getY() == 0 && mutable.getZ() == 0) ? null : mutable;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,18 +3,18 @@ package com.boydti.fawe.object.mask;
|
|||||||
import com.sk89q.worldedit.function.mask.AbstractMask;
|
import com.sk89q.worldedit.function.mask.AbstractMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
public class AdjacentMask extends AbstractMask {
|
public class AdjacentMask extends AbstractMask {
|
||||||
private final int min, max;
|
private final int min, max;
|
||||||
private final Mask mask;
|
private final Mask mask;
|
||||||
private MutableBlockVector v;
|
private MutableBlockVector3 v;
|
||||||
|
|
||||||
public AdjacentMask(Mask mask, int requiredMin, int requiredMax) {
|
public AdjacentMask(Mask mask, int requiredMin, int requiredMax) {
|
||||||
this.mask = mask;
|
this.mask = mask;
|
||||||
this.min = requiredMin;
|
this.min = requiredMin;
|
||||||
this.max = requiredMax;
|
this.max = requiredMax;
|
||||||
this.v = new MutableBlockVector();
|
this.v = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -25,34 +25,34 @@ public class AdjacentMask extends AbstractMask {
|
|||||||
double y = bv.getY();
|
double y = bv.getY();
|
||||||
double z = bv.getZ();
|
double z = bv.getZ();
|
||||||
v.mutX(x + 1);
|
v.mutX(x + 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutX(x - 1);
|
v.mutX(x - 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
v.mutY(y + 1);
|
v.mutY(y + 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutY(y);
|
v.mutY(y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutY(y - 1);
|
v.mutY(y - 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutY(y);
|
v.mutY(y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutY(y);
|
v.mutY(y);
|
||||||
v.mutZ(z + 1);
|
v.mutZ(z + 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutZ(z);
|
v.mutZ(z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutZ(z - 1);
|
v.mutZ(z - 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutZ(z);
|
v.mutZ(z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -21,7 +21,7 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
|
|||||||
protected final int maxY;
|
protected final int maxY;
|
||||||
protected final int distance;
|
protected final int distance;
|
||||||
|
|
||||||
protected transient MutableBlockVector mutable = new MutableBlockVector();
|
protected transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public AngleMask(Extent extent, double min, double max, boolean overlay, int distance) {
|
public AngleMask(Extent extent, double min, double max, boolean overlay, int distance) {
|
||||||
super(extent);
|
super(extent);
|
||||||
@ -36,7 +36,7 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
cacheBotX = Integer.MIN_VALUE;
|
cacheBotX = Integer.MIN_VALUE;
|
||||||
cacheBotZ = Integer.MIN_VALUE;
|
cacheBotZ = Integer.MIN_VALUE;
|
||||||
lastX = Integer.MIN_VALUE;
|
lastX = Integer.MIN_VALUE;
|
||||||
|
@ -4,12 +4,12 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
|
|
||||||
public class BiomeMask extends AbstractExtentMask implements ResettableMask {
|
public class BiomeMask extends AbstractExtentMask implements ResettableMask {
|
||||||
private final BaseBiome biome;
|
private final BaseBiome biome;
|
||||||
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
|
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||||
|
|
||||||
public BiomeMask(Extent extent, BaseBiome biome) {
|
public BiomeMask(Extent extent, BaseBiome biome) {
|
||||||
super(extent);
|
super(extent);
|
||||||
@ -18,12 +18,12 @@ public class BiomeMask extends AbstractExtentMask implements ResettableMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mutable = new MutableBlockVector2D();
|
mutable = new MutableBlockVector2();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
BlockVector2 pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ()).toBlockVector2();
|
BlockVector2 pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ());
|
||||||
return getExtent().getBiome(pos).getId() == biome.getId();
|
return getExtent().getBiome(pos).getId() == biome.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
|||||||
import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
|
import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
||||||
|
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private transient LocalBlockVectorSet cache_checked = new LocalBlockVectorSet();
|
private transient LocalBlockVectorSet cache_checked = new LocalBlockVectorSet();
|
||||||
private transient LocalBlockVectorSet cache_results = new LocalBlockVectorSet();
|
private transient LocalBlockVectorSet cache_results = new LocalBlockVectorSet();
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
cache_checked = new LocalBlockVectorSet();
|
cache_checked = new LocalBlockVectorSet();
|
||||||
cache_results = new LocalBlockVectorSet();
|
cache_results = new LocalBlockVectorSet();
|
||||||
resetCache();
|
resetCache();
|
||||||
@ -51,11 +51,11 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
|||||||
if (!check) {
|
if (!check) {
|
||||||
return cache_results.contains(x, y, z);
|
return cache_results.contains(x, y, z);
|
||||||
}
|
}
|
||||||
boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
|
boolean result = getMask().test(mutable.setComponents(x, y, z));
|
||||||
if (result) cache_results.add(x, y, z);
|
if (result) cache_results.add(x, y, z);
|
||||||
return result;
|
return result;
|
||||||
} catch (UnsupportedOperationException ignore) {
|
} catch (UnsupportedOperationException ignore) {
|
||||||
boolean result = getMask().test(mutable.setComponents(x, y, z).toBlockVector3());
|
boolean result = getMask().test(mutable.setComponents(x, y, z));
|
||||||
if (y < 0 || y > 255) return result;
|
if (y < 0 || y > 255) return result;
|
||||||
resetCache();
|
resetCache();
|
||||||
cache_checked.setOffset(x, z);
|
cache_checked.setOffset(x, z);
|
||||||
|
@ -21,7 +21,7 @@ public class MaskedTargetBlock extends TargetBlock {
|
|||||||
Location lastBlock = null;
|
Location lastBlock = null;
|
||||||
while (getNextBlock() != null) {
|
while (getNextBlock() != null) {
|
||||||
Location current = getCurrentBlock();
|
Location current = getCurrentBlock();
|
||||||
if (!mask.test(current.toVector().toBlockPoint())) {
|
if (!mask.test(current.toBlockPoint())) {
|
||||||
if (searchForLastBlock) {
|
if (searchForLastBlock) {
|
||||||
lastBlock = current;
|
lastBlock = current;
|
||||||
if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= world.getMaxY()) {
|
if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= world.getMaxY()) {
|
||||||
|
@ -4,7 +4,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.mask.Mask2D;
|
import com.sk89q.worldedit.function.mask.Mask2D;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import javax.annotation.Nullable;
|
|||||||
public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
|
public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
|
||||||
|
|
||||||
private transient int mode = -1;
|
private transient int mode = -1;
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
private int originX = Integer.MAX_VALUE, originY = Integer.MAX_VALUE, originZ = Integer.MAX_VALUE;
|
private int originX = Integer.MAX_VALUE, originY = Integer.MAX_VALUE, originZ = Integer.MAX_VALUE;
|
||||||
|
|
||||||
@ -34,13 +34,13 @@ public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
|
|||||||
originZ = vector.getBlockZ();
|
originZ = vector.getBlockZ();
|
||||||
mode = 0;
|
mode = 0;
|
||||||
Extent extent = getExtent();
|
Extent extent = getExtent();
|
||||||
if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX + 1, originY, originZ).toBlockVector3()).getMaterial().isAir()) {
|
if (!extent.getBlockType(mutable.setComponents(originX - 1, originY, originZ)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX + 1, originY, originZ)).getMaterial().isAir()) {
|
||||||
mode &= 1;
|
mode &= 1;
|
||||||
}
|
}
|
||||||
if (!extent.getBlockType(mutable.setComponents(originX, originY, originZ - 1).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY, originZ + 1).toBlockVector3()).getMaterial().isAir()) {
|
if (!extent.getBlockType(mutable.setComponents(originX, originY, originZ - 1)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY, originZ + 1)).getMaterial().isAir()) {
|
||||||
mode &= 4;
|
mode &= 4;
|
||||||
}
|
}
|
||||||
if (!extent.getBlockType(mutable.setComponents(originX, originY - 1, originZ + 1).toBlockVector3()).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY + 1, originZ + 1).toBlockVector3()).getMaterial().isAir()) {
|
if (!extent.getBlockType(mutable.setComponents(originX, originY - 1, originZ + 1)).getMaterial().isAir() && !extent.getBlockType(mutable.setComponents(originX, originY + 1, originZ + 1)).getMaterial().isAir()) {
|
||||||
mode &= 2;
|
mode &= 2;
|
||||||
}
|
}
|
||||||
if (Integer.bitCount(mode) >= 3) {
|
if (Integer.bitCount(mode) >= 3) {
|
||||||
@ -85,7 +85,7 @@ public class SolidPlaneMask extends SolidBlockMask implements ResettableMask {
|
|||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mode = -1;
|
mode = -1;
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -3,18 +3,18 @@ package com.boydti.fawe.object.mask;
|
|||||||
import com.sk89q.worldedit.function.mask.AbstractMask;
|
import com.sk89q.worldedit.function.mask.AbstractMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
public class WallMask extends AbstractMask {
|
public class WallMask extends AbstractMask {
|
||||||
private final int min, max;
|
private final int min, max;
|
||||||
private final Mask mask;
|
private final Mask mask;
|
||||||
private MutableBlockVector v;
|
private MutableBlockVector3 v;
|
||||||
|
|
||||||
public WallMask(Mask mask, int requiredMin, int requiredMax) {
|
public WallMask(Mask mask, int requiredMin, int requiredMax) {
|
||||||
this.mask = mask;
|
this.mask = mask;
|
||||||
this.min = requiredMin;
|
this.min = requiredMin;
|
||||||
this.max = requiredMax;
|
this.max = requiredMax;
|
||||||
this.v = new MutableBlockVector();
|
this.v = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -25,23 +25,23 @@ public class WallMask extends AbstractMask {
|
|||||||
double y = v.getY();
|
double y = v.getY();
|
||||||
double z = v.getZ();
|
double z = v.getZ();
|
||||||
v.mutX(x + 1);
|
v.mutX(x + 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutX(x - 1);
|
v.mutX(x - 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
v.mutZ(z + 1);
|
v.mutZ(z + 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutZ(z);
|
v.mutZ(z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutZ(z - 1);
|
v.mutZ(z - 1);
|
||||||
if (mask.test(v.toBlockVector3()) && ++count == min && max >= 8) {
|
if (mask.test(v) && ++count == min && max >= 8) {
|
||||||
v.mutZ(z);
|
v.mutZ(z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,12 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class BiomePattern extends ExistingPattern {
|
public class BiomePattern extends ExistingPattern {
|
||||||
private transient MutableBlockVector2D mutable = new MutableBlockVector2D();
|
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
|
||||||
private final BaseBiome biome;
|
private final BaseBiome biome;
|
||||||
|
|
||||||
public BiomePattern(Extent extent, BaseBiome biome) {
|
public BiomePattern(Extent extent, BaseBiome biome) {
|
||||||
@ -48,6 +48,6 @@ public class BiomePattern extends ExistingPattern {
|
|||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
stream.defaultReadObject();
|
stream.defaultReadObject();
|
||||||
mutable = new MutableBlockVector2D();
|
mutable = new MutableBlockVector2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
|||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.NotSerializableException;
|
import java.io.NotSerializableException;
|
||||||
@ -22,7 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class FullClipboardPattern extends AbstractExtentPattern {
|
public class FullClipboardPattern extends AbstractExtentPattern {
|
||||||
private final Clipboard clipboard;
|
private final Clipboard clipboard;
|
||||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new clipboard pattern.
|
* Create a new clipboard pattern.
|
||||||
|
@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -15,7 +15,7 @@ import java.io.IOException;
|
|||||||
public class NoXPattern extends AbstractPattern {
|
public class NoXPattern extends AbstractPattern {
|
||||||
|
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public NoXPattern(Pattern pattern) {
|
public NoXPattern(Pattern pattern) {
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
@ -25,7 +25,7 @@ public class NoXPattern extends AbstractPattern {
|
|||||||
public BaseBlock apply(BlockVector3 pos) {
|
public BaseBlock apply(BlockVector3 pos) {
|
||||||
// mutable.mutY((pos.getY()));
|
// mutable.mutY((pos.getY()));
|
||||||
// mutable.mutZ((pos.getZ()));
|
// mutable.mutZ((pos.getZ()));
|
||||||
// return pattern.apply(mutable.toBlockVector3());
|
// return pattern.apply(mutable);
|
||||||
return pattern.apply(pos);
|
return pattern.apply(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +38,6 @@ public class NoXPattern extends AbstractPattern {
|
|||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
stream.defaultReadObject();
|
stream.defaultReadObject();
|
||||||
// mutable = new MutableBlockVector();
|
// mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,7 +20,7 @@ public class NoYPattern extends AbstractPattern {
|
|||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock apply(BlockVector3 pos) {
|
public BaseBlock apply(BlockVector3 pos) {
|
||||||
@ -38,6 +38,6 @@ public class NoYPattern extends AbstractPattern {
|
|||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
stream.defaultReadObject();
|
stream.defaultReadObject();
|
||||||
// mutable = new MutableBlockVector();
|
// mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,7 +20,7 @@ public class NoZPattern extends AbstractPattern {
|
|||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock apply(BlockVector3 pos) {
|
public BaseBlock apply(BlockVector3 pos) {
|
||||||
@ -38,6 +38,6 @@ public class NoZPattern extends AbstractPattern {
|
|||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
stream.defaultReadObject();
|
stream.defaultReadObject();
|
||||||
// mutable = new MutableBlockVector();
|
// mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -15,7 +15,7 @@ import java.io.IOException;
|
|||||||
public class OffsetPattern extends AbstractPattern {
|
public class OffsetPattern extends AbstractPattern {
|
||||||
|
|
||||||
private final int dx, dy, dz;
|
private final int dx, dy, dz;
|
||||||
// private transient MutableBlockVector mutable = new MutableBlockVector();
|
// private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
|
|
||||||
public OffsetPattern(Pattern pattern, int dx, int dy, int dz) {
|
public OffsetPattern(Pattern pattern, int dx, int dy, int dz) {
|
||||||
@ -45,6 +45,6 @@ public class OffsetPattern extends AbstractPattern {
|
|||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
stream.defaultReadObject();
|
stream.defaultReadObject();
|
||||||
// mutable = new MutableBlockVector();
|
// mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
|
|
||||||
public class RandomFullClipboardPattern extends AbstractPattern {
|
public class RandomFullClipboardPattern extends AbstractPattern {
|
||||||
private final Extent extent;
|
private final Extent extent;
|
||||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private final List<ClipboardHolder> clipboards;
|
private final List<ClipboardHolder> clipboards;
|
||||||
private boolean randomRotate;
|
private boolean randomRotate;
|
||||||
private boolean randomFlip;
|
private boolean randomFlip;
|
||||||
|
@ -2,13 +2,11 @@ package com.boydti.fawe.object.pattern;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.SplittableRandom;
|
import java.util.SplittableRandom;
|
||||||
@ -18,7 +16,7 @@ public class RandomOffsetPattern extends AbstractPattern {
|
|||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
|
|
||||||
private transient int dx2, dy2, dz2;
|
private transient int dx2, dy2, dz2;
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
private transient SplittableRandom r;
|
private transient SplittableRandom r;
|
||||||
|
|
||||||
public RandomOffsetPattern(Pattern pattern, int dx, int dy, int dz) {
|
public RandomOffsetPattern(Pattern pattern, int dx, int dy, int dz) {
|
||||||
@ -38,7 +36,7 @@ public class RandomOffsetPattern extends AbstractPattern {
|
|||||||
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
||||||
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
||||||
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
||||||
return pattern.apply(mutable.toBlockVector3());
|
return pattern.apply(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,7 +44,7 @@ public class RandomOffsetPattern extends AbstractPattern {
|
|||||||
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
|
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
|
||||||
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
|
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
|
||||||
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
|
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
|
||||||
return pattern.apply(extent, set, mutable.toBlockVector3());
|
return pattern.apply(extent, set, mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
@ -55,6 +53,6 @@ public class RandomOffsetPattern extends AbstractPattern {
|
|||||||
this.dy2 = dy * 2 + 1;
|
this.dy2 = dy * 2 + 1;
|
||||||
this.dz2 = dz * 2 + 1;
|
this.dz2 = dz * 2 + 1;
|
||||||
this.r = new SplittableRandom();
|
this.r = new SplittableRandom();
|
||||||
this.mutable = new MutableBlockVector();
|
this.mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,13 +2,11 @@ package com.boydti.fawe.object.pattern;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -16,7 +14,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
|||||||
|
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
private transient BlockVector3 origin;
|
private transient BlockVector3 origin;
|
||||||
private transient MutableBlockVector mutable = new MutableBlockVector();
|
private transient MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public RelativePattern(Pattern pattern) {
|
public RelativePattern(Pattern pattern) {
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
@ -30,7 +28,7 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
|||||||
mutable.mutX((pos.getX() - origin.getX()));
|
mutable.mutX((pos.getX() - origin.getX()));
|
||||||
mutable.mutY((pos.getY() - origin.getY()));
|
mutable.mutY((pos.getY() - origin.getY()));
|
||||||
mutable.mutZ((pos.getZ() - origin.getZ()));
|
mutable.mutZ((pos.getZ() - origin.getZ()));
|
||||||
return pattern.apply(mutable.toBlockVector3());
|
return pattern.apply(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -41,12 +39,12 @@ public class RelativePattern extends AbstractPattern implements ResettablePatter
|
|||||||
mutable.mutX((get.getX() - origin.getX()));
|
mutable.mutX((get.getX() - origin.getX()));
|
||||||
mutable.mutY((get.getY() - origin.getY()));
|
mutable.mutY((get.getY() - origin.getY()));
|
||||||
mutable.mutZ((get.getZ() - origin.getZ()));
|
mutable.mutZ((get.getZ() - origin.getZ()));
|
||||||
return pattern.apply(extent, set, mutable.toBlockVector3());
|
return pattern.apply(extent, set, mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||||
stream.defaultReadObject();
|
stream.defaultReadObject();
|
||||||
mutable = new MutableBlockVector();
|
mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package com.boydti.fawe.object.pattern;
|
package com.boydti.fawe.object.pattern;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,7 +18,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
|||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
|
|
||||||
private transient int dx2, dy2, dz2;
|
private transient int dx2, dy2, dz2;
|
||||||
private transient MutableBlockVector mutable;
|
private transient MutableBlockVector3 mutable;
|
||||||
private transient boolean[] solid;
|
private transient boolean[] solid;
|
||||||
private SplittableRandom r;
|
private SplittableRandom r;
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
|||||||
this.dz2 = dz * 2 + 1;
|
this.dz2 = dz * 2 + 1;
|
||||||
solid = SolidBlockMask.getTypes();
|
solid = SolidBlockMask.getTypes();
|
||||||
this.r = new SplittableRandom();
|
this.r = new SplittableRandom();
|
||||||
this.mutable = new MutableBlockVector();
|
this.mutable = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +45,7 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
|||||||
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
mutable.mutX((position.getX() + r.nextInt(dx2) - dx));
|
||||||
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
mutable.mutY((position.getY() + r.nextInt(dy2) - dy));
|
||||||
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
mutable.mutZ((position.getZ() + r.nextInt(dz2) - dz));
|
||||||
BaseBlock block = pattern.apply(mutable.toBlockVector3());
|
BaseBlock block = pattern.apply(mutable);
|
||||||
if (solid[block.getInternalBlockTypeId()]) {
|
if (solid[block.getInternalBlockTypeId()]) {
|
||||||
return block;
|
return block;
|
||||||
} else {
|
} else {
|
||||||
@ -60,9 +58,9 @@ public class SolidRandomOffsetPattern extends AbstractPattern {
|
|||||||
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
|
mutable.mutX((get.getX() + r.nextInt(dx2) - dx));
|
||||||
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
|
mutable.mutY((get.getY() + r.nextInt(dy2) - dy));
|
||||||
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
|
mutable.mutZ((get.getZ() + r.nextInt(dz2) - dz));
|
||||||
BlockStateHolder block = pattern.apply(mutable.toBlockVector3());
|
BlockStateHolder block = pattern.apply(mutable);
|
||||||
if (solid[block.getInternalBlockTypeId()]) {
|
if (solid[block.getInternalBlockTypeId()]) {
|
||||||
return pattern.apply(extent, set, mutable.toBlockVector3());
|
return pattern.apply(extent, set, mutable);
|
||||||
} else {
|
} else {
|
||||||
return pattern.apply(extent, set, get);
|
return pattern.apply(extent, set, get);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -15,10 +15,10 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
|||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
private int moves;
|
private int moves;
|
||||||
|
|
||||||
private transient MutableBlockVector cur;
|
private transient MutableBlockVector3 cur;
|
||||||
private transient MutableBlockVector[] buffer;
|
private transient MutableBlockVector3[] buffer;
|
||||||
private transient MutableBlockVector[] allowed;
|
private transient MutableBlockVector3[] allowed;
|
||||||
private transient MutableBlockVector next;
|
private transient MutableBlockVector3 next;
|
||||||
|
|
||||||
public SurfaceRandomOffsetPattern(Pattern pattern, int distance) {
|
public SurfaceRandomOffsetPattern(Pattern pattern, int distance) {
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
@ -27,12 +27,12 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
cur = new MutableBlockVector();
|
cur = new MutableBlockVector3();
|
||||||
this.buffer = new MutableBlockVector[BreadthFirstSearch.DIAGONAL_DIRECTIONS.length];
|
this.buffer = new MutableBlockVector3[BreadthFirstSearch.DIAGONAL_DIRECTIONS.length];
|
||||||
for (int i = 0; i < buffer.length; i++) {
|
for (int i = 0; i < buffer.length; i++) {
|
||||||
buffer[i] = new MutableBlockVector();
|
buffer[i] = new MutableBlockVector3();
|
||||||
}
|
}
|
||||||
allowed = new MutableBlockVector[buffer.length];
|
allowed = new MutableBlockVector3[buffer.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,21 +48,21 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
|||||||
next = buffer[i];
|
next = buffer[i];
|
||||||
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
|
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
|
||||||
next.setComponents(cur.getBlockX() + dir.getBlockX(), cur.getBlockY() + dir.getBlockY(), cur.getBlockZ() + dir.getBlockZ());
|
next.setComponents(cur.getBlockX() + dir.getBlockX(), cur.getBlockY() + dir.getBlockY(), cur.getBlockZ() + dir.getBlockZ());
|
||||||
if (allowed(next.toBlockVector3())) {
|
if (allowed(next)) {
|
||||||
allowed[index++] = next;
|
allowed[index++] = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return cur.toBlockVector3();
|
return cur;
|
||||||
}
|
}
|
||||||
next = allowed[ThreadLocalRandom.current().nextInt(index)];
|
next = allowed[ThreadLocalRandom.current().nextInt(index)];
|
||||||
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
|
cur.setComponents(next.getBlockX(), next.getBlockY(), next.getBlockZ());
|
||||||
}
|
}
|
||||||
return cur.toBlockVector3();
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean allowed(BlockVector3 bv) {
|
private boolean allowed(BlockVector3 bv) {
|
||||||
MutableBlockVector v = new MutableBlockVector(bv);
|
MutableBlockVector3 v = new MutableBlockVector3(bv);
|
||||||
BlockStateHolder block = pattern.apply(bv);
|
BlockStateHolder block = pattern.apply(bv);
|
||||||
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
return false;
|
return false;
|
||||||
@ -71,34 +71,34 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
|
|||||||
int y = v.getBlockY();
|
int y = v.getBlockY();
|
||||||
int z = v.getBlockZ();
|
int z = v.getBlockZ();
|
||||||
v.mutY(y + 1);
|
v.mutY(y + 1);
|
||||||
if (canPassthrough(v.toBlockVector3())) {
|
if (canPassthrough(v)) {
|
||||||
v.mutY(y);
|
v.mutY(y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutY(y - 1);
|
v.mutY(y - 1);
|
||||||
if (canPassthrough(v.toBlockVector3())) {
|
if (canPassthrough(v)) {
|
||||||
v.mutY(y);
|
v.mutY(y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutY(y);
|
v.mutY(y);
|
||||||
v.mutX(x + 1);
|
v.mutX(x + 1);
|
||||||
if (canPassthrough(v.toBlockVector3())) {
|
if (canPassthrough(v)) {
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutX(x - 1);
|
v.mutX(x - 1);
|
||||||
if (canPassthrough(v.toBlockVector3())) {
|
if (canPassthrough(v)) {
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutX(x);
|
v.mutX(x);
|
||||||
v.mutZ(z + 1);
|
v.mutZ(z + 1);
|
||||||
if (canPassthrough(v.toBlockVector3())) {
|
if (canPassthrough(v)) {
|
||||||
v.mutZ(z);
|
v.mutZ(z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
v.mutZ(z - 1);
|
v.mutZ(z - 1);
|
||||||
if (canPassthrough(v.toBlockVector3())) {
|
if (canPassthrough(v)) {
|
||||||
v.mutZ(z);
|
v.mutZ(z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.sk89q.worldedit.WorldEditException;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
public class FaweQueueDelegateExtent extends DelegateFaweQueue {
|
public class FaweQueueDelegateExtent extends DelegateFaweQueue {
|
||||||
private final FaweQueue parentQueue;
|
private final FaweQueue parentQueue;
|
||||||
private final Extent parentExtent;
|
private final Extent parentExtent;
|
||||||
// private final MutableBlockVector2D mutable2d = new MutableBlockVector2D();
|
// private final MutableBlockVector2 mutable2d = new MutableBlockVector2();
|
||||||
|
|
||||||
public FaweQueueDelegateExtent(FaweQueue parentQueue, Extent parentExtent) {
|
public FaweQueueDelegateExtent(FaweQueue parentQueue, Extent parentExtent) {
|
||||||
super(parentQueue);
|
super(parentQueue);
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
package com.boydti.fawe.object.regions;
|
package com.boydti.fawe.object.regions;
|
||||||
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.regions.AbstractRegion;
|
import com.sk89q.worldedit.regions.AbstractRegion;
|
||||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||||
@ -143,8 +143,8 @@ public class PolyhedralRegion extends AbstractRegion {
|
|||||||
if (minimumPoint == null) {
|
if (minimumPoint == null) {
|
||||||
minimumPoint = maximumPoint = vertex;
|
minimumPoint = maximumPoint = vertex;
|
||||||
} else {
|
} else {
|
||||||
// minimumPoint = new MutableBlockVector(minimumPoint.getMinimum(vertex));
|
// minimumPoint = new MutableBlockVector3(minimumPoint.getMinimum(vertex));
|
||||||
// maximumPoint = new MutableBlockVector(maximumPoint.getMaximum(vertex));
|
// maximumPoint = new MutableBlockVector3(maximumPoint.getMaximum(vertex));
|
||||||
minimumPoint = minimumPoint.getMinimum(vertex);
|
minimumPoint = minimumPoint.getMinimum(vertex);
|
||||||
maximumPoint = maximumPoint.getMaximum(vertex);
|
maximumPoint = maximumPoint.getMaximum(vertex);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import com.boydti.fawe.util.TextureUtil;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ public class PNGWriter implements ClipboardWriter {
|
|||||||
|
|
||||||
boolean fill = length * 4 < imageSize && width * 4 < imageSize;
|
boolean fill = length * 4 < imageSize && width * 4 < imageSize;
|
||||||
|
|
||||||
MutableBlockVector mutable, mutableTop, mutableRight, mutableLeft;
|
MutableBlockVector3 mutable, mutableTop, mutableRight, mutableLeft;
|
||||||
mutable = mutableTop = mutableRight = mutableLeft = new MutableBlockVector(0, 0, 0);
|
mutable = mutableTop = mutableRight = mutableLeft = new MutableBlockVector3(0, 0, 0);
|
||||||
// Vector mutableTop = new Vector(0, 0, 0);
|
// Vector mutableTop = new Vector(0, 0, 0);
|
||||||
// Vector mutableRight = new Vector(0, 0, 0);
|
// Vector mutableRight = new Vector(0, 0, 0);
|
||||||
// Vector mutableLeft = new Vector(0, 0, 0);
|
// Vector mutableLeft = new Vector(0, 0, 0);
|
||||||
@ -96,16 +96,16 @@ public class PNGWriter implements ClipboardWriter {
|
|||||||
double cpy2 = cpy1 + dpyj[zz];
|
double cpy2 = cpy1 + dpyj[zz];
|
||||||
for (int y = y0; y < y0 + height; y++) {
|
for (int y = y0; y < y0 + height; y++) {
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
BlockStateHolder block = clipboard.getBlock(mutable.toBlockVector3());
|
BlockStateHolder block = clipboard.getBlock(mutable);
|
||||||
if (block.getBlockType().getMaterial().isAir()) {
|
if (block.getBlockType().getMaterial().isAir()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mutableTop.mutY(y + 1);
|
mutableTop.mutY(y + 1);
|
||||||
mutableRight.mutY(y);
|
mutableRight.mutY(y);
|
||||||
mutableLeft.mutY(y);
|
mutableLeft.mutY(y);
|
||||||
if (!clipboard.getBlock(mutableTop.toBlockVector3()).getBlockType().getMaterial().isAir() &&
|
if (!clipboard.getBlock(mutableTop).getBlockType().getMaterial().isAir() &&
|
||||||
!clipboard.getBlock(mutableRight.toBlockVector3()).getBlockType().getMaterial().isAir() &&
|
!clipboard.getBlock(mutableRight).getBlockType().getMaterial().isAir() &&
|
||||||
!clipboard.getBlock(mutableLeft.toBlockVector3()).getBlockType().getMaterial().isAir() ) {
|
!clipboard.getBlock(mutableLeft).getBlockType().getMaterial().isAir() ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double cpy = cpy2 - dpxi[y - y0];
|
double cpy = cpy2 - dpxi[y - y0];
|
||||||
|
@ -8,8 +8,6 @@ import com.boydti.fawe.util.MaskTraverser;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
@ -25,7 +23,7 @@ import com.sk89q.worldedit.function.operation.Operations;
|
|||||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
@ -211,7 +209,7 @@ public class Schematic {
|
|||||||
BlockArrayClipboard bac = (BlockArrayClipboard) clipboard;
|
BlockArrayClipboard bac = (BlockArrayClipboard) clipboard;
|
||||||
if (copyBiomes) {
|
if (copyBiomes) {
|
||||||
bac.IMP.forEach(new FaweClipboard.BlockReader() {
|
bac.IMP.forEach(new FaweClipboard.BlockReader() {
|
||||||
MutableBlockVector2D mpos2d = new MutableBlockVector2D();
|
MutableBlockVector2 mpos2d = new MutableBlockVector2();
|
||||||
{
|
{
|
||||||
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
}
|
}
|
||||||
@ -222,7 +220,7 @@ public class Schematic {
|
|||||||
int zz = z + relz;
|
int zz = z + relz;
|
||||||
if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) {
|
if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) {
|
||||||
mpos2d.setComponents(xx, zz);
|
mpos2d.setComponents(xx, zz);
|
||||||
extent.setBiome(mpos2d.toBlockVector2(), bac.IMP.getBiome(x, z));
|
extent.setBiome(mpos2d, bac.IMP.getBiome(x, z));
|
||||||
}
|
}
|
||||||
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
||||||
return;
|
return;
|
||||||
@ -247,8 +245,8 @@ public class Schematic {
|
|||||||
final int rely = to.getBlockY() - origin.getBlockY();
|
final int rely = to.getBlockY() - origin.getBlockY();
|
||||||
final int relz = to.getBlockZ() - origin.getBlockZ();
|
final int relz = to.getBlockZ() - origin.getBlockZ();
|
||||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||||
// MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D();
|
// MutableBlockVector2 mpos2d_2 = new MutableBlockVector2();
|
||||||
MutableBlockVector2D mpos2d = new MutableBlockVector2D();
|
MutableBlockVector2 mpos2d = new MutableBlockVector2();
|
||||||
{
|
{
|
||||||
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||||
}
|
}
|
||||||
@ -260,7 +258,7 @@ public class Schematic {
|
|||||||
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
|
if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) {
|
||||||
mpos2d.setComponents(xx, zz);
|
mpos2d.setComponents(xx, zz);
|
||||||
// extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ())));
|
// extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ())));
|
||||||
extent.setBiome(mpos2d.toBlockVector2(), clipboard.getBiome(BlockVector2.at(mutable.getBlockX(), mutable.getBlockZ())));
|
extent.setBiome(mpos2d, clipboard.getBiome(BlockVector2.at(mutable.getBlockX(), mutable.getBlockZ())));
|
||||||
}
|
}
|
||||||
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
if (!pasteAir && block.getBlockType().getMaterial().isAir()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,7 +22,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||||
@ -168,7 +168,7 @@ public class StructureFormat implements ClipboardReader, ClipboardWriter {
|
|||||||
}
|
}
|
||||||
Map<String, Object> structure = FaweCache.asMap("version", 1, "author", owner);
|
Map<String, Object> structure = FaweCache.asMap("version", 1, "author", owner);
|
||||||
// ignored: version / owner
|
// ignored: version / owner
|
||||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
Int2ObjectArrayMap<Integer> indexes = new Int2ObjectArrayMap<>();
|
Int2ObjectArrayMap<Integer> indexes = new Int2ObjectArrayMap<>();
|
||||||
// Size
|
// Size
|
||||||
structure.put("size", Arrays.asList(width, height, length));
|
structure.put("size", Arrays.asList(width, height, length));
|
||||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@ -56,7 +56,7 @@ public class SchemVis extends ImmutableVirtualWorld {
|
|||||||
private final Long2ObjectOpenHashMap<Map.Entry<File, Long>> files;
|
private final Long2ObjectOpenHashMap<Map.Entry<File, Long>> files;
|
||||||
private final Long2ObjectOpenHashMap<MCAChunk> chunks; // TODO use soft references OR clear chunks outside view distance
|
private final Long2ObjectOpenHashMap<MCAChunk> chunks; // TODO use soft references OR clear chunks outside view distance
|
||||||
|
|
||||||
private final MutableBlockVector2D lastPos = new MutableBlockVector2D();
|
private final MutableBlockVector2 lastPos = new MutableBlockVector2();
|
||||||
private final FawePlayer player;
|
private final FawePlayer player;
|
||||||
private final Location origin;
|
private final Location origin;
|
||||||
private final BlockVector2 chunkOffset;
|
private final BlockVector2 chunkOffset;
|
||||||
@ -322,10 +322,10 @@ public class SchemVis extends ImmutableVirtualWorld {
|
|||||||
private BlockVector2 registerAndGetChunkOffset(BlockVector2 schemDimensions, File file) {
|
private BlockVector2 registerAndGetChunkOffset(BlockVector2 schemDimensions, File file) {
|
||||||
int chunkX = schemDimensions.getBlockX() >> 4;
|
int chunkX = schemDimensions.getBlockX() >> 4;
|
||||||
int chunkZ = schemDimensions.getBlockZ() >> 4;
|
int chunkZ = schemDimensions.getBlockZ() >> 4;
|
||||||
MutableBlockVector2D pos2 = new MutableBlockVector2D();
|
MutableBlockVector2 pos2 = new MutableBlockVector2();
|
||||||
MutableBlockVector2D curPos = lastPos;
|
MutableBlockVector2 curPos = lastPos;
|
||||||
// Find next free position
|
// Find next free position
|
||||||
while (!isAreaFree(curPos.toBlockVector2(), pos2.setComponents(curPos.getBlockX() + chunkX, curPos.getBlockZ() + chunkZ).toBlockVector2())) {
|
while (!isAreaFree(curPos, pos2.setComponents(curPos.getBlockX() + chunkX, curPos.getBlockZ() + chunkZ))) {
|
||||||
// if (curPos == lastPos && !files.containsKey(MathMan.pairInt(curPos.getBlockX(), curPos.getBlockZ()))) {
|
// if (curPos == lastPos && !files.containsKey(MathMan.pairInt(curPos.getBlockX(), curPos.getBlockZ()))) {
|
||||||
// curPos = new MutableBlockVector2();
|
// curPos = new MutableBlockVector2();
|
||||||
// curPos.setComponents(lastPos.getBlockX(), lastPos.getBlockZ());
|
// curPos.setComponents(lastPos.getBlockX(), lastPos.getBlockZ());
|
||||||
@ -345,7 +345,7 @@ public class SchemVis extends ImmutableVirtualWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < Math.min(chunkX, chunkZ); i++) curPos.nextPosition();
|
for (int i = 0; i < Math.min(chunkX, chunkZ); i++) curPos.nextPosition();
|
||||||
return curPos.toBlockVector2();
|
return curPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAreaFree(BlockVector2 chunkPos1, BlockVector2 chunkPos2 /* inclusive */) {
|
private boolean isAreaFree(BlockVector2 chunkPos1, BlockVector2 chunkPos2 /* inclusive */) {
|
||||||
@ -599,7 +599,7 @@ public class SchemVis extends ImmutableVirtualWorld {
|
|||||||
clear();
|
clear();
|
||||||
chunks.clear();
|
chunks.clear();
|
||||||
files.clear();
|
files.clear();
|
||||||
player.getPlayer().setPosition(origin.toVector(), origin.getPitch(), origin.getYaw());
|
player.getPlayer().setPosition(origin, origin.getPitch(), origin.getYaw());
|
||||||
if (update) {
|
if (update) {
|
||||||
FaweQueue packetQueue = SetQueue.IMP.getNewQueue(player.getWorld(), true, false);
|
FaweQueue packetQueue = SetQueue.IMP.getNewQueue(player.getWorld(), true, false);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import com.sk89q.worldedit.function.RegionFunction;
|
|||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.function.operation.RunContext;
|
import com.sk89q.worldedit.function.operation.RunContext;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -77,8 +77,8 @@ public abstract class DFSVisitor implements Operation {
|
|||||||
NodePair current;
|
NodePair current;
|
||||||
Node from;
|
Node from;
|
||||||
Node adjacent;
|
Node adjacent;
|
||||||
// MutableBlockVector mutable = new MutableBlockVector();
|
// MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
// MutableBlockVector mutable2 = new MutableBlockVector();
|
// MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
||||||
int countAdd, countAttempt;
|
int countAdd, countAttempt;
|
||||||
IntegerTrio[] dirs = getIntDirections();
|
IntegerTrio[] dirs = getIntDirections();
|
||||||
|
|
||||||
|
@ -67,20 +67,6 @@ public abstract class TaskManager {
|
|||||||
* @param runnables
|
* @param runnables
|
||||||
*/
|
*/
|
||||||
public void parallel(Collection<Runnable> runnables) {
|
public void parallel(Collection<Runnable> runnables) {
|
||||||
// if (!Fawe.get().isJava8()) {
|
|
||||||
// ExecutorCompletionService c = new ExecutorCompletionService(pool);
|
|
||||||
// for (Runnable run : runnables) {
|
|
||||||
// c.submit(run, null);
|
|
||||||
// }
|
|
||||||
// try {
|
|
||||||
// for (int i = 0; i < runnables.size(); i++) {
|
|
||||||
// c.take();
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
for (Runnable run : runnables) {
|
for (Runnable run : runnables) {
|
||||||
pool.submit(run);
|
pool.submit(run);
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
private FawePlayer player;
|
private FawePlayer player;
|
||||||
private FaweChangeSet changeTask;
|
private FaweChangeSet changeTask;
|
||||||
|
|
||||||
private MutableBlockVector mutablebv = new MutableBlockVector();
|
private MutableBlockVector3 mutablebv = new MutableBlockVector3();
|
||||||
private MutableVector mutablev = new MutableVector();
|
|
||||||
|
|
||||||
private int changes = 0;
|
private int changes = 0;
|
||||||
private BlockBag blockBag;
|
private BlockBag blockBag;
|
||||||
@ -1080,7 +1079,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
public boolean setBlock(int x, int y, int z, Pattern pattern) {
|
public boolean setBlock(int x, int y, int z, Pattern pattern) {
|
||||||
this.changes++;
|
this.changes++;
|
||||||
try {
|
try {
|
||||||
BlockVector3 bv = mutablebv.setComponents(x, y, z).toBlockVector3();
|
BlockVector3 bv = mutablebv.setComponents(x, y, z);
|
||||||
return pattern.apply(extent, bv, bv);
|
return pattern.apply(extent, bv, bv);
|
||||||
} catch (WorldEditException e) {
|
} catch (WorldEditException e) {
|
||||||
throw new RuntimeException("Unexpected exception", e);
|
throw new RuntimeException("Unexpected exception", e);
|
||||||
@ -2147,7 +2146,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
private int makeCylinder(BlockVector3 pos, final Pattern block, double radiusX, double radiusZ, int height, double thickness, final boolean filled) {
|
private int makeCylinder(BlockVector3 pos, final Pattern block, double radiusX, double radiusZ, int height, double thickness, final boolean filled) {
|
||||||
radiusX += 0.5;
|
radiusX += 0.5;
|
||||||
radiusZ += 0.5;
|
radiusZ += 0.5;
|
||||||
MutableBlockVector posv = new MutableBlockVector(pos);
|
MutableBlockVector3 posv = new MutableBlockVector3(pos);
|
||||||
if (height == 0) {
|
if (height == 0) {
|
||||||
return this.changes;
|
return this.changes;
|
||||||
} else if (height < 0) {
|
} else if (height < 0) {
|
||||||
@ -2167,7 +2166,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
int px = posv.getBlockX();
|
int px = posv.getBlockX();
|
||||||
int py = posv.getBlockY();
|
int py = posv.getBlockY();
|
||||||
int pz = posv.getBlockZ();
|
int pz = posv.getBlockZ();
|
||||||
MutableBlockVector mutable = new MutableBlockVector();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
final int ceilRadiusX = (int) Math.ceil(radiusX);
|
final int ceilRadiusX = (int) Math.ceil(radiusX);
|
||||||
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
|
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
|
||||||
@ -2207,10 +2206,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2241,10 +2240,10 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
this.setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||||
this.setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||||
this.setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||||
this.setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
this.setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2271,7 +2270,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
int px = pos.getBlockX();
|
int px = pos.getBlockX();
|
||||||
int py = pos.getBlockY();
|
int py = pos.getBlockY();
|
||||||
int pz = pos.getBlockZ();
|
int pz = pos.getBlockZ();
|
||||||
MutableBlockVector mutable = new MutableBlockVector();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
final int ceilRadiusX = (int) Math.ceil(radiusX);
|
final int ceilRadiusX = (int) Math.ceil(radiusX);
|
||||||
final int ceilRadiusY = (int) Math.ceil(radiusY);
|
final int ceilRadiusY = (int) Math.ceil(radiusY);
|
||||||
@ -2318,21 +2317,21 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
|
if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px + x, py + y, pz + z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px + x, py + y, pz + z), block);
|
||||||
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold)
|
if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px - x, py + y, pz + z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px - x, py + y, pz + z), block);
|
||||||
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold)
|
if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px + x, py - y, pz + z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px + x, py - y, pz + z), block);
|
||||||
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold)
|
if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px + x, py + y, pz - z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px + x, py + y, pz - z), block);
|
||||||
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold)
|
if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px - x, py - y, pz + z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px - x, py - y, pz + z), block);
|
||||||
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px + x, py - y, pz - z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px + x, py - y, pz - z), block);
|
||||||
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold)
|
if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px - x, py + y, pz - z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px - x, py + y, pz - z), block);
|
||||||
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold)
|
||||||
setBlock(mutable.setComponents(px - x, py - y, pz - z).toBlockVector3(), block);
|
setBlock(mutable.setComponents(px - x, py - y, pz - z), block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2791,7 +2790,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
final int maxY = max.getBlockY();
|
final int maxY = max.getBlockY();
|
||||||
final int maxZ = max.getBlockZ();
|
final int maxZ = max.getBlockZ();
|
||||||
|
|
||||||
MutableBlockVector mutable = new MutableBlockVector(minX, minY, minZ);
|
MutableBlockVector3 mutable = new MutableBlockVector3(minX, minY, minZ);
|
||||||
for (int x = minX; x <= maxX; ++x) {
|
for (int x = minX; x <= maxX; ++x) {
|
||||||
for (int y = minY; y <= maxY; ++y) {
|
for (int y = minY; y <= maxY; ++y) {
|
||||||
for (int z = minZ; z <= maxZ; ++z) {
|
for (int z = minZ; z <= maxZ; ++z) {
|
||||||
@ -2938,14 +2937,14 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
//
|
//
|
||||||
// for (BlockVector3 position : region) {
|
// for (BlockVector3 position : region) {
|
||||||
// // offset, scale
|
// // offset, scale
|
||||||
// final Vector3 scaled = position.toVector3().subtract(zero).divide(unit);
|
// final Vector3 scaled = position.subtract(zero).divide(unit);
|
||||||
//
|
//
|
||||||
// // transform
|
// // transform
|
||||||
// expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ());
|
// expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ());
|
||||||
//
|
//
|
||||||
// final BlockVector3 sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
|
// final BlockVector3 sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
|
||||||
|
|
||||||
private MutableBlockVector mutable = new MutableBlockVector();
|
private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||||
@ -3297,12 +3296,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
|
||||||
@Override
|
@Override
|
||||||
protected BaseBiome getBiome(final int x, final int z, final BaseBiome defaultBiomeType) {
|
protected BaseBiome getBiome(final int x, final int z, final BaseBiome defaultBiomeType) {
|
||||||
final Vector2 current = Vector2.at(x, z);
|
environment.setCurrentBlock(x, 0, z);
|
||||||
environment.setCurrentBlock(current.toVector3(0));
|
double scaledX = (x - zero2D.getX()) / unit2D.getX();
|
||||||
final Vector2 scaled = current.subtract(zero2D).divide(unit2D);
|
double scaledZ = (z - zero2D.getZ()) / unit2D.getZ();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) {
|
if (expression.evaluate(scaledX, scaledZ) <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3397,8 +3396,8 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Set<BlockVector2> chunks = region.getChunks();
|
final Set<BlockVector2> chunks = region.getChunks();
|
||||||
MutableBlockVector mutable = new MutableBlockVector();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
MutableBlockVector2D mutable2D = new MutableBlockVector2D();
|
MutableBlockVector2 mutable2D = new MutableBlockVector2();
|
||||||
for (BlockVector2 chunk : chunks) {
|
for (BlockVector2 chunk : chunks) {
|
||||||
final int cx = chunk.getBlockX();
|
final int cx = chunk.getBlockX();
|
||||||
final int cz = chunk.getBlockZ();
|
final int cz = chunk.getBlockZ();
|
||||||
@ -3418,7 +3417,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
boolean containsAny = false;
|
boolean containsAny = false;
|
||||||
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) {
|
if (cuboid && containsBot1 && containsBot2 && containsTop1 && containsTop2 && conNextX && conNextZ) {
|
||||||
containsAny = true;
|
containsAny = true;
|
||||||
BlockVector3 mbv = mutable.toBlockVector3();
|
BlockVector3 mbv = mutable;
|
||||||
if (fcs != null) {
|
if (fcs != null) {
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
int xx = x + bx;
|
int xx = x + bx;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package com.sk89q.worldedit;
|
package com.sk89q.worldedit;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweInputStream;
|
import com.boydti.fawe.object.FaweInputStream;
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
import com.boydti.fawe.object.FaweLimit;
|
||||||
@ -43,7 +42,6 @@ import com.sk89q.jchronic.utils.Time;
|
|||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.command.tool.*;
|
import com.sk89q.worldedit.command.tool.*;
|
||||||
@ -51,7 +49,6 @@ import com.sk89q.worldedit.entity.Player;
|
|||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.Masks;
|
|
||||||
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
|
import com.sk89q.worldedit.function.operation.ChangeSetExecutor;
|
||||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
@ -67,7 +64,6 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||||
@ -878,7 +874,7 @@ public class LocalSession implements TextureHolder {
|
|||||||
public BlockVector3 getPlacementPosition(Player player) throws IncompleteRegionException {
|
public BlockVector3 getPlacementPosition(Player player) throws IncompleteRegionException {
|
||||||
checkNotNull(player);
|
checkNotNull(player);
|
||||||
if (!placeAtPos1) {
|
if (!placeAtPos1) {
|
||||||
return player.getBlockIn().toVector().toBlockPoint();
|
return player.getBlockIn().toBlockPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
return selector.getPrimaryPosition();
|
return selector.getPrimaryPosition();
|
||||||
|
@ -150,11 +150,11 @@ public class BiomeCommands extends MethodCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseBiome biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint().toBlockVector2());
|
BaseBiome biome = player.getWorld().getBiome(blockPosition.toBlockPoint().toBlockVector2());
|
||||||
biomes[biome.getId()]++;
|
biomes[biome.getId()]++;
|
||||||
size = 1;
|
size = 1;
|
||||||
} else if (args.hasFlag('p')) {
|
} else if (args.hasFlag('p')) {
|
||||||
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint().toBlockVector2());
|
BaseBiome biome = player.getWorld().getBiome(player.getLocation().toBlockPoint().toBlockVector2());
|
||||||
biomes[biome.getId()]++;
|
biomes[biome.getId()]++;
|
||||||
size = 1;
|
size = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -219,7 +219,7 @@ public class BiomeCommands extends MethodCommands {
|
|||||||
Mask2D mask2d = mask != null ? mask.toMask2D() : null;
|
Mask2D mask2d = mask != null ? mask.toMask2D() : null;
|
||||||
|
|
||||||
if (atPosition) {
|
if (atPosition) {
|
||||||
region = new CuboidRegion(player.getLocation().toVector().toBlockPoint(), player.getLocation().toVector().toBlockPoint());
|
region = new CuboidRegion(player.getLocation().toBlockPoint(), player.getLocation().toBlockPoint());
|
||||||
} else {
|
} else {
|
||||||
region = session.getSelection(world);
|
region = session.getSelection(world);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
|||||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableVector;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.math.transform.CombinedTransform;
|
import com.sk89q.worldedit.math.transform.CombinedTransform;
|
||||||
@ -94,11 +94,11 @@ public class FlattenedClipboardTransform {
|
|||||||
corners[i] = transformAround.apply(corners[i]);
|
corners[i] = transformAround.apply(corners[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
MutableVector newMinimum = new MutableVector(corners[0]);
|
MutableVector3 newMinimum = new MutableVector3(corners[0]);
|
||||||
MutableVector newMaximum = new MutableVector(corners[0]);
|
MutableVector3 newMaximum = new MutableVector3(corners[0]);
|
||||||
// MutableVector cbv = new MutableVector();
|
// MutableVector3 cbv = new MutableVector3();
|
||||||
for (int i = 1; i < corners.length; i++) {
|
for (int i = 1; i < corners.length; i++) {
|
||||||
MutableVector cbv = new MutableVector(corners[i]);
|
MutableVector3 cbv = new MutableVector3(corners[i]);
|
||||||
newMinimum = newMinimum.setComponents(newMinimum.getMinimum(cbv));
|
newMinimum = newMinimum.setComponents(newMinimum.getMinimum(cbv));
|
||||||
newMaximum = newMaximum.setComponents(newMaximum.getMaximum(cbv));
|
newMaximum = newMaximum.setComponents(newMaximum.getMaximum(cbv));
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,7 @@ import com.sk89q.minecraft.util.commands.Command;
|
|||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.minecraft.util.commands.Logging;
|
import com.sk89q.minecraft.util.commands.Logging;
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -49,10 +47,8 @@ import com.sk89q.worldedit.internal.expression.ExpressionException;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
|
||||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||||
import com.sk89q.worldedit.util.command.binding.Range;
|
import com.sk89q.worldedit.util.command.binding.Range;
|
||||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||||
@ -142,9 +138,9 @@ public class GenerationCommands extends MethodCommands {
|
|||||||
image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
image = ImageUtil.getScaledInstance(image, dimensions.getBlockX(), dimensions.getBlockZ(), RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MutableBlockVector pos1 = new MutableBlockVector(player.getLocation().toVector().toBlockPoint());
|
// MutableBlockVector3 pos1 = new MutableBlockVector3(player.getLocation().toBlockPoint());
|
||||||
// MutableBlockVector pos2 = new MutableBlockVector(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
|
// MutableBlockVector3 pos2 = new MutableBlockVector3(pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1));
|
||||||
BlockVector3 pos1 = player.getLocation().toVector().toBlockPoint();
|
BlockVector3 pos1 = player.getLocation().toBlockPoint();
|
||||||
BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1);
|
BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1);
|
||||||
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
||||||
int[] count = new int[1];
|
int[] count = new int[1];
|
||||||
|
@ -40,7 +40,6 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
|
|||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.command.binding.Range;
|
import com.sk89q.worldedit.util.command.binding.Range;
|
||||||
@ -167,10 +166,10 @@ public class HistoryCommands extends MethodCommands {
|
|||||||
radius = Math.max(Math.min(500, radius), 0);
|
radius = Math.max(Math.min(500, radius), 0);
|
||||||
final World world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
Location origin = player.getLocation();
|
Location origin = player.getLocation();
|
||||||
BlockVector3 bot = origin.toVector().toBlockPoint().subtract(radius, radius, radius);
|
BlockVector3 bot = origin.toBlockPoint().subtract(radius, radius, radius);
|
||||||
bot = bot.withY(Math.max(0, bot.getY()));
|
bot = bot.withY(Math.max(0, bot.getY()));
|
||||||
// bot.mutY(Math.max(0, bot.getY()));
|
// bot.mutY(Math.max(0, bot.getY()));
|
||||||
BlockVector3 top = origin.toVector().toBlockPoint().add(radius, radius, radius);
|
BlockVector3 top = origin.toBlockPoint().add(radius, radius, radius);
|
||||||
bot = bot.withY(Math.min(255, top.getY()));
|
bot = bot.withY(Math.min(255, top.getY()));
|
||||||
// top.mutY(Math.min(255, top.getY()));
|
// top.mutY(Math.min(255, top.getY()));
|
||||||
RollbackDatabase database = DBHandler.IMP.getDatabase(world);
|
RollbackDatabase database = DBHandler.IMP.getDatabase(world);
|
||||||
|
@ -190,7 +190,7 @@ public class NavigationCommands {
|
|||||||
pos = player.getSolidBlockTrace(300);
|
pos = player.getSolidBlockTrace(300);
|
||||||
}
|
}
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if(args.hasFlag('f')) player.setPosition(pos.toVector()); else player.findFreePosition(pos);
|
if(args.hasFlag('f')) player.setPosition(pos); else player.findFreePosition(pos);
|
||||||
BBC.POOF.send(player);
|
BBC.POOF.send(player);
|
||||||
} else {
|
} else {
|
||||||
BBC.NO_BLOCK.send(player);
|
BBC.NO_BLOCK.send(player);
|
||||||
|
@ -34,9 +34,7 @@ import com.sk89q.minecraft.util.commands.Command;
|
|||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.minecraft.util.commands.Logging;
|
import com.sk89q.minecraft.util.commands.Logging;
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -64,7 +62,6 @@ import com.sk89q.worldedit.math.convolution.HeightMapFilter;
|
|||||||
import com.sk89q.worldedit.math.noise.RandomNoise;
|
import com.sk89q.worldedit.math.noise.RandomNoise;
|
||||||
import com.sk89q.worldedit.regions.*;
|
import com.sk89q.worldedit.regions.*;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
|
||||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||||
import com.sk89q.worldedit.util.command.binding.Range;
|
import com.sk89q.worldedit.util.command.binding.Range;
|
||||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||||
@ -172,7 +169,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
BBC.NO_BLOCK.send(player);
|
BBC.NO_BLOCK.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompoundTag nbt = editSession.getFullBlock(pos.toVector().toBlockPoint()).getNbtData();
|
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
player.print(nbt.getValue().toString());
|
player.print(nbt.getValue().toString());
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,7 +35,6 @@ import com.sk89q.worldedit.LocalSession;
|
|||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
@ -45,7 +44,6 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
@ -65,18 +63,13 @@ import com.sk89q.worldedit.util.formatting.Style;
|
|||||||
import com.sk89q.worldedit.util.formatting.StyledFragment;
|
import com.sk89q.worldedit.util.formatting.StyledFragment;
|
||||||
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
|
||||||
@ -115,7 +108,7 @@ public class SelectionCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos = player.getBlockIn().toVector().toBlockPoint();
|
pos = player.getBlockIn().toBlockPoint();
|
||||||
}
|
}
|
||||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||||
@ -148,7 +141,7 @@ public class SelectionCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos = player.getBlockIn().toVector().toBlockPoint();
|
pos = player.getBlockIn().toBlockPoint();
|
||||||
}
|
}
|
||||||
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
pos = pos.clampY(0, player.getWorld().getMaximumPoint().getBlockY());
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
||||||
@ -169,7 +162,7 @@ public class SelectionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.selection.hpos")
|
@CommandPermissions("worldedit.selection.hpos")
|
||||||
public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
public void hpos1(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||||
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
|
BlockVector3 pos = player.getBlockTrace(300).toBlockPoint();
|
||||||
|
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
|
||||||
@ -193,7 +186,7 @@ public class SelectionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.selection.hpos")
|
@CommandPermissions("worldedit.selection.hpos")
|
||||||
public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
public void hpos2(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||||
BlockVector3 pos = player.getBlockTrace(300).toVector().toBlockPoint();
|
BlockVector3 pos = player.getBlockTrace(300).toBlockPoint();
|
||||||
|
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
|
||||||
@ -254,7 +247,7 @@ public class SelectionCommands {
|
|||||||
min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3());
|
min2D = (args.hasFlag('c')) ? pos : ChunkStore.toChunk(pos.toBlockVector3());
|
||||||
} else {
|
} else {
|
||||||
// use player loc
|
// use player loc
|
||||||
min2D = ChunkStore.toChunk(player.getBlockIn().toVector().toBlockPoint());
|
min2D = ChunkStore.toChunk(player.getBlockIn().toBlockPoint());
|
||||||
}
|
}
|
||||||
|
|
||||||
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||||
|
@ -6,9 +6,6 @@ import com.sk89q.worldedit.LocalSession;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
@ -33,7 +30,7 @@ public class AreaPickaxe implements BlockTool {
|
|||||||
int ox = clicked.getBlockX();
|
int ox = clicked.getBlockX();
|
||||||
int oy = clicked.getBlockY();
|
int oy = clicked.getBlockY();
|
||||||
int oz = clicked.getBlockZ();
|
int oz = clicked.getBlockZ();
|
||||||
BlockType initialType = clicked.getExtent().getBlock(clicked.toVector().toBlockPoint()).getBlockType();
|
BlockType initialType = clicked.getExtent().getBlock(clicked.toBlockPoint()).getBlockType();
|
||||||
|
|
||||||
if (initialType.getMaterial().isAir()) {
|
if (initialType.getMaterial().isAir()) {
|
||||||
return true;
|
return true;
|
||||||
@ -63,7 +60,7 @@ public class AreaPickaxe implements BlockTool {
|
|||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toVector().toBlockPoint().distanceSq(pos));
|
// ((World) clicked.getExtent()).queueBlockBreakEffect(server, pos, initialType, clicked.toBlockPoint().distanceSq(pos));
|
||||||
//
|
//
|
||||||
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
// editSession.setBlock(pos, BlockTypes.AIR.getDefaultState());
|
||||||
// }
|
// }
|
||||||
|
@ -37,7 +37,6 @@ import com.sk89q.worldedit.registry.state.Property;
|
|||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mode that cycles the data values of supported blocks.
|
* A mode that cycles the data values of supported blocks.
|
||||||
@ -56,8 +55,8 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
|||||||
|
|
||||||
World world = (World) clicked.getExtent();
|
World world = (World) clicked.getExtent();
|
||||||
|
|
||||||
// BlockStateHolder block = world.getBlock(clicked.toVector());
|
// BlockStateHolder block = world.getBlock(clicked);
|
||||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
BlockVector3 blockPoint = clicked.toBlockPoint();
|
||||||
BlockState block = world.getBlock(blockPoint);
|
BlockState block = world.getBlock(blockPoint);
|
||||||
|
|
||||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||||
|
@ -19,24 +19,16 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
import com.boydti.fawe.object.extent.PatternTransform;
|
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A mode that replaces one block.
|
* A mode that replaces one block.
|
||||||
@ -61,7 +53,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
|||||||
EditSession editSession = session.createEditSession(player);
|
EditSession editSession = session.createEditSession(player);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
editSession.setBlock(clicked.toVector().toBlockPoint(), pattern);
|
editSession.setBlock(clicked.toBlockPoint(), pattern);
|
||||||
} finally {
|
} finally {
|
||||||
if (bag != null) {
|
if (bag != null) {
|
||||||
bag.flushChanges();
|
bag.flushChanges();
|
||||||
@ -76,7 +68,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
|||||||
@Override
|
@Override
|
||||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||||
EditSession editSession = session.createEditSession(player);
|
EditSession editSession = session.createEditSession(player);
|
||||||
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toVector().toBlockPoint());
|
BlockStateHolder targetBlock = (editSession).getBlock(clicked.toBlockPoint());
|
||||||
BlockType type = targetBlock.getBlockType();
|
BlockType type = targetBlock.getBlockType();
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.object.RunnableVal;
|
import com.boydti.fawe.object.RunnableVal;
|
||||||
@ -26,7 +25,6 @@ import com.sk89q.worldedit.*;
|
|||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -40,7 +38,6 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -53,7 +50,6 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
import static com.boydti.fawe.object.brush.TargetMode.TARGET_FACE_RANGE;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
|
public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool, ResettableTool, Serializable {
|
||||||
@ -385,7 +381,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
switch (targetMode) {
|
switch (targetMode) {
|
||||||
case TARGET_BLOCK_RANGE:
|
case TARGET_BLOCK_RANGE:
|
||||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
|
||||||
case FOWARD_POINT_PITCH: {
|
case FOWARD_POINT_PITCH: {
|
||||||
int d = 0;
|
int d = 0;
|
||||||
float pitch = loc.getPitch();
|
float pitch = loc.getPitch();
|
||||||
@ -393,7 +389,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
|
d += (int) (Math.sin(Math.toRadians(pitch)) * 50);
|
||||||
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
|
final Vector3 vector = loc.getDirection().withY(0).normalize().multiply(d).add(loc.getX(), loc.getY(), loc.getZ());
|
||||||
// vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
|
// vector = vector.add(loc.getX(), loc.getY(), loc.getZ());
|
||||||
return offset(vector, loc.toVector()).toBlockPoint();
|
return offset(vector, loc).toBlockPoint();
|
||||||
}
|
}
|
||||||
case TARGET_POINT_HEIGHT: {
|
case TARGET_POINT_HEIGHT: {
|
||||||
final int height = loc.getBlockY();
|
final int height = loc.getBlockY();
|
||||||
@ -407,10 +403,10 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final int distance = (height - y) + 8;
|
final int distance = (height - y) + 8;
|
||||||
return offset(trace(editSession, player, distance, true), loc.toVector()).toBlockPoint();
|
return offset(trace(editSession, player, distance, true), loc).toBlockPoint();
|
||||||
}
|
}
|
||||||
case TARGET_FACE_RANGE:
|
case TARGET_FACE_RANGE:
|
||||||
return offset(trace(editSession, player, getRange(), true), loc.toVector()).toBlockPoint();
|
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -429,7 +425,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
@Override
|
@Override
|
||||||
public void run(Vector3 value) {
|
public void run(Vector3 value) {
|
||||||
Location result = tb.getMaskedTargetBlock(useLastBlock);
|
Location result = tb.getMaskedTargetBlock(useLastBlock);
|
||||||
this.value = result.toVector();
|
this.value = result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -478,7 +474,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
editSession.setMask(newMask);
|
editSession.setMask(newMask);
|
||||||
//=======
|
//=======
|
||||||
// try {
|
// try {
|
||||||
// brush.build(editSession, target.toVector().toBlockPoint(), material, size);
|
// brush.build(editSession, target.toBlockPoint(), material, size);
|
||||||
// } catch (MaxChangedBlocksException e) {
|
// } catch (MaxChangedBlocksException e) {
|
||||||
// player.printError("Max blocks change limit reached.");
|
// player.printError("Max blocks change limit reached.");
|
||||||
// } finally {
|
// } finally {
|
||||||
|
@ -50,7 +50,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
|||||||
if (target == null) return true;
|
if (target == null) return true;
|
||||||
|
|
||||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
BlockVector3 blockPoint = target.toBlockPoint();
|
||||||
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||||
selector.explainPrimarySelection(player, session, blockPoint);
|
selector.explainPrimarySelection(player, session, blockPoint);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
|||||||
if (target == null) return true;
|
if (target == null) return true;
|
||||||
|
|
||||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||||
BlockVector3 blockPoint = target.toVector().toBlockPoint();
|
BlockVector3 blockPoint = target.toBlockPoint();
|
||||||
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
|
||||||
selector.explainSecondarySelection(player, session, blockPoint);
|
selector.explainSecondarySelection(player, session, blockPoint);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class FloatingTreeRemover implements BlockTool {
|
|||||||
Player player, LocalSession session, Location clicked) {
|
Player player, LocalSession session, Location clicked) {
|
||||||
|
|
||||||
final World world = (World) clicked.getExtent();
|
final World world = (World) clicked.getExtent();
|
||||||
final BlockState state = world.getBlock(clicked.toVector().toBlockPoint());
|
final BlockState state = world.getBlock(clicked.toBlockPoint());
|
||||||
|
|
||||||
if (!isTreeBlock(state.getBlockType())) {
|
if (!isTreeBlock(state.getBlockType())) {
|
||||||
player.printError("That's not a tree.");
|
player.printError("That's not a tree.");
|
||||||
@ -77,7 +77,7 @@ public class FloatingTreeRemover implements BlockTool {
|
|||||||
}
|
}
|
||||||
final EditSession editSession = session.createEditSession(player);
|
final EditSession editSession = session.createEditSession(player);
|
||||||
try /*(EditSession editSession = session.createEditSession(player))*/ {
|
try /*(EditSession editSession = session.createEditSession(player))*/ {
|
||||||
final Set<BlockVector3> blockSet = bfs(world, clicked.toVector().toBlockPoint());
|
final Set<BlockVector3> blockSet = bfs(world, clicked.toBlockPoint());
|
||||||
if (blockSet == null) {
|
if (blockSet == null) {
|
||||||
player.printError("That's not a floating tree.");
|
player.printError("That's not a floating tree.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@ -59,7 +58,7 @@ public class FloodFillTool implements BlockTool {
|
|||||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||||
World world = (World) clicked.getExtent();
|
World world = (World) clicked.getExtent();
|
||||||
|
|
||||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
BlockVector3 origin = clicked.toBlockPoint();
|
||||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||||
|
|
||||||
if (initialType.getMaterial().isAir()) {
|
if (initialType.getMaterial().isAir()) {
|
||||||
|
@ -58,12 +58,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
|||||||
EditSession eS = session.createEditSession(player);
|
EditSession eS = session.createEditSession(player);
|
||||||
try {
|
try {
|
||||||
// eS.disableBuffering();
|
// eS.disableBuffering();
|
||||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
BlockVector3 blockPoint = pos.toBlockPoint();
|
||||||
BaseBlock applied = secondary.apply(blockPoint);
|
BaseBlock applied = secondary.apply(blockPoint);
|
||||||
if (applied.getBlockType().getMaterial().isAir()) {
|
if (applied.getBlockType().getMaterial().isAir()) {
|
||||||
eS.setBlock(blockPoint, secondary);
|
eS.setBlock(blockPoint, secondary);
|
||||||
} else {
|
} else {
|
||||||
eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), secondary);
|
eS.setBlock(pos.subtract(pos.getDirection()).toBlockPoint(), secondary);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
@ -80,12 +80,12 @@ public class LongRangeBuildTool extends BrushTool implements DoubleActionTraceTo
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// eS.disableBuffering();
|
// eS.disableBuffering();
|
||||||
BlockVector3 blockPoint = pos.toVector().toBlockPoint();
|
BlockVector3 blockPoint = pos.toBlockPoint();
|
||||||
BaseBlock applied = primary.apply(blockPoint);
|
BaseBlock applied = primary.apply(blockPoint);
|
||||||
if (applied.getBlockType().getMaterial().isAir()) {
|
if (applied.getBlockType().getMaterial().isAir()) {
|
||||||
eS.setBlock(blockPoint, primary);
|
eS.setBlock(blockPoint, primary);
|
||||||
} else {
|
} else {
|
||||||
eS.setBlock(pos.toVector().subtract(pos.getDirection()).toBlockPoint(), primary);
|
eS.setBlock(pos.subtract(pos.getDirection()).toBlockPoint(), primary);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (MaxChangedBlocksException e) {
|
} catch (MaxChangedBlocksException e) {
|
||||||
|
@ -45,10 +45,10 @@ public class QueryTool implements BlockTool {
|
|||||||
|
|
||||||
World world = (World) clicked.getExtent();
|
World world = (World) clicked.getExtent();
|
||||||
EditSession editSession = session.createEditSession(player);
|
EditSession editSession = session.createEditSession(player);
|
||||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
BlockVector3 blockPoint = clicked.toBlockPoint();
|
||||||
BaseBlock block = editSession.getFullBlock(blockPoint);
|
BaseBlock block = editSession.getFullBlock(blockPoint);
|
||||||
|
|
||||||
player.print("\u00A79@" + clicked.toVector() + ": " + "\u00A7e"
|
player.print("\u00A79@" + clicked + ": " + "\u00A7e"
|
||||||
+ block.getBlockType().getName() + "\u00A77" + " ("
|
+ block.getBlockType().getName() + "\u00A77" + " ("
|
||||||
+ block.toString() + ") "
|
+ block.toString() + ") "
|
||||||
+ "\u00A7f"
|
+ "\u00A7f"
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.sk89q.worldedit.command.tool;
|
package com.sk89q.worldedit.command.tool;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.boydti.fawe.object.mask.IdMask;
|
import com.boydti.fawe.object.mask.IdMask;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
@ -13,13 +11,6 @@ import com.sk89q.worldedit.function.block.BlockReplace;
|
|||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||||
import com.sk89q.worldedit.EditSession;
|
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
|
||||||
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.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
@ -45,10 +36,10 @@ public class RecursivePickaxe implements BlockTool {
|
|||||||
@Override
|
@Override
|
||||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||||
World world = (World) clicked.getExtent();
|
World world = (World) clicked.getExtent();
|
||||||
final BlockVector3 pos = clicked.toVector().toBlockPoint();
|
final BlockVector3 pos = clicked.toBlockPoint();
|
||||||
|
|
||||||
EditSession editSession = session.createEditSession(player);
|
EditSession editSession = session.createEditSession(player);
|
||||||
BlockVector3 origin = clicked.toVector().toBlockPoint();
|
BlockVector3 origin = clicked.toBlockPoint();
|
||||||
BlockType initialType = world.getBlock(origin).getBlockType();
|
BlockType initialType = world.getBlock(origin).getBlockType();
|
||||||
|
|
||||||
BlockStateHolder block = editSession.getBlock(pos);
|
BlockStateHolder block = editSession.getBlock(pos);
|
||||||
@ -74,8 +65,8 @@ public class RecursivePickaxe implements BlockTool {
|
|||||||
session.remember(editSession);
|
session.remember(editSession);
|
||||||
//=======
|
//=======
|
||||||
// try {
|
// try {
|
||||||
// recurse(server, editSession, world, clicked.toVector().toBlockPoint(),
|
// recurse(server, editSession, world, clicked.toBlockPoint(),
|
||||||
// clicked.toVector().toBlockPoint(), range, initialType, new HashSet<>());
|
// clicked.toBlockPoint(), range, initialType, new HashSet<>());
|
||||||
// } catch (MaxChangedBlocksException e) {
|
// } catch (MaxChangedBlocksException e) {
|
||||||
// player.printError("Max blocks change limit reached.");
|
// player.printError("Max blocks change limit reached.");
|
||||||
// } finally {
|
// } finally {
|
||||||
|
@ -44,7 +44,7 @@ public class SinglePickaxe implements BlockTool {
|
|||||||
@Override
|
@Override
|
||||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
|
||||||
World world = (World) clicked.getExtent();
|
World world = (World) clicked.getExtent();
|
||||||
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
|
BlockVector3 blockPoint = clicked.toBlockPoint();
|
||||||
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
|
final BlockType blockType = world.getBlock(blockPoint).getBlockType();
|
||||||
if (blockType == BlockTypes.BEDROCK
|
if (blockType == BlockTypes.BEDROCK
|
||||||
&& !player.canDestroyBedrock()) {
|
&& !player.canDestroyBedrock()) {
|
||||||
@ -61,7 +61,7 @@ public class SinglePickaxe implements BlockTool {
|
|||||||
try {
|
try {
|
||||||
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
|
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
|
||||||
// TODO FIXME play effect
|
// TODO FIXME play effect
|
||||||
// world.playEffect(clicked.toVector(), 2001, blockType);
|
// world.playEffect(clicked, 2001, blockType);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
editSession.flushQueue();
|
editSession.flushQueue();
|
||||||
|
@ -53,7 +53,7 @@ public class TreePlanter implements BlockTool {
|
|||||||
try {
|
try {
|
||||||
boolean successful = false;
|
boolean successful = false;
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0).toBlockPoint())) {
|
if (treeType.generate(editSession, clicked.add(0, 1, 0).toBlockPoint())) {
|
||||||
successful = true;
|
successful = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class SmoothBrush implements Brush {
|
|||||||
Vector3 posDouble = position.toVector3();
|
Vector3 posDouble = position.toVector3();
|
||||||
Location min = new Location(editSession.getWorld(), posDouble.subtract(size, size, size));
|
Location min = new Location(editSession.getWorld(), posDouble.subtract(size, size, size));
|
||||||
BlockVector3 max = posDouble.add(size, size + 10, size).toBlockPoint();
|
BlockVector3 max = posDouble.add(size, size + 10, size).toBlockPoint();
|
||||||
Region region = new CuboidRegion(editSession.getWorld(), min.toVector().toBlockPoint(), max);
|
Region region = new CuboidRegion(editSession.getWorld(), min.toBlockPoint(), max);
|
||||||
HeightMap heightMap = new HeightMap(editSession, region);
|
HeightMap heightMap = new HeightMap(editSession, region);
|
||||||
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
|
||||||
heightMap.applyFilter(filter, iterations);
|
heightMap.applyFilter(filter, iterations);
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extension.platform;
|
package com.sk89q.worldedit.extension.platform;
|
||||||
|
|
||||||
import com.sk89q.worldedit.NotABlockException;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -36,20 +35,12 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypeUtil;
|
import com.sk89q.worldedit.world.block.BlockTypeUtil;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
|
||||||
import com.sk89q.worldedit.util.Location;
|
|
||||||
import com.sk89q.worldedit.util.TargetBlock;
|
|
||||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -345,12 +336,12 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getBlockIn() {
|
public Location getBlockIn() {
|
||||||
return getLocation().setPosition(getLocation().toVector().floor());
|
return getLocation().setPosition(getLocation().floor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getBlockOn() {
|
public Location getBlockOn() {
|
||||||
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).toVector().floor());
|
return getLocation().setPosition(getLocation().setY(getLocation().getY() - 1).floor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -425,7 +416,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
boolean inFree = false;
|
boolean inFree = false;
|
||||||
|
|
||||||
while ((block = hitBlox.getNextBlock()) != null) {
|
while ((block = hitBlox.getNextBlock()) != null) {
|
||||||
boolean free = !world.getBlock(block.toVector().toBlockPoint()).getBlockType().getMaterial().isMovementBlocker();
|
boolean free = !world.getBlock(block.toBlockPoint()).getBlockType().getMaterial().isMovementBlocker();
|
||||||
|
|
||||||
if (firstBlock) {
|
if (firstBlock) {
|
||||||
firstBlock = false;
|
firstBlock = false;
|
||||||
|
@ -28,7 +28,6 @@ import com.boydti.fawe.util.MainUtil;
|
|||||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||||
import com.sk89q.worldedit.*;
|
|
||||||
import com.sk89q.worldedit.command.tool.*;
|
import com.sk89q.worldedit.command.tool.*;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -44,7 +43,6 @@ import com.sk89q.worldedit.entity.Player;
|
|||||||
import com.sk89q.worldedit.event.platform.*;
|
import com.sk89q.worldedit.event.platform.*;
|
||||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
@ -310,7 +308,7 @@ public class PlatformManager {
|
|||||||
final Actor actor = createProxyActor(event.getCause());
|
final Actor actor = createProxyActor(event.getCause());
|
||||||
try {
|
try {
|
||||||
final Location location = event.getLocation();
|
final Location location = event.getLocation();
|
||||||
final BlockVector3 vector = location.toVector().toBlockPoint();
|
final BlockVector3 vector = location.toBlockPoint();
|
||||||
|
|
||||||
// At this time, only handle interaction from players
|
// At this time, only handle interaction from players
|
||||||
if (actor instanceof Player) {
|
if (actor instanceof Player) {
|
||||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.extension.platform;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -112,7 +111,7 @@ public class PlayerProxy extends AbstractPlayerActor {
|
|||||||
@Override
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
Location loc = this.basePlayer.getLocation();
|
Location loc = this.basePlayer.getLocation();
|
||||||
return new Location(loc.getExtent(), loc.toVector().add(offset), loc.getDirection());
|
return new Location(loc.getExtent(), loc.add(offset), loc.getDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +35,7 @@ import com.sk89q.worldedit.function.operation.OperationQueue;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
@ -51,7 +51,7 @@ import javax.annotation.Nullable;
|
|||||||
public class AbstractDelegateExtent implements LightingExtent {
|
public class AbstractDelegateExtent implements LightingExtent {
|
||||||
|
|
||||||
private transient final Extent extent;
|
private transient final Extent extent;
|
||||||
// private MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
// private MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
|
@ -39,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
public class MaskingExtent extends AbstractDelegateExtent {
|
public class MaskingExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private Mask mask;
|
private Mask mask;
|
||||||
// private MutableBlockVector mutable = new MutableBlockVector();
|
// private MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
|
@ -32,7 +32,6 @@ import com.sk89q.worldedit.WorldEditException;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -42,9 +41,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -177,7 +175,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
|||||||
public List<? extends Entity> getEntities(Region region) {
|
public List<? extends Entity> getEntities(Region region) {
|
||||||
List<Entity> filtered = new ArrayList<>();
|
List<Entity> filtered = new ArrayList<>();
|
||||||
for (Entity entity : getEntities()) {
|
for (Entity entity : getEntities()) {
|
||||||
if (region.contains(entity.getLocation().toVector().toBlockPoint())) {
|
if (region.contains(entity.getLocation().toBlockPoint())) {
|
||||||
filtered.add(entity);
|
filtered.add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,8 @@ public class BlockTransformExtent extends ResettableExtent {
|
|||||||
|
|
||||||
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
|
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform the given block using the given transform.
|
* Transform the given block using the given transform.
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,6 @@ import com.sk89q.jnbt.FloatTag;
|
|||||||
import com.sk89q.jnbt.IntTag;
|
import com.sk89q.jnbt.IntTag;
|
||||||
import com.sk89q.jnbt.ListTag;
|
import com.sk89q.jnbt.ListTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.jnbt.CompoundTagBuilder;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -104,7 +103,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
|
|
||||||
//<<<<<<< HEAD
|
//<<<<<<< HEAD
|
||||||
// Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
// Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||||
// Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
// Vector newPosition = transform.apply(location.subtract(pivot));
|
||||||
// Vector newDirection;
|
// Vector newDirection;
|
||||||
// if (transform.isIdentity()) {
|
// if (transform.isIdentity()) {
|
||||||
// newDirection = entity.getLocation().getDirection();
|
// newDirection = entity.getLocation().getDirection();
|
||||||
@ -116,7 +115,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
// }
|
// }
|
||||||
//=======
|
//=======
|
||||||
Vector3 pivot = from.round().add(0.5, 0.5, 0.5);
|
Vector3 pivot = from.round().add(0.5, 0.5, 0.5);
|
||||||
Vector3 newPosition = transform.apply(location.toVector().subtract(pivot));
|
Vector3 newPosition = transform.apply(location.subtract(pivot));
|
||||||
Vector3 newDirection;
|
Vector3 newDirection;
|
||||||
|
|
||||||
newDirection = transform.isIdentity() ?
|
newDirection = transform.isIdentity() ?
|
||||||
|
@ -18,7 +18,7 @@ public class BackwardsExtentBlockCopy implements Operation {
|
|||||||
private final RegionFunction function;
|
private final RegionFunction function;
|
||||||
private final BlockVector3 origin;
|
private final BlockVector3 origin;
|
||||||
|
|
||||||
// private Vector mutable = new MutableBlockVector();
|
// private Vector mutable = new MutableBlockVector3();
|
||||||
|
|
||||||
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, BlockVector3 origin, Transform transform, RegionFunction function) {
|
public BackwardsExtentBlockCopy(Extent source, Region region, Extent destination, BlockVector3 origin, Transform transform, RegionFunction function) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
|
@ -369,7 +369,7 @@ public class ForwardExtentCopy implements Operation {
|
|||||||
if (!entities.isEmpty()) {
|
if (!entities.isEmpty()) {
|
||||||
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
||||||
// if (copyingEntities) {
|
// if (copyingEntities) {
|
||||||
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from.toVector3(), destination, to.toVector3(), currentTransform);
|
// ExtentEntityCopy entityCopy = new ExtentEntityCopy(from, destination, to, currentTransform);
|
||||||
entityCopy.setRemoving(removingEntities);
|
entityCopy.setRemoving(removingEntities);
|
||||||
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
EntityVisitor entityVisitor = new EntityVisitor(entities.iterator(), entityCopy);
|
||||||
Operations.completeBlindly(entityVisitor);
|
Operations.completeBlindly(entityVisitor);
|
||||||
|
@ -30,4 +30,3 @@ public interface FawePattern extends Pattern {
|
|||||||
@Override
|
@Override
|
||||||
boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException;
|
boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import com.sk89q.worldedit.function.RegionFunction;
|
|||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.function.operation.RunContext;
|
import com.sk89q.worldedit.function.operation.RunContext;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@ -217,8 +217,8 @@ public abstract class BreadthFirstSearch implements Operation {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Operation resume(RunContext run) throws WorldEditException {
|
public Operation resume(RunContext run) throws WorldEditException {
|
||||||
MutableBlockVector mutable = new MutableBlockVector();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
// MutableBlockVector mutable2 = new MutableBlockVector();
|
// MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
||||||
boolean shouldTrim = false;
|
boolean shouldTrim = false;
|
||||||
IntegerTrio[] dirs = getIntDirections();
|
IntegerTrio[] dirs = getIntDirections();
|
||||||
BlockVectorSet tempQueue = new BlockVectorSet();
|
BlockVectorSet tempQueue = new BlockVectorSet();
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
package com.sk89q.worldedit.function.visitor;
|
package com.sk89q.worldedit.function.visitor;
|
||||||
|
|
||||||
import com.boydti.fawe.object.HasFaweQueue;
|
import com.boydti.fawe.object.HasFaweQueue;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.function.RegionFunction;
|
import com.sk89q.worldedit.function.RegionFunction;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
@ -102,7 +102,7 @@ public class CommandLoggingHandler extends AbstractInvokeListener implements Inv
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (logMode != null && sender.isPlayer()) {
|
if (logMode != null && sender.isPlayer()) {
|
||||||
Vector3 position = player.getLocation().toVector();
|
Vector3 position = player.getLocation();
|
||||||
LocalSession session = worldEdit.getSessionManager().get(player);
|
LocalSession session = worldEdit.getSessionManager().get(player);
|
||||||
|
|
||||||
switch (logMode) {
|
switch (logMode) {
|
||||||
|
@ -60,22 +60,12 @@ public class BlockVector2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockVector2 at(int x, int z) {
|
public static BlockVector2 at(int x, int z) {
|
||||||
switch (x) {
|
|
||||||
case 0:
|
|
||||||
if (z == 0) {
|
|
||||||
return ZERO;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (z == 1) {
|
|
||||||
return ONE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new BlockVector2(x, z);
|
return new BlockVector2(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int x, z;
|
protected int x, z;
|
||||||
|
|
||||||
|
protected BlockVector2(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an instance.
|
* Construct an instance.
|
||||||
@ -83,11 +73,31 @@ public class BlockVector2 {
|
|||||||
* @param x the X coordinate
|
* @param x the X coordinate
|
||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
private BlockVector2(int x, int z) {
|
protected BlockVector2(int x, int z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector2 setComponents(int x, int z) {
|
||||||
|
return new MutableBlockVector2(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector2 mutX(double x) {
|
||||||
|
return new MutableBlockVector2((int) x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector2 mutZ(double z) {
|
||||||
|
return new MutableBlockVector2(x, (int) z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector2 mutX(int x) {
|
||||||
|
return new MutableBlockVector2(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector2 mutZ(int z) {
|
||||||
|
return new MutableBlockVector2(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the X coordinate.
|
* Get the X coordinate.
|
||||||
*
|
*
|
||||||
@ -144,6 +154,35 @@ public class BlockVector2 {
|
|||||||
return BlockVector2.at(x, z);
|
return BlockVector2.at(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector2 nextPosition() {
|
||||||
|
int absX = Math.abs(x);
|
||||||
|
int absY = Math.abs(z);
|
||||||
|
if (absX > absY) {
|
||||||
|
if (x > 0) {
|
||||||
|
return setComponents(x, z + 1);
|
||||||
|
} else {
|
||||||
|
return setComponents(x, z - 1);
|
||||||
|
}
|
||||||
|
} else if (absY > absX) {
|
||||||
|
if (z > 0) {
|
||||||
|
return setComponents(x - 1, z);
|
||||||
|
} else {
|
||||||
|
return setComponents(x + 1, z);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (x == z && x > 0) {
|
||||||
|
return setComponents(x, z + 1);
|
||||||
|
}
|
||||||
|
if (x == absX) {
|
||||||
|
return setComponents(x, z + 1);
|
||||||
|
}
|
||||||
|
if (z == absY) {
|
||||||
|
return setComponents(x, z - 1);
|
||||||
|
}
|
||||||
|
return setComponents(x + 1, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add another vector to this vector and return the result as a new vector.
|
* Add another vector to this vector and return the result as a new vector.
|
||||||
*
|
*
|
||||||
|
@ -42,20 +42,6 @@ public class BlockVector3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockVector3 at(int x, int y, int z) {
|
public static BlockVector3 at(int x, int y, int z) {
|
||||||
// switch for efficiency on typical cases
|
|
||||||
// in MC y is rarely 0/1 on selections
|
|
||||||
switch (y) {
|
|
||||||
case 0:
|
|
||||||
if (x == 0 && z == 0) {
|
|
||||||
return ZERO;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (x == 1 && z == 1) {
|
|
||||||
return ONE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new BlockVector3(x, y, z);
|
return new BlockVector3(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +66,9 @@ public class BlockVector3 {
|
|||||||
return YzxOrderComparator.YZX_ORDER;
|
return YzxOrderComparator.YZX_ORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int x, y, z;
|
protected int x, y, z;
|
||||||
|
|
||||||
|
protected BlockVector3(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an instance.
|
* Construct an instance.
|
||||||
@ -89,12 +77,44 @@ public class BlockVector3 {
|
|||||||
* @param y the Y coordinate
|
* @param y the Y coordinate
|
||||||
* @param z the Z coordinate
|
* @param z the Z coordinate
|
||||||
*/
|
*/
|
||||||
private BlockVector3(int x, int y, int z) {
|
protected BlockVector3(int x, int y, int z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 setComponents(double x, double y, double z) {
|
||||||
|
return new MutableBlockVector3((int) x, (int) y, (int) z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 setComponents(int x, int y, int z) {
|
||||||
|
return new MutableBlockVector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 mutX(double x) {
|
||||||
|
return new MutableBlockVector3((int) x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 mutY(double y) {
|
||||||
|
return new MutableBlockVector3(x, (int) y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 mutZ(double z) {
|
||||||
|
return new MutableBlockVector3(x, y, (int) z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 mutX(int x) {
|
||||||
|
return new MutableBlockVector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 mutY(int y) {
|
||||||
|
return new MutableBlockVector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MutableBlockVector3 mutZ(int z) {
|
||||||
|
return new MutableBlockVector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the X coordinate.
|
* Get the X coordinate.
|
||||||
*
|
*
|
||||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren