mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Current progress with update
This commit is contained in:
parent
9896a1339e
commit
d4157b7e0e
@ -31,7 +31,9 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.bukkit.adapter.CachedBukkitAdapter;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.*;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -411,15 +413,15 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
||||
}
|
||||
return new CompoundTag(values);
|
||||
} else if (foreign instanceof NBTTagByte) {
|
||||
return new ByteTag(((NBTTagByte) foreign).g()); // getByte
|
||||
return new ByteTag(((NBTTagByte) foreign).asByte()); // getByte
|
||||
} else if (foreign instanceof NBTTagByteArray) {
|
||||
return new ByteArrayTag(((NBTTagByteArray) foreign).c()); // data
|
||||
} else if (foreign instanceof NBTTagDouble) {
|
||||
return new DoubleTag(((NBTTagDouble) foreign).asDouble()); // getDouble
|
||||
} else if (foreign instanceof NBTTagFloat) {
|
||||
return new FloatTag(((NBTTagFloat) foreign).i()); // getFloat
|
||||
return new FloatTag(((NBTTagFloat) foreign).asByte()); // getFloat
|
||||
} else if (foreign instanceof NBTTagInt) {
|
||||
return new IntTag(((NBTTagInt) foreign).e()); // getInt
|
||||
return new IntTag(((NBTTagInt) foreign).asInt()); // getInt
|
||||
} else if (foreign instanceof NBTTagIntArray) {
|
||||
return new IntArrayTag(((NBTTagIntArray) foreign).d()); // data
|
||||
} else if (foreign instanceof NBTTagList) {
|
||||
@ -430,11 +432,11 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
||||
return new ListTag(ByteTag.class, new ArrayList<ByteTag>());
|
||||
}
|
||||
} else if (foreign instanceof NBTTagLong) {
|
||||
return new LongTag(((NBTTagLong) foreign).d()); // getLong
|
||||
return new LongTag(((NBTTagLong) foreign).asLong()); // getLong
|
||||
} else if (foreign instanceof NBTTagShort) {
|
||||
return new ShortTag(((NBTTagShort) foreign).f()); // getShort
|
||||
return new ShortTag(((NBTTagShort) foreign).asShort()); // getShort
|
||||
} else if (foreign instanceof NBTTagString) {
|
||||
return new StringTag(foreign.b_()); // data
|
||||
return new StringTag(foreign.asString()); // data
|
||||
} else if (foreign instanceof NBTTagEnd) {
|
||||
return EndTag.INSTANCE;
|
||||
} else {
|
||||
@ -539,4 +541,10 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
||||
BlockMaterial_1_13 material = (BlockMaterial_1_13) state.getMaterial();
|
||||
return material.getCraftBlockData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundTag nbtData) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
@ -3,7 +3,8 @@ package com.boydti.fawe.bukkit.filter;
|
||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Collection;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
@ -34,8 +35,8 @@ public class GriefPreventionFilter extends CuboidRegionFilter {
|
||||
org.bukkit.Location bot = claim.getGreaterBoundaryCorner();
|
||||
if (world.equals(bot.getWorld())) {
|
||||
org.bukkit.Location top = claim.getGreaterBoundaryCorner();
|
||||
BlockVector2D pos1 = new BlockVector2D(bot.getBlockX(), bot.getBlockZ());
|
||||
BlockVector2D pos2 = new BlockVector2D(top.getBlockX(), top.getBlockZ());
|
||||
BlockVector2 pos1 = new BlockVector2(bot.getBlockX(), bot.getBlockZ());
|
||||
BlockVector2 pos2 = new BlockVector2(top.getBlockX(), top.getBlockZ());
|
||||
add(pos1, pos2);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
@ -33,14 +33,14 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
||||
public void run(Object value) {
|
||||
WorldGuardFilter.this.manager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(FaweAPI.getWorld(world.getName()));
|
||||
for (ProtectedRegion region : manager.getRegions().values()) {
|
||||
BlockVector min = region.getMinimumPoint();
|
||||
BlockVector max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
if (max.getBlockX() - min.getBlockX() > 1024 || max.getBlockZ() - min.getBlockZ() > 1024) {
|
||||
Fawe.debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
|
||||
large = true;
|
||||
break;
|
||||
}
|
||||
add(min.toVector2D(), max.toVector2D());
|
||||
add(min.toBlockVector2(), max.toBlockVector2());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -49,8 +49,8 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
||||
@Override
|
||||
public boolean containsChunk(int chunkX, int chunkZ) {
|
||||
if (!large) return super.containsChunk(chunkX, chunkZ);
|
||||
BlockVector pos1 = new BlockVector(chunkX << 4, 0, chunkZ << 4);
|
||||
BlockVector pos2 = new BlockVector(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
|
||||
BlockVector3 pos1 = new BlockVector3(chunkX << 4, 0, chunkZ << 4);
|
||||
BlockVector3 pos2 = new BlockVector3(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
|
||||
ProtectedCuboidRegion chunkRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
|
||||
ApplicableRegionSet set = manager.getApplicableRegions(chunkRegion);
|
||||
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
|
||||
@ -59,8 +59,8 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
||||
@Override
|
||||
public boolean containsRegion(int mcaX, int mcaZ) {
|
||||
if (!large) return super.containsRegion(mcaX, mcaZ);
|
||||
BlockVector pos1 = new BlockVector(mcaX << 9, 0, mcaZ << 9);
|
||||
BlockVector pos2 = new BlockVector(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
|
||||
BlockVector3 pos1 = new BlockVector3(mcaX << 9, 0, mcaZ << 9);
|
||||
BlockVector3 pos2 = new BlockVector3(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
|
||||
ProtectedCuboidRegion regionRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
|
||||
ApplicableRegionSet set = manager.getApplicableRegions(regionRegion);
|
||||
return set.size() > 0 && !set.getRegions().iterator().next().getId().equals("__global__");
|
||||
|
@ -14,6 +14,9 @@ import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
@ -246,14 +249,14 @@ public class BukkitImageListener implements Listener {
|
||||
|
||||
if (worldX < 0 || worldX > width || worldZ < 0 || worldZ > length) return;
|
||||
|
||||
Vector wPos = new Vector(worldX, 0, worldZ);
|
||||
|
||||
fp.runAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BlockVector3 wPos = new BlockVector3(worldX, 0, worldZ);
|
||||
viewer.refresh();
|
||||
int topY = generator.getNearestSurfaceTerrainBlock(wPos.getBlockX(), wPos.getBlockZ(), 255, 0, 255);
|
||||
wPos.mutY(topY);
|
||||
wPos = wPos.withY(topY);
|
||||
|
||||
EditSession es = new EditSessionBuilder(fp.getWorld()).player(fp).combineStages(false).autoQueue(false).blockBag(null).limitUnlimited().build();
|
||||
ExtentTraverser last = new ExtentTraverser(es.getExtent()).last();
|
||||
|
@ -22,7 +22,6 @@ import com.comphenix.protocol.wrappers.ChunkCoordIntPair;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
@ -31,6 +30,9 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
||||
import com.sk89q.worldedit.event.platform.Interaction;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
@ -62,12 +64,12 @@ public class CFIPacketListener implements Listener {
|
||||
this.protocolmanager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
// Direct digging to the virtual world
|
||||
registerBlockEvent(PacketType.Play.Client.BLOCK_DIG, false, new RunnableVal3<PacketEvent, VirtualWorld, Vector>() {
|
||||
registerBlockEvent(PacketType.Play.Client.BLOCK_DIG, false, new RunnableVal3<PacketEvent, VirtualWorld, BlockVector3>() {
|
||||
@Override
|
||||
public void run(PacketEvent event, VirtualWorld gen, Vector pt) {
|
||||
public void run(PacketEvent event, VirtualWorld gen, BlockVector3 pt) {
|
||||
try {
|
||||
Player plr = event.getPlayer();
|
||||
Vector realPos = pt.add(gen.getOrigin());
|
||||
BlockVector3 realPos = pt.add(gen.getOrigin().toBlockPoint());
|
||||
if (!sendBlockChange(plr, gen, pt, Interaction.HIT)) {
|
||||
gen.setBlock(pt, EditSession.nullBlock);
|
||||
}
|
||||
@ -78,9 +80,9 @@ public class CFIPacketListener implements Listener {
|
||||
});
|
||||
|
||||
// Direct placing to the virtual world
|
||||
RunnableVal3<PacketEvent, VirtualWorld, Vector> placeTask = new RunnableVal3<PacketEvent, VirtualWorld, Vector>() {
|
||||
RunnableVal3<PacketEvent, VirtualWorld, BlockVector3> placeTask = new RunnableVal3<PacketEvent, VirtualWorld, BlockVector3>() {
|
||||
@Override
|
||||
public void run(PacketEvent event, VirtualWorld gen, Vector pt) {
|
||||
public void run(PacketEvent event, VirtualWorld gen, BlockVector3 pt) {
|
||||
try {
|
||||
Player plr = event.getPlayer();
|
||||
List<EnumWrappers.Hand> hands = event.getPacket().getHands().getValues();
|
||||
@ -113,9 +115,9 @@ public class CFIPacketListener implements Listener {
|
||||
registerBlockEvent(PacketType.Play.Client.USE_ITEM, true, placeTask);
|
||||
|
||||
// Cancel block change packets where the real world overlaps with the virtual one
|
||||
registerBlockEvent(PacketType.Play.Server.BLOCK_CHANGE, false, new RunnableVal3<PacketEvent, VirtualWorld, Vector>() {
|
||||
registerBlockEvent(PacketType.Play.Server.BLOCK_CHANGE, false, new RunnableVal3<PacketEvent, VirtualWorld, BlockVector3>() {
|
||||
@Override
|
||||
public void run(PacketEvent event, VirtualWorld gen, Vector pt) {
|
||||
public void run(PacketEvent event, VirtualWorld gen, BlockVector3 pt) {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
@ -128,7 +130,7 @@ public class CFIPacketListener implements Listener {
|
||||
|
||||
VirtualWorld gen = getGenerator(event);
|
||||
if (gen != null) {
|
||||
Vector origin = gen.getOrigin();
|
||||
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
||||
PacketContainer packet = event.getPacket();
|
||||
StructureModifier<Integer> ints = packet.getIntegers();
|
||||
int cx = ints.read(0);
|
||||
@ -137,7 +139,7 @@ public class CFIPacketListener implements Listener {
|
||||
int ocx = origin.getBlockX() >> 4;
|
||||
int ocz = origin.getBlockZ() >> 4;
|
||||
|
||||
if (gen.contains(new Vector((cx - ocx) << 4, 0, (cz - ocz) << 4))) {
|
||||
if (gen.contains(new BlockVector3((cx - ocx) << 4, 0, (cz - ocz) << 4))) {
|
||||
event.setCancelled(true);
|
||||
|
||||
Player plr = event.getPlayer();
|
||||
@ -163,8 +165,8 @@ public class CFIPacketListener implements Listener {
|
||||
Location pos = player.getLocation();
|
||||
VirtualWorld gen = getGenerator(event);
|
||||
if (gen != null) {
|
||||
Vector origin = gen.getOrigin();
|
||||
Vector pt = new Vector(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
||||
BlockVector3 pt = new BlockVector3(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
|
||||
StructureModifier<Integer> ints = event.getPacket().getIntegers();
|
||||
int id = ints.read(0);
|
||||
@ -188,12 +190,12 @@ public class CFIPacketListener implements Listener {
|
||||
Location pos = player.getLocation();
|
||||
VirtualWorld gen = getGenerator(event);
|
||||
if (gen != null) {
|
||||
Vector origin = gen.getOrigin();
|
||||
Vector from = new Vector(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
||||
BlockVector3 from = new BlockVector3(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
|
||||
PacketContainer packet = event.getPacket();
|
||||
StructureModifier<Double> doubles = packet.getDoubles();
|
||||
Vector to = new Vector(doubles.read(0), doubles.read(1), doubles.read(2));
|
||||
BlockVector3 to = new BlockVector3(doubles.read(0), doubles.read(1), doubles.read(2));
|
||||
if (gen.contains(to.subtract(origin)) && from.distanceSq(to) < 8) {
|
||||
int id = packet.getIntegers().read(0);
|
||||
PacketContainer reply = new PacketContainer(PacketType.Play.Client.TELEPORT_ACCEPT);
|
||||
@ -220,10 +222,10 @@ public class CFIPacketListener implements Listener {
|
||||
if (gen != null) {
|
||||
PacketContainer packet = event.getPacket();
|
||||
ChunkCoordIntPair chunk = packet.getChunkCoordIntPairs().read(0);
|
||||
Vector origin = gen.getOrigin();
|
||||
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
||||
int cx = chunk.getChunkX() - (origin.getBlockX() >> 4);
|
||||
int cz = chunk.getChunkZ() - (origin.getBlockX() >> 4);
|
||||
if (gen.contains(new Vector(cx << 4, 0, cz << 4))) {
|
||||
if (gen.contains(new BlockVector3(cx << 4, 0, cz << 4))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -246,14 +248,14 @@ public class CFIPacketListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean sendBlockChange(Player plr, VirtualWorld gen, Vector pt, Interaction action) {
|
||||
private boolean sendBlockChange(Player plr, VirtualWorld gen, BlockVector3 pt, Interaction action) {
|
||||
PlatformManager platform = WorldEdit.getInstance().getPlatformManager();
|
||||
com.sk89q.worldedit.entity.Player actor = FawePlayer.wrap(plr).getPlayer();
|
||||
com.sk89q.worldedit.util.Location location = new com.sk89q.worldedit.util.Location(actor.getWorld(), pt);
|
||||
com.sk89q.worldedit.util.Location location = new com.sk89q.worldedit.util.Location(actor.getWorld(), pt.toVector3());
|
||||
BlockInteractEvent toCall = new BlockInteractEvent(actor, location, action);
|
||||
platform.handleBlockInteract(toCall);
|
||||
if (toCall.isCancelled() || action == Interaction.OPEN) {
|
||||
Vector realPos = pt.add(gen.getOrigin());
|
||||
BlockVector3 realPos = pt.add(gen.getOrigin().toBlockPoint());
|
||||
BlockStateHolder block = gen.getBlock(pt);
|
||||
sendBlockChange(plr, realPos, block);
|
||||
return true;
|
||||
@ -261,7 +263,7 @@ public class CFIPacketListener implements Listener {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendBlockChange(Player plr, Vector pt, BlockStateHolder block) {
|
||||
private void sendBlockChange(Player plr, BlockVector3 pt, BlockStateHolder block) {
|
||||
plr.sendBlockChange(new Location(plr.getWorld(), pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()), BukkitAdapter.adapt(block));
|
||||
}
|
||||
|
||||
@ -280,20 +282,20 @@ public class CFIPacketListener implements Listener {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Vector getRelPos(PacketEvent event, VirtualWorld generator) {
|
||||
private BlockVector3 getRelPos(PacketEvent event, VirtualWorld generator) {
|
||||
PacketContainer packet = event.getPacket();
|
||||
StructureModifier<BlockPosition> position = packet.getBlockPositionModifier();
|
||||
BlockPosition loc = position.readSafely(0);
|
||||
if (loc == null) return null;
|
||||
Vector origin = generator.getOrigin();
|
||||
Vector pt = new Vector(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
|
||||
BlockVector3 origin = generator.getOrigin().toBlockPoint();
|
||||
BlockVector3 pt = new BlockVector3(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
|
||||
return pt;
|
||||
}
|
||||
|
||||
private void handleBlockEvent(PacketEvent event, boolean relative, RunnableVal3<PacketEvent, VirtualWorld, Vector> task) {
|
||||
private void handleBlockEvent(PacketEvent event, boolean relative, RunnableVal3<PacketEvent, VirtualWorld, BlockVector3> task) {
|
||||
VirtualWorld gen = getGenerator(event);
|
||||
if (gen != null) {
|
||||
Vector pt = getRelPos(event, gen);
|
||||
BlockVector3 pt = getRelPos(event, gen);
|
||||
if (pt != null) {
|
||||
if (relative) pt = getRelative(event, pt);
|
||||
if (gen.contains(pt)) {
|
||||
@ -304,7 +306,7 @@ public class CFIPacketListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void registerBlockEvent(PacketType type, boolean relative, RunnableVal3<PacketEvent, VirtualWorld, Vector> task) {
|
||||
private void registerBlockEvent(PacketType type, boolean relative, RunnableVal3<PacketEvent, VirtualWorld, BlockVector3> task) {
|
||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, type) {
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
@ -318,7 +320,7 @@ public class CFIPacketListener implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
private Vector getRelative(PacketEvent container, Vector pt) {
|
||||
private BlockVector3 getRelative(PacketEvent container, BlockVector3 pt) {
|
||||
PacketContainer packet = container.getPacket();
|
||||
StructureModifier<EnumWrappers.Direction> dirs = packet.getDirections();
|
||||
EnumWrappers.Direction dir = dirs.readSafely(0);
|
||||
|
@ -1,7 +1,8 @@
|
||||
package com.boydti.fawe.bukkit.regions;
|
||||
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class BukkitMask extends FaweMask {
|
||||
@ -11,6 +12,6 @@ public class BukkitMask extends FaweMask {
|
||||
}
|
||||
|
||||
public BukkitMask(Location pos1, Location pos2, String name) {
|
||||
super(new BlockVector(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), new BlockVector(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()), name);
|
||||
super(new BlockVector3(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), new BlockVector3(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()), name);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.queue.NullFaweQueue;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -55,8 +55,8 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
||||
World bukkitWorld = player.parent.getWorld();
|
||||
AsyncWorld asyncWorld = AsyncWorld.wrap(bukkitWorld);
|
||||
|
||||
Vector vec1 = new Vector(0, 0, 0);
|
||||
Vector vec2 = vec1;
|
||||
BlockVector3 vec1 = new BlockVector3(0, 0, 0);
|
||||
BlockVector3 vec2 = vec1;
|
||||
Location pos1 = BukkitAdapter.adapt(bukkitWorld, vec1);
|
||||
Location pos2 = BukkitAdapter.adapt(bukkitWorld, vec2);
|
||||
|
||||
|
@ -3,7 +3,8 @@ package com.boydti.fawe.bukkit.regions;
|
||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.List;
|
||||
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
|
||||
import net.sacredlabyrinth.Phaed.PreciousStones.field.Field;
|
||||
@ -40,8 +41,8 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener
|
||||
boolean member = fp.hasPermission("fawe.preciousstones.member");
|
||||
for (final Field myField : fields) {
|
||||
if (isAllowed(player, myField, type, member)) {
|
||||
BlockVector pos1 = new BlockVector(myField.getMinx(), myField.getMiny(), myField.getMinz());
|
||||
BlockVector pos2 = new BlockVector(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
|
||||
BlockVector3 pos1 = new BlockVector3(myField.getMinx(), myField.getMiny(), myField.getMinz());
|
||||
BlockVector3 pos2 = new BlockVector3(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
|
||||
return new FaweMask(pos1, pos2, "FIELD: " + myField) {
|
||||
@Override
|
||||
public boolean isValid(FawePlayer player, MaskType type) {
|
||||
|
@ -7,8 +7,8 @@ import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.boydti.fawe.regions.general.RegionFilter;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.AbstractRegion;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Polygonal2DRegion;
|
||||
@ -61,7 +61,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
if (global != null && isAllowed(player, global)) {
|
||||
return global;
|
||||
}
|
||||
final ApplicableRegionSet regions = manager.getApplicableRegions(new Vector(loc.getX(), loc.getY(), loc.getZ()));
|
||||
final ApplicableRegionSet regions = manager.getApplicableRegions(new BlockVector3(loc.getX(), loc.getY(), loc.getZ()));
|
||||
for (final ProtectedRegion region : regions) {
|
||||
if (isAllowed(player, region)) {
|
||||
return region;
|
||||
@ -145,27 +145,27 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return region.getMinimumPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return region.getMaximumPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(Vector... changes) {
|
||||
public void expand(BlockVector3... changes) {
|
||||
throw new UnsupportedOperationException("Region is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contract(Vector... changes) {
|
||||
public void contract(BlockVector3... changes) {
|
||||
throw new UnsupportedOperationException("Region is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Vector position) {
|
||||
public boolean contains(BlockVector3 position) {
|
||||
return region.contains(position);
|
||||
}
|
||||
}
|
||||
@ -179,8 +179,8 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
}
|
||||
if (region instanceof ProtectedPolygonalRegion) {
|
||||
ProtectedPolygonalRegion casted = (ProtectedPolygonalRegion) region;
|
||||
BlockVector max = region.getMaximumPoint();
|
||||
BlockVector min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
return new Polygonal2DRegion(null, casted.getPoints(), min.getBlockY(), max.getBlockY());
|
||||
}
|
||||
return new AdaptedRegion(region);
|
||||
|
@ -5,7 +5,7 @@ import com.boydti.fawe.bukkit.filter.WorldGuardFilter;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.boydti.fawe.regions.general.RegionFilter;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.AbstractRegion;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
@ -65,45 +65,45 @@ public class WorldguardFlag extends BukkitMaskManager implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
Vector point = null;
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
BlockVector3 point = null;
|
||||
for (Map.Entry<String, ProtectedRegion> entry : manager.getRegions().entrySet()) {
|
||||
Vector p = entry.getValue().getMinimumPoint();
|
||||
BlockVector3 p = entry.getValue().getMinimumPoint();
|
||||
if (point == null) {
|
||||
point = p;
|
||||
continue;
|
||||
}
|
||||
point = Vector.getMinimum(point, p);
|
||||
point = point.getMinimum(p);
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
Vector point = null;
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
BlockVector3 point = null;
|
||||
for (Map.Entry<String, ProtectedRegion> entry : manager.getRegions().entrySet()) {
|
||||
Vector p = entry.getValue().getMaximumPoint();
|
||||
BlockVector3 p = entry.getValue().getMaximumPoint();
|
||||
if (point == null) {
|
||||
point = p;
|
||||
continue;
|
||||
}
|
||||
point = Vector.getMaximum(point, p);
|
||||
point = point.getMaximum(p);
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(Vector... changes) {
|
||||
public void expand(BlockVector3... changes) {
|
||||
throw new UnsupportedOperationException("Region is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contract(Vector... changes) {
|
||||
public void contract(BlockVector3... changes) {
|
||||
throw new UnsupportedOperationException("Region is immutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Vector position) {
|
||||
public boolean contains(BlockVector3 position) {
|
||||
// Make sure that all these flags are not denied. Denies override allows. WorldGuardExtraFlags can add Flags.WORLDEDIT
|
||||
return manager.getApplicableRegions(position).testState(localplayer, Flags.BUILD, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK);
|
||||
}
|
||||
|
@ -13,11 +13,12 @@ import com.comphenix.protocol.wrappers.BlockPosition;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtCompound;
|
||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
||||
import com.sk89q.worldedit.internal.cui.SelectionShapeEvent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -33,10 +34,10 @@ import org.bukkit.entity.Player;
|
||||
public class StructureCUI extends CUI {
|
||||
private boolean cuboid = true;
|
||||
|
||||
private Vector pos1;
|
||||
private Vector pos2;
|
||||
private BlockVector3 pos1;
|
||||
private BlockVector3 pos2;
|
||||
|
||||
private Vector remove;
|
||||
private BlockVector3 remove;
|
||||
private NbtCompound removeTag;
|
||||
private BlockState state;
|
||||
|
||||
@ -56,7 +57,7 @@ public class StructureCUI extends CUI {
|
||||
int x = Integer.parseInt(param[1]);
|
||||
int y = Integer.parseInt(param[2]);
|
||||
int z = Integer.parseInt(param[3]);
|
||||
Vector pos = new Vector(x, y, z);
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (id == 0) {
|
||||
pos1 = pos;
|
||||
} else {
|
||||
@ -123,7 +124,7 @@ public class StructureCUI extends CUI {
|
||||
}
|
||||
}
|
||||
|
||||
private void sendNbt(Vector pos, NbtCompound compound) {
|
||||
private void sendNbt(BlockVector3 pos, NbtCompound compound) {
|
||||
Player player = this.<Player>getPlayer().parent;
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
@ -158,8 +159,8 @@ public class StructureCUI extends CUI {
|
||||
remove = null;
|
||||
}
|
||||
if (pos1 == null || pos2 == null) return;
|
||||
Vector min = Vector.getMinimum(pos1, pos2);
|
||||
Vector max = Vector.getMaximum(pos1, pos2);
|
||||
BlockVector3 min = pos1.getMinimum(pos2);
|
||||
BlockVector3 max = pos1.getMaximum(pos2);
|
||||
|
||||
// Position
|
||||
double rotX = playerLoc.getYaw();
|
||||
@ -187,7 +188,7 @@ public class StructureCUI extends CUI {
|
||||
NbtCompound compound = constructStructureNbt(x, y, z, posX, posY, posZ, sizeX, sizeY, sizeZ);
|
||||
|
||||
Block block = player.getWorld().getBlockAt(x, y, z);
|
||||
remove = new Vector(x, y, z);
|
||||
remove = new BlockVector3(x, y, z);
|
||||
state = BukkitAdapter.adapt(block.getBlockData());
|
||||
removeTag = compound;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
//import com.sk89q.jnbt.StringTag;
|
||||
//import com.sk89q.jnbt.Tag;
|
||||
//import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
//import com.sk89q.worldedit.world.block.BlockState;
|
||||
//import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
//import com.sk89q.worldedit.entity.BaseEntity;
|
||||
//import com.sk89q.worldedit.internal.Constants;
|
||||
|
@ -19,12 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.bukkit.adapter.IBukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.adapter.SimpleBukkitAdapter;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -34,6 +35,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -84,7 +86,11 @@ public enum BukkitAdapter {
|
||||
return getAdapter().adapt(location);
|
||||
}
|
||||
|
||||
public static org.bukkit.Location adapt(org.bukkit.World world, Vector position) {
|
||||
public static org.bukkit.Location adapt(org.bukkit.World world, Vector3 position) {
|
||||
return getAdapter().adapt(world, position);
|
||||
}
|
||||
|
||||
public static org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) {
|
||||
return getAdapter().adapt(world, position);
|
||||
}
|
||||
|
||||
@ -92,10 +98,14 @@ public enum BukkitAdapter {
|
||||
return getAdapter().adapt(world, location);
|
||||
}
|
||||
|
||||
public static Vector asVector(org.bukkit.Location location) {
|
||||
public static Vector3 asVector(org.bukkit.Location location) {
|
||||
return getAdapter().asVector(location);
|
||||
}
|
||||
|
||||
public static BlockVector3 asBlockVector(org.bukkit.Location location) {
|
||||
return getAdapter().asBlockVector(location);
|
||||
}
|
||||
|
||||
public static Entity adapt(org.bukkit.entity.Entity entity) {
|
||||
return getAdapter().adapt(entity);
|
||||
}
|
||||
|
@ -22,20 +22,26 @@ package com.sk89q.worldedit.bukkit;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.util.StringUtil;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.SessionKey;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -147,7 +153,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||
player.teleport(new Location(player.getWorld(), pos.getX(), pos.getY(),
|
||||
pos.getZ(), yaw, pitch));
|
||||
}
|
||||
@ -205,7 +211,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
return;
|
||||
}
|
||||
|
||||
setPosition(new Vector(x + 0.5, y, z + 0.5));
|
||||
setPosition(new Vector3(x + 0.5, y, z + 0.5));
|
||||
player.setFlying(true);
|
||||
}
|
||||
|
||||
@ -217,7 +223,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
@Override
|
||||
public com.sk89q.worldedit.util.Location getLocation() {
|
||||
Location nativeLocation = player.getLocation();
|
||||
Vector position = BukkitAdapter.asVector(nativeLocation);
|
||||
Vector3 position = BukkitAdapter.asVector(nativeLocation);
|
||||
return new com.sk89q.worldedit.util.Location(
|
||||
getWorld(),
|
||||
position,
|
||||
|
@ -21,13 +21,20 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.history.change.BlockChange;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
@ -35,6 +42,7 @@ import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.weather.WeatherType;
|
||||
import com.sk89q.worldedit.world.weather.WeatherTypes;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.World;
|
||||
@ -53,8 +61,6 @@ import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BukkitWorld extends AbstractWorld {
|
||||
|
||||
private static final Logger logger = WorldEdit.logger;
|
||||
@ -84,7 +90,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
List<Entity> ents = world.getEntities();
|
||||
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
|
||||
for (Entity ent : ents) {
|
||||
if (region.contains(BukkitAdapter.asVector(ent.getLocation()))) {
|
||||
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
|
||||
addEntities(ent, entities);
|
||||
}
|
||||
}
|
||||
@ -185,7 +191,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightLevel(Vector pt) {
|
||||
public int getBlockLightLevel(BlockVector3 pt) {
|
||||
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
|
||||
}
|
||||
|
||||
@ -193,14 +199,14 @@ public class BukkitWorld extends AbstractWorld {
|
||||
public boolean regenerate(Region region, EditSession editSession) {
|
||||
com.sk89q.worldedit.world.block.BlockStateHolder[] history = new com.sk89q.worldedit.world.block.BlockState[16 * 16 * (getMaxY() + 1)];
|
||||
|
||||
for (Vector2D chunk : region.getChunks()) {
|
||||
Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
||||
for (BlockVector2 chunk : region.getChunks()) {
|
||||
BlockVector3 min = new BlockVector3(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
|
||||
|
||||
// First save all the blocks inside
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
for (int y = 0; y < (getMaxY() + 1); ++y) {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
Vector pt = min.add(x, y, z);
|
||||
BlockVector3 pt = min.add(x, y, z);
|
||||
int index = y * 16 * 16 + z * 16 + x;
|
||||
history[index] = editSession.getFullBlock(pt);
|
||||
}
|
||||
@ -217,14 +223,14 @@ public class BukkitWorld extends AbstractWorld {
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
for (int y = 0; y < (getMaxY() + 1); ++y) {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
Vector pt = min.add(x, y, z);
|
||||
BlockVector3 pt = min.add(x, y, z);
|
||||
int index = y * 16 * 16 + z * 16 + x;
|
||||
|
||||
// We have to restore the block if it was outside
|
||||
if (!region.contains(pt)) {
|
||||
editSession.smartSetBlock(pt, history[index]);
|
||||
} else { // Otherwise fool with history
|
||||
editSession.getChangeSet().add(new BlockChange(pt.toBlockVector(), history[index], editSession.getFullBlock(pt)));
|
||||
editSession.getChangeSet().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,7 +269,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearContainerBlockContents(Vector pt) {
|
||||
public boolean clearContainerBlockContents(BlockVector3 pt) {
|
||||
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (block == null) {
|
||||
return false;
|
||||
@ -317,7 +323,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt) {
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 pt) {
|
||||
World world = getWorld();
|
||||
TreeType bukkitType = toBukkitTreeType(type);
|
||||
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
|
||||
@ -325,13 +331,13 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector pt, BaseItemStack item) {
|
||||
public void dropItem(Vector3 pt, BaseItemStack item) {
|
||||
World world = getWorld();
|
||||
world.dropItemNaturally(BukkitAdapter.adapt(world, pt), BukkitAdapter.adapt(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkLoadedChunk(Vector pt) {
|
||||
public void checkLoadedChunk(BlockVector3 pt) {
|
||||
World world = getWorld();
|
||||
|
||||
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) {
|
||||
@ -363,15 +369,15 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {
|
||||
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
|
||||
World world = getWorld();
|
||||
for (BlockVector2D chunkPos : chunks) {
|
||||
for (BlockVector2 chunkPos : chunks) {
|
||||
world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playEffect(Vector position, int type, int data) {
|
||||
public boolean playEffect(Vector3 position, int type, int data) {
|
||||
World world = getWorld();
|
||||
|
||||
final Effect effect = effects.get(type);
|
||||
@ -430,18 +436,18 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulateBlockMine(Vector pt) {
|
||||
public void simulateBlockMine(BlockVector3 pt) {
|
||||
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.sk89q.worldedit.world.block.BlockState getBlock(Vector position) {
|
||||
public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3 position) {
|
||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
try {
|
||||
@ -467,12 +473,12 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.sk89q.worldedit.world.block.BlockState getLazyBlock(Vector position) {
|
||||
public com.sk89q.worldedit.world.block.BlockState getLazyBlock(BlockVector3 position) {
|
||||
return getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public com.sk89q.worldedit.world.block.BlockState getFullBlock(Vector position) {
|
||||
public com.sk89q.worldedit.world.block.BlockState getFullBlock(BlockVector3 position) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position));
|
||||
@ -482,7 +488,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
|
||||
@ -493,7 +499,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
Biome bukkitBiome = adapter.getBiome(biome.getId());
|
||||
|
@ -21,8 +21,8 @@ package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import org.bukkit.BlockChangeDelegate;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@ -40,7 +40,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
|
||||
@Override
|
||||
public boolean setBlockData(int x, int y, int z, BlockData blockData) {
|
||||
try {
|
||||
editSession.setBlock(new Vector(x, y, z), BukkitAdapter.adapt(blockData));
|
||||
editSession.setBlock(new BlockVector3(x, y, z), BukkitAdapter.adapt(blockData));
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
return false;
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
|
||||
|
||||
@Override
|
||||
public BlockData getBlockData(int x, int y, int z) {
|
||||
return BukkitAdapter.adapt(editSession.getBlock(new Vector(x, y, z)));
|
||||
return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3(x, y, z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,7 +59,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
|
||||
|
||||
@Override
|
||||
public boolean isEmpty(int x, int y, int z) {
|
||||
return editSession.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isAir();
|
||||
return editSession.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,10 @@ import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -104,6 +108,14 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
||||
default BlockMaterial getMaterial(BlockType blockType) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Send the given NBT data to the player.
|
||||
*
|
||||
* @param player The player
|
||||
* @param pos The position
|
||||
* @param nbtData The NBT Data
|
||||
*/
|
||||
void sendFakeNBT(Player player, BlockVector3 pos, CompoundTag nbtData);
|
||||
|
||||
default BlockMaterial getMaterial(BlockState blockState) {
|
||||
return null;
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.sk89q.worldedit.bukkit.adapter;
|
||||
|
||||
import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.bukkit.*;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -96,7 +97,7 @@ public interface IBukkitAdapter {
|
||||
*/
|
||||
default Location adapt(org.bukkit.Location location) {
|
||||
checkNotNull(location);
|
||||
Vector position = asVector(location);
|
||||
Vector3 position = asVector(location);
|
||||
return new com.sk89q.worldedit.util.Location(
|
||||
adapt(location.getWorld()),
|
||||
position,
|
||||
@ -112,7 +113,7 @@ public interface IBukkitAdapter {
|
||||
*/
|
||||
default org.bukkit.Location adapt(Location location) {
|
||||
checkNotNull(location);
|
||||
Vector position = location.toVector();
|
||||
Vector3 position = location.toVector();
|
||||
return new org.bukkit.Location(
|
||||
adapt((World) location.getExtent()),
|
||||
position.getX(), position.getY(), position.getZ(),
|
||||
@ -127,13 +128,17 @@ public interface IBukkitAdapter {
|
||||
* @param position the WorldEdit position
|
||||
* @return a Bukkit location
|
||||
*/
|
||||
default org.bukkit.Location adapt(org.bukkit.World world, Vector position) {
|
||||
default org.bukkit.Location adapt(org.bukkit.World world, Vector3 position) {
|
||||
checkNotNull(world);
|
||||
checkNotNull(position);
|
||||
return new org.bukkit.Location(
|
||||
world,
|
||||
position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
default org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position){
|
||||
return adapt(world, position.toVector3());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Bukkit location from a WorldEdit location with a Bukkit world.
|
||||
@ -158,9 +163,20 @@ public interface IBukkitAdapter {
|
||||
* @param location The Bukkit location
|
||||
* @return a WorldEdit vector
|
||||
*/
|
||||
default Vector asVector(org.bukkit.Location location) {
|
||||
default Vector3 asVector(org.bukkit.Location location) {
|
||||
checkNotNull(location);
|
||||
return new Vector(location.getX(), location.getY(), location.getZ());
|
||||
return new Vector3(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WorldEdit BlockVector from a Bukkit location.
|
||||
*
|
||||
* @param location The Bukkit location
|
||||
* @return a WorldEdit vector
|
||||
*/
|
||||
default BlockVector3 asBlockVector(org.bukkit.Location location) {
|
||||
checkNotNull(location);
|
||||
return new BlockVector3(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,13 +19,7 @@ import com.boydti.fawe.util.SetQueue;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.sk89q.jnbt.ByteArrayTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.factory.DefaultMaskParser;
|
||||
@ -39,27 +33,22 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.internal.registry.AbstractFactory;
|
||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.AbstractWorld;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -468,8 +457,8 @@ public class FaweAPI {
|
||||
* @return
|
||||
*/
|
||||
public static int fixLighting(World world, Region selection, @Nullable FaweQueue queue, final FaweQueue.RelightMode mode) {
|
||||
final Vector bot = selection.getMinimumPoint();
|
||||
final Vector top = selection.getMaximumPoint();
|
||||
final BlockVector3 bot = selection.getMinimumPoint();
|
||||
final BlockVector3 top = selection.getMaximumPoint();
|
||||
|
||||
final int minX = bot.getBlockX() >> 4;
|
||||
final int minZ = bot.getBlockZ() >> 4;
|
||||
|
@ -21,7 +21,6 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
@ -29,6 +28,7 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.command.binding.Switch;
|
||||
@ -396,8 +396,8 @@ public class AnvilCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.clear")
|
||||
public void unset(Player player, EditSession editSession, @Selection Region selection) throws WorldEditException {
|
||||
Vector bot = selection.getMinimumPoint();
|
||||
Vector top = selection.getMaximumPoint();
|
||||
BlockVector3 bot = selection.getMinimumPoint();
|
||||
BlockVector3 top = selection.getMaximumPoint();
|
||||
RegionWrapper region = new RegionWrapper(bot, top);
|
||||
|
||||
MCAFilterCounter filter = new MCAFilterCounter() {
|
||||
@ -618,8 +618,8 @@ public class AnvilCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.removelayer")
|
||||
public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException {
|
||||
Vector min = selection.getMinimumPoint();
|
||||
Vector max = selection.getMaximumPoint();
|
||||
BlockVector3 min = selection.getMinimumPoint();
|
||||
BlockVector3 max = selection.getMaximumPoint();
|
||||
int minY = min.getBlockY();
|
||||
int maxY = max.getBlockY();
|
||||
RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
|
||||
@ -644,7 +644,7 @@ public class AnvilCommands {
|
||||
String worldName = Fawe.imp().getWorldName(editSession.getWorld());
|
||||
FaweQueue tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
|
||||
MCAQueue queue = new MCAQueue(tmp);
|
||||
Vector origin = session.getPlacementPosition(player);
|
||||
BlockVector3 origin = session.getPlacementPosition(player);
|
||||
MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
|
||||
|
@ -41,6 +41,8 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
@ -421,7 +423,7 @@ public class CFICommands extends MethodCommands {
|
||||
ClipboardHolder holder = fp.getSession().getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
boolean[] ids = new boolean[BlockTypes.size()];
|
||||
for (Vector pt : clipboard.getRegion()) {
|
||||
for (BlockVector3 pt : clipboard.getRegion()) {
|
||||
ids[clipboard.getBlock(pt).getInternalBlockTypeId()] = true;
|
||||
}
|
||||
blocks = new HashSet<>();
|
||||
@ -447,7 +449,7 @@ public class CFICommands extends MethodCommands {
|
||||
BlockType type = BlockTypes.get(typeId);
|
||||
BlockStateHolder block = type.getDefaultState();
|
||||
pattern.setBlock(block);
|
||||
if (mask.test(Vector.ZERO)) blocks.add(type);
|
||||
if (mask.test(BlockVector3.ZERO)) blocks.add(type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -663,7 +665,7 @@ public class CFICommands extends MethodCommands {
|
||||
public void tp(FawePlayer fp) throws ParameterException, WorldEditException {
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
msg("Teleporting...").send(fp);
|
||||
Vector origin = gen.getOrigin();
|
||||
Vector3 origin = gen.getOrigin();
|
||||
Player player = fp.getPlayer();
|
||||
player.setPosition(origin.subtract(16, 0, 16));
|
||||
player.findFreePosition();
|
||||
|
@ -9,8 +9,6 @@ import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -22,6 +20,8 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.command.binding.Range;
|
||||
import com.sk89q.worldedit.util.command.binding.Text;
|
||||
@ -257,11 +257,11 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = Vector.class,
|
||||
@BindingMatch(type = Vector3.class,
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public Vector getVector(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
public Vector3 getVector(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
@ -279,7 +279,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
default:
|
||||
throw new ParameterException("You must either specify 1 or 3 radius values.");
|
||||
}
|
||||
return new Vector(radiusX, radiusY, radiusZ);
|
||||
return new Vector3(radiusX, radiusY, radiusZ);
|
||||
}
|
||||
|
||||
|
||||
@ -290,11 +290,11 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = Vector2D.class,
|
||||
@BindingMatch(type = Vector2.class,
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public Vector2D getVector2D(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
public Vector2 getVector2D(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusZ;
|
||||
@ -311,7 +311,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
default:
|
||||
throw new ParameterException("You must either specify 1 or 2 radius values.");
|
||||
}
|
||||
return new Vector2D(radiusX, radiusZ);
|
||||
return new Vector2(radiusX, radiusZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,8 @@ import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.object.task.AsyncNotifyQueue;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -126,7 +127,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
});
|
||||
}
|
||||
|
||||
public void getPotentialEdits(final UUID uuid, final long minTime, final Vector pos1, final Vector pos2, final RunnableVal<DiskStorageHistory> onEach, final Runnable whenDone, final boolean delete, final boolean ascending) {
|
||||
public void getPotentialEdits(final UUID uuid, final long minTime, final BlockVector3 pos1, final BlockVector3 pos2, final RunnableVal<DiskStorageHistory> onEach, final Runnable whenDone, final boolean delete, final boolean ascending) {
|
||||
final World world = FaweAPI.getWorld(this.worldName);
|
||||
addTask(new Runnable() {
|
||||
@Override
|
||||
|
@ -9,10 +9,11 @@ import com.boydti.fawe.object.clipboard.MemoryOptimizedClipboard;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataInputStream;
|
||||
@ -81,7 +82,7 @@ public class CorruptSchematicStreamer {
|
||||
if (fc != null) {
|
||||
return fc;
|
||||
}
|
||||
Vector dimensions = guessDimensions(volume.get(), width.get(), height.get(), length.get());
|
||||
BlockVector3 dimensions = guessDimensions(volume.get(), width.get(), height.get(), length.get());
|
||||
if (width.get() == 0 || height.get() == 0 || length.get() == 0) {
|
||||
Fawe.debug("No dimensions found! Estimating based on factors:" + dimensions);
|
||||
}
|
||||
@ -265,21 +266,21 @@ public class CorruptSchematicStreamer {
|
||||
// }
|
||||
}
|
||||
|
||||
private Vector guessDimensions(int volume, int width, int height, int length) {
|
||||
private BlockVector3 guessDimensions(int volume, int width, int height, int length) {
|
||||
if (volume == 0) {
|
||||
return new Vector(width, height, length);
|
||||
return new BlockVector3(width, height, length);
|
||||
}
|
||||
if (volume == width * height * length) {
|
||||
return new Vector(width, height, length);
|
||||
return new BlockVector3(width, height, length);
|
||||
}
|
||||
if (width == 0 && height != 0 && length != 0 && volume % (height * length) == 0 && height * length <= volume) {
|
||||
return new Vector(volume / (height * length), height, length);
|
||||
return new BlockVector3(volume / (height * length), height, length);
|
||||
}
|
||||
if (height == 0 && width != 0 && length != 0 && volume % (width * length) == 0 && width * length <= volume) {
|
||||
return new Vector(width, volume / (width * length), length);
|
||||
return new BlockVector3(width, volume / (width * length), length);
|
||||
}
|
||||
if (length == 0 && height != 0 && width != 0 && volume % (height * width) == 0 && height * width <= volume) {
|
||||
return new Vector(width, height, volume / (width * height));
|
||||
return new BlockVector3(width, height, volume / (width * height));
|
||||
}
|
||||
List<Integer> factors = new ArrayList<>();
|
||||
for (int i = (int) Math.sqrt(volume); i > 0; i--) {
|
||||
@ -289,7 +290,7 @@ public class CorruptSchematicStreamer {
|
||||
}
|
||||
}
|
||||
int min = Integer.MAX_VALUE;
|
||||
Vector dimensions = new Vector();
|
||||
int vx = 0, vy = 0, vz = 0;
|
||||
for (int x = 0; x < factors.size(); x++) {
|
||||
int xValue = factors.get(x);
|
||||
for (int y = 0; y < factors.size(); y++) {
|
||||
@ -300,12 +301,14 @@ public class CorruptSchematicStreamer {
|
||||
int max = Math.max(Math.max(xValue, yValue), z);
|
||||
if (max < min) {
|
||||
min = max;
|
||||
dimensions = new Vector(xValue, z, yValue);
|
||||
vx = xValue;
|
||||
vz = z;
|
||||
vy = yValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dimensions;
|
||||
return new BlockVector3(vx, vz, vy);
|
||||
}
|
||||
|
||||
public interface CorruptReader {
|
||||
|
@ -14,12 +14,12 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
@ -49,7 +49,7 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
public SchematicStreamer(NBTInputStream stream, UUID uuid) {
|
||||
super(stream);
|
||||
this.uuid = uuid;
|
||||
clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
|
||||
clipboard = new BlockArrayClipboard(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(0, 0, 0)), fc);
|
||||
}
|
||||
|
||||
public void addBlockReaders() throws IOException {
|
||||
@ -180,7 +180,7 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
FaweInputStream dataIn = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(dataOut.toByteArrays())));
|
||||
|
||||
LegacyMapper remap = LegacyMapper.getInstance();
|
||||
Vector dimensions = fc.getDimensions();
|
||||
BlockVector3 dimensions = fc.getDimensions();
|
||||
int length = dimensions.getBlockX() * dimensions.getBlockY() * dimensions.getBlockZ();
|
||||
if (adds == null) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
@ -223,7 +223,7 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
Object half = block.getState(PropertyKey.HALF);
|
||||
Direction facing = block.getState(PropertyKey.FACING);
|
||||
|
||||
BlockVector forward = facing.toBlockVector();
|
||||
BlockVector3 forward = facing.toBlockVector();
|
||||
Direction left = facing.getLeft();
|
||||
Direction right = facing.getRight();
|
||||
|
||||
@ -419,7 +419,7 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
private FaweClipboard setupClipboard(int size) {
|
||||
if (fc != null) {
|
||||
if (fc.getDimensions().getX() == 0) {
|
||||
fc.setDimensions(new Vector(size, 1, 1));
|
||||
fc.setDimensions(new BlockVector3(size, 1, 1));
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
@ -432,16 +432,16 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
}
|
||||
}
|
||||
|
||||
public Vector getOrigin() {
|
||||
return new Vector(originX, originY, originZ);
|
||||
public BlockVector3 getOrigin() {
|
||||
return new BlockVector3(originX, originY, originZ);
|
||||
}
|
||||
|
||||
public Vector getOffset() {
|
||||
return new Vector(offsetX, offsetY, offsetZ);
|
||||
public BlockVector3 getOffset() {
|
||||
return new BlockVector3(offsetX, offsetY, offsetZ);
|
||||
}
|
||||
|
||||
public Vector getDimensions() {
|
||||
return new Vector(width, height, length);
|
||||
public BlockVector3 getDimensions() {
|
||||
return new BlockVector3(width, height, length);
|
||||
}
|
||||
|
||||
public void setClipboard(FaweClipboard clipboard) {
|
||||
@ -453,13 +453,13 @@ public class SchematicStreamer extends NBTStreamer {
|
||||
addDimensionReaders();
|
||||
addBlockReaders();
|
||||
readFully();
|
||||
Vector min = new Vector(originX, originY, originZ);
|
||||
Vector offset = new Vector(offsetX, offsetY, offsetZ);
|
||||
Vector origin = min.subtract(offset);
|
||||
Vector dimensions = new Vector(width, height, length);
|
||||
BlockVector3 min = new BlockVector3(originX, originY, originZ);
|
||||
BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
|
||||
BlockVector3 origin = min.subtract(offset);
|
||||
BlockVector3 dimensions = new BlockVector3(width, height, length);
|
||||
fc.setDimensions(dimensions);
|
||||
fixStates();
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
CuboidRegion region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
clipboard.init(region, fc);
|
||||
clipboard.setOrigin(origin);
|
||||
return clipboard;
|
||||
|
@ -16,13 +16,17 @@ import com.boydti.fawe.util.image.Drawable;
|
||||
import com.boydti.fawe.util.image.ImageViewer;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
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.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -194,7 +198,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
// These three variables should be set together
|
||||
// private FaweQueue packetQueue;
|
||||
private FawePlayer player;
|
||||
private Vector2D chunkOffset = Vector2D.ZERO;
|
||||
private BlockVector2 chunkOffset = BlockVector2.ZERO;
|
||||
private EditSession editSession;
|
||||
// end
|
||||
|
||||
@ -229,8 +233,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getOrigin() {
|
||||
return new BlockVector(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
|
||||
public Vector3 getOrigin() {
|
||||
return new Vector3(chunkOffset.getBlockX() << 4, 0, chunkOffset.getBlockZ() << 4);
|
||||
}
|
||||
|
||||
public boolean hasPacketViewer() {
|
||||
@ -241,7 +245,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
this.player = player;
|
||||
if (player != null) {
|
||||
FaweLocation pos = player.getLocation();
|
||||
this.chunkOffset = new Vector2D(1 + (pos.x >> 4), 1 + (pos.z >> 4));
|
||||
this.chunkOffset = new BlockVector2(1 + (pos.x >> 4), 1 + (pos.z >> 4));
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +379,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
smooth(null, mask, false, radius, iterations);
|
||||
}
|
||||
|
||||
public void smooth(Vector2D min, Vector2D max, int radius, int iterations) {
|
||||
public void smooth(BlockVector2 min, BlockVector2 max, int radius, int iterations) {
|
||||
int snowLayer = BlockTypes.SNOW.getInternalId();
|
||||
int snowBlock = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||
|
||||
@ -550,13 +554,13 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
public void addCaves() throws WorldEditException {
|
||||
CuboidRegion region = new CuboidRegion(new Vector(0, 0, 0), new Vector(getWidth() -1, 255, getLength() -1));
|
||||
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1));
|
||||
addCaves(region);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void addSchems(Mask mask, List<ClipboardHolder> clipboards, int rarity, boolean rotate) throws WorldEditException {
|
||||
CuboidRegion region = new CuboidRegion(new Vector(0, 0, 0), new Vector(getWidth() -1, 255, getLength() -1));
|
||||
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1));
|
||||
addSchems(region, mask, clipboards, rarity, rotate);
|
||||
}
|
||||
|
||||
@ -661,17 +665,17 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
public void addOre(Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException {
|
||||
CuboidRegion region = new CuboidRegion(new Vector(0, 0, 0), new Vector(getWidth() -1, 255, getLength() -1));
|
||||
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1));
|
||||
addOre(region, mask, material, size, frequency, rarity, minY, maxY);
|
||||
}
|
||||
|
||||
public void addDefaultOres(Mask mask) throws WorldEditException {
|
||||
addOres(new CuboidRegion(new Vector(0, 0, 0), new Vector(getWidth() -1, 255, getLength() -1)), mask);
|
||||
addOres(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(getWidth() -1, 255, getLength() -1)), mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
return new Vector(0, 0, 0);
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return new BlockVector3(0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -680,17 +684,17 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
return new Vector(getWidth() - 1, 255, getLength() - 1);
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return new BlockVector3(getWidth() - 1, 255, getLength() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return this.setBiome(position.getBlockX(), position.getBlockZ(), biome);
|
||||
}
|
||||
|
||||
@ -1011,12 +1015,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return FaweCache.CACHE_BIOME[getBiomeId(position.getBlockX(), position.getBlockZ())];
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return getLazyBlock(position);
|
||||
}
|
||||
|
||||
@ -1040,7 +1044,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return getLazyBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
@ -2240,33 +2244,40 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
|
||||
return setBlock(position, block);
|
||||
}
|
||||
|
||||
// These aren't implemented yet...
|
||||
@Override
|
||||
public int getBlockLightLevel(Vector position) {
|
||||
public int getBlockLightLevel(BlockVector3 position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearContainerBlockContents(Vector position) {
|
||||
public boolean clearContainerBlockContents(BlockVector3 position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector position, BaseItemStack item) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean regenerate(Region region, EditSession editSession) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector3 position, BaseItemStack item) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playEffect(Vector3 position, int type, int data) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package com.boydti.fawe.jnbt.anvil;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
|
||||
public class MCAClipboard {
|
||||
private final MCAQueue queue;
|
||||
private final CuboidRegion region;
|
||||
private final Vector origin;
|
||||
private final BlockVector3 origin;
|
||||
|
||||
public MCAClipboard(MCAQueue queue, CuboidRegion region, Vector origin) {
|
||||
public MCAClipboard(MCAQueue queue, CuboidRegion region, BlockVector3 origin) {
|
||||
this.queue = queue;
|
||||
this.region = region;
|
||||
this.origin = origin;
|
||||
@ -22,7 +22,7 @@ public class MCAClipboard {
|
||||
return region;
|
||||
}
|
||||
|
||||
public Vector getOrigin() {
|
||||
public BlockVector3 getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import com.boydti.fawe.object.RunnableVal4;
|
||||
import com.boydti.fawe.object.collection.IterableThreadLocal;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -155,11 +155,11 @@ public class MCAQueue extends NMSMappedFaweQueue<FaweQueue, FaweChunk, FaweChunk
|
||||
return super.setMCA(mcaX, mcaZ, region, whileLocked, save, unload);
|
||||
}
|
||||
|
||||
public void pasteRegion(MCAQueue from, final RegionWrapper regionFrom, Vector offset) throws IOException {
|
||||
public void pasteRegion(MCAQueue from, final RegionWrapper regionFrom, BlockVector3 offset) throws IOException {
|
||||
pasteRegion(from, regionFrom, offset, new NullAnvilHistory());
|
||||
}
|
||||
|
||||
public void pasteRegion(MCAQueue from, final RegionWrapper regionFrom, Vector offset, IAnvilHistory history) throws IOException {
|
||||
public void pasteRegion(MCAQueue from, final RegionWrapper regionFrom, BlockVector3 offset, IAnvilHistory history) throws IOException {
|
||||
int oX = offset.getBlockX();
|
||||
int oZ = offset.getBlockZ();
|
||||
int oY = offset.getBlockY();
|
||||
|
@ -6,14 +6,16 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.SimpleWorld;
|
||||
@ -48,17 +50,17 @@ public class MCAWorld implements SimpleWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
return extent.setBlock(position, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightLevel(Vector position) {
|
||||
public int getBlockLightLevel(BlockVector3 position) {
|
||||
return queue.getEmmittedLight(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearContainerBlockContents(Vector position) {
|
||||
public boolean clearContainerBlockContents(BlockVector3 position) {
|
||||
BlockStateHolder block = extent.getLazyBlock(position);
|
||||
if (block.hasNbtData()) {
|
||||
Map<String, Tag> nbt = ReflectionUtils.getMap(block.getNbtData().getValue());
|
||||
@ -75,7 +77,7 @@ public class MCAWorld implements SimpleWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector position, BaseItemStack item) {
|
||||
public void dropItem(Vector3 position, BaseItemStack item) {
|
||||
|
||||
}
|
||||
|
||||
@ -101,17 +103,23 @@ public class MCAWorld implements SimpleWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return extent.getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return extent.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return extent.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playEffect(Vector3 position, int type, int data) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.jnbt.anvil.MCAFilterCounter;
|
||||
import com.boydti.fawe.object.number.MutableLong;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -53,7 +52,7 @@ public class MappedReplacePatternFilter extends MCAFilterCounter {
|
||||
// map[block.getCombined()] = pattern;
|
||||
}
|
||||
|
||||
private final MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
// private final MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
|
||||
@Override
|
||||
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) {
|
||||
|
@ -3,11 +3,11 @@ package com.boydti.fawe.jnbt.anvil.generator;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -42,11 +42,11 @@ public class CavesGen extends GenBase {
|
||||
this.caveSystemPocketMaxSize = caveSystemPocketMaxSize;
|
||||
}
|
||||
|
||||
protected void generateLargeCaveNode(long seed, Vector2D pos, Extent chunk, double x, double y, double z) throws WorldEditException {
|
||||
protected void generateLargeCaveNode(long seed, BlockVector2 pos, Extent chunk, double x, double y, double z) throws WorldEditException {
|
||||
generateCaveNode(seed, pos, chunk, x, y, z, 1.0F + PseudoRandom.random.nextDouble() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D);
|
||||
}
|
||||
|
||||
protected void generateCaveNode(long seed, Vector2D chunkPos, Extent chunk, double x, double y, double z, double paramdouble1, double paramdouble2, double paramdouble3, int angle, int maxAngle, double paramDouble4) throws WorldEditException {
|
||||
protected void generateCaveNode(long seed, BlockVector2 chunkPos, Extent chunk, double x, double y, double z, double paramdouble1, double paramdouble2, double paramdouble3, int angle, int maxAngle, double paramDouble4) throws WorldEditException {
|
||||
int bx = (chunkPos.getBlockX() << 4);
|
||||
int bz = (chunkPos.getBlockZ() << 4);
|
||||
double real_x = bx + 7;
|
||||
@ -220,7 +220,7 @@ public class CavesGen extends GenBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateChunk(Vector2D adjacentChunk, Vector2D originChunk, Extent chunk) throws WorldEditException {
|
||||
public void generateChunk(int chunkX, int chunkZ, BlockVector2 originChunk, Extent chunk) throws WorldEditException {
|
||||
PseudoRandom random = getRandom();
|
||||
int i = random.nextInt(random.nextInt(random.nextInt(this.caveFrequency) + 1) + 1);
|
||||
if (this.evenCaveDistribution)
|
||||
@ -229,7 +229,7 @@ public class CavesGen extends GenBase {
|
||||
i = 0;
|
||||
|
||||
for (int j = 0; j < i; j++) {
|
||||
double x = (adjacentChunk.getBlockX() << 4) + random.nextInt(16);
|
||||
double x = (chunkX << 4) + random.nextInt(16);
|
||||
|
||||
double y;
|
||||
|
||||
@ -238,7 +238,7 @@ public class CavesGen extends GenBase {
|
||||
else
|
||||
y = random.nextInt(random.nextInt(this.caveMaxAltitude - this.caveMinAltitude + 1) + 1) + this.caveMinAltitude;
|
||||
|
||||
double z = (adjacentChunk.getBlockZ() << 4) + random.nextInt(16);
|
||||
double z = (chunkZ << 4) + random.nextInt(16);
|
||||
|
||||
int count = this.caveSystemFrequency;
|
||||
boolean largeCaveSpawned = false;
|
||||
|
@ -1,10 +1,9 @@
|
||||
package com.boydti.fawe.jnbt.anvil.generator;
|
||||
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.sk89q.worldedit.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
public abstract class GenBase {
|
||||
|
||||
@ -12,7 +11,6 @@ public abstract class GenBase {
|
||||
private final PseudoRandom random;
|
||||
private final long seed;
|
||||
private final long worldSeed1, worldSeed2;
|
||||
private MutableBlockVector2D mutable = new MutableBlockVector2D();
|
||||
|
||||
public GenBase(int area) {
|
||||
this.random = new PseudoRandom();
|
||||
@ -30,20 +28,17 @@ public abstract class GenBase {
|
||||
return random;
|
||||
}
|
||||
|
||||
public void generate(Vector2D chunkPos, Extent chunk) throws WorldEditException {
|
||||
public void generate(BlockVector2 chunkPos, Extent chunk) throws WorldEditException {
|
||||
int i = this.checkAreaSize;
|
||||
int chunkX = chunkPos.getBlockX();
|
||||
int chunkZ = chunkPos.getBlockZ();
|
||||
|
||||
for (int x = chunkX - i; x <= chunkX + i; x++) {
|
||||
mutable.mutX(x);
|
||||
for (int z = chunkZ - i; z <= chunkZ + i; z++) {
|
||||
mutable.mutZ(z);
|
||||
this.random.setSeed(worldSeed1 * x ^ worldSeed2 * z ^ seed);
|
||||
generateChunk(mutable, chunkPos, chunk);
|
||||
generateChunk(x, z, chunkPos, chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void generateChunk(Vector2D adjacentChunk, Vector2D originChunk, Extent chunk) throws WorldEditException;
|
||||
public abstract void generateChunk(int x, int z, BlockVector2 originChunk, Extent chunk) throws WorldEditException;
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package com.boydti.fawe.jnbt.anvil.generator;
|
||||
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -2,7 +2,7 @@ package com.boydti.fawe.jnbt.anvil.generator;
|
||||
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.boydti.fawe.object.schematic.Schematic;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
|
@ -4,7 +4,7 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.database.DBHandler;
|
||||
import com.boydti.fawe.database.RollbackDatabase;
|
||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@ -68,7 +68,7 @@ public class RollbackOptimizedHistory extends DiskStorageHistory {
|
||||
return maxZ;
|
||||
}
|
||||
|
||||
public void setDimensions(Vector pos1, Vector pos2) {
|
||||
public void setDimensions(BlockVector3 pos1, BlockVector3 pos2) {
|
||||
this.minX = pos1.getBlockX();
|
||||
this.minY = pos1.getBlockY();
|
||||
this.minZ = pos1.getBlockZ();
|
||||
|
@ -2,12 +2,12 @@ package com.boydti.fawe.object;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.extent.ExtentHeightCacher;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -24,7 +24,7 @@ public class DataAnglePattern extends AbstractPattern {
|
||||
this.FACTOR = (1D / distance) * (1D / 255);
|
||||
}
|
||||
|
||||
public int getSlope(BlockStateHolder block, Vector vector) {
|
||||
public int getSlope(BlockStateHolder block, BlockVector3 vector) {
|
||||
int x = vector.getBlockX();
|
||||
int y = vector.getBlockY();
|
||||
int z = vector.getBlockZ();
|
||||
@ -41,7 +41,7 @@ public class DataAnglePattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
public BlockStateHolder apply(BlockVector3 position) {
|
||||
BlockStateHolder block = extent.getBlock(position);
|
||||
int slope = getSlope(block, position);
|
||||
if (slope == -1) return block;
|
||||
@ -50,7 +50,7 @@ public class DataAnglePattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
|
||||
public boolean apply(Extent extent, BlockVector3 setPosition, BlockVector3 getPosition) throws WorldEditException {
|
||||
BlockStateHolder block = extent.getBlock(getPosition);
|
||||
int slope = getSlope(block, getPosition);
|
||||
if (slope == -1) return false;
|
||||
|
@ -17,13 +17,14 @@ import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.Tool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.*;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.*;
|
||||
import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
@ -208,12 +209,13 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
public void checkConfirmationStack(@Nullable Runnable task, String command, Region region, int times, CommandContext context) throws RegionOperationException {
|
||||
if (command != null && !getMeta("cmdConfirmRunning", false)) {
|
||||
if (region != null) {
|
||||
Vector min = region.getMinimumPoint().toBlockVector();
|
||||
Vector max = region.getMaximumPoint().toBlockVector();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long area = (long) ((max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1)) * times;
|
||||
if (area > 2 << 18) {
|
||||
setConfirmTask(task, context, command);
|
||||
long volume = (long) max.subtract(min).add(Vector.ONE).volume() * times;
|
||||
BlockVector3 base = max.subtract(min).add(BlockVector3.ONE);
|
||||
long volume = (long) base.getX() * base.getZ() * base.getY() * times;
|
||||
throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(min, max, command, NumberFormat.getNumberInstance().format(volume)));
|
||||
}
|
||||
}
|
||||
@ -224,12 +226,13 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
public void checkConfirmationRegion(@Nullable Runnable task, String command, Region region, CommandContext context) throws RegionOperationException {
|
||||
if (command != null && !getMeta("cmdConfirmRunning", false)) {
|
||||
if (region != null) {
|
||||
Vector min = region.getMinimumPoint().toBlockVector();
|
||||
Vector max = region.getMaximumPoint().toBlockVector();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long area = (long) ((max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1));
|
||||
if (area > 2 << 18) {
|
||||
setConfirmTask(task, context, command);
|
||||
long volume = (long) max.subtract(min).add(Vector.ONE).volume();
|
||||
BlockVector3 base = max.subtract(min).add(BlockVector3.ONE);
|
||||
long volume = (long) base.getX() * base.getZ() * base.getY();
|
||||
throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(min, max, command, NumberFormat.getNumberInstance().format(volume)));
|
||||
}
|
||||
}
|
||||
@ -561,8 +564,8 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
@Deprecated
|
||||
public void setSelection(final RegionWrapper region) {
|
||||
final Player player = this.getPlayer();
|
||||
Vector top = region.getMaximumPoint();
|
||||
top.mutY(getWorld().getMaxY());
|
||||
BlockVector3 top = region.getMaximumPoint();
|
||||
top.withY(getWorld().getMaxY());
|
||||
final RegionSelector selector = new CuboidRegionSelector(player.getWorld(), region.getMinimumPoint(), top);
|
||||
this.getSession().setRegionSelector(player.getWorld(), selector);
|
||||
}
|
||||
@ -692,7 +695,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
PlayerProxy proxy = new PlayerProxy(player, permActor, cuiActor, world);
|
||||
if (world instanceof VirtualWorld) {
|
||||
proxy.setOffset(Vector.ZERO.subtract(((VirtualWorld) world).getOrigin()));
|
||||
proxy.setOffset(Vector3.ZERO.subtract(((VirtualWorld) world).getOrigin()));
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
@ -12,13 +12,13 @@ import com.boydti.fawe.util.MemUtil;
|
||||
import com.boydti.fawe.util.SetQueue;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -61,13 +61,13 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
default Vector getMinimumPoint() {
|
||||
return new Vector(-30000000, 0, -30000000);
|
||||
default BlockVector3 getMinimumPoint() {
|
||||
return new BlockVector3(-30000000, 0, -30000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
default Vector getMaximumPoint() {
|
||||
return new Vector(30000000, getMaxY(), 30000000);
|
||||
default BlockVector3 getMaximumPoint() {
|
||||
return new BlockVector3(30000000, getMaxY(), 30000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,17 +94,17 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
default BlockState getFullBlock(Vector position) {
|
||||
default BlockState getFullBlock(BlockVector3 position) {
|
||||
return getLazyBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
default BaseBiome getBiome(Vector2D position) {
|
||||
default BaseBiome getBiome(BlockVector2 position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
default boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
default boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return setBiome(position.getBlockX(), position.getBlockZ(), biome);
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
|
||||
void addTask(Runnable whenFree);
|
||||
|
||||
default void forEachBlockInChunk(int cx, int cz, RunnableVal2<Vector, BlockState> onEach) {
|
||||
default void forEachBlockInChunk(int cx, int cz, RunnableVal2<BlockVector3, BlockState> onEach) {
|
||||
int bx = cx << 4;
|
||||
int bz = cz << 4;
|
||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
@ -295,7 +295,7 @@ public interface FaweQueue extends HasFaweQueue, Extent {
|
||||
}
|
||||
}
|
||||
|
||||
default void forEachTileInChunk(int cx, int cz, RunnableVal2<Vector, BlockState> onEach) {
|
||||
default void forEachTileInChunk(int cx, int cz, RunnableVal2<BlockVector3, BlockState> onEach) {
|
||||
int bx = cx << 4;
|
||||
int bz = cz << 4;
|
||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
|
@ -12,6 +12,9 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -69,7 +72,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(final Vector location, final BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(final BlockVector3 location, final BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@ -102,7 +105,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome newBiome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome newBiome) {
|
||||
BaseBiome oldBiome = this.getBiome(position);
|
||||
if (oldBiome.getId() != newBiome.getId()) {
|
||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockZ(), oldBiome, newBiome);
|
||||
@ -114,7 +117,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome newBiome) {
|
||||
BaseBiome oldBiome = this.getBiome(MutableBlockVector2D.get(x, z));
|
||||
BaseBiome oldBiome = this.getBiome(new BlockVector2(x, z));
|
||||
if (oldBiome.getId() != newBiome.getId()) {
|
||||
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome);
|
||||
return getExtent().setBiome(x, y, z, newBiome);
|
||||
|
@ -6,10 +6,10 @@ import com.boydti.fawe.object.extent.MultiRegionExtent;
|
||||
import com.boydti.fawe.object.extent.SingleRegionExtent;
|
||||
import com.boydti.fawe.object.queue.DelegateFaweQueue;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -73,7 +73,7 @@ public class MaskedFaweQueue extends DelegateFaweQueue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
if (region.contains(position.getBlockX(), position.getBlockZ())) {
|
||||
return super.setBlock(position, block);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class MaskedFaweQueue extends DelegateFaweQueue {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
if (region.contains(position.getBlockX(), position.getBlockZ())) {
|
||||
return super.setBiome(position, biome);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.boydti.fawe.object;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
|
||||
@Deprecated
|
||||
@ -23,10 +23,10 @@ public class RegionWrapper extends CuboidRegion {
|
||||
}
|
||||
|
||||
public RegionWrapper(final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) {
|
||||
this(new Vector(minX, 0, minZ), new Vector(maxX, 255, maxZ));
|
||||
this(new BlockVector3(minX, 0, minZ), new BlockVector3(maxX, 255, maxZ));
|
||||
}
|
||||
|
||||
public RegionWrapper(final Vector pos1, final Vector pos2) {
|
||||
public RegionWrapper(final BlockVector3 pos1, final BlockVector3 pos2) {
|
||||
super(pos1, pos2);
|
||||
this.minX = Math.min(pos1.getBlockX(), pos2.getBlockX());
|
||||
this.minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ());
|
||||
@ -39,8 +39,8 @@ public class RegionWrapper extends CuboidRegion {
|
||||
@Override
|
||||
protected void recalculate() {
|
||||
super.recalculate();
|
||||
Vector pos1 = getMinimumPoint();
|
||||
Vector pos2 = getMaximumPoint();
|
||||
BlockVector3 pos1 = getMinimumPoint();
|
||||
BlockVector3 pos2 = getMaximumPoint();
|
||||
this.minX = Math.min(pos1.getBlockX(), pos2.getBlockX());
|
||||
this.minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ());
|
||||
this.maxX = Math.max(pos1.getBlockX(), pos2.getBlockX());
|
||||
|
@ -4,10 +4,10 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class AngleBrush implements Brush {
|
||||
|
||||
@ -18,7 +18,7 @@ public class AngleBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
SurfaceMask surface = new SurfaceMask(editSession);
|
||||
final SolidBlockMask solid = new SolidBlockMask(editSession);
|
||||
final RadiusMask radius = new RadiusMask(0, (int) size);
|
||||
|
@ -3,9 +3,9 @@ package com.boydti.fawe.object.brush;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -15,7 +15,7 @@ import java.util.Map;
|
||||
public class BlendBall implements Brush {
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
final int outsetSize = (int) (size + 1);
|
||||
double brushSizeSquared = size * size;
|
||||
|
||||
|
@ -4,20 +4,22 @@ import com.boydti.fawe.object.random.SimplexNoise;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class BlobBrush implements Brush {
|
||||
private final double amplitude;
|
||||
private final double frequency;
|
||||
private final Vector radius;
|
||||
private final Vector3 radius;
|
||||
private final double sphericity;
|
||||
|
||||
public BlobBrush(Vector radius, double frequency, double amplitude, double sphericity) {
|
||||
public BlobBrush(Vector3 radius, double frequency, double amplitude, double sphericity) {
|
||||
this.frequency = frequency;
|
||||
this.amplitude = amplitude;
|
||||
this.radius = radius;
|
||||
@ -25,7 +27,7 @@ public class BlobBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
double seedX = ThreadLocalRandom.current().nextDouble();
|
||||
double seedY = ThreadLocalRandom.current().nextDouble();
|
||||
double seedZ = ThreadLocalRandom.current().nextDouble();
|
||||
@ -70,7 +72,7 @@ public class BlobBrush implements Brush {
|
||||
double manScaleY = (1.25 + seedY * 0.5);
|
||||
double manScaleZ = (1.25 + seedZ * 0.5);
|
||||
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
MutableVector mutable = new MutableVector();
|
||||
double roughness = 1 - sphericity;
|
||||
for (int xr = -sizeInt; xr <= sizeInt; xr++) {
|
||||
mutable.mutX(xr);
|
||||
@ -78,10 +80,10 @@ public class BlobBrush implements Brush {
|
||||
mutable.mutY(yr);
|
||||
for (int zr = -sizeInt; zr <= sizeInt; zr++) {
|
||||
mutable.mutZ(zr);
|
||||
Vector pt = transform.apply(mutable);
|
||||
int x = MathMan.roundInt(pt.getBlockX());
|
||||
int y = MathMan.roundInt(pt.getBlockY());
|
||||
int z = MathMan.roundInt(pt.getBlockZ());
|
||||
Vector3 pt = transform.apply(mutable);
|
||||
int x = MathMan.roundInt(pt.getX());
|
||||
int y = MathMan.roundInt(pt.getY());
|
||||
int z = MathMan.roundInt(pt.getZ());
|
||||
|
||||
double xScaled = Math.abs(x) * modX;
|
||||
double yScaled = Math.abs(y) * modY;
|
||||
|
@ -2,12 +2,15 @@ package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MathUtils;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -18,9 +21,9 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
private final boolean shell, select, direction;
|
||||
private final double slack;
|
||||
|
||||
private Vector pos1;
|
||||
private Vector pos2;
|
||||
private Vector vertex;
|
||||
private BlockVector3 pos1;
|
||||
private BlockVector3 pos2;
|
||||
private BlockVector3 vertex;
|
||||
|
||||
public CatenaryBrush(boolean shell, boolean select, boolean direction, double lengthFactor) {
|
||||
this.shell = shell;
|
||||
@ -30,7 +33,7 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector pos2, final Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 pos2, final Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
boolean visual = (editSession.getExtent() instanceof VisualExtent);
|
||||
if (pos1 == null || pos2.equals(pos1)) {
|
||||
if (!visual) {
|
||||
@ -47,12 +50,12 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
}
|
||||
} else if (this.direction) {
|
||||
Location loc = editSession.getPlayer().getPlayer().getLocation();
|
||||
Vector facing = loc.getDirection().normalize();
|
||||
Vector midpoint = pos1.add(pos2).divide(2);
|
||||
Vector offset = midpoint.subtract(vertex);
|
||||
vertex = midpoint.add(facing.multiply(offset.length()));
|
||||
Vector3 facing = loc.getDirection().normalize();
|
||||
BlockVector3 midpoint = pos1.add(pos2).divide(2);
|
||||
BlockVector3 offset = midpoint.subtract(vertex);
|
||||
vertex = midpoint.add(facing.multiply(offset.length()).toBlockPoint());
|
||||
}
|
||||
List<Vector> nodes = Arrays.asList(pos1, vertex, pos2);
|
||||
List<BlockVector3> nodes = Arrays.asList(pos1, vertex, pos2);
|
||||
vertex = null;
|
||||
try {
|
||||
editSession.drawSpline(pattern, nodes, 0, 0, 0, 10, size, !shell);
|
||||
@ -76,8 +79,8 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Vector getVertex(Vector pos1, Vector pos2, double lenPercent) {
|
||||
if (lenPercent <= 1) return Vector.getMidpoint(pos1, pos2);
|
||||
public static BlockVector3 getVertex(BlockVector3 pos1, BlockVector3 pos2, double lenPercent) {
|
||||
if (lenPercent <= 1) return MathUtils.midpoint(pos1, pos2);
|
||||
double curveLen = pos1.distance(pos2) * lenPercent;
|
||||
double dy = pos2.getY() - pos1.getY();
|
||||
double dx = pos2.getX() - pos1.getX();
|
||||
@ -90,6 +93,6 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
double z = (dh/2)/a;
|
||||
double oY = (dy - curveLen * (Math.cosh(z) / Math.sinh(z))) / 2;
|
||||
double vertY = a * 1 + oY;
|
||||
return pos1.add(pos2.subtract(pos1).multiply(vertX / dh).add(0, vertY, 0)).round();
|
||||
return pos1.add(pos2.subtract(pos1).multiply(MathMan.roundInt(vertX / dh)).add(0, MathMan.roundInt(vertY), 0)).round();
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,11 @@ package com.boydti.fawe.object.brush;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
|
||||
public class CircleBrush implements Brush {
|
||||
@ -17,21 +18,21 @@ public class CircleBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
Vector normal = position.subtract(player.getLocation());
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
Vector3 normal = position.toVector3().subtract(player.getLocation().toVector());
|
||||
editSession.makeCircle(position, pattern, size, size, size, false, normal);
|
||||
}
|
||||
|
||||
private Vector any90Rotate(Vector normal) {
|
||||
private Vector3 any90Rotate(Vector3 normal) {
|
||||
normal = normal.normalize();
|
||||
if (normal.getX() == 1 || normal.getY() == 1 || normal.getZ() == 1) {
|
||||
return new Vector(normal.getZ(), normal.getX(), normal.getY());
|
||||
return new Vector3(normal.getZ(), normal.getX(), normal.getY());
|
||||
}
|
||||
AffineTransform affine = new AffineTransform();
|
||||
affine = affine.rotateX(90);
|
||||
affine = affine.rotateY(90);
|
||||
affine = affine.rotateZ(90);
|
||||
Vector random = affine.apply(normal);
|
||||
Vector3 random = affine.apply(normal);
|
||||
return random.cross(normal).normalize();
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.SilentPlayerWrapper;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.CommandManager;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import java.util.List;
|
||||
@ -26,7 +26,7 @@ public class CommandBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
int radius = (int) size;
|
||||
CuboidRegionSelector selector = new CuboidRegionSelector(editSession.getWorld(), position.subtract(radius, radius, radius), position.add(radius, radius, radius));
|
||||
String replaced = command.replace("{x}", position.getBlockX() + "")
|
||||
@ -41,10 +41,10 @@ public class CommandBrush implements Brush {
|
||||
if (face == null) {
|
||||
position = position.add(0, 1, 1);
|
||||
} else {
|
||||
position = position.add(face.getDirection());
|
||||
position = position.add(face.getDirection().toBlockPoint());
|
||||
}
|
||||
fp.setSelection(selector);
|
||||
PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position)));
|
||||
PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position.toVector3())));
|
||||
List<String> cmds = StringMan.split(replaced, ';');
|
||||
for (String cmd : cmds) {
|
||||
CommandEvent event = new CommandEvent(wePlayer, cmd);
|
||||
|
@ -10,7 +10,6 @@ import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
@ -22,6 +21,7 @@ import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
@ -50,7 +50,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(final EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
FawePlayer fp = editSession.getPlayer();
|
||||
ClipboardHolder clipboard = session.getExistingClipboard();
|
||||
if (clipboard == null) {
|
||||
@ -66,7 +66,7 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
final int minY = position.getBlockY();
|
||||
mask = new AbstractDelegateMask(mask) {
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (super.test(vector) && vector.getBlockY() >= minY) {
|
||||
BlockStateHolder block = editSession.getLazyBlock(vector);
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
|
@ -7,12 +7,12 @@ import com.boydti.fawe.object.clipboard.FaweClipboard;
|
||||
import com.boydti.fawe.object.clipboard.OffsetFaweClipboard;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.Blocks;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -23,14 +23,14 @@ public class ErodeBrush implements Brush {
|
||||
|
||||
private PseudoRandom rand = new PseudoRandom();
|
||||
|
||||
private static final Vector[] FACES_TO_CHECK = {new Vector(0, 0, 1), new Vector(0, 0, -1), new Vector(0, 1, 0), new Vector(0, -1, 0), new Vector(1, 0, 0), new Vector(-1, 0, 0)};
|
||||
private static final BlockVector3[] FACES_TO_CHECK = {new BlockVector3(0, 0, 1), new BlockVector3(0, 0, -1), new BlockVector3(0, 1, 0), new BlockVector3(0, -1, 0), new BlockVector3(1, 0, 0), new BlockVector3(-1, 0, 0)};
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
this.erosion(editSession, 2, 1, 5, 1, position, size);
|
||||
}
|
||||
|
||||
public void erosion(final EditSession es, int erodeFaces, int erodeRec, int fillFaces, int fillRec, Vector target, double size) {
|
||||
public void erosion(final EditSession es, int erodeFaces, int erodeRec, int fillFaces, int fillRec, BlockVector3 target, double size) {
|
||||
int brushSize = (int) size + 1;
|
||||
int brushSizeSquared = (int) (size * size);
|
||||
int dimension = brushSize * 2 + 1;
|
||||
@ -98,7 +98,7 @@ public class ErodeBrush implements Brush {
|
||||
} else {
|
||||
Arrays.fill(frequency, 0);
|
||||
}
|
||||
for (Vector offs : FACES_TO_CHECK) {
|
||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||
BlockStateHolder next = current.getBlock(x + offs.getBlockX(), y + offs.getBlockY(), z + offs.getBlockZ());
|
||||
if (!next.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
@ -142,7 +142,7 @@ public class ErodeBrush implements Brush {
|
||||
} else {
|
||||
Arrays.fill(frequency, 0);
|
||||
}
|
||||
for (Vector offs : FACES_TO_CHECK) {
|
||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||
BlockStateHolder next = current.getBlock(x + offs.getBlockX(), y + offs.getBlockY(), z + offs.getBlockZ());
|
||||
if (next.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
|
@ -3,13 +3,13 @@ package com.boydti.fawe.object.brush;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class FallingSphere implements Brush {
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
int px = position.getBlockX();
|
||||
int py = position.getBlockY();
|
||||
int pz = position.getBlockZ();
|
||||
|
@ -4,11 +4,12 @@ import com.boydti.fawe.object.brush.heightmap.HeightMap;
|
||||
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
public class FlattenBrush extends HeightBrush {
|
||||
@ -18,7 +19,7 @@ public class FlattenBrush extends HeightBrush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
int size = (int) sizeDouble;
|
||||
Mask mask = editSession.getMask();
|
||||
if (mask == Masks.alwaysTrue() || mask == Masks.alwaysTrue2D()) {
|
||||
|
@ -11,13 +11,15 @@ import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -68,7 +70,7 @@ public class HeightBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
int size = (int) sizeDouble;
|
||||
HeightMap map = getHeightMap();
|
||||
map.setSize(size);
|
||||
@ -83,7 +85,7 @@ public class HeightBrush implements Brush {
|
||||
hmmg.getMetaData().setMeta("PRECISION_HEIGHT", metaHeight = new byte[hmmg.getArea()]);
|
||||
}
|
||||
|
||||
Vector origin = hmmg.getOrigin();
|
||||
Vector3 origin = hmmg.getOrigin();
|
||||
|
||||
int bx = position.getBlockX();
|
||||
int bz = position.getBlockZ();
|
||||
@ -131,14 +133,14 @@ public class HeightBrush implements Brush {
|
||||
}
|
||||
|
||||
if (smooth) {
|
||||
Vector2D min = new Vector2D(Math.max(0, bx - size), Math.max(0, bz - size));
|
||||
Vector2D max = new Vector2D(Math.min(hmmg.getWidth() - 1, bx + size), Math.min(hmmg.getLength() - 1, bz + size));
|
||||
BlockVector2 min = new BlockVector2(Math.max(0, bx - size), Math.max(0, bz - size));
|
||||
BlockVector2 max = new BlockVector2(Math.min(hmmg.getWidth() - 1, bx + size), Math.min(hmmg.getLength() - 1, bz + size));
|
||||
hmmg.smooth(min, max, 8, 1);
|
||||
|
||||
if (size > 20) {
|
||||
int smoothSize = size + 8;
|
||||
min = new Vector2D(Math.max(0, bx - smoothSize), Math.max(0, bz - smoothSize));
|
||||
max = new Vector2D(Math.min(hmmg.getWidth() - 1, bx + smoothSize), Math.min(hmmg.getLength() - 1, bz + smoothSize));
|
||||
min = new BlockVector2(Math.max(0, bx - smoothSize), Math.max(0, bz - smoothSize));
|
||||
max = new BlockVector2(Math.min(hmmg.getWidth() - 1, bx + smoothSize), Math.min(hmmg.getLength() - 1, bz + smoothSize));
|
||||
hmmg.smooth(min, max, 1, 1);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.boydti.fawe.util.TextureUtil;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
@ -16,6 +15,9 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -64,15 +66,15 @@ public class ImageBrush implements Brush {
|
||||
}
|
||||
|
||||
private interface ColorFunction {
|
||||
int call(int x1, int z1, int x2, int z2, Extent extent, Vector pos);
|
||||
int call(int x1, int z1, int x2, int z2, Extent extent, BlockVector3 pos);
|
||||
}
|
||||
|
||||
private interface BlockFunction {
|
||||
void apply(int color, Extent extent, Vector pos);
|
||||
void apply(int color, Extent extent, BlockVector3 pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
TextureUtil texture = session.getTextureUtil();
|
||||
|
||||
final int cx = position.getBlockX();
|
||||
@ -88,19 +90,19 @@ public class ImageBrush implements Brush {
|
||||
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX((pitch - 90) % 360).inverse();
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
||||
private final Vector mutable = new Vector();
|
||||
private final MutableVector mutable = new MutableVector();
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (solid.test(vector)) {
|
||||
int dx = vector.getBlockX() - cx;
|
||||
int dy = vector.getBlockY() - cy;
|
||||
int dz = vector.getBlockZ() - cz;
|
||||
|
||||
Vector pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5));
|
||||
Vector3 pos1 = transform.apply(mutable.setComponents(dx - 0.5, dy - 0.5, dz - 0.5));
|
||||
int x1 = (int) (pos1.getX() * scale + centerX);
|
||||
int z1 = (int) (pos1.getZ() * scale + centerZ);
|
||||
|
||||
Vector pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5));
|
||||
Vector3 pos2 = transform.apply(mutable.setComponents(dx + 0.5, dy + 0.5, dz + 0.5));
|
||||
int x2 = (int) (pos2.getX() * scale + centerX);
|
||||
int z2 = (int) (pos2.getZ() * scale + centerZ);
|
||||
if (x2 < x1) {
|
||||
|
@ -13,12 +13,13 @@ import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.DoubleActionTraceTool;
|
||||
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.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -47,7 +48,7 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
return perform(player, session, true);
|
||||
}
|
||||
|
||||
public Vector getTarget(Player player, boolean adjacent) {
|
||||
public Vector3 getTarget(Player player, boolean adjacent) {
|
||||
Location target = null;
|
||||
int range = this.range > -1 ? getRange() : MAX_RANGE;
|
||||
if (adjacent) {
|
||||
@ -67,7 +68,7 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
|
||||
player.print(BBC.getPrefix() + BBC.SETTING_DISABLE.f("history.use-database (Import with /frb #import )"));
|
||||
return false;
|
||||
}
|
||||
Vector target = getTarget(player, rightClick);
|
||||
BlockVector3 target = getTarget(player, rightClick).toBlockPoint();
|
||||
final int x = target.getBlockX();
|
||||
final int y = target.getBlockY();
|
||||
final int z = target.getBlockZ();
|
||||
|
@ -6,8 +6,6 @@ import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
@ -17,6 +15,8 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -34,7 +34,7 @@ public class LayerBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern ignore, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern ignore, double size) throws MaxChangedBlocksException {
|
||||
final FaweQueue queue = editSession.getQueue();
|
||||
final AdjacentAnyMask adjacent = new AdjacentAnyMask(new BlockTypeMask(editSession, BlockTypes.AIR, BlockTypes.CAVE_AIR, BlockTypes.VOID_AIR));
|
||||
final SolidBlockMask solid = new SolidBlockMask(editSession);
|
||||
@ -51,7 +51,7 @@ public class LayerBrush implements Brush {
|
||||
boolean found = false;
|
||||
int previous = layers[depth - 1].getInternalId();
|
||||
int previous2 = layers[depth - 2].getInternalId();
|
||||
for (Vector dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX(), pos.getBlockY() + dir.getBlockY(), pos.getBlockZ() + dir.getBlockZ());
|
||||
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);
|
||||
@ -73,7 +73,7 @@ public class LayerBrush implements Brush {
|
||||
BlockStateHolder currentPattern = layers[depth];
|
||||
return editSession.setBlock(pos, currentPattern);
|
||||
}, layers.length - 1, editSession);
|
||||
for (Vector pos : visited) {
|
||||
for (BlockVector3 pos : visited) {
|
||||
visitor.visit(pos);
|
||||
}
|
||||
Operations.completeBlindly(visitor);
|
||||
|
@ -4,14 +4,14 @@ import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class LineBrush implements Brush, ResettableTool {
|
||||
|
||||
private final boolean shell, select, flat;
|
||||
private Vector pos1;
|
||||
private BlockVector3 pos1;
|
||||
|
||||
public LineBrush(boolean shell, boolean select, boolean flat) {
|
||||
this.shell = shell;
|
||||
@ -20,7 +20,7 @@ public class LineBrush implements Brush, ResettableTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, final Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, final Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
boolean visual = (editSession.getExtent() instanceof VisualExtent);
|
||||
if (pos1 == null) {
|
||||
if (!visual) {
|
||||
|
@ -2,13 +2,14 @@ package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.boydti.fawe.jnbt.anvil.generator.SchemGen;
|
||||
import com.boydti.fawe.util.MaskTraverser;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import java.util.List;
|
||||
@ -27,10 +28,11 @@ public class PopulateSchem implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
new MaskTraverser(mask).reset(editSession);
|
||||
SchemGen gen = new SchemGen(mask, editSession, clipboards, randomRotate);
|
||||
CuboidRegion cuboid = new CuboidRegion(editSession.getWorld(), position.subtract(size, size, size), position.add(size, size, size));
|
||||
int size1 = MathMan.roundInt(size);
|
||||
CuboidRegion cuboid = new CuboidRegion(editSession.getWorld(), position.subtract(size1, size1, size1), position.add(size1, size1, size1));
|
||||
try {
|
||||
editSession.addSchems(cuboid, mask, clipboards, rarity, randomRotate);
|
||||
} catch (WorldEditException e) {
|
||||
|
@ -2,12 +2,12 @@ package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class RaiseBrush extends ErodeBrush {
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
this.erosion(editSession, 6, 0, 1, 1, position, size);
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.visitor.DFSRecursiveVisitor;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
@ -14,6 +13,7 @@ import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
public class RecurseBrush implements Brush {
|
||||
@ -25,7 +25,7 @@ public class RecurseBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(final EditSession editSession, final Vector position, Pattern to, double size) throws MaxChangedBlocksException {
|
||||
public void build(final EditSession editSession, final BlockVector3 position, Pattern to, double size) throws MaxChangedBlocksException {
|
||||
Mask mask = editSession.getMask();
|
||||
if (mask == null) {
|
||||
mask = Masks.alwaysTrue();
|
||||
@ -42,7 +42,7 @@ public class RecurseBrush implements Brush {
|
||||
final Mask radMask = new RadiusMask(0, (int) size);
|
||||
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, replace, Integer.MAX_VALUE, Integer.MAX_VALUE) {
|
||||
@Override
|
||||
public boolean isVisitable(Vector from, Vector to) {
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int y = to.getBlockY();
|
||||
return y >= y && y < maxY && radMask.test(to) && super.isVisitable(from, to);
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class RecurseBrush implements Brush {
|
||||
} else {
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession) {
|
||||
@Override
|
||||
public boolean isVisitable(Vector from, Vector to) {
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int y = to.getBlockY();
|
||||
return y >= y && y < maxY && super.isVisitable(from, to);
|
||||
}
|
||||
|
@ -3,24 +3,26 @@ package com.boydti.fawe.object.brush;
|
||||
import com.boydti.fawe.object.random.SimplexNoise;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class RockBrush implements Brush {
|
||||
private final double amplitude;
|
||||
private final double frequency;
|
||||
private final Vector radius;
|
||||
private final Vector3 radius;
|
||||
|
||||
public RockBrush(Vector radius, double frequency, double amplitude) {
|
||||
public RockBrush(Vector3 radius, double frequency, double amplitude) {
|
||||
this.frequency = frequency;
|
||||
this.amplitude = amplitude;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
double seedX = ThreadLocalRandom.current().nextDouble();
|
||||
double seedY = ThreadLocalRandom.current().nextDouble();
|
||||
double seedZ = ThreadLocalRandom.current().nextDouble();
|
||||
|
@ -8,7 +8,6 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
@ -16,6 +15,8 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ScatterBrush implements Brush {
|
||||
@ -39,7 +40,7 @@ public class ScatterBrush implements Brush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
this.mask = editSession.getMask();
|
||||
if (this.mask == null) {
|
||||
this.mask = Masks.alwaysTrue();
|
||||
@ -63,7 +64,7 @@ public class ScatterBrush implements Brush {
|
||||
int maxFails = 1000;
|
||||
for (int i = 0; i < count; i++) {
|
||||
int index = PseudoRandom.random.nextInt(length);
|
||||
Vector pos = visited.get(index);
|
||||
BlockVector3 pos = visited.get(index);
|
||||
if (pos != null && canApply(editSession, pos)) {
|
||||
int x = pos.getBlockX();
|
||||
int y = pos.getBlockY();
|
||||
@ -82,18 +83,18 @@ public class ScatterBrush implements Brush {
|
||||
finish(editSession, placed, position, pattern, size);
|
||||
}
|
||||
|
||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, Vector pos, Pattern pattern, double size) {
|
||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pos, Pattern pattern, double size) {
|
||||
}
|
||||
|
||||
public boolean canApply(EditSession editSession, Vector pos) {
|
||||
public boolean canApply(EditSession editSession, BlockVector3 pos) {
|
||||
return mask.test(pos);
|
||||
}
|
||||
|
||||
public Vector getDirection(Vector pt) {
|
||||
public BlockVector3 getDirection(BlockVector3 pt) {
|
||||
return surface.direction(pt);
|
||||
}
|
||||
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, Vector pt, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
editSession.setBlock(pt, p);
|
||||
}
|
||||
}
|
@ -8,11 +8,11 @@ import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.SilentPlayerWrapper;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.platform.CommandManager;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import java.util.List;
|
||||
@ -26,7 +26,7 @@ public class ScatterCommand extends ScatterBrush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, Vector position, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 position, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
int radius = getDistance();
|
||||
CuboidRegionSelector selector = new CuboidRegionSelector(editSession.getWorld(), position.subtract(radius, radius, radius), position.add(radius, radius, radius));
|
||||
String replaced = command.replace("{x}", position.getBlockX() + "")
|
||||
@ -38,7 +38,7 @@ public class ScatterCommand extends ScatterBrush {
|
||||
FawePlayer fp = editSession.getPlayer();
|
||||
Player player = fp.getPlayer();
|
||||
fp.setSelection(selector);
|
||||
PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position)));
|
||||
PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position.toVector3())));
|
||||
List<String> cmds = StringMan.split(replaced, ';');
|
||||
for (String cmd : cmds) {
|
||||
CommandEvent event = new CommandEvent(wePlayer, cmd);
|
||||
|
@ -3,8 +3,8 @@ package com.boydti.fawe.object.brush;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class ScatterOverlayBrush extends ScatterBrush {
|
||||
public ScatterOverlayBrush(int count, int distance) {
|
||||
@ -12,12 +12,12 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, Vector pt, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
int x = pt.getBlockX();
|
||||
int y = pt.getBlockY();
|
||||
int z = pt.getBlockZ();
|
||||
Vector dir = getDirection(pt);
|
||||
dir.setComponents(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ());
|
||||
editSession.setBlock(dir, p);
|
||||
BlockVector3 dir = getDirection(pt);
|
||||
// dir.setComponents(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ());
|
||||
editSession.setBlock(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ(), p);
|
||||
}
|
||||
}
|
@ -5,12 +5,12 @@ import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
|
||||
public class ShatterBrush extends ScatterBrush {
|
||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
||||
@ -20,11 +20,11 @@ public class ShatterBrush extends ScatterBrush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(final EditSession editSession, final LocalBlockVectorSet placed, final Vector position, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
public void apply(final EditSession editSession, final LocalBlockVectorSet placed, final BlockVector3 position, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, final Vector position, Pattern pattern, double size) {
|
||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, final BlockVector3 position, Pattern pattern, double size) {
|
||||
int radius2 = (int) (size * size);
|
||||
// Keep track of where we've visited
|
||||
LocalBlockVectorSet tmp = new LocalBlockVectorSet();
|
||||
@ -34,7 +34,7 @@ public class ShatterBrush extends ScatterBrush {
|
||||
LocalBlockVectorSet[] frontiersVisited = new LocalBlockVectorSet[placed.size()];
|
||||
// Initiate the frontier with the starting points
|
||||
int i = 0;
|
||||
for (Vector pos : placed) {
|
||||
for (BlockVector3 pos : placed) {
|
||||
LocalBlockVectorSet set = new LocalBlockVectorSet();
|
||||
set.add(pos);
|
||||
frontiers[i] = set;
|
||||
@ -66,7 +66,7 @@ public class ShatterBrush extends ScatterBrush {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < BreadthFirstSearch.DIAGONAL_DIRECTIONS.length; i++) {
|
||||
Vector direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
|
||||
BlockVector3 direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];
|
||||
int x2 = x + direction.getBlockX();
|
||||
int y2 = y + direction.getBlockY();
|
||||
int z2 = z + direction.getBlockZ();
|
||||
|
@ -2,14 +2,14 @@ package com.boydti.fawe.object.brush;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class SpikeBrush implements Brush {
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.boydti.fawe.object.pattern.BiomePattern;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -14,6 +13,8 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SplatterBrush extends ScatterBrush {
|
||||
@ -27,7 +28,7 @@ public class SplatterBrush extends ScatterBrush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(final EditSession editSession, final LocalBlockVectorSet placed, final Vector position, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
public void apply(final EditSession editSession, final LocalBlockVectorSet placed, final BlockVector3 position, Pattern p, double size) throws MaxChangedBlocksException {
|
||||
final Pattern finalPattern;
|
||||
if (solid) {
|
||||
Pattern tmp;
|
||||
@ -46,7 +47,7 @@ public class SplatterBrush extends ScatterBrush {
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
double dist = vector.distanceSq(position);
|
||||
if (dist < size2 && !placed.contains(vector) && (PseudoRandom.random.random(5) < 2) && surface.test(vector)) {
|
||||
placed.add(vector);
|
||||
@ -56,7 +57,7 @@ public class SplatterBrush extends ScatterBrush {
|
||||
}
|
||||
}, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector vector) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 vector) throws WorldEditException {
|
||||
return editSession.setBlock(vector, finalPattern);
|
||||
}
|
||||
}, recursion, editSession);
|
||||
|
@ -8,7 +8,6 @@ import com.boydti.fawe.object.visitor.DFSRecursiveVisitor;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -17,6 +16,9 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.interpolation.Node;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -27,12 +29,12 @@ import java.util.List;
|
||||
public class SplineBrush implements Brush, ResettableTool {
|
||||
|
||||
public static int MAX_POINTS = 15;
|
||||
private ArrayList<ArrayList<Vector>> positionSets;
|
||||
private ArrayList<ArrayList<BlockVector3>> positionSets;
|
||||
private int numSplines;
|
||||
|
||||
private final LocalSession session;
|
||||
private final Player player;
|
||||
private Vector position;
|
||||
private BlockVector3 position;
|
||||
|
||||
public SplineBrush(Player player, LocalSession session) {
|
||||
this.session = session;
|
||||
@ -50,7 +52,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, final Vector position, Pattern pattern, double size) throws WorldEditException {
|
||||
public void build(EditSession editSession, final BlockVector3 position, Pattern pattern, double size) throws WorldEditException {
|
||||
Mask mask = editSession.getMask();
|
||||
if (mask == null) {
|
||||
mask = new IdMask(editSession);
|
||||
@ -68,21 +70,21 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
if (positionSets.size() >= MAX_POINTS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
final ArrayList<Vector> points = new ArrayList<>();
|
||||
final ArrayList<BlockVector3> points = new ArrayList<>();
|
||||
if (size > 0) {
|
||||
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector p) {
|
||||
points.add(new Vector(p));
|
||||
public boolean apply(BlockVector3 p) {
|
||||
points.add(p);
|
||||
return true;
|
||||
}
|
||||
}, (int) size, 1);
|
||||
List<Vector> directions = visitor.getDirections();
|
||||
List<BlockVector3> directions = visitor.getDirections();
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (x != 0 || y != 0 || z != 0) {
|
||||
Vector pos = new Vector(x, y, z);
|
||||
BlockVector3 pos = new BlockVector3(x, y, z);
|
||||
if (!directions.contains(pos)) {
|
||||
directions.add(pos);
|
||||
}
|
||||
@ -109,8 +111,8 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
|
||||
return;
|
||||
}
|
||||
List<Vector> centroids = new ArrayList<>();
|
||||
for (List<Vector> points : positionSets) {
|
||||
List<Vector3> centroids = new ArrayList<>();
|
||||
for (List<BlockVector3> points : positionSets) {
|
||||
centroids.add(getCentroid(points));
|
||||
}
|
||||
|
||||
@ -121,7 +123,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
|
||||
final List<Node> nodes = new ArrayList<Node>(centroids.size());
|
||||
|
||||
for (final Vector nodevector : centroids) {
|
||||
for (final Vector3 nodevector : centroids) {
|
||||
final Node n = new Node(nodevector);
|
||||
n.setTension(tension);
|
||||
n.setBias(bias);
|
||||
@ -130,8 +132,8 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
}
|
||||
int samples = numSplines;
|
||||
for (int i = 0; i < numSplines; i++) {
|
||||
List<Vector> currentSpline = new ArrayList<>();
|
||||
for (ArrayList<Vector> points : positionSets) {
|
||||
List<BlockVector3> currentSpline = new ArrayList<>();
|
||||
for (ArrayList<BlockVector3> points : positionSets) {
|
||||
int listSize = points.size();
|
||||
int index = (int) (i * listSize / (double) (numSplines));
|
||||
currentSpline.add(points.get(index));
|
||||
@ -148,9 +150,9 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
}
|
||||
}
|
||||
|
||||
private Vector getCentroid(Collection<Vector> points) {
|
||||
Vector sum = new Vector();
|
||||
for (Vector p : points) {
|
||||
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
||||
MutableVector sum = new MutableVector();
|
||||
for (BlockVector3 p : points) {
|
||||
sum.mutX(sum.getX() + p.getX());
|
||||
sum.mutY(sum.getY() + p.getY());
|
||||
sum.mutZ(sum.getZ() + p.getZ());
|
||||
@ -158,7 +160,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
return sum.multiply(1.0 / points.size());
|
||||
}
|
||||
|
||||
private Vector normal(Collection<Vector> points, Vector centroid) {
|
||||
private BlockVector3 normal(Collection<BlockVector3> points, BlockVector3 centroid) {
|
||||
int n = points.size();
|
||||
switch (n) {
|
||||
case 1: {
|
||||
@ -177,8 +179,8 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
double yz = 0.0;
|
||||
double zz = 0.0;
|
||||
|
||||
Vector r = new Vector();
|
||||
for (Vector p : points) {
|
||||
MutableVector r = new MutableVector();
|
||||
for (BlockVector3 p : points) {
|
||||
r.mutX((p.getX() - centroid.getX()));
|
||||
r.mutY((p.getY() - centroid.getY()));
|
||||
r.mutZ((p.getZ() - centroid.getZ()));
|
||||
@ -200,19 +202,19 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
}
|
||||
|
||||
// Pick path with best conditioning:
|
||||
Vector dir;
|
||||
BlockVector3 dir;
|
||||
if (det_max == det_x) {
|
||||
double a = (xz * yz - xy * zz) / det_x;
|
||||
double b = (xy * yz - xz * yy) / det_x;
|
||||
dir = new Vector(1.0, a, b);
|
||||
dir = new BlockVector3(1.0, a, b);
|
||||
} else if (det_max == det_y) {
|
||||
double a = (yz * xz - xy * zz) / det_y;
|
||||
double b = (xy * xz - yz * xx) / det_y;
|
||||
dir = new Vector(a, 1.0, b);
|
||||
dir = new BlockVector3(a, 1.0, b);
|
||||
} else {
|
||||
double a = (yz * xy - xz * yy) / det_z;
|
||||
double b = (xz * xy - yz * xx) / det_z;
|
||||
dir = new Vector(a, b, 1.0);
|
||||
dir = new BlockVector3(a, b, 1.0);
|
||||
}
|
||||
;
|
||||
return dir.normalize();
|
||||
|
@ -3,10 +3,9 @@ package com.boydti.fawe.object.brush;
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.boydti.fawe.object.brush.heightmap.HeightMap;
|
||||
import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -15,6 +14,10 @@ import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import java.io.InputStream;
|
||||
@ -29,7 +32,7 @@ public class StencilBrush extends HeightBrush {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
|
||||
final int cx = position.getBlockX();
|
||||
final int cy = position.getBlockY();
|
||||
final int cz = position.getBlockZ();
|
||||
@ -51,7 +54,7 @@ public class StencilBrush extends HeightBrush {
|
||||
|
||||
|
||||
Player player = editSession.getPlayer().getPlayer();
|
||||
Vector pos = player.getLocation();
|
||||
// BlockVector3 pos = player.getLocation().toVector();
|
||||
|
||||
|
||||
|
||||
@ -62,17 +65,17 @@ public class StencilBrush extends HeightBrush {
|
||||
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
|
||||
private final MutableBlockVector mutable = new MutableBlockVector();
|
||||
private final MutableVector mutable = new MutableVector();
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (solid.test(vector)) {
|
||||
int dx = vector.getBlockX() - cx;
|
||||
int dy = vector.getBlockY() - cy;
|
||||
int dz = vector.getBlockZ() - cz;
|
||||
|
||||
Vector srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
||||
dx = srcPos.getBlockX();
|
||||
dz = srcPos.getBlockZ();
|
||||
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
||||
dx = MathMan.roundInt(srcPos.getX());
|
||||
dz = MathMan.roundInt(srcPos.getZ());
|
||||
|
||||
int distance = dx * dx + dz * dz;
|
||||
if (distance > size2 || Math.abs(dx) > 256 || Math.abs(dz) > 256) return false;
|
||||
|
@ -4,18 +4,19 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SurfaceSphereBrush implements Brush {
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
SurfaceMask surface = new SurfaceMask(editSession);
|
||||
final SolidBlockMask solid = new SolidBlockMask(editSession);
|
||||
final RadiusMask radius = new RadiusMask(0, (int) size);
|
||||
|
@ -7,6 +7,9 @@ import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
|
||||
import com.sk89q.worldedit.math.interpolation.Node;
|
||||
import java.util.ArrayList;
|
||||
@ -22,17 +25,17 @@ public class SurfaceSpline implements Brush {
|
||||
this.quality = quality;
|
||||
}
|
||||
|
||||
private ArrayList<Vector> path = new ArrayList<>();
|
||||
private ArrayList<Vector3> path = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector pos, Pattern pattern, double radius) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 pos, Pattern pattern, double radius) throws MaxChangedBlocksException {
|
||||
int maxY = editSession.getMaxY();
|
||||
boolean vis = editSession.getExtent() instanceof VisualExtent;
|
||||
if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) {
|
||||
int max = editSession.getNearestSurfaceTerrainBlock(pos.getBlockX(), pos.getBlockZ(), pos.getBlockY(), 0, editSession.getMaxY());
|
||||
if (max == -1) return;
|
||||
pos.mutY(max);
|
||||
path.add(pos);
|
||||
// pos.mutY(max);
|
||||
path.add(new Vector3(pos.getBlockX(), max, pos.getBlockZ()));
|
||||
editSession.getPlayer().sendMessage(BBC.getPrefix() + BBC.BRUSH_SPLINE_PRIMARY_2.s());
|
||||
if (!vis) return;
|
||||
}
|
||||
@ -40,7 +43,7 @@ public class SurfaceSpline implements Brush {
|
||||
final List<Node> nodes = new ArrayList<>(path.size());
|
||||
final KochanekBartelsInterpolation interpol = new KochanekBartelsInterpolation();
|
||||
|
||||
for (final Vector nodevector : path) {
|
||||
for (final Vector3 nodevector : path) {
|
||||
final Node n = new Node(nodevector);
|
||||
n.setTension(tension);
|
||||
n.setBias(bias);
|
||||
@ -50,14 +53,14 @@ public class SurfaceSpline implements Brush {
|
||||
interpol.setNodes(nodes);
|
||||
final double splinelength = interpol.arcLength(0, 1);
|
||||
for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
|
||||
final Vector tipv = interpol.getPosition(loop);
|
||||
final Vector3 tipv = interpol.getPosition(loop);
|
||||
final int tipx = MathMan.roundInt(tipv.getX());
|
||||
final int tipz = (int) tipv.getZ();
|
||||
int tipy = MathMan.roundInt(tipv.getY());
|
||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, 0, maxY);
|
||||
if (tipy == -1) continue;
|
||||
if (radius == 0) {
|
||||
Vector set = MutableBlockVector.get(tipx, tipy, tipz);
|
||||
BlockVector3 set = MutableBlockVector.get(tipx, tipy, tipz);
|
||||
try {
|
||||
pattern.apply(editSession, set, set);
|
||||
} catch (WorldEditException e) {
|
||||
@ -71,7 +74,7 @@ public class SurfaceSpline implements Brush {
|
||||
double radius2 = (radius * radius);
|
||||
LocalBlockVectorSet newSet = new LocalBlockVectorSet();
|
||||
final int ceilrad = (int) Math.ceil(radius);
|
||||
for (final Vector v : vset) {
|
||||
for (final BlockVector3 v : vset) {
|
||||
final int tipx = v.getBlockX(), tipy = v.getBlockY(), tipz = v.getBlockZ();
|
||||
for (int loopx = tipx - ceilrad; loopx <= (tipx + ceilrad); loopx++) {
|
||||
for (int loopz = tipz - ceilrad; loopz <= (tipz + ceilrad); loopz++) {
|
||||
|
@ -4,9 +4,9 @@ import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.convolution.GaussianKernel;
|
||||
import com.sk89q.worldedit.math.convolution.HeightMapFilter;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -19,19 +19,19 @@ public interface HeightMap {
|
||||
public void setSize(int size);
|
||||
|
||||
|
||||
default void perform(EditSession session, Mask mask, Vector pos, int size, int rotationMode, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
|
||||
default void perform(EditSession session, Mask mask, BlockVector3 pos, int size, int rotationMode, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
|
||||
int[][] data = generateHeightData(session, mask, pos, size, rotationMode, yscale, smooth, towards, layers);
|
||||
applyHeightMapData(data, session, mask, pos, size, rotationMode, yscale, smooth, towards, layers);
|
||||
}
|
||||
|
||||
default void applyHeightMapData(int[][] data, EditSession session, Mask mask, Vector pos, int size, int rotationMode, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
|
||||
Vector top = session.getMaximumPoint();
|
||||
default void applyHeightMapData(int[][] data, EditSession session, Mask mask, BlockVector3 pos, int size, int rotationMode, double yscale, boolean smooth, boolean towards, boolean layers) throws MaxChangedBlocksException {
|
||||
BlockVector3 top = session.getMaximumPoint();
|
||||
int maxY = top.getBlockY();
|
||||
int diameter = 2 * size + 1;
|
||||
int iterations = 1;
|
||||
Location min = new Location(session.getWorld(), pos.subtract(size, maxY, size));
|
||||
Vector max = pos.add(size, maxY, size);
|
||||
Region region = new CuboidRegion(session.getWorld(), min, max);
|
||||
Location min = new Location(session.getWorld(), pos.subtract(size, maxY, size).toVector3());
|
||||
BlockVector3 max = pos.add(size, maxY, size);
|
||||
Region region = new CuboidRegion(session.getWorld(), min.toVector().toBlockPoint(), max);
|
||||
com.sk89q.worldedit.math.convolution.HeightMap heightMap = new com.sk89q.worldedit.math.convolution.HeightMap(session, region, data[0], layers);
|
||||
if (smooth) {
|
||||
try {
|
||||
@ -52,8 +52,8 @@ public interface HeightMap {
|
||||
}
|
||||
}
|
||||
|
||||
default int[][] generateHeightData(EditSession session, Mask mask, Vector pos, int size, final int rotationMode, double yscale, boolean smooth, boolean towards, final boolean layers) {
|
||||
Vector top = session.getMaximumPoint();
|
||||
default int[][] generateHeightData(EditSession session, Mask mask, BlockVector3 pos, int size, final int rotationMode, double yscale, boolean smooth, boolean towards, final boolean layers) {
|
||||
BlockVector3 top = session.getMaximumPoint();
|
||||
int maxY = top.getBlockY();
|
||||
int diameter = 2 * size + 1;
|
||||
int centerX = pos.getBlockX();
|
||||
@ -67,14 +67,14 @@ public interface HeightMap {
|
||||
centerY <<= 3;
|
||||
maxY <<= 3;
|
||||
}
|
||||
Vector mutablePos = new Vector(0, 0, 0);
|
||||
// Vector mutablePos = new Vector(0, 0, 0);
|
||||
if (towards) {
|
||||
double sizePowInv = 1d / Math.pow(size, yscale);
|
||||
int targetY = pos.getBlockY();
|
||||
int tmpY = targetY;
|
||||
for (int x = -size; x <= size; x++) {
|
||||
int xx = centerX + x;
|
||||
mutablePos.mutX(xx);
|
||||
// mutablePos.mutX(xx);
|
||||
for (int z = -size; z <= size; z++) {
|
||||
int index = (z + size) * diameter + (x + size);
|
||||
int zz = centerZ + z;
|
||||
@ -118,7 +118,7 @@ public interface HeightMap {
|
||||
int height = pos.getBlockY();
|
||||
for (int x = -size; x <= size; x++) {
|
||||
int xx = centerX + x;
|
||||
mutablePos.mutX(xx);
|
||||
// mutablePos.mutX(xx);
|
||||
for (int z = -size; z <= size; z++) {
|
||||
int index = (z + size) * diameter + (x + size);
|
||||
int zz = centerZ + z;
|
||||
|
@ -1,16 +1,16 @@
|
||||
package com.boydti.fawe.object.brush.heightmap;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
|
||||
public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
||||
private AffineTransform transform;
|
||||
private MutableBlockVector mutable;
|
||||
private MutableVector mutable;
|
||||
|
||||
public RotatableHeightMap(HeightMap parent) {
|
||||
super(parent);
|
||||
mutable = new MutableBlockVector();
|
||||
mutable = new MutableVector();
|
||||
this.transform = new AffineTransform();
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ public class RotatableHeightMap extends AbstractDelegateHeightMap {
|
||||
public double getHeight(int x, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutZ(z);
|
||||
Vector pos = transform.apply(mutable.setComponents(x, 0, z));
|
||||
BlockVector3 pos = transform.apply(mutable.setComponents(x, 0, z)).toBlockPoint();
|
||||
return super.getHeight(pos.getBlockX(), pos.getBlockZ());
|
||||
}
|
||||
}
|
@ -3,10 +3,11 @@ package com.boydti.fawe.object.brush.heightmap;
|
||||
import com.boydti.fawe.object.IntegerPair;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
@ -60,7 +61,7 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
||||
}
|
||||
|
||||
public static ScalableHeightMap fromClipboard(Clipboard clipboard) {
|
||||
Vector dim = clipboard.getDimensions();
|
||||
BlockVector3 dim = clipboard.getDimensions();
|
||||
byte[][] heightArray = new byte[dim.getBlockX()][dim.getBlockZ()];
|
||||
int minX = clipboard.getMinimumPoint().getBlockX();
|
||||
int minZ = clipboard.getMinimumPoint().getBlockZ();
|
||||
@ -68,7 +69,7 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
||||
int maxY = clipboard.getMaximumPoint().getBlockY();
|
||||
int clipHeight = maxY - minY + 1;
|
||||
HashSet<IntegerPair> visited = new HashSet<>();
|
||||
for (Vector pos : clipboard.getRegion()) {
|
||||
for (BlockVector3 pos : clipboard.getRegion()) {
|
||||
IntegerPair pair = new IntegerPair(pos.getBlockX(), pos.getBlockZ());
|
||||
if (visited.contains(pair)) {
|
||||
continue;
|
||||
@ -77,9 +78,10 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
||||
int xx = pos.getBlockX();
|
||||
int zz = pos.getBlockZ();
|
||||
int highestY = minY;
|
||||
MutableBlockVector bv = new MutableBlockVector(pos);
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
pos.mutY(y);
|
||||
BlockStateHolder block = clipboard.getBlock(pos);
|
||||
bv.mutY(y);
|
||||
BlockStateHolder block = clipboard.getBlock(bv);
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
highestY = y + 1;
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ package com.boydti.fawe.object.brush.sweep;
|
||||
import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.interpolation.Interpolation;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.RoundedTransform;
|
||||
@ -24,11 +24,11 @@ public class ClipboardSpline extends Spline {
|
||||
|
||||
private final Transform transform;
|
||||
private ClipboardHolder clipboardHolder;
|
||||
private Vector originalOrigin;
|
||||
private BlockVector3 originalOrigin;
|
||||
private Transform originalTransform;
|
||||
|
||||
private Vector center;
|
||||
private Vector centerOffset;
|
||||
private BlockVector3 center;
|
||||
private BlockVector3 centerOffset;
|
||||
private LocalBlockVectorSet buffer;
|
||||
|
||||
/**
|
||||
@ -70,8 +70,9 @@ public class ClipboardSpline extends Spline {
|
||||
this.originalOrigin = clipboard.getOrigin();
|
||||
|
||||
Region region = clipboard.getRegion();
|
||||
Vector origin = clipboard.getOrigin();
|
||||
center = region.getCenter().setY(origin.getY() - 1);
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
// center = region.getCenter().setY(origin.getY() - 1);
|
||||
center = region.getCenter().withY(origin.getY() - 1).toBlockPoint();
|
||||
this.centerOffset = center.subtract(center.round());
|
||||
this.center = center.subtract(centerOffset);
|
||||
this.transform = transform;
|
||||
@ -79,7 +80,7 @@ public class ClipboardSpline extends Spline {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int pasteBlocks(Vector target, Vector offset, double angle) throws MaxChangedBlocksException {
|
||||
protected int pasteBlocks(BlockVector3 target, BlockVector3 offset, double angle) throws MaxChangedBlocksException {
|
||||
RoundedTransform transform = new RoundedTransform(new AffineTransform()
|
||||
.translate(offset)
|
||||
.rotateY(angle));
|
||||
@ -95,7 +96,7 @@ public class ClipboardSpline extends Spline {
|
||||
clipboard.setOrigin(center.subtract(centerOffset).round());
|
||||
clipboardHolder.setTransform(transform);
|
||||
|
||||
Vector functionOffset = target.subtract(clipboard.getOrigin());
|
||||
BlockVector3 functionOffset = target.subtract(clipboard.getOrigin());
|
||||
final int offX = functionOffset.getBlockX();
|
||||
final int offY = functionOffset.getBlockY();
|
||||
final int offZ = functionOffset.getBlockZ();
|
||||
|
@ -3,8 +3,10 @@ package com.boydti.fawe.object.brush.sweep;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.interpolation.Interpolation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -19,7 +21,7 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class Spline {
|
||||
|
||||
private Vector2D direction = new Vector2D(1, 0);
|
||||
private BlockVector2 direction = new BlockVector2(1, 0);
|
||||
private final int nodeCount;
|
||||
|
||||
protected EditSession editSession;
|
||||
@ -77,7 +79,7 @@ public abstract class Spline {
|
||||
* The default direction is a (1;0) vector (pointing in the positive x-direction).
|
||||
* @param direction A normalized vector representing the horizontal forward direction of the clipboard content
|
||||
*/
|
||||
public void setDirection(Vector2D direction) {
|
||||
public void setDirection(BlockVector2 direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
@ -91,7 +93,7 @@ public abstract class Spline {
|
||||
* The default direction is a (1;0) vector (pointing in the positive x-direction).
|
||||
* @return A vector representing the horizontal forward direction of the clipboard content
|
||||
*/
|
||||
public Vector2D getDirection() {
|
||||
public BlockVector2 getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
@ -125,14 +127,14 @@ public abstract class Spline {
|
||||
Preconditions.checkArgument(position <= 1);
|
||||
|
||||
// Calculate position from spline
|
||||
Vector target = interpolation.getPosition(position);
|
||||
Vector offset = target.subtract(target.round());
|
||||
BlockVector3 target = interpolation.getPosition(position).toBlockPoint();
|
||||
BlockVector3 offset = target.subtract(target.round());
|
||||
target = target.subtract(offset);
|
||||
|
||||
// Calculate rotation from spline
|
||||
|
||||
Vector deriv = interpolation.get1stDerivative(position);
|
||||
Vector2D deriv2D = new Vector2D(deriv.getX(), deriv.getZ()).normalize();
|
||||
Vector3 deriv = interpolation.get1stDerivative(position);
|
||||
Vector2 deriv2D = new Vector2(deriv.getX(), deriv.getZ()).normalize();
|
||||
double angle = Math.toDegrees(
|
||||
Math.atan2(direction.getZ(), direction.getX()) - Math.atan2(deriv2D.getZ(), deriv2D.getX())
|
||||
);
|
||||
@ -140,7 +142,7 @@ public abstract class Spline {
|
||||
return pasteBlocks(target, offset, angle);
|
||||
}
|
||||
|
||||
protected abstract int pasteBlocks(Vector target, Vector offset, double angle) throws MaxChangedBlocksException;
|
||||
protected abstract int pasteBlocks(BlockVector3 target, BlockVector3 offset, double angle) throws MaxChangedBlocksException;
|
||||
|
||||
private void initSections() {
|
||||
int sectionCount = nodeCount - 1;
|
||||
|
@ -9,10 +9,12 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.interpolation.Interpolation;
|
||||
import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation;
|
||||
import com.sk89q.worldedit.math.interpolation.Node;
|
||||
@ -23,8 +25,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SweepBrush implements Brush, ResettableTool {
|
||||
private List<Vector> positions;
|
||||
private Vector position;
|
||||
private List<BlockVector3> positions;
|
||||
private BlockVector3 position;
|
||||
private int copies;
|
||||
|
||||
private static final double tension = 0D;
|
||||
@ -37,7 +39,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
boolean visualization = editSession.getExtent() instanceof VisualExtent;
|
||||
if (visualization && positions.isEmpty()) {
|
||||
return;
|
||||
@ -59,7 +61,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
|
||||
Interpolation interpol = new KochanekBartelsInterpolation();
|
||||
List<Node> nodes = positions.stream().map(v -> {
|
||||
Node n = new Node(v);
|
||||
Node n = new Node(v.toVector3());
|
||||
n.setTension(tension);
|
||||
n.setBias(bias);
|
||||
n.setContinuity(continuity);
|
||||
@ -74,7 +76,7 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
}
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
|
||||
Vector dimensions = clipboard.getDimensions();
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
AffineTransform transform = new AffineTransform();
|
||||
if (dimensions.getBlockX() > dimensions.getBlockZ()) {
|
||||
transform = transform.rotateY(90);
|
||||
@ -93,10 +95,10 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
double blockDistance = 1d / splineLength;
|
||||
double step = blockDistance / quality;
|
||||
double accumulation = 0;
|
||||
Vector last = null;
|
||||
MutableVector last = new MutableVector(0, 0, 0);
|
||||
for (double pos = 0D; pos <= 1D; pos += step) {
|
||||
Vector gradient = interpol.get1stDerivative(pos);
|
||||
if (last == null) last = new Vector(interpol.get1stDerivative(pos));
|
||||
Vector3 gradient = interpol.get1stDerivative(pos);
|
||||
if (last == null) last = new MutableVector(interpol.get1stDerivative(pos));
|
||||
double dist = MathMan.sqrtApprox(last.distanceSq(gradient));
|
||||
last.mutX(gradient.getX());
|
||||
last.mutY(gradient.getY());
|
||||
|
@ -13,6 +13,9 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -59,7 +62,7 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return FaweCache.getBiome(0);
|
||||
}
|
||||
|
||||
@ -185,27 +188,27 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
|
||||
return setBlock(position, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightLevel(Vector position) {
|
||||
public int getBlockLightLevel(BlockVector3 position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearContainerBlockContents(Vector position) {
|
||||
public boolean clearContainerBlockContents(BlockVector3 position) {
|
||||
return unsupported();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(Vector position, BaseItemStack item) {
|
||||
public void dropItem(Vector3 position, BaseItemStack item) {
|
||||
unsupported();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws MaxChangedBlocksException {
|
||||
return unsupported();
|
||||
}
|
||||
|
||||
@ -264,12 +267,12 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector pt, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 pt, BlockStateHolder block) throws WorldEditException {
|
||||
return unsupported();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simulateBlockMine(Vector position) {
|
||||
public void simulateBlockMine(BlockVector3 position) {
|
||||
unsupported();
|
||||
}
|
||||
|
||||
|
@ -3,11 +3,12 @@ package com.boydti.fawe.object.brush.visualization;
|
||||
import com.boydti.fawe.object.FaweChunk;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.SimpleWorld;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -16,12 +17,12 @@ import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface VirtualWorld extends SimpleWorld, FaweQueue, Closeable {
|
||||
Vector getOrigin();
|
||||
Vector3 getOrigin();
|
||||
|
||||
FaweChunk getSnapshot(int chunkX, int chunkZ);
|
||||
|
||||
@Override
|
||||
default BlockState getFullBlock(Vector position) {
|
||||
default BlockState getFullBlock(BlockVector3 position) {
|
||||
return getLazyBlock(position);
|
||||
}
|
||||
|
||||
@ -29,15 +30,15 @@ public interface VirtualWorld extends SimpleWorld, FaweQueue, Closeable {
|
||||
int getMaxY();
|
||||
|
||||
@Override
|
||||
boolean setBlock(Vector pt, BlockStateHolder block) throws WorldEditException;
|
||||
boolean setBlock(BlockVector3 pt, BlockStateHolder block) throws WorldEditException;
|
||||
|
||||
@Override
|
||||
default Vector getMaximumPoint() {
|
||||
default BlockVector3 getMaximumPoint() {
|
||||
return FaweQueue.super.getMaximumPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
default Vector getMinimumPoint() {
|
||||
default BlockVector3 getMinimumPoint() {
|
||||
return FaweQueue.super.getMinimumPoint();
|
||||
}
|
||||
|
||||
@ -52,7 +53,7 @@ public interface VirtualWorld extends SimpleWorld, FaweQueue, Closeable {
|
||||
|
||||
void close(boolean update) throws IOException;
|
||||
|
||||
default void handleBlockInteract(Player player, Vector pos, BlockInteractEvent event) {}
|
||||
default void handleBlockInteract(Player player, BlockVector3 pos, BlockInteractEvent event) {}
|
||||
|
||||
default void handlePlayerInput(Player player, PlayerInputEvent event) {}
|
||||
}
|
||||
|
@ -7,13 +7,13 @@ import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.boydti.fawe.object.visitor.FaweChunkVisitor;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
@ -31,7 +31,7 @@ public class VisualExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public class VisualExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
// Do nothing
|
||||
return false;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.boydti.fawe.object.change;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.history.UndoContext;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
|
||||
public class MutableBiomeChange implements Change {
|
||||
|
@ -4,7 +4,6 @@ import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.FaweQueue;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
@ -12,6 +11,7 @@ import com.sk89q.worldedit.history.change.BlockChange;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.history.change.EntityCreate;
|
||||
import com.sk89q.worldedit.history.change.EntityRemove;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -154,7 +154,7 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Vector loc, BlockStateHolder from, BlockStateHolder to) {
|
||||
public void add(BlockVector3 loc, BlockStateHolder from, BlockStateHolder to) {
|
||||
parent.add(loc, from, to);
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,11 @@ import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBagException;
|
||||
import com.sk89q.worldedit.extent.inventory.UnplaceableBlockException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -71,7 +71,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Vector loc, BlockStateHolder from, BlockStateHolder to) {
|
||||
public void add(BlockVector3 loc, BlockStateHolder from, BlockStateHolder to) {
|
||||
int x = loc.getBlockX();
|
||||
int y = loc.getBlockY();
|
||||
int z = loc.getBlockZ();
|
||||
|
@ -13,9 +13,7 @@ import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
@ -24,6 +22,7 @@ import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.history.change.EntityCreate;
|
||||
import com.sk89q.worldedit.history.change.EntityRemove;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -197,7 +196,7 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
|
||||
public void add(BlockChange change) {
|
||||
try {
|
||||
BlockVector loc = change.getPosition();
|
||||
BlockVector3 loc = change.getPosition();
|
||||
BlockStateHolder from = change.getPrevious();
|
||||
BlockStateHolder to = change.getCurrent();
|
||||
add(loc, from, to);
|
||||
@ -206,7 +205,7 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Vector loc, BlockStateHolder from, BlockStateHolder to) {
|
||||
public void add(BlockVector3 loc, BlockStateHolder from, BlockStateHolder to) {
|
||||
int x = loc.getBlockX();
|
||||
int y = loc.getBlockY();
|
||||
int z = loc.getBlockZ();
|
||||
|
@ -2,12 +2,12 @@ package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.boydti.fawe.jnbt.NBTStreamer;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -87,12 +87,12 @@ public class AbstractDelegateFaweClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrigin(Vector offset) {
|
||||
public void setOrigin(BlockVector3 offset) {
|
||||
parent.setOrigin(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(Vector dimensions) {
|
||||
public void setDimensions(BlockVector3 dimensions) {
|
||||
parent.setDimensions(dimensions);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class AbstractDelegateFaweClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions() {
|
||||
public BlockVector3 getDimensions() {
|
||||
return parent.getDimensions();
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,12 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -112,7 +112,7 @@ public class CPUOptimizedClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(Vector dimensions) {
|
||||
public void setDimensions(BlockVector3 dimensions) {
|
||||
width = dimensions.getBlockX();
|
||||
height = dimensions.getBlockY();
|
||||
length = dimensions.getBlockZ();
|
||||
@ -125,8 +125,8 @@ public class CPUOptimizedClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions() {
|
||||
return new Vector(width, height, length);
|
||||
public BlockVector3 getDimensions() {
|
||||
return new BlockVector3(width, height, length);
|
||||
}
|
||||
|
||||
private int ylast;
|
||||
|
@ -11,13 +11,13 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -166,18 +166,18 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions() {
|
||||
return new Vector(width, height, length);
|
||||
public BlockVector3 getDimensions() {
|
||||
return new BlockVector3(width, height, length);
|
||||
}
|
||||
|
||||
public BlockArrayClipboard toClipboard() {
|
||||
try {
|
||||
CuboidRegion region = new CuboidRegion(new Vector(0, 0, 0), new Vector(width - 1, height - 1, length - 1));
|
||||
CuboidRegion region = new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(width - 1, height - 1, length - 1));
|
||||
int ox = mbb.getShort(8);
|
||||
int oy = mbb.getShort(10);
|
||||
int oz = mbb.getShort(12);
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, this);
|
||||
clipboard.setOrigin(new Vector(ox, oy, oz));
|
||||
clipboard.setOrigin(new BlockVector3(ox, oy, oz));
|
||||
return clipboard;
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
@ -223,7 +223,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrigin(Vector offset) {
|
||||
public void setOrigin(BlockVector3 offset) {
|
||||
try {
|
||||
mbb.putShort(8, (short) offset.getBlockX());
|
||||
mbb.putShort(10, (short) offset.getBlockY());
|
||||
@ -234,7 +234,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(Vector dimensions) {
|
||||
public void setDimensions(BlockVector3 dimensions) {
|
||||
try {
|
||||
width = dimensions.getBlockX();
|
||||
height = dimensions.getBlockY();
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -10,6 +8,8 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -30,31 +30,31 @@ public class EmptyClipboard implements Clipboard {
|
||||
|
||||
@Override
|
||||
public Region getRegion() {
|
||||
return new CuboidRegion(Vector.ZERO, Vector.ZERO);
|
||||
return new CuboidRegion(BlockVector3.ZERO, BlockVector3.ZERO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions() {
|
||||
return Vector.ZERO;
|
||||
public BlockVector3 getDimensions() {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getOrigin() {
|
||||
return Vector.ZERO;
|
||||
public BlockVector3 getOrigin() {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrigin(Vector origin) {
|
||||
public void setOrigin(BlockVector3 origin) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
return Vector.ZERO;
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMaximumPoint() {
|
||||
return Vector.ZERO;
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,27 +74,27 @@ public class EmptyClipboard implements Clipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return EditSession.nullBiome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5,12 +5,12 @@ import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -51,12 +51,12 @@ public abstract class FaweClipboard {
|
||||
|
||||
public abstract boolean remove(ClipboardEntity clipboardEntity);
|
||||
|
||||
public void setOrigin(Vector offset) {
|
||||
public void setOrigin(BlockVector3 offset) {
|
||||
} // Do nothing
|
||||
|
||||
public abstract void setDimensions(Vector dimensions);
|
||||
public abstract void setDimensions(BlockVector3 dimensions);
|
||||
|
||||
public abstract Vector getDimensions();
|
||||
public abstract BlockVector3 getDimensions();
|
||||
|
||||
/**
|
||||
* The locations provided are relative to the clipboard min
|
||||
|
@ -10,12 +10,12 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -159,7 +159,7 @@ public class MemoryOptimizedClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(Vector dimensions) {
|
||||
public void setDimensions(BlockVector3 dimensions) {
|
||||
width = dimensions.getBlockX();
|
||||
height = dimensions.getBlockY();
|
||||
length = dimensions.getBlockZ();
|
||||
@ -174,8 +174,8 @@ public class MemoryOptimizedClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions() {
|
||||
return new Vector(width, height, length);
|
||||
public BlockVector3 getDimensions() {
|
||||
return new BlockVector3(width, height, length);
|
||||
}
|
||||
|
||||
private int lastI;
|
||||
|
@ -3,12 +3,12 @@ package com.boydti.fawe.object.clipboard;
|
||||
import com.boydti.fawe.jnbt.NBTStreamer;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -36,12 +36,12 @@ public abstract class ReadOnlyClipboard extends FaweClipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions() {
|
||||
public BlockVector3 getDimensions() {
|
||||
return region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(Vector dimensions) {
|
||||
public void setDimensions(BlockVector3 dimensions) {
|
||||
throw new UnsupportedOperationException("Clipboard is immutable");
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public abstract class ReadOnlyClipboard extends FaweClipboard {
|
||||
|
||||
@Override
|
||||
public void streamBiomes(NBTStreamer.ByteReader task) {
|
||||
Vector dim = getDimensions();
|
||||
BlockVector3 dim = getDimensions();
|
||||
int index = 0;
|
||||
for (int z = 0; z <= dim.getBlockZ(); z++) {
|
||||
for (int x = 0; x <= dim.getBlockX(); x++, index++) {
|
||||
|
@ -3,12 +3,12 @@ package com.boydti.fawe.object.clipboard;
|
||||
import com.boydti.fawe.object.change.MutableBlockChange;
|
||||
import com.boydti.fawe.object.change.MutableTileChange;
|
||||
import com.boydti.fawe.object.changeset.MemoryOptimizedHistory;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -60,8 +60,8 @@ public class ResizableClipboardBuilder extends MemoryOptimizedHistory {
|
||||
}
|
||||
|
||||
public Clipboard build() {
|
||||
Vector pos1 = new Vector(minX, minY, minZ);
|
||||
Vector pos2 = new Vector(maxX, maxY, maxZ);
|
||||
BlockVector3 pos1 = new BlockVector3(minX, minY, minZ);
|
||||
BlockVector3 pos2 = new BlockVector3(maxX, maxY, maxZ);
|
||||
CuboidRegion region = new CuboidRegion(pos1, pos2);
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
||||
Iterator<Change> iter = getIterator(true);
|
||||
|
@ -5,8 +5,6 @@ import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -14,6 +12,9 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -38,7 +39,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
super(region);
|
||||
this.hasBiomes = hasBiomes;
|
||||
this.hasEntities = hasEntities;
|
||||
final Vector origin = region.getMinimumPoint();
|
||||
final BlockVector3 origin = region.getMinimumPoint();
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
@ -72,15 +73,15 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
@Override
|
||||
public void forEach(BlockReader task, boolean air) {
|
||||
Vector min = region.getMinimumPoint();
|
||||
Vector max = region.getMaximumPoint();
|
||||
final Vector pos = new Vector();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
MutableBlockVector pos = new MutableBlockVector();
|
||||
if (region instanceof CuboidRegion) {
|
||||
if (air) {
|
||||
((CuboidRegion) region).setUseOldIterator(true);
|
||||
RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector pos) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 pos) throws WorldEditException {
|
||||
BlockState block = getBlockAbs(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
int x = pos.getBlockX() - mx;
|
||||
int y = pos.getBlockY() - my;
|
||||
@ -102,7 +103,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
cuboidEquivalent.setUseOldIterator(true);
|
||||
RegionVisitor visitor = new RegionVisitor(cuboidEquivalent, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector pos) throws WorldEditException {
|
||||
public boolean apply(BlockVector3 pos) throws WorldEditException {
|
||||
int x = pos.getBlockX() - mx;
|
||||
int y = pos.getBlockY() - my;
|
||||
int z = pos.getBlockZ() - mz;
|
||||
|
@ -7,7 +7,6 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -15,7 +14,6 @@ import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.boydti.fawe.object.collection;
|
||||
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
@ -20,7 +21,7 @@ import java.util.Set;
|
||||
* - All BlockVectors must be a valid world coordinate: y=[0,255],x=[-30000000,30000000],z=[-30000000,30000000]
|
||||
* - This will use ~8 bytes for every 64 BlockVectors (about 800x less than a HashSet)
|
||||
*/
|
||||
public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Vector> {
|
||||
public class BlockVectorSet extends AbstractCollection<BlockVector3> implements Set<BlockVector3> {
|
||||
private Int2ObjectMap<LocalBlockVectorSet> localSets = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
@Override
|
||||
@ -32,7 +33,7 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
return size;
|
||||
}
|
||||
|
||||
public Vector get(int index) {
|
||||
public BlockVector3 get(int index) {
|
||||
int count = 0;
|
||||
ObjectIterator<Int2ObjectMap.Entry<LocalBlockVectorSet>> iter = localSets.int2ObjectEntrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
@ -42,7 +43,7 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
int newSize = count + size;
|
||||
if (newSize > index) {
|
||||
int localIndex = index - count;
|
||||
Vector pos = set.getIndex(localIndex);
|
||||
MutableBlockVector pos = new MutableBlockVector(set.getIndex(localIndex));
|
||||
if (pos != null) {
|
||||
int pair = entry.getIntKey();
|
||||
int cx = MathMan.unpairX(pair);
|
||||
@ -75,22 +76,22 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Vector) {
|
||||
Vector v = (Vector) o;
|
||||
if (o instanceof BlockVector3) {
|
||||
BlockVector3 v = (BlockVector3) o;
|
||||
return contains(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Vector> iterator() {
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
final ObjectIterator<Int2ObjectMap.Entry<LocalBlockVectorSet>> entries = localSets.int2ObjectEntrySet().iterator();
|
||||
if (!entries.hasNext()) {
|
||||
return new ArrayList<Vector>().iterator();
|
||||
return new ArrayList<BlockVector3>().iterator();
|
||||
}
|
||||
return new Iterator<Vector>() {
|
||||
return new Iterator<BlockVector3>() {
|
||||
Int2ObjectMap.Entry<LocalBlockVectorSet> entry = entries.next();
|
||||
Iterator<Vector> entryIter = entry.getValue().iterator();
|
||||
Iterator<BlockVector3> entryIter = entry.getValue().iterator();
|
||||
MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
@Override
|
||||
@ -104,7 +105,7 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector next() {
|
||||
public BlockVector3 next() {
|
||||
while (!entryIter.hasNext()) {
|
||||
if (!entries.hasNext()) {
|
||||
throw new NoSuchElementException("End of iterator");
|
||||
@ -112,7 +113,7 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
entry = entries.next();
|
||||
entryIter = entry.getValue().iterator();
|
||||
}
|
||||
Vector localPos = entryIter.next();
|
||||
BlockVector3 localPos = entryIter.next();
|
||||
int pair = entry.getIntKey();
|
||||
int cx = MathMan.unpairX(pair);
|
||||
int cz = MathMan.unpairY(pair);
|
||||
@ -122,7 +123,7 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Vector vector) {
|
||||
public boolean add(BlockVector3 vector) {
|
||||
return add(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||
}
|
||||
|
||||
@ -154,8 +155,8 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
if (o instanceof Vector) {
|
||||
Vector v = (Vector) o;
|
||||
if (o instanceof BlockVector3) {
|
||||
BlockVector3 v = (BlockVector3) o;
|
||||
return remove(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
@ -172,9 +173,9 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Vector> c) {
|
||||
public boolean addAll(Collection<? extends BlockVector3> c) {
|
||||
boolean result = false;
|
||||
for (Vector v : c) {
|
||||
for (BlockVector3 v : c) {
|
||||
result |= add(v);
|
||||
}
|
||||
return result;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.boydti.fawe.object.collection;
|
||||
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.MutableBlockVector2D;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2D;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
@ -13,7 +13,7 @@ import java.util.Set;
|
||||
* - All Vector2Ds must be within x[0,32768), y[0,32768)
|
||||
* - This will use 8 bytes for every 64 Vector2Ds (about 800x less than a HashSet)
|
||||
*/
|
||||
public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
public class LocalBlockVector2DSet implements Set<BlockVector2> {
|
||||
private final SparseBitSet set;
|
||||
private final MutableBlockVector2D mutable = new MutableBlockVector2D();
|
||||
|
||||
@ -41,8 +41,8 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Vector2D) {
|
||||
Vector2D v = (Vector2D) o;
|
||||
if (o instanceof BlockVector2) {
|
||||
BlockVector2 v = (BlockVector2) o;
|
||||
return contains(v.getBlockX(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
@ -90,7 +90,7 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Vector2D getIndex(int getIndex) {
|
||||
public BlockVector2 getIndex(int getIndex) {
|
||||
int size = size();
|
||||
if (getIndex > size) {
|
||||
return null;
|
||||
@ -108,8 +108,8 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Vector2D> iterator() {
|
||||
return new Iterator<Vector2D>() {
|
||||
public Iterator<BlockVector2> iterator() {
|
||||
return new Iterator<BlockVector2>() {
|
||||
int index = set.nextSetBit(0);
|
||||
int previous = -1;
|
||||
|
||||
@ -124,7 +124,7 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2D next() {
|
||||
public BlockVector2 next() {
|
||||
if (index != -1) {
|
||||
int x = MathMan.unpairSearchCoordsX(index);
|
||||
int y = MathMan.unpairSearchCoordsY(index);
|
||||
@ -147,14 +147,14 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
public <T> T[] toArray(T[] array) {
|
||||
int size = size();
|
||||
if (array == null || array.length < size) {
|
||||
array = (T[]) new BlockVector2D[size];
|
||||
array = (T[]) new BlockVector2[size];
|
||||
}
|
||||
int index = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
index = set.nextSetBit(index);
|
||||
int x = MathMan.unpairSearchCoordsX(index);
|
||||
int y = MathMan.unpairSearchCoordsY(index);
|
||||
array[i] = (T) new BlockVector2D(x, y);
|
||||
array[i] = (T) new BlockVector2(x, y);
|
||||
index++;
|
||||
}
|
||||
return array;
|
||||
@ -174,11 +174,11 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Vector2D vector) {
|
||||
public boolean add(BlockVector2 vector) {
|
||||
return add(vector.getBlockX(), vector.getBlockZ());
|
||||
}
|
||||
|
||||
private int getIndex(Vector2D vector) {
|
||||
private int getIndex(BlockVector2 vector) {
|
||||
return MathMan.pairSearchCoords(vector.getBlockX(), vector.getBlockZ());
|
||||
}
|
||||
|
||||
@ -200,8 +200,8 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
if (o instanceof Vector2D) {
|
||||
Vector2D v = (Vector2D) o;
|
||||
if (o instanceof BlockVector2) {
|
||||
BlockVector2 v = (BlockVector2) o;
|
||||
return remove(v.getBlockX(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
@ -218,9 +218,9 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Vector2D> c) {
|
||||
public boolean addAll(Collection<? extends BlockVector2> c) {
|
||||
boolean result = false;
|
||||
for (Vector2D v : c) {
|
||||
for (BlockVector2 v : c) {
|
||||
result |= add(v);
|
||||
}
|
||||
return result;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.boydti.fawe.object.collection;
|
||||
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
@ -13,7 +13,7 @@ import java.util.Set;
|
||||
* - All vectors must be in a 2048 * 2048 area centered around the first entry
|
||||
* - This will use 8 bytes for every 64 BlockVectors (about 800x less than a HashSet)
|
||||
*/
|
||||
public class LocalBlockVectorSet implements Set<Vector> {
|
||||
public class LocalBlockVectorSet implements Set<BlockVector3> {
|
||||
private int offsetX, offsetZ;
|
||||
private final SparseBitSet set;
|
||||
|
||||
@ -48,8 +48,8 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Vector) {
|
||||
Vector v = (Vector) o;
|
||||
if (o instanceof BlockVector3) {
|
||||
BlockVector3 v = (BlockVector3) o;
|
||||
return contains(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
@ -100,7 +100,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
this.offsetZ = z;
|
||||
}
|
||||
|
||||
public Vector getIndex(int getIndex) {
|
||||
public BlockVector3 getIndex(int getIndex) {
|
||||
int size = size();
|
||||
if (getIndex > size) {
|
||||
return null;
|
||||
@ -123,8 +123,8 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Vector> iterator() {
|
||||
return new Iterator<Vector>() {
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
return new Iterator<BlockVector3>() {
|
||||
int index = set.nextSetBit(0);
|
||||
int previous = -1;
|
||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
@ -140,7 +140,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector next() {
|
||||
public BlockVector3 next() {
|
||||
if (index != -1) {
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
@ -167,7 +167,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
public <T> T[] toArray(T[] array) {
|
||||
int size = size();
|
||||
if (array == null || array.length < size) {
|
||||
array = (T[]) new BlockVector[size];
|
||||
array = (T[]) new BlockVector3[size];
|
||||
}
|
||||
int index = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
@ -179,7 +179,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
||||
int y = b1;
|
||||
int z = offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21);
|
||||
array[i] = (T) new BlockVector(x, y, z);
|
||||
array[i] = (T) new BlockVector3(x, y, z);
|
||||
index++;
|
||||
}
|
||||
return array;
|
||||
@ -223,11 +223,11 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Vector vector) {
|
||||
public boolean add(BlockVector3 vector) {
|
||||
return add(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||
}
|
||||
|
||||
private int getIndex(Vector vector) {
|
||||
private int getIndex(BlockVector3 vector) {
|
||||
return MathMan.tripleSearchCoords(vector.getBlockX() - offsetX, vector.getBlockY(), vector.getBlockZ() - offsetZ);
|
||||
}
|
||||
|
||||
@ -249,8 +249,8 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
if (o instanceof Vector) {
|
||||
Vector v = (Vector) o;
|
||||
if (o instanceof BlockVector3) {
|
||||
BlockVector3 v = (BlockVector3) o;
|
||||
return remove(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
@ -267,9 +267,9 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Vector> c) {
|
||||
public boolean addAll(Collection<? extends BlockVector3> c) {
|
||||
boolean result = false;
|
||||
for (Vector v : c) {
|
||||
for (BlockVector3 v : c) {
|
||||
result |= add(v);
|
||||
}
|
||||
return result;
|
||||
@ -280,7 +280,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
boolean result = false;
|
||||
int size = size();
|
||||
int index = -1;
|
||||
Vector mVec = MutableBlockVector.get(0, 0, 0);
|
||||
MutableBlockVector mVec = MutableBlockVector.get(0, 0, 0);
|
||||
for (int i = 0; i < size; i++) {
|
||||
index = set.nextSetBit(index + 1);
|
||||
int b1 = (index & 0xFF);
|
||||
@ -310,7 +310,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
public void forEach(BlockVectorSetVisitor visitor) {
|
||||
int size = size();
|
||||
int index = -1;
|
||||
Vector mVec = MutableBlockVector.get(0, 0, 0);
|
||||
BlockVector3 mVec = MutableBlockVector.get(0, 0, 0);
|
||||
for (int i = 0; i < size; i++) {
|
||||
index = set.nextSetBit(index + 1);
|
||||
int b1 = (index & 0xFF);
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -24,7 +24,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
mutable.mutX((location.getX() + dx));
|
||||
mutable.mutY((location.getY() + dy));
|
||||
mutable.mutZ((location.getZ() + dz));
|
||||
@ -40,7 +40,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return super.setBiome(position.add(dx, dz), biome);
|
||||
}
|
||||
|
||||
@ -50,17 +50,17 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return super.getBiome(position.add(dx, dz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector location) {
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector location) {
|
||||
public BlockState getLazyBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
@ -10,6 +8,8 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -23,12 +23,12 @@ public class EmptyExtent implements Extent {
|
||||
public EmptyExtent() {
|
||||
}
|
||||
|
||||
public Vector getMinimumPoint() {
|
||||
return Vector.ZERO;
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
public Vector getMaximumPoint() {
|
||||
return Vector.ZERO;
|
||||
public BlockVector3 getMaximumPoint() {
|
||||
return BlockVector3.ZERO;
|
||||
}
|
||||
|
||||
public List<Entity> getEntities(Region region) {
|
||||
@ -45,27 +45,27 @@ public class EmptyExtent implements Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -6,14 +6,14 @@ import com.boydti.fawe.object.HasFaweQueue;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.*;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
@ -106,17 +106,17 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(final Vector2D position) {
|
||||
public BaseBiome getBiome(final BlockVector2 position) {
|
||||
return FaweCache.CACHE_BIOME[queue.getBiomeId(position.getBlockX(), position.getBlockZ())];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(final Vector location, final BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(final BlockVector3 location, final BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector location) {
|
||||
public BlockState getLazyBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@ -145,12 +145,12 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(final Vector position) {
|
||||
public BlockState getBlock(final BlockVector3 position) {
|
||||
return this.getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(final Vector2D position, final BaseBiome biome) {
|
||||
public boolean setBiome(final BlockVector2 position, final BaseBiome biome) {
|
||||
queue.setBiome(position.getBlockX(), position.getBlockZ(), biome);
|
||||
return true;
|
||||
}
|
||||
|
@ -4,14 +4,14 @@ import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
@ -48,16 +48,16 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final boolean contains(Vector p) {
|
||||
public final boolean contains(BlockVector3 p) {
|
||||
return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ());
|
||||
}
|
||||
|
||||
public final boolean contains(Vector2D p) {
|
||||
public final boolean contains(BlockVector2 p) {
|
||||
return contains(p.getBlockX(), p.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
if (!contains(location)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
@ -79,7 +79,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
@ -101,7 +101,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
@ -112,7 +112,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
@ -123,7 +123,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user