mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
chore: address deprecations in vector classes
This commit is contained in:
parent
7318685613
commit
36d2c85fdb
@ -27,7 +27,6 @@ import com.google.common.collect.Sets;
|
|||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.mojang.datafixers.util.Either;
|
import com.mojang.datafixers.util.Either;
|
||||||
import com.mojang.serialization.Lifecycle;
|
import com.mojang.serialization.Lifecycle;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.jnbt.NBTConstants;
|
import com.sk89q.jnbt.NBTConstants;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
@ -531,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||||
new StructureBlockEntity(
|
new StructureBlockEntity(
|
||||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||||
),
|
),
|
||||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||||
@ -581,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
||||||
fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(),
|
fakePlayer.absMoveTo(position.x(), position.y(), position.z(),
|
||||||
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
||||||
|
|
||||||
final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
final BlockPos blockPos = new BlockPos(position.x(), position.y(), position.z());
|
||||||
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
||||||
final net.minecraft.core.Direction enumFacing = adapt(face);
|
final net.minecraft.core.Direction enumFacing = adapt(face);
|
||||||
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
||||||
@ -605,7 +604,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
||||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||||
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
||||||
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.getX(), position.getY(), position.getZ()));
|
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -725,7 +724,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector3 vec : region) {
|
for (BlockVector3 vec : region) {
|
||||||
BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
|
BlockPos pos = new BlockPos(vec.x(), vec.y(), vec.z());
|
||||||
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
||||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||||
int internalId = Block.getId(blockData);
|
int internalId = Block.getId(blockData);
|
||||||
@ -738,7 +737,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
extent.setBlock(vec, state.toBaseBlock());
|
extent.setBlock(vec, state.toBaseBlock());
|
||||||
if (options.shouldRegenBiomes()) {
|
if (options.shouldRegenBiomes()) {
|
||||||
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value();
|
Biome origBiome = chunk.getNoiseBiome(vec.x(), vec.y(), vec.z()).value();
|
||||||
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
||||||
if (adaptedBiome != null) {
|
if (adaptedBiome != null) {
|
||||||
extent.setBiome(vec, adaptedBiome);
|
extent.setBiome(vec, adaptedBiome);
|
||||||
@ -757,7 +756,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunkLoadings.add(
|
chunkLoadings.add(
|
||||||
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
||||||
getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true))
|
getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true))
|
||||||
.thenApply(either -> either.left().orElse(null))
|
.thenApply(either -> either.left().orElse(null))
|
||||||
);
|
);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
@ -797,7 +796,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
||||||
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
|
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.x(), pt.y(), pt.z()));
|
||||||
if (entity instanceof Clearable) {
|
if (entity instanceof Clearable) {
|
||||||
((Clearable) entity).clearContent();
|
((Clearable) entity).clearContent();
|
||||||
return true;
|
return true;
|
||||||
|
@ -472,7 +472,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
|||||||
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
||||||
return blockState1.hasPostProcess(
|
return blockState1.hasPostProcess(
|
||||||
getServerLevel(world),
|
getServerLevel(world),
|
||||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,9 +786,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
final int x = blockHash.getX() + bx;
|
final int x = blockHash.x() + bx;
|
||||||
final int y = blockHash.getY();
|
final int y = blockHash.y();
|
||||||
final int z = blockHash.getZ() + bz;
|
final int z = blockHash.z() + bz;
|
||||||
final BlockPos pos = new BlockPos(x, y, z);
|
final BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
synchronized (nmsWorld) {
|
synchronized (nmsWorld) {
|
||||||
|
@ -570,7 +570,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||||
new StructureBlockEntity(
|
new StructureBlockEntity(
|
||||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||||
),
|
),
|
||||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||||
@ -631,10 +631,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
||||||
fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(),
|
fakePlayer.absMoveTo(position.x(), position.y(), position.z(),
|
||||||
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
||||||
|
|
||||||
final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
final BlockPos blockPos = new BlockPos(position.x(), position.y(), position.z());
|
||||||
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
||||||
final net.minecraft.core.Direction enumFacing = adapt(face);
|
final net.minecraft.core.Direction enumFacing = adapt(face);
|
||||||
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
||||||
@ -655,7 +655,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
||||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||||
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
||||||
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.getX(), position.getY(), position.getZ()));
|
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -776,7 +776,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector3 vec : region) {
|
for (BlockVector3 vec : region) {
|
||||||
BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
|
BlockPos pos = new BlockPos(vec.x(), vec.y(), vec.z());
|
||||||
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
||||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||||
int internalId = Block.getId(blockData);
|
int internalId = Block.getId(blockData);
|
||||||
@ -789,7 +789,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
extent.setBlock(vec, state.toBaseBlock());
|
extent.setBlock(vec, state.toBaseBlock());
|
||||||
if (options.shouldRegenBiomes()) {
|
if (options.shouldRegenBiomes()) {
|
||||||
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value();
|
Biome origBiome = chunk.getNoiseBiome(vec.x(), vec.y(), vec.z()).value();
|
||||||
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
||||||
if (adaptedBiome != null) {
|
if (adaptedBiome != null) {
|
||||||
extent.setBiome(vec, adaptedBiome);
|
extent.setBiome(vec, adaptedBiome);
|
||||||
@ -808,7 +808,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunkLoadings.add(
|
chunkLoadings.add(
|
||||||
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
||||||
getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true))
|
getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true))
|
||||||
.thenApply(either -> either.left().orElse(null))
|
.thenApply(either -> either.left().orElse(null))
|
||||||
);
|
);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
@ -848,7 +848,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
||||||
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
|
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.x(), pt.y(), pt.z()));
|
||||||
if (entity instanceof Clearable) {
|
if (entity instanceof Clearable) {
|
||||||
((Clearable) entity).clearContent();
|
((Clearable) entity).clearContent();
|
||||||
return true;
|
return true;
|
||||||
|
@ -472,7 +472,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
|||||||
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
||||||
return blockState1.hasPostProcess(
|
return blockState1.hasPostProcess(
|
||||||
getServerLevel(world),
|
getServerLevel(world),
|
||||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,9 +784,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
final int x = blockHash.getX() + bx;
|
final int x = blockHash.x() + bx;
|
||||||
final int y = blockHash.getY();
|
final int y = blockHash.y();
|
||||||
final int z = blockHash.getZ() + bz;
|
final int z = blockHash.z() + bz;
|
||||||
final BlockPos pos = new BlockPos(x, y, z);
|
final BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
synchronized (nmsWorld) {
|
synchronized (nmsWorld) {
|
||||||
|
@ -530,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||||
new StructureBlockEntity(
|
new StructureBlockEntity(
|
||||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||||
),
|
),
|
||||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||||
@ -580,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
||||||
fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(),
|
fakePlayer.absMoveTo(position.x(), position.y(), position.z(),
|
||||||
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
||||||
|
|
||||||
final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
final BlockPos blockPos = new BlockPos(position.x(), position.y(), position.z());
|
||||||
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
||||||
final net.minecraft.core.Direction enumFacing = adapt(face);
|
final net.minecraft.core.Direction enumFacing = adapt(face);
|
||||||
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
||||||
@ -604,7 +604,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
||||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||||
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
||||||
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.getX(), position.getY(), position.getZ()));
|
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -725,7 +725,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector3 vec : region) {
|
for (BlockVector3 vec : region) {
|
||||||
BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
|
BlockPos pos = new BlockPos(vec.x(), vec.y(), vec.z());
|
||||||
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
||||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||||
int internalId = Block.getId(blockData);
|
int internalId = Block.getId(blockData);
|
||||||
@ -738,7 +738,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
extent.setBlock(vec, state.toBaseBlock());
|
extent.setBlock(vec, state.toBaseBlock());
|
||||||
if (options.shouldRegenBiomes()) {
|
if (options.shouldRegenBiomes()) {
|
||||||
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value();
|
Biome origBiome = chunk.getNoiseBiome(vec.x(), vec.y(), vec.z()).value();
|
||||||
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
||||||
if (adaptedBiome != null) {
|
if (adaptedBiome != null) {
|
||||||
extent.setBiome(vec, adaptedBiome);
|
extent.setBiome(vec, adaptedBiome);
|
||||||
@ -757,7 +757,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunkLoadings.add(
|
chunkLoadings.add(
|
||||||
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
||||||
getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true))
|
getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true))
|
||||||
.thenApply(either -> either.left().orElse(null))
|
.thenApply(either -> either.left().orElse(null))
|
||||||
);
|
);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
@ -797,7 +797,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
||||||
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
|
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.x(), pt.y(), pt.z()));
|
||||||
if (entity instanceof Clearable) {
|
if (entity instanceof Clearable) {
|
||||||
((Clearable) entity).clearContent();
|
((Clearable) entity).clearContent();
|
||||||
return true;
|
return true;
|
||||||
|
@ -475,7 +475,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
|||||||
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
||||||
return blockState1.hasPostProcess(
|
return blockState1.hasPostProcess(
|
||||||
getServerLevel(world),
|
getServerLevel(world),
|
||||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,9 +771,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
final int x = blockHash.getX() + bx;
|
final int x = blockHash.x() + bx;
|
||||||
final int y = blockHash.getY();
|
final int y = blockHash.y();
|
||||||
final int z = blockHash.getZ() + bz;
|
final int z = blockHash.z() + bz;
|
||||||
final BlockPos pos = new BlockPos(x, y, z);
|
final BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
synchronized (nmsWorld) {
|
synchronized (nmsWorld) {
|
||||||
|
@ -530,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||||
new StructureBlockEntity(
|
new StructureBlockEntity(
|
||||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||||
),
|
),
|
||||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||||
@ -580,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
||||||
fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(),
|
fakePlayer.absMoveTo(position.x(), position.y(), position.z(),
|
||||||
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
(float) face.toVector().toYaw(), (float) face.toVector().toPitch());
|
||||||
|
|
||||||
final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
final BlockPos blockPos = new BlockPos(position.x(), position.y(), position.z());
|
||||||
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
||||||
final net.minecraft.core.Direction enumFacing = adapt(face);
|
final net.minecraft.core.Direction enumFacing = adapt(face);
|
||||||
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
||||||
@ -604,7 +604,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) {
|
||||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||||
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
||||||
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.getX(), position.getY(), position.getZ()));
|
return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -725,7 +725,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector3 vec : region) {
|
for (BlockVector3 vec : region) {
|
||||||
BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
|
BlockPos pos = new BlockPos(vec.x(), vec.y(), vec.z());
|
||||||
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
||||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||||
int internalId = Block.getId(blockData);
|
int internalId = Block.getId(blockData);
|
||||||
@ -738,7 +738,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
extent.setBlock(vec, state.toBaseBlock());
|
extent.setBlock(vec, state.toBaseBlock());
|
||||||
if (options.shouldRegenBiomes()) {
|
if (options.shouldRegenBiomes()) {
|
||||||
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value();
|
Biome origBiome = chunk.getNoiseBiome(vec.x(), vec.y(), vec.z()).value();
|
||||||
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
||||||
if (adaptedBiome != null) {
|
if (adaptedBiome != null) {
|
||||||
extent.setBiome(vec, adaptedBiome);
|
extent.setBiome(vec, adaptedBiome);
|
||||||
@ -757,7 +757,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunkLoadings.add(
|
chunkLoadings.add(
|
||||||
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
|
||||||
getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true))
|
getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true))
|
||||||
.thenApply(either -> either.left().orElse(null))
|
.thenApply(either -> either.left().orElse(null))
|
||||||
);
|
);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
@ -797,7 +797,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
||||||
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
|
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.x(), pt.y(), pt.z()));
|
||||||
if (entity instanceof Clearable) {
|
if (entity instanceof Clearable) {
|
||||||
((Clearable) entity).clearContent();
|
((Clearable) entity).clearContent();
|
||||||
return true;
|
return true;
|
||||||
|
@ -475,7 +475,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
|||||||
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
||||||
return blockState1.hasPostProcess(
|
return blockState1.hasPostProcess(
|
||||||
getServerLevel(world),
|
getServerLevel(world),
|
||||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,9 +771,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
final int x = blockHash.getX() + bx;
|
final int x = blockHash.x() + bx;
|
||||||
final int y = blockHash.getY();
|
final int y = blockHash.y();
|
||||||
final int z = blockHash.getZ() + bz;
|
final int z = blockHash.z() + bz;
|
||||||
final BlockPos pos = new BlockPos(x, y, z);
|
final BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
synchronized (nmsWorld) {
|
synchronized (nmsWorld) {
|
||||||
|
@ -577,7 +577,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
@Override
|
@Override
|
||||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||||
var structureBlock = new StructureBlockEntity(
|
var structureBlock = new StructureBlockEntity(
|
||||||
new BlockPos(pos.getX(), pos.getY(), pos.getZ()),
|
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||||
);
|
);
|
||||||
structureBlock.setLevel(((CraftPlayer) player).getHandle().level());
|
structureBlock.setLevel(((CraftPlayer) player).getHandle().level());
|
||||||
@ -644,11 +644,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack);
|
||||||
fakePlayer.absMoveTo(position.getX(), position.getY(), position.getZ(),
|
fakePlayer.absMoveTo(position.x(), position.y(), position.z(),
|
||||||
(float) face.toVector().toYaw(), (float) face.toVector().toPitch()
|
(float) face.toVector().toYaw(), (float) face.toVector().toPitch()
|
||||||
);
|
);
|
||||||
|
|
||||||
final BlockPos blockPos = new BlockPos(position.getX(), position.getY(), position.getZ());
|
final BlockPos blockPos = new BlockPos(position.x(), position.y(), position.z());
|
||||||
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos);
|
||||||
final net.minecraft.core.Direction enumFacing = adapt(face);
|
final net.minecraft.core.Direction enumFacing = adapt(face);
|
||||||
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false);
|
||||||
@ -674,7 +674,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId);
|
||||||
return blockData.canSurvive(
|
return blockData.canSurvive(
|
||||||
((CraftWorld) world).getHandle(),
|
((CraftWorld) world).getHandle(),
|
||||||
new BlockPos(position.getX(), position.getY(), position.getZ())
|
new BlockPos(position.x(), position.y(), position.z())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,7 +802,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (BlockVector3 vec : region) {
|
for (BlockVector3 vec : region) {
|
||||||
BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ());
|
BlockPos pos = new BlockPos(vec.x(), vec.y(), vec.z());
|
||||||
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
ChunkAccess chunk = chunks.get(new ChunkPos(pos));
|
||||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||||
int internalId = Block.getId(blockData);
|
int internalId = Block.getId(blockData);
|
||||||
@ -815,7 +815,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
}
|
}
|
||||||
extent.setBlock(vec, state.toBaseBlock());
|
extent.setBlock(vec, state.toBaseBlock());
|
||||||
if (options.shouldRegenBiomes()) {
|
if (options.shouldRegenBiomes()) {
|
||||||
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value();
|
Biome origBiome = chunk.getNoiseBiome(vec.x(), vec.y(), vec.z()).value();
|
||||||
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
|
||||||
if (adaptedBiome != null) {
|
if (adaptedBiome != null) {
|
||||||
extent.setBiome(vec, adaptedBiome);
|
extent.setBiome(vec, adaptedBiome);
|
||||||
@ -834,7 +834,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunkLoadings.add(
|
chunkLoadings.add(
|
||||||
((CompletableFuture<ChunkResult<ChunkAccess>>)
|
((CompletableFuture<ChunkResult<ChunkAccess>>)
|
||||||
getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true))
|
getChunkFutureMethod.invoke(chunkManager, chunk.x(), chunk.z(), ChunkStatus.FEATURES, true))
|
||||||
.thenApply(either -> either.orElse(null))
|
.thenApply(either -> either.orElse(null))
|
||||||
);
|
);
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
@ -874,7 +874,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
|||||||
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) {
|
||||||
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
ServerLevel originalWorld = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()));
|
BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.x(), pt.y(), pt.z()));
|
||||||
if (entity instanceof Clearable) {
|
if (entity instanceof Clearable) {
|
||||||
((Clearable) entity).clearContent();
|
((Clearable) entity).clearContent();
|
||||||
return true;
|
return true;
|
||||||
|
@ -484,7 +484,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
|||||||
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
|
||||||
return blockState1.hasPostProcess(
|
return blockState1.hasPostProcess(
|
||||||
getServerLevel(world),
|
getServerLevel(world),
|
||||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,9 +773,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
final CompoundTag nativeTag = entry.getValue();
|
final CompoundTag nativeTag = entry.getValue();
|
||||||
final BlockVector3 blockHash = entry.getKey();
|
final BlockVector3 blockHash = entry.getKey();
|
||||||
final int x = blockHash.getX() + bx;
|
final int x = blockHash.x() + bx;
|
||||||
final int y = blockHash.getY();
|
final int y = blockHash.y();
|
||||||
final int z = blockHash.getZ() + bz;
|
final int z = blockHash.z() + bz;
|
||||||
final BlockPos pos = new BlockPos(x, y, z);
|
final BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
|
||||||
synchronized (nmsWorld) {
|
synchronized (nmsWorld) {
|
||||||
|
@ -99,7 +99,7 @@ public interface IBukkitAdapter {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
position.getX(), position.getY(), position.getZ()
|
position.x(), position.y(), position.z()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public interface IBukkitAdapter {
|
|||||||
checkNotNull(location);
|
checkNotNull(location);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
location.getX(), location.getY(), location.getZ(),
|
location.x(), location.y(), location.z(),
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch()
|
location.getPitch()
|
||||||
);
|
);
|
||||||
|
@ -354,7 +354,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Extent extent, final BlockVector3 get, final BlockVector3 set) throws WorldEditException {
|
public boolean apply(final Extent extent, final BlockVector3 get, final BlockVector3 set) throws WorldEditException {
|
||||||
return extent.setBlock(set.getX(), set.getY(), set.getZ(), source.getFullBlock(get.getX(), get.getY(), get.getZ()));
|
return extent.setBlock(set.x(), set.y(), set.z(), source.getFullBlock(get.x(), get.y(), get.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -374,8 +374,8 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Extent extent, final BlockVector3 get, final BlockVector3 set) throws WorldEditException {
|
public boolean apply(final Extent extent, final BlockVector3 get, final BlockVector3 set) throws WorldEditException {
|
||||||
return extent.setBlock(set.getX(), set.getY(), set.getZ(), source.getFullBlock(get.getX(), get.getY(), get.getZ()))
|
return extent.setBlock(set.x(), set.y(), set.z(), source.getFullBlock(get.x(), get.y(), get.z()))
|
||||||
&& extent.setBiome(set.getX(), set.getY(), set.getZ(), biomeGetter.apply(get));
|
&& extent.setBiome(set.x(), set.y(), set.z(), biomeGetter.apply(get));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -468,22 +468,22 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
|||||||
private long[] getChunkCoordsRegen(Region region, int border) { //needs to be square num of chunks
|
private long[] getChunkCoordsRegen(Region region, int border) { //needs to be square num of chunks
|
||||||
BlockVector3 oldMin = region.getMinimumPoint();
|
BlockVector3 oldMin = region.getMinimumPoint();
|
||||||
BlockVector3 newMin = BlockVector3.at(
|
BlockVector3 newMin = BlockVector3.at(
|
||||||
(oldMin.getX() >> 4 << 4) - border * 16,
|
(oldMin.x() >> 4 << 4) - border * 16,
|
||||||
oldMin.getY(),
|
oldMin.y(),
|
||||||
(oldMin.getZ() >> 4 << 4) - border * 16
|
(oldMin.z() >> 4 << 4) - border * 16
|
||||||
);
|
);
|
||||||
BlockVector3 oldMax = region.getMaximumPoint();
|
BlockVector3 oldMax = region.getMaximumPoint();
|
||||||
BlockVector3 newMax = BlockVector3.at(
|
BlockVector3 newMax = BlockVector3.at(
|
||||||
(oldMax.getX() >> 4 << 4) + (border + 1) * 16 - 1,
|
(oldMax.x() >> 4 << 4) + (border + 1) * 16 - 1,
|
||||||
oldMax.getY(),
|
oldMax.y(),
|
||||||
(oldMax.getZ() >> 4 << 4) + (border + 1) * 16 - 1
|
(oldMax.z() >> 4 << 4) + (border + 1) * 16 - 1
|
||||||
);
|
);
|
||||||
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
||||||
return adjustedRegion.getChunks().stream()
|
return adjustedRegion.getChunks().stream()
|
||||||
.sorted(Comparator
|
.sorted(Comparator
|
||||||
.comparingInt(BlockVector2::getZ)
|
.comparingInt(BlockVector2::z)
|
||||||
.thenComparingInt(BlockVector2::getX)) //needed for RegionLimitedWorldAccess
|
.thenComparingInt(BlockVector2::x)) //needed for RegionLimitedWorldAccess
|
||||||
.mapToLong(c -> MathMan.pairInt(c.getX(), c.getZ()))
|
.mapToLong(c -> MathMan.pairInt(c.x(), c.z()))
|
||||||
.toArray();
|
.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
|||||||
if (region instanceof ProtectedPolygonalRegion casted) {
|
if (region instanceof ProtectedPolygonalRegion casted) {
|
||||||
BlockVector3 max = region.getMaximumPoint();
|
BlockVector3 max = region.getMaximumPoint();
|
||||||
BlockVector3 min = region.getMinimumPoint();
|
BlockVector3 min = region.getMinimumPoint();
|
||||||
return new Polygonal2DRegion(null, casted.getPoints(), min.getBlockY(), max.getBlockY());
|
return new Polygonal2DRegion(null, casted.getPoints(), min.y(), max.y());
|
||||||
}
|
}
|
||||||
return new AdaptedRegion(region);
|
return new AdaptedRegion(region);
|
||||||
}
|
}
|
||||||
|
@ -94,15 +94,15 @@ public class FaweDelegateSchematicHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BlockVector3 dimension = schematic.getClipboard().getDimensions();
|
BlockVector3 dimension = schematic.getClipboard().getDimensions();
|
||||||
final int WIDTH = dimension.getX();
|
final int WIDTH = dimension.x();
|
||||||
final int LENGTH = dimension.getZ();
|
final int LENGTH = dimension.z();
|
||||||
final int HEIGHT = dimension.getY();
|
final int HEIGHT = dimension.y();
|
||||||
final int worldHeight = plot.getArea().getMaxGenHeight() - plot.getArea().getMinGenHeight() + 1;
|
final int worldHeight = plot.getArea().getMaxGenHeight() - plot.getArea().getMinGenHeight() + 1;
|
||||||
// Validate dimensions
|
// Validate dimensions
|
||||||
CuboidRegion region = plot.getLargestRegion();
|
CuboidRegion region = plot.getLargestRegion();
|
||||||
boolean sizeMismatch =
|
boolean sizeMismatch =
|
||||||
((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
((region.getMaximumPoint().x() - region.getMinimumPoint().x() + xOffset + 1) < WIDTH) || (
|
||||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
(region.getMaximumPoint().z() - region.getMinimumPoint().z() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||||
> worldHeight);
|
> worldHeight);
|
||||||
if (!Settings.Schematics.PASTE_MISMATCHES && sizeMismatch) {
|
if (!Settings.Schematics.PASTE_MISMATCHES && sizeMismatch) {
|
||||||
if (actor != null) {
|
if (actor != null) {
|
||||||
@ -111,8 +111,8 @@ public class FaweDelegateSchematicHandler {
|
|||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
if (((region.getMaximumPoint().x() - region.getMinimumPoint().x() + xOffset + 1) < WIDTH) || (
|
||||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
(region.getMaximumPoint().z() - region.getMinimumPoint().z() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||||
> worldHeight)) {
|
> worldHeight)) {
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
@ -141,7 +141,7 @@ public class FaweDelegateSchematicHandler {
|
|||||||
} else {
|
} else {
|
||||||
y_offset_actual = yOffset + pw.getMinBuildHeight() + editSession.getHighestTerrainBlock(region
|
y_offset_actual = yOffset + pw.getMinBuildHeight() + editSession.getHighestTerrainBlock(region
|
||||||
.getMinimumPoint()
|
.getMinimumPoint()
|
||||||
.getX() + 1, region.getMinimumPoint().getZ() + 1, pw.getMinGenHeight(), pw.getMaxGenHeight()
|
.x() + 1, region.getMinimumPoint().z() + 1, pw.getMinGenHeight(), pw.getMaxGenHeight()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ public class FaweDelegateSchematicHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final BlockVector3 to = BlockVector3
|
final BlockVector3 to = BlockVector3
|
||||||
.at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
|
.at(region.getMinimumPoint().x() + xOffset, y_offset_actual, region.getMinimumPoint().z() + zOffset);
|
||||||
final Clipboard clipboard = schematic.getClipboard();
|
final Clipboard clipboard = schematic.getClipboard();
|
||||||
clipboard.setOrigin(clipboard.getRegion().getMinimumPoint());
|
clipboard.setOrigin(clipboard.getRegion().getMinimumPoint());
|
||||||
clipboard.paste(editSession, to, true, false, true);
|
clipboard.paste(editSession, to, true, false, true);
|
||||||
|
@ -159,8 +159,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
regions = WEManager.getMask(pp);
|
regions = WEManager.getMask(pp);
|
||||||
if (regions.size() == 1) {
|
if (regions.size() == 1) {
|
||||||
CuboidRegion region = regions.iterator().next();
|
CuboidRegion region = regions.iterator().next();
|
||||||
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE
|
if (region.getMinimumPoint().x() == Integer.MIN_VALUE
|
||||||
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
|
&& region.getMaximumPoint().x() == Integer.MAX_VALUE) {
|
||||||
regions.clear();
|
regions.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public enum BukkitAdapter {
|
|||||||
Vector3 position = location;
|
Vector3 position = location;
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
adapt((World) location.getExtent()),
|
adapt((World) location.getExtent()),
|
||||||
position.getX(), position.getY(), position.getZ(),
|
position.x(), position.y(), position.z(),
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch()
|
location.getPitch()
|
||||||
);
|
);
|
||||||
@ -258,7 +258,7 @@ public enum BukkitAdapter {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
position.getX(), position.getY(), position.getZ()
|
position.x(), position.y(), position.z()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ public enum BukkitAdapter {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
position.getX(), position.getY(), position.getZ()
|
position.x(), position.y(), position.z()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ public enum BukkitAdapter {
|
|||||||
checkNotNull(location);
|
checkNotNull(location);
|
||||||
return new org.bukkit.Location(
|
return new org.bukkit.Location(
|
||||||
world,
|
world,
|
||||||
location.getX(), location.getY(), location.getZ(),
|
location.x(), location.y(), location.z(),
|
||||||
location.getYaw(),
|
location.getYaw(),
|
||||||
location.getPitch()
|
location.getPitch()
|
||||||
);
|
);
|
||||||
|
@ -242,9 +242,9 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
//FAWE end
|
//FAWE end
|
||||||
return TaskManager.taskManager().sync(() -> player.teleport(new Location(
|
return TaskManager.taskManager().sync(() -> player.teleport(new Location(
|
||||||
finalWorld,
|
finalWorld,
|
||||||
pos.getX(),
|
pos.x(),
|
||||||
pos.getY(),
|
pos.y(),
|
||||||
pos.getZ(),
|
pos.z(),
|
||||||
yaw,
|
yaw,
|
||||||
pitch
|
pitch
|
||||||
)));
|
)));
|
||||||
@ -422,7 +422,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
|
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
|
||||||
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
|
Location loc = new Location(player.getWorld(), pos.x(), pos.y(), pos.z());
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
|
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
|
||||||
} else {
|
} else {
|
||||||
|
@ -247,7 +247,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
//FAWE start - safe edit region
|
//FAWE start - safe edit region
|
||||||
testCoords(pt);
|
testCoords(pt);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
|
return getWorld().getBlockAt(pt.x(), pt.y(), pt.z()).getLightLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -284,7 +284,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
Block block = getWorld().getBlockAt(pt.x(), pt.y(), pt.z());
|
||||||
BlockState state = PaperLib.getBlockState(block, false).getState();
|
BlockState state = PaperLib.getBlockState(block, false).getState();
|
||||||
if (!(state instanceof InventoryHolder)) {
|
if (!(state instanceof InventoryHolder)) {
|
||||||
return false;
|
return false;
|
||||||
@ -363,8 +363,8 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
//FAWE end
|
//FAWE end
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
//FAWE start
|
//FAWE start
|
||||||
int X = pt.getBlockX() >> 4;
|
int X = pt.x() >> 4;
|
||||||
int Z = pt.getBlockZ() >> 4;
|
int Z = pt.z() >> 4;
|
||||||
if (Fawe.isMainThread()) {
|
if (Fawe.isMainThread()) {
|
||||||
world.getChunkAt(X, Z);
|
world.getChunkAt(X, Z);
|
||||||
} else if (PaperLib.isPaper()) {
|
} else if (PaperLib.isPaper()) {
|
||||||
@ -413,7 +413,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
|
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
for (BlockVector2 chunkPos : chunks) {
|
for (BlockVector2 chunkPos : chunks) {
|
||||||
world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ());
|
world.refreshChunk(chunkPos.x(), chunkPos.z());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,13 +495,13 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
//FAWE start - safe edit region
|
//FAWE start - safe edit region
|
||||||
testCoords(pt);
|
testCoords(pt);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
getWorld().getBlockAt(pt.x(), pt.y(), pt.z()).breakNaturally();
|
||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public Collection<BaseItemStack> getBlockDrops(BlockVector3 position) {
|
public Collection<BaseItemStack> getBlockDrops(BlockVector3 position) {
|
||||||
return getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()).getDrops().stream()
|
return getWorld().getBlockAt(position.x(), position.y(), position.z()).getDrops().stream()
|
||||||
.map(BukkitAdapter::adapt).collect(Collectors.toList());
|
.map(BukkitAdapter::adapt).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
//FAWE end
|
//FAWE end
|
||||||
@ -538,7 +538,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WorldEditPlugin.getInstance().getLocalConfiguration().unsupportedVersionEditing) {
|
if (WorldEditPlugin.getInstance().getLocalConfiguration().unsupportedVersionEditing) {
|
||||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
Block bukkitBlock = getWorld().getBlockAt(position.x(), position.y(), position.z());
|
||||||
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException(new UnsupportedVersionEditException());
|
throw new RuntimeException(new UnsupportedVersionEditException());
|
||||||
@ -562,7 +562,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
Block bukkitBlock = getWorld().getBlockAt(position.x(), position.y(), position.z());
|
||||||
bukkitBlock.setBlockData(BukkitAdapter.adapt(block), sideEffects.doesApplyAny());
|
bukkitBlock.setBlockData(BukkitAdapter.adapt(block), sideEffects.doesApplyAny());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -584,8 +584,8 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
if (!Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) {
|
if (!Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int x = position.getX();
|
int x = position.x();
|
||||||
int z = position.getZ();
|
int z = position.z();
|
||||||
if (x > 30000000 || z > 30000000 || x < -30000000 || z < -30000000) {
|
if (x > 30000000 || z > 30000000 || x < -30000000 || z < -30000000) {
|
||||||
throw FaweCache.OUTSIDE_SAFE_REGION;
|
throw FaweCache.OUTSIDE_SAFE_REGION;
|
||||||
}
|
}
|
||||||
@ -636,9 +636,9 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
testCoords(position);
|
testCoords(position);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
if (HAS_3D_BIOMES) {
|
if (HAS_3D_BIOMES) {
|
||||||
return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
|
return BukkitAdapter.adapt(getWorld().getBiome(position.x(), position.y(), position.z()));
|
||||||
} else {
|
} else {
|
||||||
return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
|
return BukkitAdapter.adapt(getWorld().getBiome(position.x(), position.z()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,9 +649,9 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
testCoords(position);
|
testCoords(position);
|
||||||
//FAWE end
|
//FAWE end
|
||||||
if (HAS_3D_BIOMES) {
|
if (HAS_3D_BIOMES) {
|
||||||
getWorld().setBiome(position.getBlockX(), position.getBlockY(), position.getBlockZ(), BukkitAdapter.adapt(biome));
|
getWorld().setBiome(position.x(), position.y(), position.z(), BukkitAdapter.adapt(biome));
|
||||||
} else {
|
} else {
|
||||||
getWorld().setBiome(position.getBlockX(), position.getBlockZ(), BukkitAdapter.adapt(biome));
|
getWorld().setBiome(position.x(), position.z(), BukkitAdapter.adapt(biome));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -339,11 +339,11 @@ public class FaweAPI {
|
|||||||
final BlockVector3 bot = selection.getMinimumPoint();
|
final BlockVector3 bot = selection.getMinimumPoint();
|
||||||
final BlockVector3 top = selection.getMaximumPoint();
|
final BlockVector3 top = selection.getMaximumPoint();
|
||||||
|
|
||||||
final int minX = bot.getBlockX() >> 4;
|
final int minX = bot.x() >> 4;
|
||||||
final int minZ = bot.getBlockZ() >> 4;
|
final int minZ = bot.z() >> 4;
|
||||||
|
|
||||||
final int maxX = top.getBlockX() >> 4;
|
final int maxX = top.x() >> 4;
|
||||||
final int maxZ = top.getBlockZ() >> 4;
|
final int maxZ = top.z() >> 4;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ public class BlendBall implements Brush {
|
|||||||
final int outsetSize = (int) (size + 1);
|
final int outsetSize = (int) (size + 1);
|
||||||
double brushSizeSquared = size * size;
|
double brushSizeSquared = size * size;
|
||||||
|
|
||||||
int tx = position.getBlockX();
|
int tx = position.x();
|
||||||
int ty = position.getBlockY();
|
int ty = position.y();
|
||||||
int tz = position.getBlockZ();
|
int tz = position.z();
|
||||||
|
|
||||||
int[] frequency = new int[BlockTypes.size()];
|
int[] frequency = new int[BlockTypes.size()];
|
||||||
|
|
||||||
|
@ -81,9 +81,9 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
|||||||
return pos1.add(pos2).divide(2).toBlockPoint();
|
return pos1.add(pos2).divide(2).toBlockPoint();
|
||||||
}
|
}
|
||||||
double curveLen = pos1.distance(pos2) * lenPercent;
|
double curveLen = pos1.distance(pos2) * lenPercent;
|
||||||
double dy = pos2.getY() - pos1.getY();
|
double dy = pos2.y() - pos1.y();
|
||||||
double dx = pos2.getX() - pos1.getX();
|
double dx = pos2.x() - pos1.x();
|
||||||
double dz = pos2.getZ() - pos1.getZ();
|
double dz = pos2.z() - pos1.z();
|
||||||
double dh = Math.sqrt(dx * dx + dz * dz);
|
double dh = Math.sqrt(dx * dx + dz * dz);
|
||||||
double g = Math.sqrt(curveLen * curveLen - dy * dy) / 2;
|
double g = Math.sqrt(curveLen * curveLen - dy * dy) / 2;
|
||||||
double a = 0.00001;
|
double a = 0.00001;
|
||||||
|
@ -54,9 +54,9 @@ public class CommandBrush implements Brush {
|
|||||||
position.subtract(radius, radius, radius),
|
position.subtract(radius, radius, radius),
|
||||||
position.add(radius, radius, radius)
|
position.add(radius, radius, radius)
|
||||||
);
|
);
|
||||||
String replaced = command.replace("{x}", Integer.toString(position.getBlockX()))
|
String replaced = command.replace("{x}", Integer.toString(position.x()))
|
||||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
.replace("{y}", Integer.toString(position.y()))
|
||||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
.replace("{z}", Integer.toString(position.z()))
|
||||||
.replace("{world}", editSession.getWorld().getName())
|
.replace("{world}", editSession.getWorld().getName())
|
||||||
.replace("{size}", Integer.toString(radius));
|
.replace("{size}", Integer.toString(radius));
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
|||||||
mask = Masks.alwaysTrue();
|
mask = Masks.alwaysTrue();
|
||||||
}
|
}
|
||||||
final ResizableClipboardBuilder builder = new ResizableClipboardBuilder(editSession.getWorld());
|
final ResizableClipboardBuilder builder = new ResizableClipboardBuilder(editSession.getWorld());
|
||||||
final int minY = position.getBlockY();
|
final int minY = position.y();
|
||||||
mask = new AbstractDelegateMask(mask) {
|
mask = new AbstractDelegateMask(mask) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (super.test(vector) && vector.getBlockY() >= minY) {
|
if (super.test(vector) && vector.y() >= minY) {
|
||||||
BaseBlock block = editSession.getFullBlock(vector);
|
BaseBlock block = editSession.getFullBlock(vector);
|
||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
builder.add(vector, BlockTypes.AIR.getDefaultState().toBaseBlock(), block);
|
builder.add(vector, BlockTypes.AIR.getDefaultState().toBaseBlock(), block);
|
||||||
|
@ -63,9 +63,9 @@ public class ErodeBrush implements Brush {
|
|||||||
Clipboard buffer1 = new CPUOptimizedClipboard(region);
|
Clipboard buffer1 = new CPUOptimizedClipboard(region);
|
||||||
Clipboard buffer2 = new CPUOptimizedClipboard(region);
|
Clipboard buffer2 = new CPUOptimizedClipboard(region);
|
||||||
|
|
||||||
final int bx = target.getBlockX();
|
final int bx = target.x();
|
||||||
final int by = target.getBlockY();
|
final int by = target.y();
|
||||||
final int bz = target.getBlockZ();
|
final int bz = target.z();
|
||||||
|
|
||||||
for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) {
|
for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) {
|
||||||
int x0 = x + bx;
|
int x0 = x + bx;
|
||||||
@ -106,7 +106,7 @@ public class ErodeBrush implements Brush {
|
|||||||
|
|
||||||
for (BlockVector3 pos : finalBuffer) {
|
for (BlockVector3 pos : finalBuffer) {
|
||||||
BlockState block = pos.getBlock(finalBuffer);
|
BlockState block = pos.getBlock(finalBuffer);
|
||||||
es.setBlock(pos.getX() + bx - brushSize, pos.getY() + by - brushSize, pos.getZ() + bz - brushSize, block);
|
es.setBlock(pos.x() + bx - brushSize, pos.y() + by - brushSize, pos.z() + bz - brushSize, block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,9 +139,9 @@ public class ErodeBrush implements Brush {
|
|||||||
int highest = 1;
|
int highest = 1;
|
||||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||||
BaseBlock next = current.getFullBlock(
|
BaseBlock next = current.getFullBlock(
|
||||||
relx + offs.getBlockX(),
|
relx + offs.x(),
|
||||||
rely + offs.getBlockY(),
|
rely + offs.y(),
|
||||||
relz + offs.getBlockZ()
|
relz + offs.z()
|
||||||
);
|
);
|
||||||
if (!next.getBlockType().getMaterial().isMovementBlocker()) {
|
if (!next.getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
continue;
|
continue;
|
||||||
@ -190,9 +190,9 @@ public class ErodeBrush implements Brush {
|
|||||||
int total = 0;
|
int total = 0;
|
||||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||||
BaseBlock next = current.getFullBlock(
|
BaseBlock next = current.getFullBlock(
|
||||||
relx + offs.getBlockX(),
|
relx + offs.x(),
|
||||||
rely + offs.getBlockY(),
|
rely + offs.y(),
|
||||||
relz + offs.getBlockZ()
|
relz + offs.z()
|
||||||
);
|
);
|
||||||
if (next.getMaterial().isMovementBlocker()) {
|
if (next.getMaterial().isMovementBlocker()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -12,9 +12,9 @@ public class FallingSphere implements Brush {
|
|||||||
@Override
|
@Override
|
||||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws
|
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws
|
||||||
MaxChangedBlocksException {
|
MaxChangedBlocksException {
|
||||||
int px = position.getBlockX();
|
int px = position.x();
|
||||||
int py = position.getBlockY();
|
int py = position.y();
|
||||||
int pz = position.getBlockZ();
|
int pz = position.z();
|
||||||
int maxY = editSession.getMaxY();
|
int maxY = editSession.getMaxY();
|
||||||
int minY = editSession.getMinY();
|
int minY = editSession.getMinY();
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import com.sk89q.worldedit.command.tool.BrushTool;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@ -25,7 +24,6 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -80,9 +78,9 @@ public class InspectBrush extends BrushTool {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BlockVector3 target = targetVector.toBlockPoint();
|
BlockVector3 target = targetVector.toBlockPoint();
|
||||||
final int x = target.getBlockX();
|
final int x = target.x();
|
||||||
final int y = target.getBlockY();
|
final int y = target.y();
|
||||||
final int z = target.getBlockZ();
|
final int z = target.z();
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
RollbackDatabase db = DBHandler.dbHandler().getDatabase(world);
|
RollbackDatabase db = DBHandler.dbHandler().getDatabase(world);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -35,7 +35,7 @@ public record RecurseBrush(boolean dfs) implements Brush {
|
|||||||
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, replace, Integer.MAX_VALUE, Integer.MAX_VALUE) {
|
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, replace, Integer.MAX_VALUE, Integer.MAX_VALUE) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||||
int y = to.getBlockY();
|
int y = to.y();
|
||||||
return y < maxY && radMask.test(to) && super.isVisitable(from, to);
|
return y < maxY && radMask.test(to) && super.isVisitable(from, to);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -45,7 +45,7 @@ public record RecurseBrush(boolean dfs) implements Brush {
|
|||||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession.getMinY(), editSession.getMaxY()) {
|
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession.getMinY(), editSession.getMaxY()) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||||
int y = to.getBlockY();
|
int y = to.y();
|
||||||
return y < maxY && super.isVisitable(from, to);
|
return y < maxY && super.isVisitable(from, to);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -19,15 +19,15 @@ public record RockBrush(double amplitude, double frequency, Vector3 radius) impl
|
|||||||
double seedY = ThreadLocalRandom.current().nextDouble();
|
double seedY = ThreadLocalRandom.current().nextDouble();
|
||||||
double seedZ = ThreadLocalRandom.current().nextDouble();
|
double seedZ = ThreadLocalRandom.current().nextDouble();
|
||||||
|
|
||||||
int px = position.getBlockX();
|
int px = position.x();
|
||||||
int py = position.getBlockY();
|
int py = position.y();
|
||||||
int pz = position.getBlockZ();
|
int pz = position.z();
|
||||||
|
|
||||||
double distort = this.frequency / size;
|
double distort = this.frequency / size;
|
||||||
|
|
||||||
double modX = 1D / radius.getX();
|
double modX = 1D / radius.x();
|
||||||
double modY = 1D / radius.getY();
|
double modY = 1D / radius.y();
|
||||||
double modZ = 1D / radius.getZ();
|
double modZ = 1D / radius.z();
|
||||||
|
|
||||||
int radiusSqr = (int) (size * size);
|
int radiusSqr = (int) (size * size);
|
||||||
int sizeInt = (int) size * 2;
|
int sizeInt = (int) size * 2;
|
||||||
|
@ -67,15 +67,15 @@ public class ScatterBrush implements Brush {
|
|||||||
}
|
}
|
||||||
BlockVector3 patternSize = pattern.size();
|
BlockVector3 patternSize = pattern.size();
|
||||||
BlockVector3Set placed = BlockVector3Set.getAppropriateVectorSet(patternSize.add(distance, distance, distance));
|
BlockVector3Set placed = BlockVector3Set.getAppropriateVectorSet(patternSize.add(distance, distance, distance));
|
||||||
placed.setOffset(position.getX(), position.getY(), position.getZ());
|
placed.setOffset(position.x(), position.y(), position.z());
|
||||||
int maxFails = 1000;
|
int maxFails = 1000;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
int index = ThreadLocalRandom.current().nextInt(length);
|
int index = ThreadLocalRandom.current().nextInt(length);
|
||||||
BlockVector3 pos = visited.get(index);
|
BlockVector3 pos = visited.get(index);
|
||||||
if (pos != null && canApply(pos)) {
|
if (pos != null && canApply(pos)) {
|
||||||
int x = pos.getBlockX();
|
int x = pos.x();
|
||||||
int y = pos.getBlockY();
|
int y = pos.y();
|
||||||
int z = pos.getBlockZ();
|
int z = pos.z();
|
||||||
if (placed.containsRadius(x, y, z, distance)) {
|
if (placed.containsRadius(x, y, z, distance)) {
|
||||||
if (maxFails-- <= 0) {
|
if (maxFails-- <= 0) {
|
||||||
break;
|
break;
|
||||||
|
@ -45,9 +45,9 @@ public class ScatterCommand extends ScatterBrush {
|
|||||||
position.subtract(radius, radius, radius),
|
position.subtract(radius, radius, radius),
|
||||||
position.add(radius, radius, radius)
|
position.add(radius, radius, radius)
|
||||||
);
|
);
|
||||||
String replaced = command.replace("{x}", Integer.toString(position.getBlockX()))
|
String replaced = command.replace("{x}", Integer.toString(position.x()))
|
||||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
.replace("{y}", Integer.toString(position.y()))
|
||||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
.replace("{z}", Integer.toString(position.z()))
|
||||||
.replace("{world}", editSession.getWorld().getName())
|
.replace("{world}", editSession.getWorld().getName())
|
||||||
.replace("{size}", Integer.toString(radius));
|
.replace("{size}", Integer.toString(radius));
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
|||||||
@Override
|
@Override
|
||||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws
|
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws
|
||||||
MaxChangedBlocksException {
|
MaxChangedBlocksException {
|
||||||
final int x = pt.getBlockX();
|
final int x = pt.x();
|
||||||
final int y = pt.getBlockY();
|
final int y = pt.y();
|
||||||
final int z = pt.getBlockZ();
|
final int z = pt.z();
|
||||||
BlockVector3 dir = getDirection(pt);
|
BlockVector3 dir = getDirection(pt);
|
||||||
if (dir == null) {
|
if (dir == null) {
|
||||||
getDir:
|
getDir:
|
||||||
@ -37,7 +37,7 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
editSession.setBlock(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ(), p);
|
editSession.setBlock(x + dir.x(), y + dir.y(), z + dir.z(), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,13 @@ public class ShatterBrush extends ScatterBrush {
|
|||||||
}
|
}
|
||||||
for (int i1 = 0; i1 < BreadthFirstSearch.DIAGONAL_DIRECTIONS.length; i1++) {
|
for (int i1 = 0; i1 < BreadthFirstSearch.DIAGONAL_DIRECTIONS.length; i1++) {
|
||||||
BlockVector3 direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i1];
|
BlockVector3 direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i1];
|
||||||
int x2 = x + direction.getBlockX();
|
int x2 = x + direction.x();
|
||||||
int y2 = y + direction.getBlockY();
|
int y2 = y + direction.y();
|
||||||
int z2 = z + direction.getBlockZ();
|
int z2 = z + direction.z();
|
||||||
// Check boundary
|
// Check boundary
|
||||||
int dx = position.getBlockX() - x2;
|
int dx = position.x() - x2;
|
||||||
int dy = position.getBlockY() - y2;
|
int dy = position.y() - y2;
|
||||||
int dz = position.getBlockZ() - z2;
|
int dz = position.z() - z2;
|
||||||
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
||||||
if (dSqr <= radius2) {
|
if (dSqr <= radius2) {
|
||||||
BlockVector3 bv = mutable.setComponents(x2, y2, z2);
|
BlockVector3 bv = mutable.setComponents(x2, y2, z2);
|
||||||
|
@ -130,9 +130,9 @@ public class SplineBrush implements Brush, ResettableTool {
|
|||||||
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
||||||
MutableVector3 sum = new MutableVector3();
|
MutableVector3 sum = new MutableVector3();
|
||||||
for (BlockVector3 p : points) {
|
for (BlockVector3 p : points) {
|
||||||
sum.mutX(sum.getX() + p.getX());
|
sum.mutX(sum.x() + p.x());
|
||||||
sum.mutY(sum.getY() + p.getY());
|
sum.mutY(sum.y() + p.y());
|
||||||
sum.mutZ(sum.getZ() + p.getZ());
|
sum.mutZ(sum.z() + p.z());
|
||||||
}
|
}
|
||||||
return sum.multiply(1.0 / points.size());
|
return sum.multiply(1.0 / points.size());
|
||||||
}
|
}
|
||||||
|
@ -38,16 +38,16 @@ public class SurfaceSpline implements Brush {
|
|||||||
int minY = editSession.getMinY();
|
int minY = editSession.getMinY();
|
||||||
if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) {
|
if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) {
|
||||||
int max = editSession.getNearestSurfaceTerrainBlock(
|
int max = editSession.getNearestSurfaceTerrainBlock(
|
||||||
pos.getBlockX(),
|
pos.x(),
|
||||||
pos.getBlockZ(),
|
pos.z(),
|
||||||
pos.getBlockY(),
|
pos.y(),
|
||||||
minY,
|
minY,
|
||||||
maxY
|
maxY
|
||||||
);
|
);
|
||||||
if (max == -1) {
|
if (max == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ()));
|
path.add(BlockVector3.at(pos.x(), max, pos.z()));
|
||||||
if (editSession.getActor() != null) {
|
if (editSession.getActor() != null) {
|
||||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||||
}
|
}
|
||||||
@ -69,9 +69,9 @@ public class SurfaceSpline implements Brush {
|
|||||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||||
for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
|
for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
|
||||||
final Vector3 tipv = interpol.getPosition(loop);
|
final Vector3 tipv = interpol.getPosition(loop);
|
||||||
final int tipx = MathMan.roundInt(tipv.getX());
|
final int tipx = MathMan.roundInt(tipv.x());
|
||||||
final int tipz = (int) tipv.getZ();
|
final int tipz = (int) tipv.z();
|
||||||
int tipy = MathMan.roundInt(tipv.getY());
|
int tipy = MathMan.roundInt(tipv.y());
|
||||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||||
if (tipy == Integer.MIN_VALUE || tipy == Integer.MAX_VALUE) {
|
if (tipy == Integer.MIN_VALUE || tipy == Integer.MAX_VALUE) {
|
||||||
continue;
|
continue;
|
||||||
@ -88,15 +88,15 @@ public class SurfaceSpline implements Brush {
|
|||||||
LocalBlockVectorSet newSet = new LocalBlockVectorSet();
|
LocalBlockVectorSet newSet = new LocalBlockVectorSet();
|
||||||
final int ceilrad = (int) Math.ceil(radius);
|
final int ceilrad = (int) Math.ceil(radius);
|
||||||
for (BlockVector3 v : vset) {
|
for (BlockVector3 v : vset) {
|
||||||
final int tipx = v.getBlockX();
|
final int tipx = v.x();
|
||||||
final int tipz = v.getBlockZ();
|
final int tipz = v.z();
|
||||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||||
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
||||||
if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
|
if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
|
||||||
int y = editSession.getNearestSurfaceTerrainBlock(
|
int y = editSession.getNearestSurfaceTerrainBlock(
|
||||||
loopx,
|
loopx,
|
||||||
loopz,
|
loopz,
|
||||||
v.getBlockY(),
|
v.y(),
|
||||||
minY,
|
minY,
|
||||||
maxY,
|
maxY,
|
||||||
Integer.MIN_VALUE,
|
Integer.MIN_VALUE,
|
||||||
|
@ -83,7 +83,7 @@ public class ClipboardSpline extends Spline {
|
|||||||
Region region = clipboard.getRegion();
|
Region region = clipboard.getRegion();
|
||||||
BlockVector3 origin = clipboard.getOrigin();
|
BlockVector3 origin = clipboard.getOrigin();
|
||||||
// center = region.getCenter().setY(origin.getY() - 1);
|
// center = region.getCenter().setY(origin.getY() - 1);
|
||||||
center = region.getCenter().withY(origin.getY() - 1).toBlockPoint();
|
center = region.getCenter().withY(origin.y() - 1).toBlockPoint();
|
||||||
this.centerOffset = center.subtract(center.round());
|
this.centerOffset = center.subtract(center.round());
|
||||||
this.center = center.subtract(centerOffset);
|
this.center = center.subtract(centerOffset);
|
||||||
this.transform = transform;
|
this.transform = transform;
|
||||||
@ -108,15 +108,15 @@ public class ClipboardSpline extends Spline {
|
|||||||
clipboardHolder.setTransform(transform);
|
clipboardHolder.setTransform(transform);
|
||||||
|
|
||||||
BlockVector3 functionOffset = target.subtract(clipboard.getOrigin());
|
BlockVector3 functionOffset = target.subtract(clipboard.getOrigin());
|
||||||
final int offX = functionOffset.getBlockX();
|
final int offX = functionOffset.x();
|
||||||
final int offY = functionOffset.getBlockY();
|
final int offY = functionOffset.y();
|
||||||
final int offZ = functionOffset.getBlockZ();
|
final int offZ = functionOffset.z();
|
||||||
|
|
||||||
Operation operation = clipboardHolder
|
Operation operation = clipboardHolder
|
||||||
.createPaste(editSession)
|
.createPaste(editSession)
|
||||||
.to(target)
|
.to(target)
|
||||||
.ignoreAirBlocks(true)
|
.ignoreAirBlocks(true)
|
||||||
.filter(v -> buffer.add(v.getBlockX() + offX, v.getBlockY() + offY, v.getBlockZ() + offZ))
|
.filter(v -> buffer.add(v.x() + offX, v.y() + offY, v.z() + offZ))
|
||||||
.build();
|
.build();
|
||||||
Operations.completeLegacy(operation);
|
Operations.completeLegacy(operation);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public abstract class Spline {
|
|||||||
* 2 dimensional "cross" product. cross2D(v1, v2) = |v1|*|v2|*sin(theta) or v1 X v2 taking Y to be 0
|
* 2 dimensional "cross" product. cross2D(v1, v2) = |v1|*|v2|*sin(theta) or v1 X v2 taking Y to be 0
|
||||||
*/
|
*/
|
||||||
private double cross2D(Vector2 v1, Vector2 v2) {
|
private double cross2D(Vector2 v1, Vector2 v2) {
|
||||||
return v1.getX() * v2.getZ() - v2.getX() * v1.getZ();
|
return v1.x() * v2.z() - v2.x() * v1.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +144,7 @@ public abstract class Spline {
|
|||||||
// Calculate rotation from spline
|
// Calculate rotation from spline
|
||||||
|
|
||||||
Vector3 deriv = interpolation.get1stDerivative(position);
|
Vector3 deriv = interpolation.get1stDerivative(position);
|
||||||
Vector2 deriv2D = Vector2.at(deriv.getX(), deriv.getZ()).normalize();
|
Vector2 deriv2D = Vector2.at(deriv.x(), deriv.z()).normalize();
|
||||||
double angle = Math.toDegrees(
|
double angle = Math.toDegrees(
|
||||||
-Math.atan2(cross2D(direction, deriv2D), direction.dot(deriv2D))
|
-Math.atan2(cross2D(direction, deriv2D), direction.dot(deriv2D))
|
||||||
);
|
);
|
||||||
|
@ -79,13 +79,13 @@ public class SweepBrush implements Brush, ResettableTool {
|
|||||||
Clipboard clipboard = holder.getClipboard();
|
Clipboard clipboard = holder.getClipboard();
|
||||||
|
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
double quality = Math.max(dimensions.getBlockX(), dimensions.getBlockZ());
|
double quality = Math.max(dimensions.x(), dimensions.z());
|
||||||
|
|
||||||
AffineTransform transform = new AffineTransform();
|
AffineTransform transform = new AffineTransform();
|
||||||
|
|
||||||
ClipboardSpline spline = new ClipboardSpline(editSession, holder, interpol, transform, nodes.size());
|
ClipboardSpline spline = new ClipboardSpline(editSession, holder, interpol, transform, nodes.size());
|
||||||
|
|
||||||
if (dimensions.getBlockX() > dimensions.getBlockZ()) {
|
if (dimensions.x() > dimensions.z()) {
|
||||||
spline.setDirection(Vector2.at(0, 1));
|
spline.setDirection(Vector2.at(0, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,13 +179,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
|||||||
}
|
}
|
||||||
try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) {
|
try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) {
|
||||||
stmt.setInt(1, (int) (minTime / 1000));
|
stmt.setInt(1, (int) (minTime / 1000));
|
||||||
stmt.setInt(2, pos1.getBlockX());
|
stmt.setInt(2, pos1.x());
|
||||||
stmt.setInt(3, pos2.getBlockX());
|
stmt.setInt(3, pos2.x());
|
||||||
stmt.setInt(4, pos1.getBlockZ());
|
stmt.setInt(4, pos1.z());
|
||||||
stmt.setInt(5, pos2.getBlockZ());
|
stmt.setInt(5, pos2.z());
|
||||||
// Keep 128 offset for backwards-compatibility
|
// Keep 128 offset for backwards-compatibility
|
||||||
stmt.setInt(6, pos1.getBlockY() - 128);
|
stmt.setInt(6, pos1.y() - 128);
|
||||||
stmt.setInt(7, pos2.getBlockY() - 128);
|
stmt.setInt(7, pos2.y() - 128);
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
byte[] uuidBytes = toBytes(uuid);
|
byte[] uuidBytes = toBytes(uuid);
|
||||||
stmt.setBytes(8, uuidBytes);
|
stmt.setBytes(8, uuidBytes);
|
||||||
@ -210,13 +210,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
|||||||
.array();
|
.array();
|
||||||
stmt.setBytes(1, uuidBytes);
|
stmt.setBytes(1, uuidBytes);
|
||||||
stmt.setInt(2, (int) (minTime / 1000));
|
stmt.setInt(2, (int) (minTime / 1000));
|
||||||
stmt.setInt(3, pos1.getBlockX());
|
stmt.setInt(3, pos1.x());
|
||||||
stmt.setInt(4, pos2.getBlockX());
|
stmt.setInt(4, pos2.x());
|
||||||
stmt.setInt(5, pos1.getBlockZ());
|
stmt.setInt(5, pos1.z());
|
||||||
stmt.setInt(6, pos2.getBlockZ());
|
stmt.setInt(6, pos2.z());
|
||||||
// Keep 128 offset for backwards-compatibility
|
// Keep 128 offset for backwards-compatibility
|
||||||
stmt.setInt(7, pos1.getBlockY() - 128);
|
stmt.setInt(7, pos1.y() - 128);
|
||||||
stmt.setInt(8, pos2.getBlockY() - 128);
|
stmt.setInt(8, pos2.y() - 128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
@ -262,13 +262,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
|||||||
BlockVector3 pos1 = change.getMinimumPoint();
|
BlockVector3 pos1 = change.getMinimumPoint();
|
||||||
BlockVector3 pos2 = change.getMaximumPoint();
|
BlockVector3 pos2 = change.getMaximumPoint();
|
||||||
|
|
||||||
stmt.setInt(4, pos1.getX());
|
stmt.setInt(4, pos1.x());
|
||||||
stmt.setInt(5, pos2.getX());
|
stmt.setInt(5, pos2.x());
|
||||||
stmt.setInt(6, pos1.getZ());
|
stmt.setInt(6, pos1.z());
|
||||||
stmt.setInt(7, pos2.getZ());
|
stmt.setInt(7, pos2.z());
|
||||||
// Keep 128 offset for backwards-compatibility
|
// Keep 128 offset for backwards-compatibility
|
||||||
stmt.setInt(8, pos1.getY() - 128);
|
stmt.setInt(8, pos1.y() - 128);
|
||||||
stmt.setInt(9, pos2.getY() - 128);
|
stmt.setInt(9, pos2.y() - 128);
|
||||||
stmt.setString(10, change.getCommand());
|
stmt.setString(10, change.getCommand());
|
||||||
stmt.setInt(11, change.size());
|
stmt.setInt(11, change.size());
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
@ -24,7 +24,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||||
return getExtent().setBlock(location.getX() + dx, location.getY() + dy, location.getZ() + dz, block);
|
return getExtent().setBlock(location.x() + dx, location.y() + dy, location.z() + dz, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +49,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(BlockVector3 location) {
|
public BlockState getBlock(BlockVector3 location) {
|
||||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
return getBlock(location.x(), location.y(), location.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,11 +64,11 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean contains(BlockVector3 p) {
|
public final boolean contains(BlockVector3 p) {
|
||||||
return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ());
|
return contains(p.x(), p.y(), p.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean contains(BlockVector2 p) {
|
public final boolean contains(BlockVector2 p) {
|
||||||
return contains(p.getBlockX(), p.getBlockZ());
|
return contains(p.x(), p.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -96,7 +96,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
return getBiomeType(position.getX(), position.getY(), position.getZ());
|
return getBiomeType(position.x(), position.y(), position.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -112,7 +112,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||||
return getFullBlock(position.getX(), position.getY(), position.getZ());
|
return getFullBlock(position.x(), position.y(), position.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -128,7 +128,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(BlockVector3 position) {
|
public BlockState getBlock(BlockVector3 position) {
|
||||||
return getBlock(position.getX(), position.getY(), position.getZ());
|
return getBlock(position.x(), position.y(), position.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,7 +66,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
return setBlock(location.x(), location.y(), location.z(), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -111,7 +111,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
||||||
BiomeType oldBiome = this.getBiome(position);
|
BiomeType oldBiome = this.getBiome(position);
|
||||||
if (!oldBiome.getId().equals(newBiome.getId())) {
|
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome);
|
this.changeSet.addBiomeChange(position.x(), position.y(), position.z(), oldBiome, newBiome);
|
||||||
return getExtent().setBiome(position, newBiome);
|
return getExtent().setBiome(position, newBiome);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -373,12 +373,12 @@ public class LimitExtent extends AbstractDelegateExtent {
|
|||||||
size = ((Collection<BlockVector3>) positions).size();
|
size = ((Collection<BlockVector3>) positions).size();
|
||||||
} else if (positions instanceof Region) {
|
} else if (positions instanceof Region) {
|
||||||
BlockVector3 dim = ((Region) positions).getDimensions();
|
BlockVector3 dim = ((Region) positions).getDimensions();
|
||||||
size = dim.getX() * dim.getY() * dim.getZ();
|
size = dim.x() * dim.y() * dim.z();
|
||||||
} else if (positions instanceof Extent) {
|
} else if (positions instanceof Extent) {
|
||||||
BlockVector3 min = ((Extent) positions).getMinimumPoint();
|
BlockVector3 min = ((Extent) positions).getMinimumPoint();
|
||||||
BlockVector3 max = ((Extent) positions).getMinimumPoint();
|
BlockVector3 max = ((Extent) positions).getMinimumPoint();
|
||||||
BlockVector3 dim = max.subtract(min).add(BlockVector3.ONE);
|
BlockVector3 dim = max.subtract(min).add(BlockVector3.ONE);
|
||||||
size = dim.getX() * dim.getY() * dim.getZ();
|
size = dim.x() * dim.y() * dim.z();
|
||||||
} else {
|
} else {
|
||||||
ExtentFilterBlock block = new ExtentFilterBlock(this);
|
ExtentFilterBlock block = new ExtentFilterBlock(this);
|
||||||
for (BlockVector3 pos : positions) {
|
for (BlockVector3 pos : positions) {
|
||||||
|
@ -38,9 +38,9 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = pos;
|
min = pos;
|
||||||
}
|
}
|
||||||
mutable.mutX(pos.getX() - min.getX());
|
mutable.mutX(pos.x() - min.x());
|
||||||
mutable.mutY(pos.getY() - min.getY());
|
mutable.mutY(pos.y() - min.y());
|
||||||
mutable.mutZ(pos.getZ() - min.getZ());
|
mutable.mutZ(pos.z() - min.z());
|
||||||
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||||
}
|
}
|
||||||
@ -49,9 +49,9 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = BlockVector3.at(x, y, z);
|
min = BlockVector3.at(x, y, z);
|
||||||
}
|
}
|
||||||
mutable.mutX(x - min.getX());
|
mutable.mutX(x - min.x());
|
||||||
mutable.mutY(y - min.getY());
|
mutable.mutY(y - min.y());
|
||||||
mutable.mutZ(z - min.getZ());
|
mutable.mutZ(z - min.z());
|
||||||
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||||
}
|
}
|
||||||
@ -73,10 +73,10 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.x());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.z());
|
||||||
mutable.mutY(position.getBlockY());
|
mutable.mutY(position.y());
|
||||||
return super.getBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()));
|
return super.getBiome(getPos(mutable.x(), mutable.y(), mutable.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,10 +92,10 @@ public class PositionTransformExtent extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
mutable.mutX(position.getBlockX());
|
mutable.mutX(position.x());
|
||||||
mutable.mutZ(position.getBlockZ());
|
mutable.mutZ(position.z());
|
||||||
mutable.mutY(position.getBlockY());
|
mutable.mutY(position.y());
|
||||||
return super.setBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()), biome);
|
return super.setBiome(getPos(mutable.x(), mutable.y(), mutable.z()), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransform(Transform transform) {
|
public void setTransform(Transform transform) {
|
||||||
|
@ -80,12 +80,12 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block)
|
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
return setBlock(location.x(), location.y(), location.z(), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(BlockVector3 location) {
|
public BlockState getBlock(BlockVector3 location) {
|
||||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
return getBlock(location.x(), location.y(), location.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,8 +41,8 @@ public class SourceMaskExtent extends TemporalExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||||
set(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
set(location.x(), location.y(), location.z(), block);
|
||||||
return mask.test(location) && super.setBlock(location.getX(), location.getY(), location.getZ(), block);
|
return mask.test(location) && super.setBlock(location.x(), location.y(), location.z(), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,7 +44,7 @@ public class TemporalExtent extends PassthroughExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(BlockVector3 position) {
|
public BlockState getBlock(BlockVector3 position) {
|
||||||
if (position.getX() == x && position.getY() == y && position.getZ() == z) {
|
if (position.x() == x && position.y() == y && position.z() == z) {
|
||||||
return block.toImmutableState();
|
return block.toImmutableState();
|
||||||
}
|
}
|
||||||
return super.getBlock(position);
|
return super.getBlock(position);
|
||||||
@ -60,7 +60,7 @@ public class TemporalExtent extends PassthroughExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||||
if (position.getX() == x && position.getY() == y && position.getZ() == z) {
|
if (position.x() == x && position.y() == y && position.z() == z) {
|
||||||
if (block instanceof BaseBlock) {
|
if (block instanceof BaseBlock) {
|
||||||
return (BaseBlock) block;
|
return (BaseBlock) block;
|
||||||
} else {
|
} else {
|
||||||
@ -72,7 +72,7 @@ public class TemporalExtent extends PassthroughExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
if (position.getX() == bx && position.getZ() == bz) {
|
if (position.x() == bx && position.z() == bz) {
|
||||||
return biome;
|
return biome;
|
||||||
}
|
}
|
||||||
return super.getBiome(position);
|
return super.getBiome(position);
|
||||||
|
@ -55,13 +55,13 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = pos;
|
min = pos;
|
||||||
}
|
}
|
||||||
mutable1.mutX(pos.getX() - min.getX());
|
mutable1.mutX(pos.x() - min.x());
|
||||||
mutable1.mutY(pos.getY() - min.getY());
|
mutable1.mutY(pos.y() - min.y());
|
||||||
mutable1.mutZ(pos.getZ() - min.getZ());
|
mutable1.mutZ(pos.z() - min.z());
|
||||||
Vector3 tmp = getTransform().apply(mutable1);
|
Vector3 tmp = getTransform().apply(mutable1);
|
||||||
mutable2.mutX(tmp.getX() + min.getX());
|
mutable2.mutX(tmp.x() + min.x());
|
||||||
mutable2.mutY(tmp.getY() + min.getY());
|
mutable2.mutY(tmp.y() + min.y());
|
||||||
mutable2.mutZ(tmp.getZ() + min.getZ());
|
mutable2.mutZ(tmp.z() + min.z());
|
||||||
return mutable2;
|
return mutable2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,20 +69,20 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = BlockVector3.at(x, y, z);
|
min = BlockVector3.at(x, y, z);
|
||||||
}
|
}
|
||||||
mutable1.mutX(x - min.getX());
|
mutable1.mutX(x - min.x());
|
||||||
mutable1.mutY(y - min.getY());
|
mutable1.mutY(y - min.y());
|
||||||
mutable1.mutZ(z - min.getZ());
|
mutable1.mutZ(z - min.z());
|
||||||
Vector3 tmp = getTransform().apply(mutable1);
|
Vector3 tmp = getTransform().apply(mutable1);
|
||||||
mutable2.mutX(tmp.getX() + min.getX());
|
mutable2.mutX(tmp.x() + min.x());
|
||||||
mutable2.mutY(tmp.getY() + min.getY());
|
mutable2.mutY(tmp.y() + min.y());
|
||||||
mutable2.mutZ(tmp.getZ() + min.getZ());
|
mutable2.mutZ(tmp.z() + min.z());
|
||||||
return tmp.toBlockPoint();
|
return tmp.toBlockPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(int x, int y, int z) {
|
public BlockState getBlock(int x, int y, int z) {
|
||||||
BlockVector3 p = getPos(x, y, z);
|
BlockVector3 p = getPos(x, y, z);
|
||||||
return transform(super.getBlock(p.getX(), p.getY(), p.getZ()));
|
return transform(super.getBlock(p.x(), p.y(), p.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -93,7 +93,7 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
@Override
|
@Override
|
||||||
public BiomeType getBiomeType(int x, int y, int z) {
|
public BiomeType getBiomeType(int x, int y, int z) {
|
||||||
BlockVector3 p = getPos(x, y, z);
|
BlockVector3 p = getPos(x, y, z);
|
||||||
return super.getBiomeType(p.getX(), y, p.getZ());
|
return super.getBiomeType(p.x(), y, p.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -114,7 +114,7 @@ public class TransformExtent extends BlockTransformExtent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||||
BlockVector3 p = getPos(x, y, z);
|
BlockVector3 p = getPos(x, y, z);
|
||||||
return super.setBiome(p.getX(), p.getY(), p.getZ(), biome);
|
return super.setBiome(p.x(), p.y(), p.z(), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,7 +92,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ()));
|
return getBiome(getBiomeIndex(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertTilesToIndex() {
|
public void convertTilesToIndex() {
|
||||||
|
@ -359,7 +359,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -417,7 +417,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ()));
|
return getBiome(getBiomeIndex(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockArrayClipboard toClipboard() {
|
public BlockArrayClipboard toClipboard() {
|
||||||
@ -438,9 +438,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
super.setOrigin(origin);
|
super.setOrigin(origin);
|
||||||
origin = origin.subtract(offset);
|
origin = origin.subtract(offset);
|
||||||
try {
|
try {
|
||||||
byteBuffer.putShort(10, (short) origin.getBlockX());
|
byteBuffer.putShort(10, (short) origin.x());
|
||||||
byteBuffer.putShort(12, (short) origin.getBlockY());
|
byteBuffer.putShort(12, (short) origin.y());
|
||||||
byteBuffer.putShort(14, (short) origin.getBlockZ());
|
byteBuffer.putShort(14, (short) origin.z());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -450,9 +450,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
protected void setOffset(BlockVector3 offset) {
|
protected void setOffset(BlockVector3 offset) {
|
||||||
super.setOffset(offset);
|
super.setOffset(offset);
|
||||||
try {
|
try {
|
||||||
byteBuffer.putShort(16, (short) offset.getBlockX());
|
byteBuffer.putShort(16, (short) offset.x());
|
||||||
byteBuffer.putShort(18, (short) offset.getBlockY());
|
byteBuffer.putShort(18, (short) offset.y());
|
||||||
byteBuffer.putShort(20, (short) offset.getBlockZ());
|
byteBuffer.putShort(20, (short) offset.z());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -588,9 +588,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
CompoundTag data = entity.getState().getNbtData();
|
CompoundTag data = entity.getState().getNbtData();
|
||||||
HashMap<String, Tag> value = new HashMap<>(data.getValue());
|
HashMap<String, Tag> value = new HashMap<>(data.getValue());
|
||||||
List<DoubleTag> pos = new ArrayList<>(3);
|
List<DoubleTag> pos = new ArrayList<>(3);
|
||||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||||
value.put("Pos", new ListTag(DoubleTag.class, pos));
|
value.put("Pos", new ListTag(DoubleTag.class, pos));
|
||||||
nbtOS.writeTag(new CompoundTag(value));
|
nbtOS.writeTag(new CompoundTag(value));
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
return setBiome(position.x(), position.y(), position.z(), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,7 +115,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
return getBiome(getBiomeIndex(position.getX(), position.getY(), position.getZ()));
|
return getBiome(getBiomeIndex(position.x(), position.y(), position.z()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getOrdinal(int index) {
|
private int getOrdinal(int index) {
|
||||||
|
@ -70,17 +70,17 @@ public abstract class SimpleClipboard implements Clipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final int getWidth() {
|
public final int getWidth() {
|
||||||
return size.getBlockX();
|
return size.x();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final int getHeight() {
|
public final int getHeight() {
|
||||||
return size.getBlockY();
|
return size.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final int getLength() {
|
public final int getLength() {
|
||||||
return size.getBlockZ();
|
return size.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,7 +56,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
return getExtent().getBiomeType(position.getX(), position.getY(), position.getZ());
|
return getExtent().getBiomeType(position.x(), position.y(), position.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -396,8 +396,8 @@ public class FastSchematicReader extends NBTSchematicReader {
|
|||||||
int locY = loc.getBlockY();
|
int locY = loc.getBlockY();
|
||||||
int locZ = loc.getBlockZ();
|
int locZ = loc.getBlockZ();
|
||||||
BlockVector3 max = min.add(dimensions).subtract(BlockVector3.ONE);
|
BlockVector3 max = min.add(dimensions).subtract(BlockVector3.ONE);
|
||||||
if (locX < min.getX() || locY < min.getY() || locZ < min.getZ()
|
if (locX < min.x() || locY < min.y() || locZ < min.z()
|
||||||
|| locX > max.getX() || locY > max.getY() || locZ > max.getZ()) {
|
|| locX > max.x() || locY > max.y() || locZ > max.z()) {
|
||||||
for (Entity e : clipboard.getEntities()) {
|
for (Entity e : clipboard.getEntities()) {
|
||||||
clipboard.removeEntity(e);
|
clipboard.removeEntity(e);
|
||||||
}
|
}
|
||||||
|
@ -114,15 +114,15 @@ public class FastSchematicWriter implements ClipboardWriter {
|
|||||||
|
|
||||||
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
||||||
out.writeNamedTag("Offset", new int[]{
|
out.writeNamedTag("Offset", new int[]{
|
||||||
min.getBlockX(),
|
min.x(),
|
||||||
min.getBlockY(),
|
min.y(),
|
||||||
min.getBlockZ(),
|
min.z(),
|
||||||
});
|
});
|
||||||
|
|
||||||
out.writeLazyCompoundTag("Metadata", out1 -> {
|
out.writeLazyCompoundTag("Metadata", out1 -> {
|
||||||
out1.writeNamedTag("WEOffsetX", offset.getBlockX());
|
out1.writeNamedTag("WEOffsetX", offset.x());
|
||||||
out1.writeNamedTag("WEOffsetY", offset.getBlockY());
|
out1.writeNamedTag("WEOffsetY", offset.y());
|
||||||
out1.writeNamedTag("WEOffsetZ", offset.getBlockZ());
|
out1.writeNamedTag("WEOffsetZ", offset.z());
|
||||||
out1.writeNamedTag("FAWEVersion", Fawe.instance().getVersion().build);
|
out1.writeNamedTag("FAWEVersion", Fawe.instance().getVersion().build);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -162,9 +162,9 @@ public class FastSchematicWriter implements ClipboardWriter {
|
|||||||
// Dum.
|
// Dum.
|
||||||
values.remove("id");
|
values.remove("id");
|
||||||
values.put("Pos", new IntArrayTag(new int[]{
|
values.put("Pos", new IntArrayTag(new int[]{
|
||||||
pos.getX(),
|
pos.x(),
|
||||||
pos.getY(),
|
pos.y(),
|
||||||
pos.getZ()
|
pos.z()
|
||||||
}));
|
}));
|
||||||
numTiles++;
|
numTiles++;
|
||||||
|
|
||||||
@ -282,10 +282,10 @@ public class FastSchematicWriter implements ClipboardWriter {
|
|||||||
int length = clipboard.getRegion().getLength();
|
int length = clipboard.getRegion().getLength();
|
||||||
MutableBlockVector3 mutable = new MutableBlockVector3();
|
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||||
for (int z = 0, i = 0; z < length; z++) {
|
for (int z = 0, i = 0; z < length; z++) {
|
||||||
int z0 = min.getBlockZ() + z;
|
int z0 = min.z() + z;
|
||||||
for (int x = 0; x < width; x++, i++) {
|
for (int x = 0; x < width; x++, i++) {
|
||||||
int x0 = min.getBlockX() + x;
|
int x0 = min.x() + x;
|
||||||
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.getY(), z0));
|
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.y(), z0));
|
||||||
task.applyInt(i, biome.getInternalId());
|
task.applyInt(i, biome.getInternalId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,8 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
|||||||
if (block.getBlockType() != BlockTypes.STRUCTURE_VOID) {
|
if (block.getBlockType() != BlockTypes.STRUCTURE_VOID) {
|
||||||
int combined = block.getInternalId();
|
int combined = block.getInternalId();
|
||||||
int index = indexes.get(combined);
|
int index = indexes.get(combined);
|
||||||
List<Integer> pos = Arrays.asList(point.getX() - min.getX(),
|
List<Integer> pos = Arrays.asList(point.x() - min.x(),
|
||||||
point.getY() - min.getY(), point.getZ() - min.getZ()
|
point.y() - min.y(), point.z() - min.z()
|
||||||
);
|
);
|
||||||
if (!block.hasNbtData()) {
|
if (!block.hasNbtData()) {
|
||||||
blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos));
|
blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos));
|
||||||
@ -231,7 +231,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
|||||||
ArrayList<Map<String, Object>> entities = new ArrayList<>();
|
ArrayList<Map<String, Object>> entities = new ArrayList<>();
|
||||||
for (Entity entity : clipboard.getEntities()) {
|
for (Entity entity : clipboard.getEntities()) {
|
||||||
Location loc = entity.getLocation();
|
Location loc = entity.getLocation();
|
||||||
List<Double> pos = Arrays.asList(loc.getX(), loc.getY(), loc.getZ());
|
List<Double> pos = Arrays.asList(loc.x(), loc.y(), loc.z());
|
||||||
List<Integer> blockPos = Arrays.asList(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
List<Integer> blockPos = Arrays.asList(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
BaseEntity state = entity.getState();
|
BaseEntity state = entity.getState();
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
@ -75,9 +75,9 @@ public class PNGWriter implements ClipboardWriter {
|
|||||||
MutableBlockVector3 mutableLeft = new MutableBlockVector3(0, 0, 0);
|
MutableBlockVector3 mutableLeft = new MutableBlockVector3(0, 0, 0);
|
||||||
|
|
||||||
BlockVector3 min = clipboard.getMinimumPoint();
|
BlockVector3 min = clipboard.getMinimumPoint();
|
||||||
int y0 = min.getBlockY();
|
int y0 = min.y();
|
||||||
int z0 = min.getBlockZ();
|
int z0 = min.z();
|
||||||
int x0 = min.getBlockX();
|
int x0 = min.x();
|
||||||
for (int x = x0; x < x0 + width; x++) {
|
for (int x = x0; x < x0 + width; x++) {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutableTop.mutX(x);
|
mutableTop.mutX(x);
|
||||||
|
@ -20,7 +20,7 @@ public class ArrayImageMask implements FilterBlockMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applyBlock(FilterBlock block) {
|
public boolean applyBlock(FilterBlock block) {
|
||||||
int height = image.getRGB(block.getX(), block.getZ()) & 0xFF;
|
int height = image.getRGB(block.x(), block.z()) & 0xFF;
|
||||||
return height == 255 || height > 0 && !white && random.nextInt(256) <= height;
|
return height == 255 || height > 0 && !white && random.nextInt(256) <= height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,18 +83,18 @@ public abstract class AbstractSingleFilterBlock extends FilterBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector3 getMinimumPoint() {
|
public BlockVector3 getMinimumPoint() {
|
||||||
return at(getX(), getY(), getZ());
|
return at(x(), y(), z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockVector3 getMaximumPoint() {
|
public BlockVector3 getMaximumPoint() {
|
||||||
return at(getX(), getY(), getZ());
|
return at(x(), y(), z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
if (x == this.getX() && y == this.getY() && z == this.getZ()) {
|
if (x == this.x() && y == this.y() && z == this.z()) {
|
||||||
setFullBlock(block.toBaseBlock());
|
setFullBlock(block.toBaseBlock());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ public class EntityInBlockRemovingProcessor implements IBatchProcessor {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BlockVector3 pos = tag.getEntityPosition().toBlockPoint();
|
BlockVector3 pos = tag.getEntityPosition().toBlockPoint();
|
||||||
int x = pos.getX() & 15;
|
int x = pos.x() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.y();
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.z() & 15;
|
||||||
if (!set.hasSection(y >> 4)) {
|
if (!set.hasSection(y >> 4)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -273,9 +273,9 @@ public class NMSRelighter implements Relighter {
|
|||||||
int lightLevel = (int) val[1];
|
int lightLevel = (int) val[1];
|
||||||
|
|
||||||
this.computeRemoveBlockLight(
|
this.computeRemoveBlockLight(
|
||||||
node.getX() - 1,
|
node.x() - 1,
|
||||||
node.getY(),
|
node.y(),
|
||||||
node.getZ(),
|
node.z(),
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightRemovalQueue,
|
lightRemovalQueue,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
@ -283,20 +283,20 @@ public class NMSRelighter implements Relighter {
|
|||||||
visited
|
visited
|
||||||
);
|
);
|
||||||
this.computeRemoveBlockLight(
|
this.computeRemoveBlockLight(
|
||||||
node.getX() + 1,
|
node.x() + 1,
|
||||||
node.getY(),
|
node.y(),
|
||||||
node.getZ(),
|
node.z(),
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightRemovalQueue,
|
lightRemovalQueue,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
removalVisited,
|
removalVisited,
|
||||||
visited
|
visited
|
||||||
);
|
);
|
||||||
if (node.getY() > minY) {
|
if (node.y() > minY) {
|
||||||
this.computeRemoveBlockLight(
|
this.computeRemoveBlockLight(
|
||||||
node.getX(),
|
node.x(),
|
||||||
node.getY() - 1,
|
node.y() - 1,
|
||||||
node.getZ(),
|
node.z(),
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightRemovalQueue,
|
lightRemovalQueue,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
@ -304,11 +304,11 @@ public class NMSRelighter implements Relighter {
|
|||||||
visited
|
visited
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (node.getY() < maxY) {
|
if (node.y() < maxY) {
|
||||||
this.computeRemoveBlockLight(
|
this.computeRemoveBlockLight(
|
||||||
node.getX(),
|
node.x(),
|
||||||
node.getY() + 1,
|
node.y() + 1,
|
||||||
node.getZ(),
|
node.z(),
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightRemovalQueue,
|
lightRemovalQueue,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
@ -317,9 +317,9 @@ public class NMSRelighter implements Relighter {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.computeRemoveBlockLight(
|
this.computeRemoveBlockLight(
|
||||||
node.getX(),
|
node.x(),
|
||||||
node.getY(),
|
node.y(),
|
||||||
node.getZ() - 1,
|
node.z() - 1,
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightRemovalQueue,
|
lightRemovalQueue,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
@ -327,9 +327,9 @@ public class NMSRelighter implements Relighter {
|
|||||||
visited
|
visited
|
||||||
);
|
);
|
||||||
this.computeRemoveBlockLight(
|
this.computeRemoveBlockLight(
|
||||||
node.getX(),
|
node.x(),
|
||||||
node.getY(),
|
node.y(),
|
||||||
node.getZ() + 1,
|
node.z() + 1,
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightRemovalQueue,
|
lightRemovalQueue,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
@ -340,27 +340,27 @@ public class NMSRelighter implements Relighter {
|
|||||||
|
|
||||||
while (!lightPropagationQueue.isEmpty()) {
|
while (!lightPropagationQueue.isEmpty()) {
|
||||||
MutableBlockVector3 node = lightPropagationQueue.poll();
|
MutableBlockVector3 node = lightPropagationQueue.poll();
|
||||||
ChunkHolder<?> iChunk = (ChunkHolder<?>) queue.getOrCreateChunk(node.getX() >> 4, node.getZ() >> 4);
|
ChunkHolder<?> iChunk = (ChunkHolder<?>) queue.getOrCreateChunk(node.x() >> 4, node.z() >> 4);
|
||||||
if (!iChunk.isInit()) {
|
if (!iChunk.isInit()) {
|
||||||
iChunk.init(queue, node.getX() >> 4, node.getZ() >> 4);
|
iChunk.init(queue, node.x() >> 4, node.z() >> 4);
|
||||||
}
|
}
|
||||||
int lightLevel = iChunk.getEmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15);
|
int lightLevel = iChunk.getEmittedLight(node.x() & 15, node.y(), node.z() & 15);
|
||||||
BlockState state = this.queue.getBlock(node.getX(), node.getY(), node.getZ());
|
BlockState state = this.queue.getBlock(node.x(), node.y(), node.z());
|
||||||
String id = state.getBlockType().getId().toLowerCase(Locale.ROOT);
|
String id = state.getBlockType().getId().toLowerCase(Locale.ROOT);
|
||||||
if (lightLevel <= 1) {
|
if (lightLevel <= 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (id.contains("slab")) {
|
if (id.contains("slab")) {
|
||||||
boolean top = state.getState(slabHalf).equalsIgnoreCase("top");
|
boolean top = state.getState(slabHalf).equalsIgnoreCase("top");
|
||||||
computeSlab(node.getX(), node.getY(), node.getZ(), lightLevel, lightPropagationQueue, visited, top);
|
computeSlab(node.x(), node.y(), node.z(), lightLevel, lightPropagationQueue, visited, top);
|
||||||
} else if (id.contains("stair")) {
|
} else if (id.contains("stair")) {
|
||||||
boolean top = state.getState(stairHalf).equalsIgnoreCase("top");
|
boolean top = state.getState(stairHalf).equalsIgnoreCase("top");
|
||||||
Direction direction = getStairDir(state);
|
Direction direction = getStairDir(state);
|
||||||
String shape = getStairShape(state);
|
String shape = getStairShape(state);
|
||||||
computeStair(
|
computeStair(
|
||||||
node.getX(),
|
node.x(),
|
||||||
node.getY(),
|
node.y(),
|
||||||
node.getZ(),
|
node.z(),
|
||||||
lightLevel,
|
lightLevel,
|
||||||
lightPropagationQueue,
|
lightPropagationQueue,
|
||||||
visited,
|
visited,
|
||||||
@ -369,7 +369,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
shape
|
shape
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
computeNormal(node.getX(), node.getY(), node.getZ(), lightLevel, lightPropagationQueue, visited);
|
computeNormal(node.x(), node.y(), node.z(), lightLevel, lightPropagationQueue, visited);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ public class OffsetTransform extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 location, BiomeType biome) {
|
public boolean setBiome(BlockVector3 location, BiomeType biome) {
|
||||||
int x = location.getX() + dx;
|
int x = location.x() + dx;
|
||||||
int y = location.getX() + dy;
|
int y = location.x() + dy;
|
||||||
int z = location.getX() + dz;
|
int z = location.x() + dz;
|
||||||
if (!getExtent().contains(x, y, z)) {
|
if (!getExtent().contains(x, y, z)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -53,9 +53,9 @@ public class OffsetTransform extends ResettableExtent {
|
|||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
int x = location.getX() + dx;
|
int x = location.x() + dx;
|
||||||
int y = location.getX() + dy;
|
int y = location.x() + dy;
|
||||||
int z = location.getX() + dz;
|
int z = location.x() + dz;
|
||||||
if (!getExtent().contains(x, y, z)) {
|
if (!getExtent().contains(x, y, z)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ public class RandomOffsetTransform extends ResettableExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
int x = position.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
int x = position.x() + random.nextInt(1 + (dx << 1)) - dx;
|
||||||
int y = position.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
|
int y = position.y() + random.nextInt(1 + (dy << 1)) - dy;
|
||||||
int z = position.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
int z = position.z() + random.nextInt(1 + (dz << 1)) - dz;
|
||||||
if (!getExtent().contains(x, y, z)) {
|
if (!getExtent().contains(x, y, z)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -57,9 +57,9 @@ public class RandomOffsetTransform extends ResettableExtent {
|
|||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pos, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pos, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
|
int x = pos.x() + random.nextInt(1 + (dx << 1)) - dx;
|
||||||
int y = pos.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
|
int y = pos.y() + random.nextInt(1 + (dy << 1)) - dy;
|
||||||
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
|
int z = pos.z() + random.nextInt(1 + (dz << 1)) - dz;
|
||||||
if (!getExtent().contains(x, y, z)) {
|
if (!getExtent().contains(x, y, z)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,9 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = pos;
|
min = pos;
|
||||||
}
|
}
|
||||||
mutable.mutX(min.getX() + (pos.getX() - min.getX()) * dx);
|
mutable.mutX(min.x() + (pos.x() - min.x()) * dx);
|
||||||
mutable.mutY(min.getY() + (pos.getY() - min.getY()) * dy);
|
mutable.mutY(min.y() + (pos.y() - min.y()) * dy);
|
||||||
mutable.mutZ(min.getZ() + (pos.getZ() - min.getZ()) * dz);
|
mutable.mutZ(min.z() + (pos.z() - min.z()) * dz);
|
||||||
return new MutableVector3(mutable);
|
return new MutableVector3(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = BlockVector3.at(x, y, z);
|
min = BlockVector3.at(x, y, z);
|
||||||
}
|
}
|
||||||
mutable.mutX(min.getX() + (x - min.getX()) * dx);
|
mutable.mutX(min.x() + (x - min.x()) * dx);
|
||||||
mutable.mutY(min.getY() + (y - min.getY()) * dy);
|
mutable.mutY(min.y() + (y - min.y()) * dy);
|
||||||
mutable.mutZ(min.getZ() + (z - min.getZ()) * dz);
|
mutable.mutZ(min.z() + (z - min.z()) * dz);
|
||||||
return new MutableVector3(mutable);
|
return new MutableVector3(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,15 +77,15 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableVector3 vector3 = getPos(location);
|
MutableVector3 vector3 = getPos(location);
|
||||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||||
double sx = vector3.getX();
|
double sx = vector3.x();
|
||||||
double sy = vector3.getY();
|
double sy = vector3.y();
|
||||||
double sz = vector3.getZ();
|
double sz = vector3.z();
|
||||||
double ex = sx + dx;
|
double ex = sx + dx;
|
||||||
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
||||||
double ez = sz + dz;
|
double ez = sz + dz;
|
||||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||||
if (!getExtent().contains(pos)) {
|
if (!getExtent().contains(pos)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -101,15 +101,15 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableVector3 vector3 = getPos(position);
|
MutableVector3 vector3 = getPos(position);
|
||||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||||
double sx = vector3.getX();
|
double sx = vector3.x();
|
||||||
double sy = vector3.getY();
|
double sy = vector3.y();
|
||||||
double sz = vector3.getZ();
|
double sz = vector3.z();
|
||||||
double ex = sx + dx;
|
double ex = sx + dx;
|
||||||
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
||||||
double ez = sz + dz;
|
double ez = sz + dz;
|
||||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||||
if (!getExtent().contains(pos)) {
|
if (!getExtent().contains(pos)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -126,15 +126,15 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableVector3 vector3 = getPos(x1, y1, z1);
|
MutableVector3 vector3 = getPos(x1, y1, z1);
|
||||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||||
double sx = vector3.getX();
|
double sx = vector3.x();
|
||||||
double sy = vector3.getY();
|
double sy = vector3.y();
|
||||||
double sz = vector3.getZ();
|
double sz = vector3.z();
|
||||||
double ex = vector3.getX() + dx;
|
double ex = vector3.x() + dx;
|
||||||
double ey = Math.min(maxy, sy + dy);
|
double ey = Math.min(maxy, sy + dy);
|
||||||
double ez = vector3.getZ() + dz;
|
double ez = vector3.z() + dz;
|
||||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||||
if (!getExtent().contains(pos)) {
|
if (!getExtent().contains(pos)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -150,15 +150,15 @@ public class ScaleTransform extends ResettableExtent {
|
|||||||
boolean result = false;
|
boolean result = false;
|
||||||
MutableVector3 vector3 = getPos(x1, y1, z1);
|
MutableVector3 vector3 = getPos(x1, y1, z1);
|
||||||
MutableBlockVector3 pos = new MutableBlockVector3();
|
MutableBlockVector3 pos = new MutableBlockVector3();
|
||||||
double sx = vector3.getX();
|
double sx = vector3.x();
|
||||||
double sy = vector3.getY();
|
double sy = vector3.y();
|
||||||
double sz = vector3.getZ();
|
double sz = vector3.z();
|
||||||
double ex = sx + dx;
|
double ex = sx + dx;
|
||||||
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
double ey = Math.max(minY, Math.min(maxy, sy + dy));
|
||||||
double ez = sz + dz;
|
double ez = sz + dz;
|
||||||
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
|
for (pos.mutY(sy); pos.y() < ey; pos.mutY(pos.y() + 1)) {
|
||||||
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
|
for (pos.mutZ(sz); pos.z() < ez; pos.mutZ(pos.z() + 1)) {
|
||||||
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
|
for (pos.mutX(sx); pos.x() < ex; pos.mutX(pos.x() + 1)) {
|
||||||
if (!getExtent().contains(pos)) {
|
if (!getExtent().contains(pos)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,11 @@ public abstract class SelectTransform extends ResettableExtent {
|
|||||||
public abstract AbstractDelegateExtent getExtent(int x, int z);
|
public abstract AbstractDelegateExtent getExtent(int x, int z);
|
||||||
|
|
||||||
public Extent getExtent(BlockVector3 pos) {
|
public Extent getExtent(BlockVector3 pos) {
|
||||||
return getExtent(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
return getExtent(pos.x(), pos.y(), pos.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Extent getExtent(BlockVector2 pos) {
|
public Extent getExtent(BlockVector2 pos) {
|
||||||
return getExtent(pos.getBlockX(), pos.getBlockZ());
|
return getExtent(pos.x(), pos.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,8 +26,8 @@ public class SurfaceRegionFunction implements FlatRegionFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(BlockVector2 position) throws WorldEditException {
|
public boolean apply(BlockVector2 position) throws WorldEditException {
|
||||||
int x = position.getBlockX();
|
int x = position.x();
|
||||||
int z = position.getBlockZ();
|
int z = position.z();
|
||||||
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false);
|
||||||
if (layer != -1) {
|
if (layer != -1) {
|
||||||
lastY = layer;
|
lastY = layer;
|
||||||
|
@ -21,11 +21,11 @@ public class BiomeCopy implements RegionFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||||
int x = position.getBlockX();
|
int x = position.x();
|
||||||
int y = position.getBlockY();
|
int y = position.y();
|
||||||
int z = position.getBlockZ();
|
int z = position.z();
|
||||||
if (x != mutableVector.getBlockX() || z != mutableVector.getBlockZ() || y != mutableVector
|
if (x != mutableVector.x() || z != mutableVector.z() || y != mutableVector
|
||||||
.getBlockY()) {
|
.y()) {
|
||||||
mutableVector.setComponents(x, y, z);
|
mutableVector.setComponents(x, y, z);
|
||||||
return destination.setBiome(mutableVector, source.getBiome(mutableVector));
|
return destination.setBiome(mutableVector, source.getBiome(mutableVector));
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,8 @@ public class CavesGen extends GenBase {
|
|||||||
int maxAngle,
|
int maxAngle,
|
||||||
double paramDouble4
|
double paramDouble4
|
||||||
) throws WorldEditException {
|
) throws WorldEditException {
|
||||||
int bx = chunkPos.getBlockX() << 4;
|
int bx = chunkPos.x() << 4;
|
||||||
int bz = chunkPos.getBlockZ() << 4;
|
int bz = chunkPos.z() << 4;
|
||||||
double real_x = bx + 7;
|
double real_x = bx + 7;
|
||||||
double real_z = bz + 7;
|
double real_z = bz + 7;
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ public abstract class GenBase {
|
|||||||
|
|
||||||
public void generate(BlockVector2 chunkPos, Extent chunk) throws WorldEditException {
|
public void generate(BlockVector2 chunkPos, Extent chunk) throws WorldEditException {
|
||||||
int i = this.checkAreaSize;
|
int i = this.checkAreaSize;
|
||||||
int chunkX = chunkPos.getBlockX();
|
int chunkX = chunkPos.x();
|
||||||
int chunkZ = chunkPos.getBlockZ();
|
int chunkZ = chunkPos.z();
|
||||||
for (int x = chunkX - i; x <= chunkX + i; x++) {
|
for (int x = chunkX - i; x <= chunkX + i; x++) {
|
||||||
for (int z = chunkZ - i; z <= chunkZ + i; z++) {
|
for (int z = chunkZ - i; z <= chunkZ + i; z++) {
|
||||||
generateChunk(x, z, chunkPos, chunk);
|
generateChunk(x, z, chunkPos, chunk);
|
||||||
|
@ -36,7 +36,7 @@ public class SchemGen implements Resource {
|
|||||||
int y = extent.getNearestSurfaceTerrainBlock(
|
int y = extent.getNearestSurfaceTerrainBlock(
|
||||||
x,
|
x,
|
||||||
z,
|
z,
|
||||||
mutable.getBlockY(),
|
mutable.y(),
|
||||||
this.extent.getMinY(),
|
this.extent.getMinY(),
|
||||||
this.extent.getMaxY(),
|
this.extent.getMaxY(),
|
||||||
Integer.MIN_VALUE,
|
Integer.MIN_VALUE,
|
||||||
|
@ -44,9 +44,9 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockVector3 direction(BlockVector3 v) {
|
public BlockVector3 direction(BlockVector3 v) {
|
||||||
int x = v.getBlockX();
|
int x = v.x();
|
||||||
int y = v.getBlockY();
|
int y = v.y();
|
||||||
int z = v.getBlockZ();
|
int z = v.z();
|
||||||
if (mask.test(mutable.setComponents(x + 1, y, z))) {
|
if (mask.test(mutable.setComponents(x + 1, y, z))) {
|
||||||
return mutable.setComponents(1, 0, 0);
|
return mutable.setComponents(1, 0, 0);
|
||||||
} else if (mask.test(mutable.setComponents(x - 1, y, z))) {
|
} else if (mask.test(mutable.setComponents(x - 1, y, z))) {
|
||||||
|
@ -22,9 +22,9 @@ public class AdjacentMask extends AbstractMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 bv) {
|
public boolean test(BlockVector3 bv) {
|
||||||
vector.setComponents(bv);
|
vector.setComponents(bv);
|
||||||
double x = bv.getX();
|
double x = bv.x();
|
||||||
double y = bv.getY();
|
double y = bv.y();
|
||||||
double z = bv.getZ();
|
double z = bv.z();
|
||||||
vector.mutX(x + 1);
|
vector.mutX(x + 1);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (mask.test(vector) && ++count == min && max >= 8) {
|
if (mask.test(vector) && ++count == min && max >= 8) {
|
||||||
|
@ -127,9 +127,9 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean adjacentAir(Extent extent, MutableBlockVector3 mutable) {
|
private boolean adjacentAir(Extent extent, MutableBlockVector3 mutable) {
|
||||||
int x = mutable.getBlockX();
|
int x = mutable.x();
|
||||||
int y = mutable.getBlockY();
|
int y = mutable.y();
|
||||||
int z = mutable.getBlockZ();
|
int z = mutable.z();
|
||||||
if (!mask.test(extent, mutable.setComponents(x + 1, y, z))) {
|
if (!mask.test(extent, mutable.setComponents(x + 1, y, z))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -154,23 +154,23 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask {
|
|||||||
if (!mask.test(vector)) {
|
if (!mask.test(vector)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int y = vector.getBlockY();
|
int y = vector.y();
|
||||||
if (overlay) {
|
if (overlay) {
|
||||||
MutableBlockVector3 mutable = new MutableBlockVector3(vector);
|
MutableBlockVector3 mutable = new MutableBlockVector3(vector);
|
||||||
if (y < maxY && !adjacentAir(null, mutable)) {
|
if (y < maxY && !adjacentAir(null, mutable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int x = vector.getBlockX();
|
int x = vector.x();
|
||||||
int z = vector.getBlockZ();
|
int z = vector.z();
|
||||||
return testSlope(getExtent(), x, y, z);
|
return testSlope(getExtent(), x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(final Extent extent, final BlockVector3 vector) {
|
public boolean test(final Extent extent, final BlockVector3 vector) {
|
||||||
int x = vector.getBlockX();
|
int x = vector.x();
|
||||||
int y = vector.getBlockY();
|
int y = vector.y();
|
||||||
int z = vector.getBlockZ();
|
int z = vector.z();
|
||||||
|
|
||||||
if ((lastX == (lastX = x) & lastZ == (lastZ = z))) {
|
if ((lastX == (lastX = x) & lastZ == (lastZ = z))) {
|
||||||
int height = getHeight(extent, x, y, z);
|
int height = getHeight(extent, x, y, z);
|
||||||
|
@ -60,9 +60,9 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
int x = vector.getX();
|
int x = vector.x();
|
||||||
int y = vector.getY();
|
int y = vector.y();
|
||||||
int z = vector.getZ();
|
int z = vector.z();
|
||||||
try {
|
try {
|
||||||
boolean check = cache_checked.add(x, y, z);
|
boolean check = cache_checked.add(x, y, z);
|
||||||
if (!check) {
|
if (!check) {
|
||||||
@ -88,9 +88,9 @@ public class CachedMask extends AbstractDelegateMask implements ResettableMask {
|
|||||||
if (!hasExtent || !(extent instanceof AbstractExtentMask)) {
|
if (!hasExtent || !(extent instanceof AbstractExtentMask)) {
|
||||||
return test(vector);
|
return test(vector);
|
||||||
}
|
}
|
||||||
int x = vector.getX();
|
int x = vector.x();
|
||||||
int y = vector.getY();
|
int y = vector.y();
|
||||||
int z = vector.getZ();
|
int z = vector.z();
|
||||||
AbstractExtentMask mask = (AbstractExtentMask) getMask();
|
AbstractExtentMask mask = (AbstractExtentMask) getMask();
|
||||||
try {
|
try {
|
||||||
boolean check = cache_checked.add(x, y, z);
|
boolean check = cache_checked.add(x, y, z);
|
||||||
|
@ -62,17 +62,17 @@ public class ImageBrushMask extends AbstractExtentMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (solid.test(vector)) {
|
if (solid.test(vector)) {
|
||||||
int dx = vector.getBlockX() - center.getBlockX();
|
int dx = vector.x() - center.x();
|
||||||
int dy = vector.getBlockY() - center.getBlockY();
|
int dy = vector.y() - center.y();
|
||||||
int dz = vector.getBlockZ() - center.getBlockZ();
|
int dz = vector.z() - center.z();
|
||||||
|
|
||||||
Vector3 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 + centerImageX);
|
int x1 = (int) (pos1.x() * scale + centerImageX);
|
||||||
int z1 = (int) (pos1.getZ() * scale + centerImageZ);
|
int z1 = (int) (pos1.z() * scale + centerImageZ);
|
||||||
|
|
||||||
Vector3 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 + centerImageX);
|
int x2 = (int) (pos2.x() * scale + centerImageX);
|
||||||
int z2 = (int) (pos2.getZ() * scale + centerImageZ);
|
int z2 = (int) (pos2.z() * scale + centerImageZ);
|
||||||
if (x2 < x1) {
|
if (x2 < x1) {
|
||||||
int tmp = x1;
|
int tmp = x1;
|
||||||
x1 = x2;
|
x1 = x2;
|
||||||
|
@ -40,20 +40,20 @@ public class LayerBrushMask extends AbstractExtentMask {
|
|||||||
BlockState previous2 = layers[depth - 2];
|
BlockState previous2 = layers[depth - 2];
|
||||||
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
for (BlockVector3 dir : BreadthFirstSearch.DEFAULT_DIRECTIONS) {
|
||||||
mutable.setComponents(
|
mutable.setComponents(
|
||||||
pos.getBlockX() + dir.getBlockX(),
|
pos.x() + dir.x(),
|
||||||
pos.getBlockY() + dir.getBlockY(),
|
pos.y() + dir.y(),
|
||||||
pos.getBlockZ() + dir.getBlockZ()
|
pos.z() + dir.z()
|
||||||
);
|
);
|
||||||
if (visitor.isVisited(mutable) && editSession.getBlock(
|
if (visitor.isVisited(mutable) && editSession.getBlock(
|
||||||
mutable.getBlockX(),
|
mutable.x(),
|
||||||
mutable.getBlockY(),
|
mutable.y(),
|
||||||
mutable.getBlockZ()
|
mutable.z()
|
||||||
) == previous) {
|
) == previous) {
|
||||||
mutable.setComponents(pos.getBlockX() + dir.getBlockX() * 2, pos.getBlockY() + dir.getBlockY() * 2,
|
mutable.setComponents(pos.x() + dir.x() * 2, pos.y() + dir.y() * 2,
|
||||||
pos.getBlockZ() + dir.getBlockZ() * 2
|
pos.z() + dir.z() * 2
|
||||||
);
|
);
|
||||||
if (visitor.isVisited(mutable)
|
if (visitor.isVisited(mutable)
|
||||||
&& editSession.getBlock(mutable.getBlockX(), mutable.getBlockY(), mutable.getBlockZ()) == previous2) {
|
&& editSession.getBlock(mutable.x(), mutable.y(), mutable.z()) == previous2) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,9 +15,9 @@ public class PlaneMask extends AbstractMask implements ResettableMask {
|
|||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case -1:
|
case -1:
|
||||||
originX = vector.getBlockX();
|
originX = vector.x();
|
||||||
originY = vector.getBlockY();
|
originY = vector.y();
|
||||||
originZ = vector.getBlockZ();
|
originZ = vector.z();
|
||||||
mode = 0;
|
mode = 0;
|
||||||
return true;
|
return true;
|
||||||
case 0:
|
case 0:
|
||||||
@ -25,13 +25,13 @@ public class PlaneMask extends AbstractMask implements ResettableMask {
|
|||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
int original = mode;
|
int original = mode;
|
||||||
if (originX != vector.getBlockX()) {
|
if (originX != vector.x()) {
|
||||||
mode &= 1;
|
mode &= 1;
|
||||||
}
|
}
|
||||||
if (originY != vector.getBlockY()) {
|
if (originY != vector.y()) {
|
||||||
mode &= 2;
|
mode &= 2;
|
||||||
}
|
}
|
||||||
if (originZ != vector.getBlockZ()) {
|
if (originZ != vector.z()) {
|
||||||
mode &= 4;
|
mode &= 4;
|
||||||
}
|
}
|
||||||
if (Integer.bitCount(mode) >= 3) {
|
if (Integer.bitCount(mode) >= 3) {
|
||||||
@ -39,13 +39,13 @@ public class PlaneMask extends AbstractMask implements ResettableMask {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (originX != vector.getBlockX() && (mode & 1) == 0) {
|
if (originX != vector.x() && (mode & 1) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (originZ != vector.getBlockZ() && (mode & 4) == 0) {
|
if (originZ != vector.z() && (mode & 4) == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return originY == vector.getBlockY() || (mode & 2) != 0;
|
return originY == vector.y() || (mode & 2) != 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,17 +30,17 @@ public class RadiusMask extends AbstractMask implements ResettableMask {
|
|||||||
if (pos == null) {
|
if (pos == null) {
|
||||||
pos = to.toImmutable();
|
pos = to.toImmutable();
|
||||||
}
|
}
|
||||||
int dx = pos.getBlockX() - to.getBlockX();
|
int dx = pos.x() - to.x();
|
||||||
int d = dx * dx;
|
int d = dx * dx;
|
||||||
if (d > maxSqr) {
|
if (d > maxSqr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int dz = pos.getBlockZ() - to.getBlockZ();
|
int dz = pos.z() - to.z();
|
||||||
d += dz * dz;
|
d += dz * dz;
|
||||||
if (d > maxSqr) {
|
if (d > maxSqr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int dy = pos.getBlockY() - to.getBlockY();
|
int dy = pos.y() - to.y();
|
||||||
d += dy * dy;
|
d += dy * dy;
|
||||||
return d >= minSqr && d <= maxSqr;
|
return d >= minSqr && d <= maxSqr;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class SimplexMask extends AbstractMask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
double value = SimplexNoise.noise(vector.getBlockX() * scale, vector.getBlockY() * scale, vector.getBlockZ() * scale);
|
double value = SimplexNoise.noise(vector.x() * scale, vector.y() * scale, vector.z() * scale);
|
||||||
return value >= min && value <= max;
|
return value >= min && value <= max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ public class StencilBrushMask extends AbstractExtentMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (solid.test(vector)) {
|
if (solid.test(vector)) {
|
||||||
int dx = vector.getBlockX() - center.getBlockX();
|
int dx = vector.x() - center.x();
|
||||||
int dy = vector.getBlockY() - center.getBlockY();
|
int dy = vector.y() - center.y();
|
||||||
int dz = vector.getBlockZ() - center.getBlockZ();
|
int dz = vector.z() - center.z();
|
||||||
|
|
||||||
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
Vector3 srcPos = transform.apply(mutable.setComponents(dx, dy, dz));
|
||||||
dx = MathMan.roundInt(srcPos.getX());
|
dx = MathMan.roundInt(srcPos.x());
|
||||||
dz = MathMan.roundInt(srcPos.getZ());
|
dz = MathMan.roundInt(srcPos.z());
|
||||||
|
|
||||||
int distance = dx * dx + dz * dz;
|
int distance = dx * dx + dz * dz;
|
||||||
if (distance > size2 || Math.abs(dx) > 256 || Math.abs(dz) > 256) {
|
if (distance > size2 || Math.abs(dx) > 256 || Math.abs(dz) > 256) {
|
||||||
@ -83,7 +83,7 @@ public class StencilBrushMask extends AbstractExtentMask {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (val >= 255 || ThreadLocalRandom.current().nextInt(maxY) < val) {
|
if (val >= 255 || ThreadLocalRandom.current().nextInt(maxY) < val) {
|
||||||
editSession.setBlock(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), pattern);
|
editSession.setBlock(vector.x(), vector.y(), vector.z(), pattern);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) {
|
if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) {
|
||||||
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).getY();
|
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).y();
|
||||||
return (angle >= (min / 90.0) && angle <= (max / 90.0));
|
return (angle >= (min / 90.0) && angle <= (max / 90.0));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -33,7 +33,7 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(Extent extent, BlockVector3 vector) {
|
public boolean test(Extent extent, BlockVector3 vector) {
|
||||||
if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) {
|
if (!vector.getBlock(getExtent()).isAir() && nextToAir(vector)) {
|
||||||
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).getY();
|
double angle = 1 - getAverageAirDirection(vector.toVector3(), size).y();
|
||||||
return (angle >= (min / 90.0) && angle <= (max / 90.0));
|
return (angle >= (min / 90.0) && angle <= (max / 90.0));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -44,7 +44,7 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
|||||||
for (int i = -size; i <= size; i++) {
|
for (int i = -size; i <= size; i++) {
|
||||||
for (int j = -size; j <= size; j++) {
|
for (int j = -size; j <= size; j++) {
|
||||||
for (int k = -size; k <= size; k++) {
|
for (int k = -size; k <= size; k++) {
|
||||||
Vector3 block = Vector3.at(currentLocation.getX(), currentLocation.getY(), currentLocation.getZ()).add(
|
Vector3 block = Vector3.at(currentLocation.x(), currentLocation.y(), currentLocation.z()).add(
|
||||||
0.5,
|
0.5,
|
||||||
0.5,
|
0.5,
|
||||||
0.5
|
0.5
|
||||||
@ -65,13 +65,13 @@ public class SurfaceAngleMask extends AbstractExtentMask {
|
|||||||
double y = 0.0;
|
double y = 0.0;
|
||||||
double z = 0.0;
|
double z = 0.0;
|
||||||
for (Vector3 vector3 : airDirections) {
|
for (Vector3 vector3 : airDirections) {
|
||||||
x += vector3.getX();
|
x += vector3.x();
|
||||||
y += vector3.getY();
|
y += vector3.y();
|
||||||
z += vector3.getZ();
|
z += vector3.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 averageAirDirection = Vector3.at(x / airDirections.size(), y / airDirections.size(), z / airDirections.size());
|
Vector3 averageAirDirection = Vector3.at(x / airDirections.size(), y / airDirections.size(), z / airDirections.size());
|
||||||
return (Double.isNaN(averageAirDirection.getY()) ? Vector3.ZERO : averageAirDirection.normalize());
|
return (Double.isNaN(averageAirDirection.y()) ? Vector3.ZERO : averageAirDirection.normalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,8 +14,8 @@ public class WallMakeMask implements Mask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 position) {
|
public boolean test(BlockVector3 position) {
|
||||||
int x = position.getBlockX();
|
int x = position.x();
|
||||||
int z = position.getBlockZ();
|
int z = position.z();
|
||||||
return !region.contains(x, z + 1) || !region.contains(x, z - 1) || !region.contains(x + 1, z) || !region.contains(
|
return !region.contains(x, z + 1) || !region.contains(x, z - 1) || !region.contains(x + 1, z) || !region.contains(
|
||||||
x - 1,
|
x - 1,
|
||||||
z
|
z
|
||||||
|
@ -23,9 +23,9 @@ public class WallMask extends AbstractMask {
|
|||||||
public boolean test(BlockVector3 bv) {
|
public boolean test(BlockVector3 bv) {
|
||||||
vector.setComponents(bv);
|
vector.setComponents(bv);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
double x = vector.getX();
|
double x = vector.x();
|
||||||
double y = vector.getY();
|
double y = vector.y();
|
||||||
double z = vector.getZ();
|
double z = vector.z();
|
||||||
vector.mutX(x + 1);
|
vector.mutX(x + 1);
|
||||||
if (mask.test(vector) && ++count == min && max >= 8) {
|
if (mask.test(vector) && ++count == min && max >= 8) {
|
||||||
vector.mutX(x);
|
vector.mutX(x);
|
||||||
|
@ -16,9 +16,9 @@ public class XAxisMask extends AbstractMask implements ResettableMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (layer == -1) {
|
if (layer == -1) {
|
||||||
layer = vector.getBlockX();
|
layer = vector.x();
|
||||||
}
|
}
|
||||||
return vector.getBlockX() == layer;
|
return vector.x() == layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,9 +14,9 @@ public class YAxisMask extends AbstractMask implements ResettableMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (layer == -1) {
|
if (layer == -1) {
|
||||||
layer = vector.getBlockY();
|
layer = vector.y();
|
||||||
}
|
}
|
||||||
return vector.getBlockY() == layer;
|
return vector.y() == layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,9 +14,9 @@ public class ZAxisMask extends AbstractMask implements ResettableMask {
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(BlockVector3 vector) {
|
public boolean test(BlockVector3 vector) {
|
||||||
if (layer == -1) {
|
if (layer == -1) {
|
||||||
layer = vector.getBlockZ();
|
layer = vector.z();
|
||||||
}
|
}
|
||||||
return vector.getBlockZ() == layer;
|
return vector.z() == layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,9 +42,9 @@ public class AngleColorPattern extends AnglePattern {
|
|||||||
public <T extends BlockStateHolder<T>> int getSlope(T block, BlockVector3 vector, Extent extent) {
|
public <T extends BlockStateHolder<T>> int getSlope(T block, BlockVector3 vector, Extent extent) {
|
||||||
int slope = super.getSlope(block, vector, extent);
|
int slope = super.getSlope(block, vector, extent);
|
||||||
if (slope != -1) {
|
if (slope != -1) {
|
||||||
int x = vector.getBlockX();
|
int x = vector.x();
|
||||||
int y = vector.getBlockY();
|
int y = vector.y();
|
||||||
int z = vector.getBlockZ();
|
int z = vector.z();
|
||||||
int height = extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
|
int height = extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
|
||||||
if (height > minY) {
|
if (height > minY) {
|
||||||
BlockState below = extent.getBlock(x, height - 1, z);
|
BlockState below = extent.getBlock(x, height - 1, z);
|
||||||
|
@ -31,9 +31,9 @@ public abstract class AnglePattern extends AbstractPattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <T extends BlockStateHolder<T>> int getSlope(T block, BlockVector3 vector, Extent extent) {
|
public <T extends BlockStateHolder<T>> int getSlope(T block, BlockVector3 vector, Extent extent) {
|
||||||
int x = vector.getBlockX();
|
int x = vector.x();
|
||||||
int y = vector.getBlockY();
|
int y = vector.y();
|
||||||
int z = vector.getBlockZ();
|
int z = vector.z();
|
||||||
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
if (!block.getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class BufferedPattern2D extends BufferedPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean set(BlockVector3 pos) {
|
public boolean set(BlockVector3 pos) {
|
||||||
return set.add(pos.getBlockX(), 0, pos.getBlockY());
|
return set.add(pos.x(), 0, pos.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class ExpressionPattern extends AbstractPattern {
|
|||||||
if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) {
|
if (expression.getEnvironment() instanceof WorldEditExpressionEnvironment) {
|
||||||
((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3());
|
((WorldEditExpressionEnvironment) expression.getEnvironment()).setCurrentBlock(vector.toVector3());
|
||||||
}
|
}
|
||||||
double combined = expression.evaluate(vector.getX(), vector.getY(), vector.getZ());
|
double combined = expression.evaluate(vector.x(), vector.y(), vector.z());
|
||||||
return BlockState.getFromOrdinal((int) combined).toBaseBlock();
|
return BlockState.getFromOrdinal((int) combined).toBaseBlock();
|
||||||
} catch (EvaluationException e) {
|
} catch (EvaluationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -37,7 +37,7 @@ public class Linear2DBlockPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock applyBlock(BlockVector3 position) {
|
public BaseBlock applyBlock(BlockVector3 position) {
|
||||||
int index = (position.getBlockX() / this.xScale + position.getBlockZ() / this.zScale) % patternsArray.length;
|
int index = (position.x() / this.xScale + position.z() / this.zScale) % patternsArray.length;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index += patternsArray.length;
|
index += patternsArray.length;
|
||||||
}
|
}
|
||||||
@ -46,8 +46,8 @@ public class Linear2DBlockPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||||
int index = (floorDiv(get.getBlockX(), this.xScale)
|
int index = (floorDiv(get.x(), this.xScale)
|
||||||
+ floorDiv(get.getBlockZ(), this.zScale)) % patternsArray.length;
|
+ floorDiv(get.z(), this.zScale)) % patternsArray.length;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index += patternsArray.length;
|
index += patternsArray.length;
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ public class Linear3DBlockPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock applyBlock(BlockVector3 position) {
|
public BaseBlock applyBlock(BlockVector3 position) {
|
||||||
int index = (position.getBlockX() / this.xScale
|
int index = (position.x() / this.xScale
|
||||||
+ position.getBlockY() / this.yScale + position.getBlockZ() / this.zScale) % patternsArray.length;
|
+ position.y() / this.yScale + position.z() / this.zScale) % patternsArray.length;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index += patternsArray.length;
|
index += patternsArray.length;
|
||||||
}
|
}
|
||||||
@ -50,8 +50,8 @@ public class Linear3DBlockPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||||
int index = (floorDiv(get.getBlockX(), this.xScale)
|
int index = (floorDiv(get.x(), this.xScale)
|
||||||
+ floorDiv(get.getBlockY(), this.yScale) + floorDiv(get.getBlockZ(), this.zScale)) % patternsArray.length;
|
+ floorDiv(get.y(), this.yScale) + floorDiv(get.z(), this.zScale)) % patternsArray.length;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index += patternsArray.length;
|
index += patternsArray.length;
|
||||||
}
|
}
|
||||||
|
@ -24,15 +24,15 @@ public class NoXPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock applyBlock(BlockVector3 pos) {
|
public BaseBlock applyBlock(BlockVector3 pos) {
|
||||||
mutable.mutY(pos.getY());
|
mutable.mutY(pos.y());
|
||||||
mutable.mutZ(pos.getZ());
|
mutable.mutZ(pos.z());
|
||||||
return pattern.applyBlock(mutable);
|
return pattern.applyBlock(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||||
mutable.mutY(get.getY());
|
mutable.mutY(get.y());
|
||||||
mutable.mutZ(get.getZ());
|
mutable.mutZ(get.z());
|
||||||
return pattern.apply(extent, mutable, set);
|
return pattern.apply(extent, mutable, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,15 @@ public class NoYPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock applyBlock(BlockVector3 pos) {
|
public BaseBlock applyBlock(BlockVector3 pos) {
|
||||||
mutable.mutX(pos.getX());
|
mutable.mutX(pos.x());
|
||||||
mutable.mutZ(pos.getZ());
|
mutable.mutZ(pos.z());
|
||||||
return pattern.applyBlock(mutable);
|
return pattern.applyBlock(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||||
mutable.mutX(get.getX());
|
mutable.mutX(get.x());
|
||||||
mutable.mutZ(get.getZ());
|
mutable.mutZ(get.z());
|
||||||
return pattern.apply(extent, mutable, set);
|
return pattern.apply(extent, mutable, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.fastasyncworldedit.core.function.pattern;
|
package com.fastasyncworldedit.core.function.pattern;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
import com.fastasyncworldedit.core.math.MutableBlockVector3;
|
||||||
import com.fastasyncworldedit.core.queue.Filter;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||||
@ -25,15 +24,15 @@ public class NoZPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock applyBlock(BlockVector3 pos) {
|
public BaseBlock applyBlock(BlockVector3 pos) {
|
||||||
mutable.mutX(pos.getX());
|
mutable.mutX(pos.x());
|
||||||
mutable.mutY(pos.getY());
|
mutable.mutY(pos.y());
|
||||||
return pattern.applyBlock(mutable);
|
return pattern.applyBlock(mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||||
mutable.mutX(get.getX());
|
mutable.mutX(get.x());
|
||||||
mutable.mutY(get.getY());
|
mutable.mutY(get.y());
|
||||||
return pattern.apply(extent, mutable, set);
|
return pattern.apply(extent, mutable, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ public class OffsetPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock applyBlock(BlockVector3 position) {
|
public BaseBlock applyBlock(BlockVector3 position) {
|
||||||
mutable.mutX(position.getX() + dx);
|
mutable.mutX(position.x() + dx);
|
||||||
mutable.mutY(position.getY() + dy);
|
mutable.mutY(position.y() + dy);
|
||||||
mutable.mutZ(position.getZ() + dz);
|
mutable.mutZ(position.z() + dz);
|
||||||
if (mutable.getY() < minY || mutable.getY() > maxY) {
|
if (mutable.y() < minY || mutable.y() > maxY) {
|
||||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||||
}
|
}
|
||||||
return pattern.applyBlock(mutable);
|
return pattern.applyBlock(mutable);
|
||||||
@ -51,10 +51,10 @@ public class OffsetPattern extends AbstractPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException {
|
||||||
mutable.mutX(get.getX() + dx);
|
mutable.mutX(get.x() + dx);
|
||||||
mutable.mutY(get.getY() + dy);
|
mutable.mutY(get.y() + dy);
|
||||||
mutable.mutZ(get.getZ() + dz);
|
mutable.mutZ(get.z() + dz);
|
||||||
if (mutable.getY() < extent.getMinY() || mutable.getY() > extent.getMaxY()) {
|
if (mutable.y() < extent.getMinY() || mutable.y() > extent.getMaxY()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return pattern.apply(extent, get, mutable);
|
return pattern.apply(extent, get, mutable);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user