Skip to content

Commit

Permalink
Drop d modifier from vec names
Browse files Browse the repository at this point in the history
  • Loading branch information
octylFractal committed Oct 14, 2018
1 parent 2668209 commit 31a96e9
Show file tree
Hide file tree
Showing 221 changed files with 1,983 additions and 1,990 deletions.
Expand Up @@ -29,8 +29,8 @@
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.math.BlockVector3d;
import com.sk89q.worldedit.math.Vector3d;
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;
Expand Down Expand Up @@ -161,7 +161,7 @@ public static org.bukkit.World adapt(World world) {
*/
public static Location adapt(org.bukkit.Location location) {
checkNotNull(location);
Vector3d position = asVector(location);
Vector3 position = asVector(location);
return new com.sk89q.worldedit.util.Location(
adapt(location.getWorld()),
position,
Expand All @@ -177,7 +177,7 @@ public static Location adapt(org.bukkit.Location location) {
*/
public static org.bukkit.Location adapt(Location location) {
checkNotNull(location);
Vector3d position = location.toVector();
Vector3 position = location.toVector();
return new org.bukkit.Location(
adapt((World) location.getExtent()),
position.getX(), position.getY(), position.getZ(),
Expand All @@ -192,7 +192,7 @@ public static org.bukkit.Location adapt(Location location) {
* @param position the WorldEdit position
* @return a Bukkit location
*/
public static org.bukkit.Location adapt(org.bukkit.World world, Vector3d position) {
public static org.bukkit.Location adapt(org.bukkit.World world, Vector3 position) {
checkNotNull(world);
checkNotNull(position);
return new org.bukkit.Location(
Expand All @@ -207,7 +207,7 @@ public static org.bukkit.Location adapt(org.bukkit.World world, Vector3d positio
* @param position the WorldEdit position
* @return a Bukkit location
*/
public static org.bukkit.Location adapt(org.bukkit.World world, BlockVector3d position) {
public static org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) {
checkNotNull(world);
checkNotNull(position);
return new org.bukkit.Location(
Expand Down Expand Up @@ -238,9 +238,9 @@ public static org.bukkit.Location adapt(org.bukkit.World world, Location locatio
* @param location The Bukkit location
* @return a WorldEdit vector
*/
public static Vector3d asVector(org.bukkit.Location location) {
public static Vector3 asVector(org.bukkit.Location location) {
checkNotNull(location);
return new Vector3d(location.getX(), location.getY(), location.getZ());
return new Vector3(location.getX(), location.getY(), location.getZ());
}

/**
Expand All @@ -249,9 +249,9 @@ public static Vector3d asVector(org.bukkit.Location location) {
* @param location The Bukkit location
* @return a WorldEdit vector
*/
public static BlockVector3d asBlockVector(org.bukkit.Location location) {
public static BlockVector3 asBlockVector(org.bukkit.Location location) {
checkNotNull(location);
return new BlockVector3d(location.getX(), location.getY(), location.getZ());
return new BlockVector3(location.getX(), location.getY(), location.getZ());
}

/**
Expand Down
Expand Up @@ -27,8 +27,8 @@
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.BlockVector3d;
import com.sk89q.worldedit.math.Vector3d;
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;
Expand Down Expand Up @@ -117,7 +117,7 @@ public void printError(String msg) {
}

@Override
public void setPosition(Vector3d 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));
}
Expand Down Expand Up @@ -175,7 +175,7 @@ public void floatAt(int x, int y, int z, boolean alwaysGlass) {
return;
}

setPosition(new Vector3d(x + 0.5, y, z + 0.5));
setPosition(new Vector3(x + 0.5, y, z + 0.5));
player.setFlying(true);
}

Expand All @@ -187,7 +187,7 @@ public BaseEntity getState() {
@Override
public com.sk89q.worldedit.util.Location getLocation() {
Location nativeLocation = player.getLocation();
Vector3d position = BukkitAdapter.asVector(nativeLocation);
Vector3 position = BukkitAdapter.asVector(nativeLocation);
return new com.sk89q.worldedit.util.Location(
getWorld(),
position,
Expand Down Expand Up @@ -245,7 +245,7 @@ public boolean isPersistent() {
}

@Override
public void sendFakeBlock(BlockVector3d pos, BlockStateHolder block) {
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
if (block == null) {
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
Expand All @@ -254,7 +254,7 @@ public void sendFakeBlock(BlockVector3d pos, BlockStateHolder block) {
if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
adapter.sendFakeNBT(player, pos.toVector3d(), ((BaseBlock) block).getNbtData());
adapter.sendFakeNBT(player, pos.toVector3(), ((BaseBlock) block).getNbtData());
if (block.getBlockType() == BlockTypes.STRUCTURE_BLOCK) {
adapter.sendFakeOP(player);
}
Expand Down
Expand Up @@ -28,9 +28,9 @@
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.BlockVector2d;
import com.sk89q.worldedit.math.BlockVector3d;
import com.sk89q.worldedit.math.Vector3d;
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;
Expand Down Expand Up @@ -160,22 +160,22 @@ public String getName() {
}

@Override
public int getBlockLightLevel(BlockVector3d pt) {
public int getBlockLightLevel(BlockVector3 pt) {
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
}

@Override
public boolean regenerate(Region region, EditSession editSession) {
BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)];

for (BlockVector2d chunk : region.getChunks()) {
BlockVector3d min = new BlockVector3d(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) {
BlockVector3d 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);
}
Expand All @@ -192,7 +192,7 @@ public boolean regenerate(Region region, EditSession editSession) {
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < (getMaxY() + 1); ++y) {
for (int z = 0; z < 16; ++z) {
BlockVector3d 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
Expand Down Expand Up @@ -238,7 +238,7 @@ private Inventory getBlockInventory(Chest chest) {
}

@Override
public boolean clearContainerBlockContents(BlockVector3d pt) {
public boolean clearContainerBlockContents(BlockVector3 pt) {
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (block == null) {
return false;
Expand Down Expand Up @@ -292,21 +292,21 @@ public static TreeType toBukkitTreeType(TreeGenerator.TreeType type) {
}

@Override
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3d 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,
new EditSessionBlockChangeDelegate(editSession));
}

@Override
public void dropItem(Vector3d 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(BlockVector3d pt) {
public void checkLoadedChunk(BlockVector3 pt) {
World world = getWorld();

if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) {
Expand Down Expand Up @@ -338,15 +338,15 @@ public int getMaxY() {
}

@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(Vector3d position, int type, int data) {
public boolean playEffect(Vector3 position, int type, int data) {
World world = getWorld();

final Effect effect = effects.get(type);
Expand Down Expand Up @@ -405,18 +405,18 @@ public void setWeather(WeatherType weatherType, long duration) {
}

@Override
public void simulateBlockMine(BlockVector3d pt) {
public void simulateBlockMine(BlockVector3 pt) {
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
}

@Override
public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3d 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(BlockVector3d position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
try {
Expand All @@ -439,7 +439,7 @@ public boolean setBlock(BlockVector3d position, BlockStateHolder block, boolean
}

@Override
public BaseBlock getFullBlock(BlockVector3d position) {
public BaseBlock getFullBlock(BlockVector3 position) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position));
Expand All @@ -449,7 +449,7 @@ public BaseBlock getFullBlock(BlockVector3d position) {
}

@Override
public BaseBiome getBiome(BlockVector2d position) {
public BaseBiome getBiome(BlockVector2 position) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
Expand All @@ -460,7 +460,7 @@ public BaseBiome getBiome(BlockVector2d position) {
}

@Override
public boolean setBiome(BlockVector2d position, BaseBiome biome) {
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
Biome bukkitBiome = adapter.getBiome(biome.getId());
Expand Down
Expand Up @@ -21,7 +21,7 @@

import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.math.BlockVector3d;
import com.sk89q.worldedit.math.BlockVector3;

import org.bukkit.BlockChangeDelegate;
import org.bukkit.block.data.BlockData;
Expand All @@ -40,7 +40,7 @@ public EditSessionBlockChangeDelegate(EditSession editSession) {
@Override
public boolean setBlockData(int x, int y, int z, BlockData blockData) {
try {
editSession.setBlock(new BlockVector3d(x, y, z), BukkitAdapter.adapt(blockData));
editSession.setBlock(new BlockVector3(x, y, z), BukkitAdapter.adapt(blockData));
} catch (MaxChangedBlocksException e) {
return false;
}
Expand All @@ -49,7 +49,7 @@ public boolean setBlockData(int x, int y, int z, BlockData blockData) {

@Override
public BlockData getBlockData(int x, int y, int z) {
return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3d(x, y, z)));
return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3(x, y, z)));
}

@Override
Expand All @@ -59,7 +59,7 @@ public int getHeight() {

@Override
public boolean isEmpty(int x, int y, int z) {
return editSession.getBlock(new BlockVector3d(x, y, z)).getBlockType().getMaterial().isAir();
return editSession.getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().isAir();
}

}
Expand Up @@ -22,7 +22,7 @@
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.math.Vector3d;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
Expand Down Expand Up @@ -112,7 +112,7 @@ public interface BukkitImplAdapter {
* @param pos The position
* @param nbtData The NBT Data
*/
void sendFakeNBT(Player player, Vector3d pos, CompoundTag nbtData);
void sendFakeNBT(Player player, Vector3 pos, CompoundTag nbtData);

/**
* Make the client think it has operator status.
Expand Down
6 changes: 3 additions & 3 deletions worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java
Expand Up @@ -21,7 +21,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

import com.sk89q.worldedit.math.Vector3d;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.storage.InvalidFormatException;

import java.util.Map;
Expand Down Expand Up @@ -167,9 +167,9 @@ public static Class<? extends Tag> getTypeClass(int type) {
* @param listTag the list tag
* @return a vector
*/
public static Vector3d toVector(ListTag listTag) {
public static Vector3 toVector(ListTag listTag) {
checkNotNull(listTag);
return new Vector3d(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2));
return new Vector3(listTag.asDouble(0), listTag.asDouble(1), listTag.asDouble(2));
}

/**
Expand Down

0 comments on commit 31a96e9

Please sign in to comment.