mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
This commit is contained in:
commit
754b228d84
2
.github/workflows/label-merge-conflicts.yaml
vendored
2
.github/workflows/label-merge-conflicts.yaml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Label conflicting PRs
|
||||
uses: eps1lon/actions-label-merge-conflict@v3.0.1
|
||||
uses: eps1lon/actions-label-merge-conflict@v3.0.2
|
||||
with:
|
||||
dirtyLabel: "unresolved-merge-conflict"
|
||||
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
@ -14,7 +14,7 @@ mapmanager = "1.8.0-SNAPSHOT"
|
||||
griefprevention = "17.0.0"
|
||||
griefdefender = "2.1.0-SNAPSHOT"
|
||||
residence = "4.5._13.1"
|
||||
towny = "0.100.2.9"
|
||||
towny = "0.100.2.14"
|
||||
plotsquared = "7.3.8"
|
||||
|
||||
# Third party
|
||||
@ -22,7 +22,7 @@ bstats = "3.0.2"
|
||||
sparsebitset = "1.3"
|
||||
parallelgzip = "1.0.5"
|
||||
adventure = "4.17.0"
|
||||
adventure-bukkit = "4.3.2"
|
||||
adventure-bukkit = "4.3.3"
|
||||
checkerqual = "3.43.0"
|
||||
truezip = "6.8.4"
|
||||
auto-value = "1.10.4"
|
||||
@ -35,7 +35,7 @@ jlibnoise = "1.0.0"
|
||||
jchronic = "0.2.4a"
|
||||
lz4-java = "1.8.0"
|
||||
lz4-stream = "1.0.0"
|
||||
commons-cli = "1.7.0"
|
||||
commons-cli = "1.8.0"
|
||||
paperlib = "1.0.8"
|
||||
paster = "1.1.6"
|
||||
vault = "1.7.1"
|
||||
|
@ -27,7 +27,6 @@ import com.google.common.collect.Sets;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTConstants;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
@ -284,11 +283,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
|
||||
private static Block getBlockFromType(BlockType blockType) {
|
||||
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.id()));
|
||||
}
|
||||
|
||||
private static Item getItemFromType(ItemType itemType) {
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.id()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -441,7 +440,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
CraftWorld craftWorld = ((CraftWorld) location.getWorld());
|
||||
ServerLevel worldServer = craftWorld.getHandle();
|
||||
|
||||
Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle());
|
||||
Entity createdEntity = createEntityFromId(state.getType().id(), craftWorld.getHandle());
|
||||
|
||||
if (createdEntity != null) {
|
||||
CompoundBinaryTag nativeTag = state.getNbt();
|
||||
@ -531,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||
new StructureBlockEntity(
|
||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
||||
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||
),
|
||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||
@ -548,7 +547,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
@Override
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())),
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().id())),
|
||||
item.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())));
|
||||
@ -581,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
|
||||
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 net.minecraft.core.Direction enumFacing = adapt(face);
|
||||
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) {
|
||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||
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
|
||||
@ -725,7 +724,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
|
||||
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));
|
||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||
int internalId = Block.getId(blockData);
|
||||
@ -738,7 +737,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
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);
|
||||
if (adaptedBiome != null) {
|
||||
extent.setBiome(vec, adaptedBiome);
|
||||
@ -757,7 +756,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
//noinspection unchecked
|
||||
chunkLoadings.add(
|
||||
((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))
|
||||
);
|
||||
} 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) {
|
||||
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) {
|
||||
((Clearable) entity).clearContent();
|
||||
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);
|
||||
return blockState1.hasPostProcess(
|
||||
getServerLevel(world),
|
||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
||||
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||
);
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM)
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().getId())),
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().id())),
|
||||
baseItemStack.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData())));
|
||||
@ -547,7 +547,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
.getServer()
|
||||
.registryAccess()
|
||||
.registryOrThrow(BIOME);
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId());
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.id());
|
||||
Biome biome = registry.get(resourceLocation);
|
||||
return registry.getId(biome);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
return;
|
||||
}
|
||||
for (IntPair chunk : toSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -262,7 +262,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)
|
||||
));
|
||||
for (IntPair chunk : cachedChunksToSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -786,9 +786,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||
final CompoundTag nativeTag = entry.getValue();
|
||||
final BlockVector3 blockHash = entry.getKey();
|
||||
final int x = blockHash.getX() + bx;
|
||||
final int y = blockHash.getY();
|
||||
final int z = blockHash.getZ() + bz;
|
||||
final int x = blockHash.x() + bx;
|
||||
final int y = blockHash.y();
|
||||
final int z = blockHash.z() + bz;
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
synchronized (nmsWorld) {
|
||||
@ -823,7 +823,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
nmsChunk.setUnsaved(true);
|
||||
// send to player
|
||||
if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) {
|
||||
this.send(finalMask, finalLightUpdate);
|
||||
this.send();
|
||||
}
|
||||
if (finalizer != null) {
|
||||
finalizer.run();
|
||||
@ -919,9 +919,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(int mask, boolean lighting) {
|
||||
public void send() {
|
||||
synchronized (sendLock) {
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
|
||||
PaperweightPlatformAdapter.sendChunk(this, serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@ -318,7 +319,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) {
|
||||
public static void sendChunk(Object chunk, ServerLevel nmsWorld, int chunkX, int chunkZ) {
|
||||
ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||
if (chunkHolder == null) {
|
||||
return;
|
||||
@ -339,9 +340,10 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
if (levelChunk == null) {
|
||||
return;
|
||||
}
|
||||
TaskManager.taskManager().task(() -> {
|
||||
MinecraftServer.getServer().execute(() -> {
|
||||
ClientboundLevelChunkWithLightPacket packet;
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (chunk) {
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
nmsWorld.getChunkSource().getLightEngine(),
|
||||
@ -350,7 +352,9 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
true,
|
||||
false // last false is to not bother with x-ray
|
||||
);
|
||||
}
|
||||
} else {
|
||||
synchronized (chunk) {
|
||||
// deprecated on paper - deprecation suppressed
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
@ -360,6 +364,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet));
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class PaperweightStarlightRelighter extends StarlightRelighter<ServerLeve
|
||||
int x = pos.x;
|
||||
int z = pos.z;
|
||||
if (delay) { // we still need to send the block changes of that chunk
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false);
|
||||
PaperweightPlatformAdapter.sendChunk(pos, serverLevel, x, z);
|
||||
}
|
||||
serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE);
|
||||
}
|
||||
|
@ -284,11 +284,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
|
||||
private static Block getBlockFromType(BlockType blockType) {
|
||||
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.id()));
|
||||
}
|
||||
|
||||
private static Item getItemFromType(ItemType itemType) {
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.id()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -480,7 +480,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
CraftWorld craftWorld = ((CraftWorld) location.getWorld());
|
||||
ServerLevel worldServer = craftWorld.getHandle();
|
||||
|
||||
Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle());
|
||||
Entity createdEntity = createEntityFromId(state.getType().id(), craftWorld.getHandle());
|
||||
|
||||
if (createdEntity != null) {
|
||||
CompoundBinaryTag nativeTag = state.getNbt();
|
||||
@ -570,7 +570,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||
new StructureBlockEntity(
|
||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
||||
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||
),
|
||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||
@ -598,7 +598,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
@Override
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())),
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().id())),
|
||||
item.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())));
|
||||
@ -631,10 +631,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
|
||||
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 net.minecraft.core.Direction enumFacing = adapt(face);
|
||||
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) {
|
||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||
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
|
||||
@ -776,7 +776,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
|
||||
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));
|
||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||
int internalId = Block.getId(blockData);
|
||||
@ -789,7 +789,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
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);
|
||||
if (adaptedBiome != null) {
|
||||
extent.setBiome(vec, adaptedBiome);
|
||||
@ -808,7 +808,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
//noinspection unchecked
|
||||
chunkLoadings.add(
|
||||
((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))
|
||||
);
|
||||
} 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) {
|
||||
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) {
|
||||
((Clearable) entity).clearContent();
|
||||
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);
|
||||
return blockState1.hasPostProcess(
|
||||
getServerLevel(world),
|
||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
||||
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||
);
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM)
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().getId())),
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().id())),
|
||||
baseItemStack.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData())));
|
||||
@ -547,7 +547,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
.getServer()
|
||||
.registryAccess()
|
||||
.registryOrThrow(BIOME);
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId());
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.id());
|
||||
Biome biome = registry.get(resourceLocation);
|
||||
return registry.getId(biome);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
return;
|
||||
}
|
||||
for (IntPair chunk : toSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -263,7 +263,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)
|
||||
));
|
||||
for (IntPair chunk : cachedChunksToSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -784,9 +784,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||
final CompoundTag nativeTag = entry.getValue();
|
||||
final BlockVector3 blockHash = entry.getKey();
|
||||
final int x = blockHash.getX() + bx;
|
||||
final int y = blockHash.getY();
|
||||
final int z = blockHash.getZ() + bz;
|
||||
final int x = blockHash.x() + bx;
|
||||
final int y = blockHash.y();
|
||||
final int z = blockHash.z() + bz;
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
synchronized (nmsWorld) {
|
||||
@ -821,7 +821,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
nmsChunk.setUnsaved(true);
|
||||
// send to player
|
||||
if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) {
|
||||
this.send(finalMask, finalLightUpdate);
|
||||
this.send();
|
||||
}
|
||||
if (finalizer != null) {
|
||||
finalizer.run();
|
||||
@ -917,9 +917,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(int mask, boolean lighting) {
|
||||
public void send() {
|
||||
synchronized (sendLock) {
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
|
||||
PaperweightPlatformAdapter.sendChunk(this, serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@ -342,7 +343,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) {
|
||||
public static void sendChunk(Object chunk, ServerLevel nmsWorld, int chunkX, int chunkZ) {
|
||||
ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||
if (chunkHolder == null) {
|
||||
return;
|
||||
@ -363,17 +364,20 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
if (levelChunk == null) {
|
||||
return;
|
||||
}
|
||||
TaskManager.taskManager().task(() -> {
|
||||
MinecraftServer.getServer().execute(() -> {
|
||||
ClientboundLevelChunkWithLightPacket packet;
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (chunk) {
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
nmsWorld.getChunkSource().getLightEngine(),
|
||||
null,
|
||||
null
|
||||
// last false is to not bother with x-ray
|
||||
null,
|
||||
false // last false is to not bother with x-ray
|
||||
);
|
||||
}
|
||||
} else {
|
||||
synchronized (chunk) {
|
||||
// deprecated on paper - deprecation suppressed
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
@ -382,6 +386,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet));
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class PaperweightStarlightRelighter extends StarlightRelighter<ServerLeve
|
||||
int x = pos.x;
|
||||
int z = pos.z;
|
||||
if (delay) { // we still need to send the block changes of that chunk
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false);
|
||||
PaperweightPlatformAdapter.sendChunk(pos, serverLevel, x, z);
|
||||
}
|
||||
serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE);
|
||||
}
|
||||
|
@ -281,11 +281,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
|
||||
private static Block getBlockFromType(BlockType blockType) {
|
||||
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.id()));
|
||||
}
|
||||
|
||||
private static Item getItemFromType(ItemType itemType) {
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.id()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -440,7 +440,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
CraftWorld craftWorld = ((CraftWorld) location.getWorld());
|
||||
ServerLevel worldServer = craftWorld.getHandle();
|
||||
|
||||
Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle());
|
||||
Entity createdEntity = createEntityFromId(state.getType().id(), craftWorld.getHandle());
|
||||
|
||||
if (createdEntity != null) {
|
||||
CompoundBinaryTag nativeTag = state.getNbt();
|
||||
@ -530,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||
new StructureBlockEntity(
|
||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
||||
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||
),
|
||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||
@ -547,7 +547,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
@Override
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())),
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().id())),
|
||||
item.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())));
|
||||
@ -580,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
|
||||
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 net.minecraft.core.Direction enumFacing = adapt(face);
|
||||
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) {
|
||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||
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
|
||||
@ -725,7 +725,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
|
||||
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));
|
||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||
int internalId = Block.getId(blockData);
|
||||
@ -738,7 +738,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
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);
|
||||
if (adaptedBiome != null) {
|
||||
extent.setBiome(vec, adaptedBiome);
|
||||
@ -757,7 +757,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
//noinspection unchecked
|
||||
chunkLoadings.add(
|
||||
((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))
|
||||
);
|
||||
} 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) {
|
||||
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) {
|
||||
((Clearable) entity).clearContent();
|
||||
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);
|
||||
return blockState1.hasPostProcess(
|
||||
getServerLevel(world),
|
||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
||||
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||
);
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM)
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().getId())),
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().id())),
|
||||
baseItemStack.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData())));
|
||||
@ -550,7 +550,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
.getServer()
|
||||
.registryAccess()
|
||||
.registryOrThrow(BIOME);
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId());
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.id());
|
||||
Biome biome = registry.get(resourceLocation);
|
||||
return registry.getId(biome);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
return;
|
||||
}
|
||||
for (IntPair chunk : toSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -263,7 +263,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)
|
||||
));
|
||||
for (IntPair chunk : cachedChunksToSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -771,9 +771,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||
final CompoundTag nativeTag = entry.getValue();
|
||||
final BlockVector3 blockHash = entry.getKey();
|
||||
final int x = blockHash.getX() + bx;
|
||||
final int y = blockHash.getY();
|
||||
final int z = blockHash.getZ() + bz;
|
||||
final int x = blockHash.x() + bx;
|
||||
final int y = blockHash.y();
|
||||
final int z = blockHash.z() + bz;
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
synchronized (nmsWorld) {
|
||||
@ -808,7 +808,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
nmsChunk.setUnsaved(true);
|
||||
// send to player
|
||||
if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) {
|
||||
this.send(finalMask, finalLightUpdate);
|
||||
this.send();
|
||||
}
|
||||
if (finalizer != null) {
|
||||
finalizer.run();
|
||||
@ -904,9 +904,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(int mask, boolean lighting) {
|
||||
public void send() {
|
||||
synchronized (sendLock) {
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
|
||||
PaperweightPlatformAdapter.sendChunk(this, serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@ -333,7 +334,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) {
|
||||
public static void sendChunk(Object chunk, ServerLevel nmsWorld, int chunkX, int chunkZ) {
|
||||
ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||
if (chunkHolder == null) {
|
||||
return;
|
||||
@ -354,17 +355,20 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
if (levelChunk == null) {
|
||||
return;
|
||||
}
|
||||
TaskManager.taskManager().task(() -> {
|
||||
MinecraftServer.getServer().execute(() -> {
|
||||
ClientboundLevelChunkWithLightPacket packet;
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (chunk) {
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
nmsWorld.getChunkSource().getLightEngine(),
|
||||
null,
|
||||
null
|
||||
// last false is to not bother with x-ray
|
||||
null,
|
||||
false // last false is to not bother with x-ray
|
||||
);
|
||||
}
|
||||
} else {
|
||||
synchronized (chunk) {
|
||||
// deprecated on paper - deprecation suppressed
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
@ -373,6 +377,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet));
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class PaperweightStarlightRelighter extends StarlightRelighter<ServerLeve
|
||||
int x = pos.x;
|
||||
int z = pos.z;
|
||||
if (delay) { // we still need to send the block changes of that chunk
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false);
|
||||
PaperweightPlatformAdapter.sendChunk(pos, serverLevel, x, z);
|
||||
}
|
||||
serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE);
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.4-R0.1-SNAPSHOT
|
||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.4-R0.1-20240424.165410-174")
|
||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.4-R0.1-20240528.102248-175")
|
||||
compileOnly(libs.paperlib)
|
||||
}
|
||||
|
@ -281,11 +281,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
|
||||
private static Block getBlockFromType(BlockType blockType) {
|
||||
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.id()));
|
||||
}
|
||||
|
||||
private static Item getItemFromType(ItemType itemType) {
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.getId()));
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.id()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -440,7 +440,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
CraftWorld craftWorld = ((CraftWorld) location.getWorld());
|
||||
ServerLevel worldServer = craftWorld.getHandle();
|
||||
|
||||
Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle());
|
||||
Entity createdEntity = createEntityFromId(state.getType().id(), craftWorld.getHandle());
|
||||
|
||||
if (createdEntity != null) {
|
||||
CompoundBinaryTag nativeTag = state.getNbt();
|
||||
@ -530,7 +530,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||
((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create(
|
||||
new StructureBlockEntity(
|
||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
||||
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||
),
|
||||
__ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData)
|
||||
@ -547,7 +547,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
@Override
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())),
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().id())),
|
||||
item.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())));
|
||||
@ -580,10 +580,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
|
||||
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 net.minecraft.core.Direction enumFacing = adapt(face);
|
||||
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) {
|
||||
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
|
||||
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
|
||||
@ -725,7 +725,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
|
||||
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));
|
||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||
int internalId = Block.getId(blockData);
|
||||
@ -738,7 +738,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
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);
|
||||
if (adaptedBiome != null) {
|
||||
extent.setBiome(vec, adaptedBiome);
|
||||
@ -757,7 +757,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
//noinspection unchecked
|
||||
chunkLoadings.add(
|
||||
((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))
|
||||
);
|
||||
} 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) {
|
||||
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) {
|
||||
((Clearable) entity).clearContent();
|
||||
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);
|
||||
return blockState1.hasPostProcess(
|
||||
getServerLevel(world),
|
||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
||||
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||
);
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) {
|
||||
ItemStack stack = new ItemStack(
|
||||
DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM)
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().getId())),
|
||||
.get(ResourceLocation.tryParse(baseItemStack.getType().id())),
|
||||
baseItemStack.getAmount()
|
||||
);
|
||||
stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData())));
|
||||
@ -550,7 +550,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
.getServer()
|
||||
.registryAccess()
|
||||
.registryOrThrow(BIOME);
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId());
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.id());
|
||||
Biome biome = registry.get(resourceLocation);
|
||||
return registry.getId(biome);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
return;
|
||||
}
|
||||
for (IntPair chunk : toSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -262,7 +262,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)
|
||||
));
|
||||
for (IntPair chunk : cachedChunksToSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -87,7 +87,6 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
private final Registry<Biome> biomeRegistry;
|
||||
private final IdMap<Holder<Biome>> biomeHolderIdMap;
|
||||
private final ConcurrentHashMap<Integer, PaperweightGetBlocks_Copy> copies = new ConcurrentHashMap<>();
|
||||
private final Object sendLock = new Object();
|
||||
private LevelChunkSection[] sections;
|
||||
private LevelChunk levelChunk;
|
||||
private DataLayer[] blockLight;
|
||||
@ -771,9 +770,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||
final CompoundTag nativeTag = entry.getValue();
|
||||
final BlockVector3 blockHash = entry.getKey();
|
||||
final int x = blockHash.getX() + bx;
|
||||
final int y = blockHash.getY();
|
||||
final int z = blockHash.getZ() + bz;
|
||||
final int x = blockHash.x() + bx;
|
||||
final int y = blockHash.y();
|
||||
final int z = blockHash.z() + bz;
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
synchronized (nmsWorld) {
|
||||
@ -808,7 +807,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
nmsChunk.setUnsaved(true);
|
||||
// send to player
|
||||
if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) {
|
||||
this.send(finalMask, finalLightUpdate);
|
||||
this.send();
|
||||
}
|
||||
if (finalizer != null) {
|
||||
finalizer.run();
|
||||
@ -904,10 +903,8 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(int mask, boolean lighting) {
|
||||
synchronized (sendLock) {
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
|
||||
}
|
||||
public void send() {
|
||||
PaperweightPlatformAdapter.sendChunk(this, serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@ -332,7 +333,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) {
|
||||
public static void sendChunk(Object chunk, ServerLevel nmsWorld, int chunkX, int chunkZ) {
|
||||
ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||
if (chunkHolder == null) {
|
||||
return;
|
||||
@ -353,17 +354,20 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
if (levelChunk == null) {
|
||||
return;
|
||||
}
|
||||
TaskManager.taskManager().task(() -> {
|
||||
MinecraftServer.getServer().execute(() -> {
|
||||
ClientboundLevelChunkWithLightPacket packet;
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (chunk) {
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
nmsWorld.getChunkSource().getLightEngine(),
|
||||
null,
|
||||
null
|
||||
// last false is to not bother with x-ray
|
||||
null,
|
||||
false // last false is to not bother with x-ray
|
||||
);
|
||||
}
|
||||
} else {
|
||||
synchronized (chunk) {
|
||||
// deprecated on paper - deprecation suppressed
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
@ -372,6 +376,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet));
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class PaperweightStarlightRelighter extends StarlightRelighter<ServerLeve
|
||||
int x = pos.x;
|
||||
int z = pos.z;
|
||||
if (delay) { // we still need to send the block changes of that chunk
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false);
|
||||
PaperweightPlatformAdapter.sendChunk(pos, serverLevel, x, z);
|
||||
}
|
||||
serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE);
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.6-R0.1-SNAPSHOT/
|
||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.6-R0.1-20240520.005421-60")
|
||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.6-R0.1-20240604.210637-112")
|
||||
compileOnly(libs.paperlib)
|
||||
}
|
||||
|
@ -291,12 +291,12 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
private static Block getBlockFromType(BlockType blockType) {
|
||||
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(
|
||||
blockType.getId()));
|
||||
blockType.id()));
|
||||
}
|
||||
|
||||
private static Item getItemFromType(ItemType itemType) {
|
||||
return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(
|
||||
itemType.getId()));
|
||||
itemType.id()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -470,7 +470,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
CraftWorld craftWorld = ((CraftWorld) location.getWorld());
|
||||
ServerLevel worldServer = craftWorld.getHandle();
|
||||
|
||||
Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle());
|
||||
Entity createdEntity = createEntityFromId(state.getType().id(), craftWorld.getHandle());
|
||||
|
||||
if (createdEntity != null) {
|
||||
CompoundBinaryTag nativeTag = state.getNbt();
|
||||
@ -577,7 +577,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
@Override
|
||||
public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) {
|
||||
var structureBlock = new StructureBlockEntity(
|
||||
new BlockPos(pos.getX(), pos.getY(), pos.getZ()),
|
||||
new BlockPos(pos.x(), pos.y(), pos.z()),
|
||||
Blocks.STRUCTURE_BLOCK.defaultBlockState()
|
||||
);
|
||||
structureBlock.setLevel(((CraftPlayer) player).getHandle().level());
|
||||
@ -598,7 +598,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) {
|
||||
final RegistryAccess.Frozen registryAccess = DedicatedServer.getServer().registryAccess();
|
||||
ItemStack stack = new ItemStack(
|
||||
registryAccess.registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())),
|
||||
registryAccess.registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().id())),
|
||||
item.getAmount()
|
||||
);
|
||||
final CompoundTag nbt = (net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData());
|
||||
@ -644,11 +644,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
return false;
|
||||
}
|
||||
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()
|
||||
);
|
||||
|
||||
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 net.minecraft.core.Direction enumFacing = adapt(face);
|
||||
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);
|
||||
return blockData.canSurvive(
|
||||
((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) {
|
||||
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));
|
||||
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos);
|
||||
int internalId = Block.getId(blockData);
|
||||
@ -815,7 +815,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
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);
|
||||
if (adaptedBiome != null) {
|
||||
extent.setBiome(vec, adaptedBiome);
|
||||
@ -834,7 +834,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
//noinspection unchecked
|
||||
chunkLoadings.add(
|
||||
((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))
|
||||
);
|
||||
} 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) {
|
||||
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) {
|
||||
((Clearable) entity).clearContent();
|
||||
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);
|
||||
return blockState1.hasPostProcess(
|
||||
getServerLevel(world),
|
||||
new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ())
|
||||
new BlockPos(blockVector3.x(), blockVector3.y(), blockVector3.z())
|
||||
);
|
||||
}
|
||||
|
||||
@ -492,7 +492,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) {
|
||||
final RegistryAccess.Frozen registryAccess = DedicatedServer.getServer().registryAccess();
|
||||
ItemStack stack = new ItemStack(
|
||||
registryAccess.registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(baseItemStack.getType().getId())),
|
||||
registryAccess.registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(baseItemStack.getType().id())),
|
||||
baseItemStack.getAmount()
|
||||
);
|
||||
final CompoundTag nbt = (net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData());
|
||||
@ -572,7 +572,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
|
||||
.getServer()
|
||||
.registryAccess()
|
||||
.registryOrThrow(BIOME);
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId());
|
||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.id());
|
||||
Biome biome = registry.get(resourceLocation);
|
||||
return registry.getId(biome);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
return;
|
||||
}
|
||||
for (IntPair chunk : toSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -263,7 +263,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
|
||||
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)
|
||||
));
|
||||
for (IntPair chunk : cachedChunksToSend) {
|
||||
PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false);
|
||||
PaperweightPlatformAdapter.sendChunk(chunk, getLevel().getWorld().getHandle(), chunk.x(), chunk.z());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -773,9 +773,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||
final CompoundTag nativeTag = entry.getValue();
|
||||
final BlockVector3 blockHash = entry.getKey();
|
||||
final int x = blockHash.getX() + bx;
|
||||
final int y = blockHash.getY();
|
||||
final int z = blockHash.getZ() + bz;
|
||||
final int x = blockHash.x() + bx;
|
||||
final int y = blockHash.y();
|
||||
final int z = blockHash.z() + bz;
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
synchronized (nmsWorld) {
|
||||
@ -810,7 +810,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
nmsChunk.setUnsaved(true);
|
||||
// send to player
|
||||
if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) {
|
||||
this.send(finalMask, finalLightUpdate);
|
||||
this.send();
|
||||
}
|
||||
if (finalizer != null) {
|
||||
finalizer.run();
|
||||
@ -906,9 +906,9 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(int mask, boolean lighting) {
|
||||
public void send() {
|
||||
synchronized (sendLock) {
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
|
||||
PaperweightPlatformAdapter.sendChunk(this, serverLevel, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@ -332,7 +333,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) {
|
||||
public static void sendChunk(Object chunk, ServerLevel nmsWorld, int chunkX, int chunkZ) {
|
||||
ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||
if (chunkHolder == null) {
|
||||
return;
|
||||
@ -345,25 +346,26 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
.getChunkSource()
|
||||
.getChunkAtIfLoadedImmediately(chunkX, chunkZ);
|
||||
} else {
|
||||
levelChunk = ((Optional<LevelChunk>) ((Either) chunkHolder
|
||||
.getTickingChunkFuture() // method is not present with new paper chunk system
|
||||
.getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left())
|
||||
.orElse(null);
|
||||
levelChunk = chunkHolder.getTickingChunkFuture()
|
||||
.getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK).orElse(null);
|
||||
}
|
||||
if (levelChunk == null) {
|
||||
return;
|
||||
}
|
||||
TaskManager.taskManager().task(() -> {
|
||||
MinecraftServer.getServer().execute(() -> {
|
||||
ClientboundLevelChunkWithLightPacket packet;
|
||||
if (PaperLib.isPaper()) {
|
||||
synchronized (chunk) {
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
nmsWorld.getChunkSource().getLightEngine(),
|
||||
null,
|
||||
null
|
||||
// last false is to not bother with x-ray
|
||||
null,
|
||||
false // last false is to not bother with x-ray
|
||||
);
|
||||
}
|
||||
} else {
|
||||
synchronized (chunk) {
|
||||
// deprecated on paper - deprecation suppressed
|
||||
packet = new ClientboundLevelChunkWithLightPacket(
|
||||
levelChunk,
|
||||
@ -372,6 +374,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet));
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class PaperweightStarlightRelighter extends StarlightRelighter<ServerLeve
|
||||
int x = pos.x;
|
||||
int z = pos.z;
|
||||
if (delay) { // we still need to send the block changes of that chunk
|
||||
PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false);
|
||||
PaperweightPlatformAdapter.sendChunk(pos, serverLevel, x, z);
|
||||
}
|
||||
serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE);
|
||||
}
|
||||
|
@ -2,6 +2,6 @@ package com.fastasyncworldedit.bukkit.adapter;
|
||||
|
||||
public interface BukkitGetBlocks {
|
||||
|
||||
void send(int mask, boolean lighting);
|
||||
void send();
|
||||
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public interface IBukkitAdapter {
|
||||
checkNotNull(position);
|
||||
return new org.bukkit.Location(
|
||||
world,
|
||||
position.getX(), position.getY(), position.getZ()
|
||||
position.x(), position.y(), position.z()
|
||||
);
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public interface IBukkitAdapter {
|
||||
checkNotNull(location);
|
||||
return new org.bukkit.Location(
|
||||
world,
|
||||
location.getX(), location.getY(), location.getZ(),
|
||||
location.x(), location.y(), location.z(),
|
||||
location.getYaw(),
|
||||
location.getPitch()
|
||||
);
|
||||
@ -166,10 +166,10 @@ public interface IBukkitAdapter {
|
||||
*/
|
||||
default Material adapt(ItemType itemType) {
|
||||
checkNotNull(itemType);
|
||||
if (!itemType.getId().startsWith("minecraft:")) {
|
||||
if (!itemType.id().startsWith("minecraft:")) {
|
||||
throw new IllegalArgumentException("Bukkit only supports Minecraft items");
|
||||
}
|
||||
return Material.getMaterial(itemType.getId().substring(10).toUpperCase(Locale.ROOT));
|
||||
return Material.getMaterial(itemType.id().substring(10).toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -180,10 +180,10 @@ public interface IBukkitAdapter {
|
||||
*/
|
||||
default Material adapt(BlockType blockType) {
|
||||
checkNotNull(blockType);
|
||||
if (!blockType.getId().startsWith("minecraft:")) {
|
||||
if (!blockType.id().startsWith("minecraft:")) {
|
||||
throw new IllegalArgumentException("Bukkit only supports Minecraft blocks");
|
||||
}
|
||||
String id = blockType.getId().substring(10).toUpperCase(Locale.ROOT);
|
||||
String id = blockType.id().substring(10).toUpperCase(Locale.ROOT);
|
||||
return Material.getMaterial(id);
|
||||
}
|
||||
|
||||
@ -293,11 +293,11 @@ public interface IBukkitAdapter {
|
||||
}
|
||||
|
||||
default Biome adapt(BiomeType biomeType) {
|
||||
if (!biomeType.getId().startsWith("minecraft:")) {
|
||||
if (!biomeType.id().startsWith("minecraft:")) {
|
||||
throw new IllegalArgumentException("Bukkit only supports vanilla biomes");
|
||||
}
|
||||
try {
|
||||
return Biome.valueOf(biomeType.getId().substring(10).toUpperCase(Locale.ROOT));
|
||||
return Biome.valueOf(biomeType.id().substring(10).toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl {
|
||||
if (!(chunk instanceof BukkitGetBlocks)) {
|
||||
throw new IllegalArgumentException("(IChunkGet) chunk not of type BukkitGetBlocks");
|
||||
}
|
||||
((BukkitGetBlocks) chunk).send(mask, lighting);
|
||||
((BukkitGetBlocks) chunk).send();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ public abstract class Regenerator<IChunkAccess, ProtoChunk extends IChunkAccess,
|
||||
|
||||
@Override
|
||||
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
|
||||
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()))
|
||||
&& extent.setBiome(set.getX(), set.getY(), set.getZ(), biomeGetter.apply(get));
|
||||
return extent.setBlock(set.x(), set.y(), set.z(), source.getFullBlock(get.x(), get.y(), get.z()))
|
||||
&& 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
|
||||
BlockVector3 oldMin = region.getMinimumPoint();
|
||||
BlockVector3 newMin = BlockVector3.at(
|
||||
(oldMin.getX() >> 4 << 4) - border * 16,
|
||||
oldMin.getY(),
|
||||
(oldMin.getZ() >> 4 << 4) - border * 16
|
||||
(oldMin.x() >> 4 << 4) - border * 16,
|
||||
oldMin.y(),
|
||||
(oldMin.z() >> 4 << 4) - border * 16
|
||||
);
|
||||
BlockVector3 oldMax = region.getMaximumPoint();
|
||||
BlockVector3 newMax = BlockVector3.at(
|
||||
(oldMax.getX() >> 4 << 4) + (border + 1) * 16 - 1,
|
||||
oldMax.getY(),
|
||||
(oldMax.getZ() >> 4 << 4) + (border + 1) * 16 - 1
|
||||
(oldMax.x() >> 4 << 4) + (border + 1) * 16 - 1,
|
||||
oldMax.y(),
|
||||
(oldMax.z() >> 4 << 4) + (border + 1) * 16 - 1
|
||||
);
|
||||
Region adjustedRegion = new CuboidRegion(newMin, newMax);
|
||||
return adjustedRegion.getChunks().stream()
|
||||
.sorted(Comparator
|
||||
.comparingInt(BlockVector2::getZ)
|
||||
.thenComparingInt(BlockVector2::getX)) //needed for RegionLimitedWorldAccess
|
||||
.mapToLong(c -> MathMan.pairInt(c.getX(), c.getZ()))
|
||||
.comparingInt(BlockVector2::z)
|
||||
.thenComparingInt(BlockVector2::x)) //needed for RegionLimitedWorldAccess
|
||||
.mapToLong(c -> MathMan.pairInt(c.x(), c.z()))
|
||||
.toArray();
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class WorldGuardFeature extends BukkitMaskManager implements Listener {
|
||||
if (region instanceof ProtectedPolygonalRegion casted) {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
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);
|
||||
}
|
||||
|
@ -94,15 +94,15 @@ public class FaweDelegateSchematicHandler {
|
||||
return;
|
||||
}
|
||||
BlockVector3 dimension = schematic.getClipboard().getDimensions();
|
||||
final int WIDTH = dimension.getX();
|
||||
final int LENGTH = dimension.getZ();
|
||||
final int HEIGHT = dimension.getY();
|
||||
final int WIDTH = dimension.x();
|
||||
final int LENGTH = dimension.z();
|
||||
final int HEIGHT = dimension.y();
|
||||
final int worldHeight = plot.getArea().getMaxGenHeight() - plot.getArea().getMinGenHeight() + 1;
|
||||
// Validate dimensions
|
||||
CuboidRegion region = plot.getLargestRegion();
|
||||
boolean sizeMismatch =
|
||||
((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
((region.getMaximumPoint().x() - region.getMinimumPoint().x() + xOffset + 1) < WIDTH) || (
|
||||
(region.getMaximumPoint().z() - region.getMinimumPoint().z() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
> worldHeight);
|
||||
if (!Settings.Schematics.PASTE_MISMATCHES && sizeMismatch) {
|
||||
if (actor != null) {
|
||||
@ -111,8 +111,8 @@ public class FaweDelegateSchematicHandler {
|
||||
TaskManager.runTask(whenDone);
|
||||
return;
|
||||
}
|
||||
if (((region.getMaximumPoint().getX() - region.getMinimumPoint().getX() + xOffset + 1) < WIDTH) || (
|
||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
if (((region.getMaximumPoint().x() - region.getMinimumPoint().x() + xOffset + 1) < WIDTH) || (
|
||||
(region.getMaximumPoint().z() - region.getMinimumPoint().z() + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
> worldHeight)) {
|
||||
if (whenDone != null) {
|
||||
TaskManager.runTask(whenDone);
|
||||
@ -141,7 +141,7 @@ public class FaweDelegateSchematicHandler {
|
||||
} else {
|
||||
y_offset_actual = yOffset + pw.getMinBuildHeight() + editSession.getHighestTerrainBlock(region
|
||||
.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
|
||||
.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();
|
||||
clipboard.setOrigin(clipboard.getRegion().getMinimumPoint());
|
||||
clipboard.paste(editSession, to, true, false, true);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.fastasyncworldedit.bukkit.regions.plotsquared;
|
||||
|
||||
import com.fastasyncworldedit.core.FaweAPI;
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.regions.FaweMask;
|
||||
import com.fastasyncworldedit.core.regions.FaweMaskManager;
|
||||
@ -159,8 +158,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
regions = WEManager.getMask(pp);
|
||||
if (regions.size() == 1) {
|
||||
CuboidRegion region = regions.iterator().next();
|
||||
if (region.getMinimumPoint().getX() == Integer.MIN_VALUE
|
||||
&& region.getMaximumPoint().getX() == Integer.MAX_VALUE) {
|
||||
if (region.getMinimumPoint().x() == Integer.MIN_VALUE
|
||||
&& region.getMaximumPoint().x() == Integer.MAX_VALUE) {
|
||||
regions.clear();
|
||||
}
|
||||
}
|
||||
@ -174,22 +173,21 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
Region maskedRegion;
|
||||
if (regions.size() == 1) {
|
||||
final World world = player.getWorld();
|
||||
int min = area != null ? area.getMinBuildHeight() : world.getMinY();
|
||||
// PlotSquared uses exclusive max height, WorldEdit uses inclusive max height -> subtract 1
|
||||
int max = area != null ? Math.min(world.getMaxY(), area.getMaxBuildHeight() - 1) : world.getMaxY();
|
||||
Region maskedRegion;
|
||||
if (regions.size() == 1) {
|
||||
|
||||
final CuboidRegion region = regions.iterator().next();
|
||||
final BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
|
||||
final BlockVector3 pos2 = BlockVector3.at(region.getMaximumX(), max, region.getMaximumZ());
|
||||
maskedRegion = new CuboidRegion(pos1, pos2);
|
||||
} else {
|
||||
World world = FaweAPI.getWorld(area.getWorldName());
|
||||
List<Region> weRegions = regions.stream().map(
|
||||
r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()),
|
||||
BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())
|
||||
r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), min, r.getMinimumZ()),
|
||||
BlockVector3.at(r.getMaximumX(), max, r.getMaximumZ())
|
||||
)).collect(Collectors.toList());
|
||||
maskedRegion = new RegionIntersection(world, weRegions);
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ public enum BukkitAdapter {
|
||||
Vector3 position = location;
|
||||
return new org.bukkit.Location(
|
||||
adapt((World) location.getExtent()),
|
||||
position.getX(), position.getY(), position.getZ(),
|
||||
position.x(), position.y(), position.z(),
|
||||
location.getYaw(),
|
||||
location.getPitch()
|
||||
);
|
||||
@ -258,7 +258,7 @@ public enum BukkitAdapter {
|
||||
checkNotNull(position);
|
||||
return new org.bukkit.Location(
|
||||
world,
|
||||
position.getX(), position.getY(), position.getZ()
|
||||
position.x(), position.y(), position.z()
|
||||
);
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ public enum BukkitAdapter {
|
||||
checkNotNull(position);
|
||||
return new org.bukkit.Location(
|
||||
world,
|
||||
position.getX(), position.getY(), position.getZ()
|
||||
position.x(), position.y(), position.z()
|
||||
);
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ public enum BukkitAdapter {
|
||||
checkNotNull(location);
|
||||
return new org.bukkit.Location(
|
||||
world,
|
||||
location.getX(), location.getY(), location.getZ(),
|
||||
location.x(), location.y(), location.z(),
|
||||
location.getYaw(),
|
||||
location.getPitch()
|
||||
);
|
||||
|
@ -40,7 +40,7 @@ class BukkitBiomeRegistry implements BiomeRegistry {
|
||||
@Override
|
||||
public Component getRichName(BiomeType biomeType) {
|
||||
return TranslatableComponent.of(
|
||||
TranslationManager.makeTranslationKey("biome", biomeType.getId())
|
||||
TranslationManager.makeTranslationKey("biome", biomeType.id())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
final PlayerInventory inv = player.getInventory();
|
||||
ItemStack newItem = BukkitAdapter.adapt(itemStack);
|
||||
TaskManager.taskManager().sync(() -> {
|
||||
if (itemStack.getType().getId().equalsIgnoreCase(WorldEdit.getInstance().getConfiguration().wandItem)) {
|
||||
if (itemStack.getType().id().equalsIgnoreCase(WorldEdit.getInstance().getConfiguration().wandItem)) {
|
||||
inv.remove(newItem);
|
||||
}
|
||||
final ItemStack item = player.getInventory().getItemInMainHand();
|
||||
@ -242,9 +242,9 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
//FAWE end
|
||||
return TaskManager.taskManager().sync(() -> player.teleport(new Location(
|
||||
finalWorld,
|
||||
pos.getX(),
|
||||
pos.getY(),
|
||||
pos.getZ(),
|
||||
pos.x(),
|
||||
pos.y(),
|
||||
pos.z(),
|
||||
yaw,
|
||||
pitch
|
||||
)));
|
||||
@ -267,7 +267,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void setGameMode(GameMode gameMode) {
|
||||
player.setGameMode(org.bukkit.GameMode.valueOf(gameMode.getId().toUpperCase(Locale.ROOT)));
|
||||
player.setGameMode(org.bukkit.GameMode.valueOf(gameMode.id().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -422,7 +422,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
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) {
|
||||
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
|
||||
} else {
|
||||
|
@ -192,6 +192,9 @@ public class BukkitPlayerBlockBag extends BlockBag implements SlottableBlockBag
|
||||
@Override
|
||||
public BaseItem getItem(int slot) {
|
||||
loadInventory();
|
||||
if (items[slot] == null) {
|
||||
return null;
|
||||
}
|
||||
return BukkitAdapter.adapt(items[slot]);
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
|
||||
//FAWE start
|
||||
@Override
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return "intellectualsites:bukkit";
|
||||
}
|
||||
//FAWE end
|
||||
|
@ -224,7 +224,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
//FAWE end
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return getWorld().getName().replace(" ", "_").toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
//FAWE start - safe edit region
|
||||
testCoords(pt);
|
||||
//FAWE end
|
||||
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
|
||||
return getWorld().getBlockAt(pt.x(), pt.y(), pt.z()).getLightLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -284,7 +284,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
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();
|
||||
if (!(state instanceof InventoryHolder)) {
|
||||
return false;
|
||||
@ -363,8 +363,8 @@ public class BukkitWorld extends AbstractWorld {
|
||||
//FAWE end
|
||||
World world = getWorld();
|
||||
//FAWE start
|
||||
int X = pt.getBlockX() >> 4;
|
||||
int Z = pt.getBlockZ() >> 4;
|
||||
int X = pt.x() >> 4;
|
||||
int Z = pt.z() >> 4;
|
||||
if (Fawe.isMainThread()) {
|
||||
world.getChunkAt(X, Z);
|
||||
} else if (PaperLib.isPaper()) {
|
||||
@ -413,7 +413,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
|
||||
World world = getWorld();
|
||||
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
|
||||
testCoords(pt);
|
||||
//FAWE end
|
||||
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
||||
getWorld().getBlockAt(pt.x(), pt.y(), pt.z()).breakNaturally();
|
||||
}
|
||||
|
||||
//FAWE start
|
||||
@Override
|
||||
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());
|
||||
}
|
||||
//FAWE end
|
||||
@ -538,7 +538,7 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
}
|
||||
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());
|
||||
} else {
|
||||
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());
|
||||
return true;
|
||||
}
|
||||
@ -584,8 +584,8 @@ public class BukkitWorld extends AbstractWorld {
|
||||
if (!Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) {
|
||||
return;
|
||||
}
|
||||
int x = position.getX();
|
||||
int z = position.getZ();
|
||||
int x = position.x();
|
||||
int z = position.z();
|
||||
if (x > 30000000 || z > 30000000 || x < -30000000 || z < -30000000) {
|
||||
throw FaweCache.OUTSIDE_SAFE_REGION;
|
||||
}
|
||||
@ -636,9 +636,9 @@ public class BukkitWorld extends AbstractWorld {
|
||||
testCoords(position);
|
||||
//FAWE end
|
||||
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 {
|
||||
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);
|
||||
//FAWE end
|
||||
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 {
|
||||
getWorld().setBiome(position.getBlockX(), position.getBlockZ(), BukkitAdapter.adapt(biome));
|
||||
getWorld().setBiome(position.x(), position.z(), BukkitAdapter.adapt(biome));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -120,7 +120,6 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
public void onLoad() {
|
||||
|
||||
//FAWE start
|
||||
this.bukkitConsoleCommandSender = new BukkitCommandSender(this, Bukkit.getConsoleSender());
|
||||
// This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt.
|
||||
Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
|
||||
for (Plugin p : plugins) {
|
||||
@ -138,24 +137,32 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
getDataFolder().mkdirs();
|
||||
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
|
||||
// Setup platform
|
||||
platform = new BukkitServerInterface(this, getServer());
|
||||
worldEdit.getPlatformManager().register(platform);
|
||||
|
||||
//FAWE start - Migrate from config-legacy to worldedit-config
|
||||
migrateLegacyConfig();
|
||||
//FAWE end
|
||||
|
||||
//FAWE start - Modify WorldEdit config name
|
||||
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "worldedit-config.yml"), true), this);
|
||||
// Load config before we say we've loaded platforms as it is used in listeners of the event
|
||||
// Load config in onLoad to ensure it is loaded before FAWE settings to allow (inelegant) copying of values across
|
||||
// where needed
|
||||
config.load();
|
||||
//FAWE end
|
||||
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
|
||||
// Setup platform
|
||||
platform = new BukkitServerInterface(this, getServer());
|
||||
worldEdit.getPlatformManager().register(platform);
|
||||
|
||||
//FAWE start - Setup permission attachments
|
||||
permissionAttachmentManager = new BukkitPermissionAttachmentManager(this);
|
||||
//FAWE end
|
||||
|
||||
//FAWE start - initialise bukkitConsoleCommandSender later
|
||||
this.bukkitConsoleCommandSender = new BukkitCommandSender(this, Bukkit.getConsoleSender());
|
||||
//FAWE end
|
||||
|
||||
Path delChunks = Paths.get(getDataFolder().getPath(), DELCHUNKS_FILE_NAME);
|
||||
if (Files.exists(delChunks)) {
|
||||
ChunkDeleter.runFromFile(delChunks, true);
|
||||
@ -189,8 +196,6 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
new FaweBukkit(this);
|
||||
//FAWE end
|
||||
|
||||
config.load(); // Load config before we say we've loaded platforms as it is used in listeners of the event
|
||||
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent());
|
||||
|
||||
PermissionsResolverManager.initialize(this); // Setup permission resolver
|
||||
|
@ -24,11 +24,13 @@ limits:
|
||||
max-polygonal-points:
|
||||
default: -1
|
||||
maximum: 20
|
||||
# radius, superpickaxe, brush radius are ignored, use FAWE config limits
|
||||
max-radius: -1
|
||||
max-super-pickaxe-size: 5
|
||||
max-brush-radius: 100
|
||||
butcher-radius:
|
||||
default: -1
|
||||
# Ignored, use FAWE config limits
|
||||
maximum: -1
|
||||
disallowed-blocks:
|
||||
- "minecraft:wheat"
|
||||
|
@ -68,7 +68,7 @@ public class CLIBlockRegistry extends BundledBlockRegistry {
|
||||
@Override
|
||||
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
|
||||
Map<String, FileRegistries.BlockProperty> properties =
|
||||
CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.getId()).properties;
|
||||
CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.id()).properties;
|
||||
Maps.EntryTransformer<String, FileRegistries.BlockProperty, Property<?>> entryTransform =
|
||||
(key, value) -> createProperty(value.type, key, value.values);
|
||||
return ImmutableMap.copyOf(Maps.transformEntries(properties, entryTransform));
|
||||
|
@ -115,7 +115,7 @@ class CLIPlatform extends AbstractPlatform {
|
||||
@Override
|
||||
public World matchWorld(World world) {
|
||||
return this.worlds.stream()
|
||||
.filter(w -> w.getId().equals(world.getId()))
|
||||
.filter(w -> w.id().equals(world.id()))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class ClipboardWorld extends AbstractWorld implements Clipboard, CLIWorld
|
||||
//FAWE end
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
public String id() {
|
||||
return getName().replace(" ", "_").toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
|
@ -339,11 +339,11 @@ public class FaweAPI {
|
||||
final BlockVector3 bot = selection.getMinimumPoint();
|
||||
final BlockVector3 top = selection.getMaximumPoint();
|
||||
|
||||
final int minX = bot.getBlockX() >> 4;
|
||||
final int minZ = bot.getBlockZ() >> 4;
|
||||
final int minX = bot.x() >> 4;
|
||||
final int minZ = bot.z() >> 4;
|
||||
|
||||
final int maxX = top.getBlockX() >> 4;
|
||||
final int maxZ = top.getBlockZ() >> 4;
|
||||
final int maxX = top.x() >> 4;
|
||||
final int maxZ = top.z() >> 4;
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
@ -50,9 +50,9 @@ public class BlendBall implements Brush {
|
||||
final int outsetSize = (int) (size + 1);
|
||||
double brushSizeSquared = size * size;
|
||||
|
||||
int tx = position.getBlockX();
|
||||
int ty = position.getBlockY();
|
||||
int tz = position.getBlockZ();
|
||||
int tx = position.x();
|
||||
int ty = position.y();
|
||||
int tz = position.z();
|
||||
|
||||
int[] frequency = new int[BlockTypes.size()];
|
||||
|
||||
|
@ -81,9 +81,9 @@ public class CatenaryBrush implements Brush, ResettableTool {
|
||||
return pos1.add(pos2).divide(2).toBlockPoint();
|
||||
}
|
||||
double curveLen = pos1.distance(pos2) * lenPercent;
|
||||
double dy = pos2.getY() - pos1.getY();
|
||||
double dx = pos2.getX() - pos1.getX();
|
||||
double dz = pos2.getZ() - pos1.getZ();
|
||||
double dy = pos2.y() - pos1.y();
|
||||
double dx = pos2.x() - pos1.x();
|
||||
double dz = pos2.z() - pos1.z();
|
||||
double dh = Math.sqrt(dx * dx + dz * dz);
|
||||
double g = Math.sqrt(curveLen * curveLen - dy * dy) / 2;
|
||||
double a = 0.00001;
|
||||
|
@ -54,9 +54,9 @@ public class CommandBrush implements Brush {
|
||||
position.subtract(radius, radius, radius),
|
||||
position.add(radius, radius, radius)
|
||||
);
|
||||
String replaced = command.replace("{x}", Integer.toString(position.getBlockX()))
|
||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
||||
String replaced = command.replace("{x}", Integer.toString(position.x()))
|
||||
.replace("{y}", Integer.toString(position.y()))
|
||||
.replace("{z}", Integer.toString(position.z()))
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
|
@ -65,11 +65,11 @@ public class CopyPastaBrush implements Brush, ResettableTool {
|
||||
mask = Masks.alwaysTrue();
|
||||
}
|
||||
final ResizableClipboardBuilder builder = new ResizableClipboardBuilder(editSession.getWorld());
|
||||
final int minY = position.getBlockY();
|
||||
final int minY = position.y();
|
||||
mask = new AbstractDelegateMask(mask) {
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (super.test(vector) && vector.getBlockY() >= minY) {
|
||||
if (super.test(vector) && vector.y() >= minY) {
|
||||
BaseBlock block = editSession.getFullBlock(vector);
|
||||
if (!block.getBlockType().getMaterial().isAir()) {
|
||||
builder.add(vector, BlockTypes.AIR.getDefaultState().toBaseBlock(), block);
|
||||
|
@ -63,9 +63,9 @@ public class ErodeBrush implements Brush {
|
||||
Clipboard buffer1 = new CPUOptimizedClipboard(region);
|
||||
Clipboard buffer2 = new CPUOptimizedClipboard(region);
|
||||
|
||||
final int bx = target.getBlockX();
|
||||
final int by = target.getBlockY();
|
||||
final int bz = target.getBlockZ();
|
||||
final int bx = target.x();
|
||||
final int by = target.y();
|
||||
final int bz = target.z();
|
||||
|
||||
for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) {
|
||||
int x0 = x + bx;
|
||||
@ -106,7 +106,7 @@ public class ErodeBrush implements Brush {
|
||||
|
||||
for (BlockVector3 pos : 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;
|
||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||
BaseBlock next = current.getFullBlock(
|
||||
relx + offs.getBlockX(),
|
||||
rely + offs.getBlockY(),
|
||||
relz + offs.getBlockZ()
|
||||
relx + offs.x(),
|
||||
rely + offs.y(),
|
||||
relz + offs.z()
|
||||
);
|
||||
if (!next.getBlockType().getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
@ -190,9 +190,9 @@ public class ErodeBrush implements Brush {
|
||||
int total = 0;
|
||||
for (BlockVector3 offs : FACES_TO_CHECK) {
|
||||
BaseBlock next = current.getFullBlock(
|
||||
relx + offs.getBlockX(),
|
||||
rely + offs.getBlockY(),
|
||||
relz + offs.getBlockZ()
|
||||
relx + offs.x(),
|
||||
rely + offs.y(),
|
||||
relz + offs.z()
|
||||
);
|
||||
if (next.getMaterial().isMovementBlocker()) {
|
||||
continue;
|
||||
|
@ -12,9 +12,9 @@ public class FallingSphere implements Brush {
|
||||
@Override
|
||||
public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
int px = position.getBlockX();
|
||||
int py = position.getBlockY();
|
||||
int pz = position.getBlockZ();
|
||||
int px = position.x();
|
||||
int py = position.y();
|
||||
int pz = position.z();
|
||||
int maxY = editSession.getMaxY();
|
||||
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.extension.platform.Actor;
|
||||
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.Vector3;
|
||||
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.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
@ -80,9 +78,9 @@ public class InspectBrush extends BrushTool {
|
||||
return true;
|
||||
}
|
||||
BlockVector3 target = targetVector.toBlockPoint();
|
||||
final int x = target.getBlockX();
|
||||
final int y = target.getBlockY();
|
||||
final int z = target.getBlockZ();
|
||||
final int x = target.x();
|
||||
final int y = target.y();
|
||||
final int z = target.z();
|
||||
World world = player.getWorld();
|
||||
RollbackDatabase db = DBHandler.dbHandler().getDatabase(world);
|
||||
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) {
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -45,7 +45,7 @@ public record RecurseBrush(boolean dfs) implements Brush {
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, radius, editSession.getMinY(), editSession.getMaxY()) {
|
||||
@Override
|
||||
public boolean isVisitable(BlockVector3 from, BlockVector3 to) {
|
||||
int y = to.getBlockY();
|
||||
int y = to.y();
|
||||
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 seedZ = ThreadLocalRandom.current().nextDouble();
|
||||
|
||||
int px = position.getBlockX();
|
||||
int py = position.getBlockY();
|
||||
int pz = position.getBlockZ();
|
||||
int px = position.x();
|
||||
int py = position.y();
|
||||
int pz = position.z();
|
||||
|
||||
double distort = this.frequency / size;
|
||||
|
||||
double modX = 1D / radius.getX();
|
||||
double modY = 1D / radius.getY();
|
||||
double modZ = 1D / radius.getZ();
|
||||
double modX = 1D / radius.x();
|
||||
double modY = 1D / radius.y();
|
||||
double modZ = 1D / radius.z();
|
||||
|
||||
int radiusSqr = (int) (size * size);
|
||||
int sizeInt = (int) size * 2;
|
||||
|
@ -67,15 +67,15 @@ public class ScatterBrush implements Brush {
|
||||
}
|
||||
BlockVector3 patternSize = pattern.size();
|
||||
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;
|
||||
for (int i = 0; i < count; i++) {
|
||||
int index = ThreadLocalRandom.current().nextInt(length);
|
||||
BlockVector3 pos = visited.get(index);
|
||||
if (pos != null && canApply(pos)) {
|
||||
int x = pos.getBlockX();
|
||||
int y = pos.getBlockY();
|
||||
int z = pos.getBlockZ();
|
||||
int x = pos.x();
|
||||
int y = pos.y();
|
||||
int z = pos.z();
|
||||
if (placed.containsRadius(x, y, z, distance)) {
|
||||
if (maxFails-- <= 0) {
|
||||
break;
|
||||
|
@ -45,9 +45,9 @@ public class ScatterCommand extends ScatterBrush {
|
||||
position.subtract(radius, radius, radius),
|
||||
position.add(radius, radius, radius)
|
||||
);
|
||||
String replaced = command.replace("{x}", Integer.toString(position.getBlockX()))
|
||||
.replace("{y}", Integer.toString(position.getBlockY()))
|
||||
.replace("{z}", Integer.toString(position.getBlockZ()))
|
||||
String replaced = command.replace("{x}", Integer.toString(position.x()))
|
||||
.replace("{y}", Integer.toString(position.y()))
|
||||
.replace("{z}", Integer.toString(position.z()))
|
||||
.replace("{world}", editSession.getWorld().getName())
|
||||
.replace("{size}", Integer.toString(radius));
|
||||
|
||||
|
@ -16,9 +16,9 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
||||
@Override
|
||||
public void apply(EditSession editSession, LocalBlockVectorSet placed, BlockVector3 pt, Pattern p, double size) throws
|
||||
MaxChangedBlocksException {
|
||||
final int x = pt.getBlockX();
|
||||
final int y = pt.getBlockY();
|
||||
final int z = pt.getBlockZ();
|
||||
final int x = pt.x();
|
||||
final int y = pt.y();
|
||||
final int z = pt.z();
|
||||
BlockVector3 dir = getDirection(pt);
|
||||
if (dir == null) {
|
||||
getDir:
|
||||
@ -37,7 +37,7 @@ public class ScatterOverlayBrush extends ScatterBrush {
|
||||
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++) {
|
||||
BlockVector3 direction = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i1];
|
||||
int x2 = x + direction.getBlockX();
|
||||
int y2 = y + direction.getBlockY();
|
||||
int z2 = z + direction.getBlockZ();
|
||||
int x2 = x + direction.x();
|
||||
int y2 = y + direction.y();
|
||||
int z2 = z + direction.z();
|
||||
// Check boundary
|
||||
int dx = position.getBlockX() - x2;
|
||||
int dy = position.getBlockY() - y2;
|
||||
int dz = position.getBlockZ() - z2;
|
||||
int dx = position.x() - x2;
|
||||
int dy = position.y() - y2;
|
||||
int dz = position.z() - z2;
|
||||
int dSqr = (dx * dx) + (dy * dy) + (dz * dz);
|
||||
if (dSqr <= radius2) {
|
||||
BlockVector3 bv = mutable.setComponents(x2, y2, z2);
|
||||
|
@ -130,9 +130,9 @@ public class SplineBrush implements Brush, ResettableTool {
|
||||
private Vector3 getCentroid(Collection<BlockVector3> points) {
|
||||
MutableVector3 sum = new MutableVector3();
|
||||
for (BlockVector3 p : points) {
|
||||
sum.mutX(sum.getX() + p.getX());
|
||||
sum.mutY(sum.getY() + p.getY());
|
||||
sum.mutZ(sum.getZ() + p.getZ());
|
||||
sum.mutX(sum.x() + p.x());
|
||||
sum.mutY(sum.y() + p.y());
|
||||
sum.mutZ(sum.z() + p.z());
|
||||
}
|
||||
return sum.multiply(1.0 / points.size());
|
||||
}
|
||||
|
@ -38,16 +38,16 @@ public class SurfaceSpline implements Brush {
|
||||
int minY = editSession.getMinY();
|
||||
if (path.isEmpty() || !pos.equals(path.get(path.size() - 1))) {
|
||||
int max = editSession.getNearestSurfaceTerrainBlock(
|
||||
pos.getBlockX(),
|
||||
pos.getBlockZ(),
|
||||
pos.getBlockY(),
|
||||
pos.x(),
|
||||
pos.z(),
|
||||
pos.y(),
|
||||
minY,
|
||||
maxY
|
||||
);
|
||||
if (max == -1) {
|
||||
return;
|
||||
}
|
||||
path.add(BlockVector3.at(pos.getBlockX(), max, pos.getBlockZ()));
|
||||
path.add(BlockVector3.at(pos.x(), max, pos.z()));
|
||||
if (editSession.getActor() != null) {
|
||||
editSession.getActor().print(Caption.of("fawe.worldedit.brush.spline.primary.2"));
|
||||
}
|
||||
@ -69,9 +69,9 @@ public class SurfaceSpline implements Brush {
|
||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||
for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
|
||||
final Vector3 tipv = interpol.getPosition(loop);
|
||||
final int tipx = MathMan.roundInt(tipv.getX());
|
||||
final int tipz = (int) tipv.getZ();
|
||||
int tipy = MathMan.roundInt(tipv.getY());
|
||||
final int tipx = MathMan.roundInt(tipv.x());
|
||||
final int tipz = (int) tipv.z();
|
||||
int tipy = MathMan.roundInt(tipv.y());
|
||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
if (tipy == Integer.MIN_VALUE || tipy == Integer.MAX_VALUE) {
|
||||
continue;
|
||||
@ -88,15 +88,15 @@ public class SurfaceSpline implements Brush {
|
||||
LocalBlockVectorSet newSet = new LocalBlockVectorSet();
|
||||
final int ceilrad = (int) Math.ceil(radius);
|
||||
for (BlockVector3 v : vset) {
|
||||
final int tipx = v.getBlockX();
|
||||
final int tipz = v.getBlockZ();
|
||||
final int tipx = v.x();
|
||||
final int tipz = v.z();
|
||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
||||
if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
|
||||
int y = editSession.getNearestSurfaceTerrainBlock(
|
||||
loopx,
|
||||
loopz,
|
||||
v.getBlockY(),
|
||||
v.y(),
|
||||
minY,
|
||||
maxY,
|
||||
Integer.MIN_VALUE,
|
||||
|
@ -13,7 +13,7 @@ public class ScrollRange extends Scroll {
|
||||
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
int max = WorldEdit.getInstance().getConfiguration().maxBrushRadius;
|
||||
int max = player.getLimit().MAX_BRUSH_RADIUS;
|
||||
int newSize = MathMan.wrap(getTool().getRange() + amount, (int) (getTool().getSize() + 1), max);
|
||||
getTool().setRange(newSize);
|
||||
return true;
|
||||
|
@ -12,7 +12,7 @@ public class ScrollSize extends Scroll {
|
||||
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
int max = WorldEdit.getInstance().getConfiguration().maxRadius;
|
||||
int max = player.getLimit().MAX_RADIUS;
|
||||
double newSize = Math.max(0, Math.min(max == -1 ? 4095 : max, getTool().getSize() + amount));
|
||||
getTool().setSize(newSize);
|
||||
return true;
|
||||
|
@ -83,7 +83,7 @@ public class ClipboardSpline extends Spline {
|
||||
Region region = clipboard.getRegion();
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
// 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.center = center.subtract(centerOffset);
|
||||
this.transform = transform;
|
||||
@ -108,15 +108,15 @@ public class ClipboardSpline extends Spline {
|
||||
clipboardHolder.setTransform(transform);
|
||||
|
||||
BlockVector3 functionOffset = target.subtract(clipboard.getOrigin());
|
||||
final int offX = functionOffset.getBlockX();
|
||||
final int offY = functionOffset.getBlockY();
|
||||
final int offZ = functionOffset.getBlockZ();
|
||||
final int offX = functionOffset.x();
|
||||
final int offY = functionOffset.y();
|
||||
final int offZ = functionOffset.z();
|
||||
|
||||
Operation operation = clipboardHolder
|
||||
.createPaste(editSession)
|
||||
.to(target)
|
||||
.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();
|
||||
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
|
||||
*/
|
||||
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
|
||||
|
||||
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(
|
||||
-Math.atan2(cross2D(direction, deriv2D), direction.dot(deriv2D))
|
||||
);
|
||||
|
@ -79,13 +79,13 @@ public class SweepBrush implements Brush, ResettableTool {
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
double quality = Math.max(dimensions.getBlockX(), dimensions.getBlockZ());
|
||||
double quality = Math.max(dimensions.x(), dimensions.z());
|
||||
|
||||
AffineTransform transform = new AffineTransform();
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,9 @@ public class Config {
|
||||
}
|
||||
|
||||
public boolean load(File file) {
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
existingMigrateNodes = new ArrayList<>();
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
||||
for (String key : yml.getKeys(true)) {
|
||||
|
@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.configuration;
|
||||
|
||||
import com.fastasyncworldedit.core.limit.FaweLimit;
|
||||
import com.fastasyncworldedit.core.limit.PropertyRemap;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
@ -140,8 +141,22 @@ public class Settings extends Config {
|
||||
);
|
||||
limit.MAX_FAILS = Math.max(limit.MAX_FAILS, newLimit.MAX_FAILS != -1 ? newLimit.MAX_FAILS : Integer.MAX_VALUE);
|
||||
limit.MAX_ITERATIONS = Math.max(
|
||||
limit.MAX_ITERATIONS,
|
||||
newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE
|
||||
limit.MAX_ITERATIONS, newLimit.MAX_ITERATIONS != -1 ? newLimit.MAX_ITERATIONS : Integer.MAX_VALUE);
|
||||
limit.MAX_RADIUS = Math.max(
|
||||
limit.MAX_RADIUS,
|
||||
newLimit.MAX_RADIUS != -1 ? newLimit.MAX_RADIUS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_SUPER_PICKAXE_SIZE = Math.max(
|
||||
limit.MAX_SUPER_PICKAXE_SIZE,
|
||||
newLimit.MAX_SUPER_PICKAXE_SIZE != -1 ? newLimit.MAX_SUPER_PICKAXE_SIZE : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_BRUSH_RADIUS = Math.max(
|
||||
limit.MAX_BRUSH_RADIUS,
|
||||
newLimit.MAX_BRUSH_RADIUS != -1 ? newLimit.MAX_BRUSH_RADIUS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_BUTCHER_RADIUS = Math.max(
|
||||
limit.MAX_BUTCHER_RADIUS,
|
||||
newLimit.MAX_BUTCHER_RADIUS != -1 ? newLimit.MAX_BUTCHER_RADIUS : Integer.MAX_VALUE
|
||||
);
|
||||
limit.MAX_HISTORY = Math.max(
|
||||
limit.MAX_HISTORY,
|
||||
@ -352,6 +367,14 @@ public class Settings extends Config {
|
||||
public int MAX_ITERATIONS = 1000;
|
||||
@Comment("Max allowed entities (e.g. cows)")
|
||||
public int MAX_ENTITIES = 1337;
|
||||
@Comment("Max allowed radius (e.g. for //sphere)")
|
||||
public int MAX_RADIUS = LocalConfiguration.MAX_RADIUS;
|
||||
@Comment("Max allowed superpickaxe size")
|
||||
public int MAX_SUPER_PICKAXE_SIZE = LocalConfiguration.MAX_SUPER_RADIUS;
|
||||
@Comment("Max allowed brush radius")
|
||||
public int MAX_BRUSH_RADIUS = LocalConfiguration.MAX_BRUSH_RADIUS;
|
||||
@Comment("Max allowed butcher radius")
|
||||
public int MAX_BUTCHER_RADIUS = LocalConfiguration.MAX_BUTCHER_RADIUS;
|
||||
@Comment({
|
||||
"Blockstates include Banner, Beacon, BrewingStand, Chest, CommandBlock, ",
|
||||
"CreatureSpawner, Dispenser, Dropper, EndGateway, Furnace, Hopper, Jukebox, ",
|
||||
@ -645,6 +668,13 @@ public class Settings extends Config {
|
||||
@Comment({"The web interface for clipboards", " - All schematics are anonymous and private", " - Downloads can be deleted by the user", " - Supports clipboard uploads, downloads and saves",})
|
||||
public String URL = "https://schem.intellectualsites.com/fawe/";
|
||||
|
||||
@Comment({"The url of the backend server (Arkitektonika)"})
|
||||
public String ARKITEKTONIKA_BACKEND_URL = "https://api.schematic.cloud/";
|
||||
@Comment({"The url used to generate a download link from.", "{key} will be replaced with the generated key"})
|
||||
public String ARKITEKTONIKA_DOWNLOAD_URL = "https://schematic.cloud/download/{key}";
|
||||
@Comment({"The url used to generate a deletion link from.", "{key} will be replaced with the generated key"})
|
||||
public String ARKITEKTONIKA_DELETE_URL = "https://schematic.cloud/delete/{key}";
|
||||
|
||||
@Comment("The maximum amount of time in seconds the plugin can attempt to load images for.")
|
||||
public int MAX_IMAGE_LOAD_TIME = 5;
|
||||
|
||||
|
@ -68,6 +68,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
LOGGER.error("Could not read {}\n" + "Renamed to {}", file, dest.getAbsolutePath(), ex);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,13 +179,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
}
|
||||
try (PreparedStatement stmt = connection.prepareStatement(stmtStr.formatted(this.prefix))) {
|
||||
stmt.setInt(1, (int) (minTime / 1000));
|
||||
stmt.setInt(2, pos1.getBlockX());
|
||||
stmt.setInt(3, pos2.getBlockX());
|
||||
stmt.setInt(4, pos1.getBlockZ());
|
||||
stmt.setInt(5, pos2.getBlockZ());
|
||||
stmt.setInt(2, pos1.x());
|
||||
stmt.setInt(3, pos2.x());
|
||||
stmt.setInt(4, pos1.z());
|
||||
stmt.setInt(5, pos2.z());
|
||||
// Keep 128 offset for backwards-compatibility
|
||||
stmt.setInt(6, pos1.getBlockY() - 128);
|
||||
stmt.setInt(7, pos2.getBlockY() - 128);
|
||||
stmt.setInt(6, pos1.y() - 128);
|
||||
stmt.setInt(7, pos2.y() - 128);
|
||||
if (uuid != null) {
|
||||
byte[] uuidBytes = toBytes(uuid);
|
||||
stmt.setBytes(8, uuidBytes);
|
||||
@ -210,13 +210,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
.array();
|
||||
stmt.setBytes(1, uuidBytes);
|
||||
stmt.setInt(2, (int) (minTime / 1000));
|
||||
stmt.setInt(3, pos1.getBlockX());
|
||||
stmt.setInt(4, pos2.getBlockX());
|
||||
stmt.setInt(5, pos1.getBlockZ());
|
||||
stmt.setInt(6, pos2.getBlockZ());
|
||||
stmt.setInt(3, pos1.x());
|
||||
stmt.setInt(4, pos2.x());
|
||||
stmt.setInt(5, pos1.z());
|
||||
stmt.setInt(6, pos2.z());
|
||||
// Keep 128 offset for backwards-compatibility
|
||||
stmt.setInt(7, pos1.getBlockY() - 128);
|
||||
stmt.setInt(8, pos2.getBlockY() - 128);
|
||||
stmt.setInt(7, pos1.y() - 128);
|
||||
stmt.setInt(8, pos2.y() - 128);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@ -262,13 +262,13 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
BlockVector3 pos1 = change.getMinimumPoint();
|
||||
BlockVector3 pos2 = change.getMaximumPoint();
|
||||
|
||||
stmt.setInt(4, pos1.getX());
|
||||
stmt.setInt(5, pos2.getX());
|
||||
stmt.setInt(6, pos1.getZ());
|
||||
stmt.setInt(7, pos2.getZ());
|
||||
stmt.setInt(4, pos1.x());
|
||||
stmt.setInt(5, pos2.x());
|
||||
stmt.setInt(6, pos1.z());
|
||||
stmt.setInt(7, pos2.z());
|
||||
// Keep 128 offset for backwards-compatibility
|
||||
stmt.setInt(8, pos1.getY() - 128);
|
||||
stmt.setInt(9, pos2.getY() - 128);
|
||||
stmt.setInt(8, pos1.y() - 128);
|
||||
stmt.setInt(9, pos2.y() - 128);
|
||||
stmt.setString(10, change.getCommand());
|
||||
stmt.setInt(11, change.size());
|
||||
stmt.executeUpdate();
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.fastasyncworldedit.core.exception;
|
||||
|
||||
/**
|
||||
* Thrown when a maximum radius for a brush is reached.
|
||||
*/
|
||||
public class BrushRadiusLimitException extends RadiusLimitException {
|
||||
|
||||
public BrushRadiusLimitException(int maxBrushRadius) {
|
||||
super(maxBrushRadius);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.fastasyncworldedit.core.exception;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
/**
|
||||
* Thrown when a maximum radius is reached, such as, for example,
|
||||
* in the case of a sphere command.
|
||||
*/
|
||||
public class RadiusLimitException extends WorldEditException {
|
||||
|
||||
private final int maxRadius;
|
||||
|
||||
public RadiusLimitException(int maxRadius) {
|
||||
this.maxRadius = maxRadius;
|
||||
}
|
||||
|
||||
public int getMaxRadius() {
|
||||
return maxRadius;
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.common;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.extent.inventory.SlottableBlockBag;
|
||||
import com.fastasyncworldedit.core.limit.FaweLimit;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.DisallowedUsageException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class HotbarParser<T> extends SimpleInputParser<T> {
|
||||
|
||||
private final List<String> aliases = ImmutableList.of("#hotbar");
|
||||
|
||||
protected HotbarParser(final WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMatchedAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
protected List<BlockType> getBlockTypes(ParserContext context) {
|
||||
Player player = context.requirePlayer();
|
||||
BlockBag bag = player.getInventoryBlockBag();
|
||||
if (!(bag instanceof final SlottableBlockBag slottable)) {
|
||||
// Matches DefaultBlockParser
|
||||
throw new InputParseException(Caption.of("fawe.error.unsupported"));
|
||||
}
|
||||
List<BlockType> types = new ArrayList<>();
|
||||
FaweLimit limit = player.getLimit();
|
||||
boolean anyBlock = player.hasPermission("worldedit.anyblock");
|
||||
for (int slot = 0; slot < 9; slot++) {
|
||||
BaseItem item = slottable.getItem(slot);
|
||||
if (item != null && item.getType().hasBlockType()) {
|
||||
BlockType type = item.getType().getBlockType();
|
||||
if (!anyBlock && worldEdit.getConfiguration().disallowedBlocks.contains(type.id().toLowerCase(Locale.ROOT))) {
|
||||
throw new DisallowedUsageException(Caption.of(
|
||||
"worldedit.error.disallowed-block",
|
||||
TextComponent.of(type.getId())
|
||||
));
|
||||
}
|
||||
if (!limit.isUnlimited()) {
|
||||
if (limit.DISALLOWED_BLOCKS.contains(type.id().toLowerCase(Locale.ROOT))) {
|
||||
throw new DisallowedUsageException(Caption.of(
|
||||
"fawe.error.limit.disallowed-block",
|
||||
TextComponent.of(type.getId())
|
||||
));
|
||||
}
|
||||
}
|
||||
types.add(type);
|
||||
}
|
||||
}
|
||||
if (types.isEmpty()) {
|
||||
throw new InputParseException(Caption.of("fawe.error.no-valid-on-hotbar"));
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.mask;
|
||||
|
||||
import com.fastasyncworldedit.core.extension.factory.parser.common.HotbarParser;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
public class HotbarMaskParser extends HotbarParser<Mask> {
|
||||
|
||||
public HotbarMaskParser(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mask parseFromSimpleInput(String input, ParserContext context) {
|
||||
return new BlockTypeMask(context.getExtent(), getBlockTypes(context));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.fastasyncworldedit.core.extension.factory.parser.pattern;
|
||||
|
||||
import com.fastasyncworldedit.core.extension.factory.parser.common.HotbarParser;
|
||||
import com.fastasyncworldedit.core.math.random.TrueRandom;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.pattern.RandomPattern;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
public class HotbarPatternParser extends HotbarParser<Pattern> {
|
||||
|
||||
public HotbarPatternParser(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pattern parseFromSimpleInput(String input, ParserContext context) {
|
||||
RandomPattern random = new RandomPattern(new TrueRandom());
|
||||
for (BlockType type : getBlockTypes(context)) {
|
||||
random.add(type, 1);
|
||||
}
|
||||
return random;
|
||||
}
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -49,7 +49,7 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
return getBlock(location.x(), location.y(), location.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +101,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB
|
||||
@SuppressWarnings("unchecked")
|
||||
private <B extends BlockStateHolder<B>> B checkBlock(B block) {
|
||||
if (blockedBlocks != null) {
|
||||
if (blockedBlocks.contains(block.getBlockType().getId())) {
|
||||
if (blockedBlocks.contains(block.getBlockType().id())) {
|
||||
return (B) (block instanceof BlockState ? RESERVED : RESERVED.toBaseBlock()); // set to reserved/empty
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB
|
||||
}
|
||||
BlockState state = BlockTypesCache.states[block];
|
||||
if (blockedBlocks != null) {
|
||||
if (blockedBlocks.contains(state.getBlockType().getId())) {
|
||||
if (blockedBlocks.contains(state.getBlockType().id())) {
|
||||
blocks[i] = BlockTypesCache.ReservedIDs.__RESERVED__;
|
||||
continue;
|
||||
}
|
||||
|
@ -64,11 +64,11 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
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) {
|
||||
return contains(p.getBlockX(), p.getBlockZ());
|
||||
return contains(p.x(), p.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,7 +96,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getBiomeType(position.getX(), position.getY(), position.getZ());
|
||||
return getBiomeType(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,7 +112,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return getFullBlock(position.getX(), position.getY(), position.getZ());
|
||||
return getFullBlock(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,7 +128,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return getBlock(position.getX(), position.getY(), position.getZ());
|
||||
return getBlock(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +66,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -110,8 +110,8 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
||||
BiomeType oldBiome = this.getBiome(position);
|
||||
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome);
|
||||
if (!oldBiome.id().equals(newBiome.id())) {
|
||||
this.changeSet.addBiomeChange(position.x(), position.y(), position.z(), oldBiome, newBiome);
|
||||
return getExtent().setBiome(position, newBiome);
|
||||
} else {
|
||||
return false;
|
||||
@ -121,7 +121,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
||||
BiomeType oldBiome = this.getBiome(mutable.setComponents(x, y, z));
|
||||
if (!oldBiome.getId().equals(newBiome.getId())) {
|
||||
if (!oldBiome.id().equals(newBiome.id())) {
|
||||
this.changeSet.addBiomeChange(x, y, z, oldBiome, newBiome);
|
||||
return getExtent().setBiome(x, y, z, newBiome);
|
||||
} else {
|
||||
|
@ -373,12 +373,12 @@ public class LimitExtent extends AbstractDelegateExtent {
|
||||
size = ((Collection<BlockVector3>) positions).size();
|
||||
} else if (positions instanceof Region) {
|
||||
BlockVector3 dim = ((Region) positions).getDimensions();
|
||||
size = dim.getX() * dim.getY() * dim.getZ();
|
||||
size = dim.x() * dim.y() * dim.z();
|
||||
} else if (positions instanceof Extent) {
|
||||
BlockVector3 min = ((Extent) positions).getMinimumPoint();
|
||||
BlockVector3 max = ((Extent) positions).getMinimumPoint();
|
||||
BlockVector3 dim = max.subtract(min).add(BlockVector3.ONE);
|
||||
size = dim.getX() * dim.getY() * dim.getZ();
|
||||
size = dim.x() * dim.y() * dim.z();
|
||||
} else {
|
||||
ExtentFilterBlock block = new ExtentFilterBlock(this);
|
||||
for (BlockVector3 pos : positions) {
|
||||
|
@ -38,9 +38,9 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
if (min == null) {
|
||||
min = pos;
|
||||
}
|
||||
mutable.mutX(pos.getX() - min.getX());
|
||||
mutable.mutY(pos.getY() - min.getY());
|
||||
mutable.mutZ(pos.getZ() - min.getZ());
|
||||
mutable.mutX(pos.x() - min.x());
|
||||
mutable.mutY(pos.y() - min.y());
|
||||
mutable.mutZ(pos.z() - min.z());
|
||||
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||
}
|
||||
@ -49,9 +49,9 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
if (min == null) {
|
||||
min = BlockVector3.at(x, y, z);
|
||||
}
|
||||
mutable.mutX(x - min.getX());
|
||||
mutable.mutY(y - min.getY());
|
||||
mutable.mutZ(z - min.getZ());
|
||||
mutable.mutX(x - min.x());
|
||||
mutable.mutY(y - min.y());
|
||||
mutable.mutZ(z - min.z());
|
||||
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
|
||||
return min.add(tmp.roundHalfUp().toBlockPoint());
|
||||
}
|
||||
@ -73,10 +73,10 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(position.getBlockY());
|
||||
return super.getBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()));
|
||||
mutable.mutX(position.x());
|
||||
mutable.mutZ(position.z());
|
||||
mutable.mutY(position.y());
|
||||
return super.getBiome(getPos(mutable.x(), mutable.y(), mutable.z()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,10 +92,10 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(position.getBlockY());
|
||||
return super.setBiome(getPos(mutable.getX(), mutable.getY(), mutable.getZ()), biome);
|
||||
mutable.mutX(position.x());
|
||||
mutable.mutZ(position.z());
|
||||
mutable.mutY(position.y());
|
||||
return super.setBiome(getPos(mutable.x(), mutable.y(), mutable.z()), biome);
|
||||
}
|
||||
|
||||
public void setTransform(Transform transform) {
|
||||
|
@ -80,12 +80,12 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
return getBlock(location.x(), location.y(), location.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,8 +41,8 @@ public class SourceMaskExtent extends TemporalExtent {
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block) throws WorldEditException {
|
||||
set(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
return mask.test(location) && super.setBlock(location.getX(), location.getY(), location.getZ(), block);
|
||||
set(location.x(), location.y(), location.z(), block);
|
||||
return mask.test(location) && super.setBlock(location.x(), location.y(), location.z(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
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 super.getBlock(position);
|
||||
@ -60,7 +60,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
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) {
|
||||
return (BaseBlock) block;
|
||||
} else {
|
||||
@ -72,7 +72,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
if (position.getX() == bx && position.getZ() == bz) {
|
||||
if (position.x() == bx && position.z() == bz) {
|
||||
return biome;
|
||||
}
|
||||
return super.getBiome(position);
|
||||
|
@ -55,13 +55,13 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
if (min == null) {
|
||||
min = pos;
|
||||
}
|
||||
mutable1.mutX(pos.getX() - min.getX());
|
||||
mutable1.mutY(pos.getY() - min.getY());
|
||||
mutable1.mutZ(pos.getZ() - min.getZ());
|
||||
mutable1.mutX(pos.x() - min.x());
|
||||
mutable1.mutY(pos.y() - min.y());
|
||||
mutable1.mutZ(pos.z() - min.z());
|
||||
Vector3 tmp = getTransform().apply(mutable1);
|
||||
mutable2.mutX(tmp.getX() + min.getX());
|
||||
mutable2.mutY(tmp.getY() + min.getY());
|
||||
mutable2.mutZ(tmp.getZ() + min.getZ());
|
||||
mutable2.mutX(tmp.x() + min.x());
|
||||
mutable2.mutY(tmp.y() + min.y());
|
||||
mutable2.mutZ(tmp.z() + min.z());
|
||||
return mutable2;
|
||||
}
|
||||
|
||||
@ -69,20 +69,20 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
if (min == null) {
|
||||
min = BlockVector3.at(x, y, z);
|
||||
}
|
||||
mutable1.mutX(x - min.getX());
|
||||
mutable1.mutY(y - min.getY());
|
||||
mutable1.mutZ(z - min.getZ());
|
||||
mutable1.mutX(x - min.x());
|
||||
mutable1.mutY(y - min.y());
|
||||
mutable1.mutZ(z - min.z());
|
||||
Vector3 tmp = getTransform().apply(mutable1);
|
||||
mutable2.mutX(tmp.getX() + min.getX());
|
||||
mutable2.mutY(tmp.getY() + min.getY());
|
||||
mutable2.mutZ(tmp.getZ() + min.getZ());
|
||||
mutable2.mutX(tmp.x() + min.x());
|
||||
mutable2.mutY(tmp.y() + min.y());
|
||||
mutable2.mutZ(tmp.z() + min.z());
|
||||
return tmp.toBlockPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int 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
|
||||
@ -93,7 +93,7 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
BlockVector3 p = getPos(x, y, z);
|
||||
return super.getBiomeType(p.getX(), y, p.getZ());
|
||||
return super.getBiomeType(p.x(), y, p.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +114,7 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
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
|
||||
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
|
||||
@ -92,7 +92,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
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() {
|
||||
|
@ -359,7 +359,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -417,7 +417,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
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() {
|
||||
@ -438,9 +438,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
super.setOrigin(origin);
|
||||
origin = origin.subtract(offset);
|
||||
try {
|
||||
byteBuffer.putShort(10, (short) origin.getBlockX());
|
||||
byteBuffer.putShort(12, (short) origin.getBlockY());
|
||||
byteBuffer.putShort(14, (short) origin.getBlockZ());
|
||||
byteBuffer.putShort(10, (short) origin.x());
|
||||
byteBuffer.putShort(12, (short) origin.y());
|
||||
byteBuffer.putShort(14, (short) origin.z());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -450,9 +450,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
protected void setOffset(BlockVector3 offset) {
|
||||
super.setOffset(offset);
|
||||
try {
|
||||
byteBuffer.putShort(16, (short) offset.getBlockX());
|
||||
byteBuffer.putShort(18, (short) offset.getBlockY());
|
||||
byteBuffer.putShort(20, (short) offset.getBlockZ());
|
||||
byteBuffer.putShort(16, (short) offset.x());
|
||||
byteBuffer.putShort(18, (short) offset.y());
|
||||
byteBuffer.putShort(20, (short) offset.z());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -588,9 +588,9 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
||||
CompoundTag data = entity.getState().getNbtData();
|
||||
HashMap<String, Tag> value = new HashMap<>(data.getValue());
|
||||
List<DoubleTag> pos = new ArrayList<>(3);
|
||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
||||
pos.add(new DoubleTag(entity.getLocation().getX()));
|
||||
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||
pos.add(new DoubleTag(entity.getLocation().x()));
|
||||
value.put("Pos", new ListTag(DoubleTag.class, pos));
|
||||
nbtOS.writeTag(new CompoundTag(value));
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -115,7 +115,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
|
||||
@Override
|
||||
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) {
|
||||
|
@ -70,17 +70,17 @@ public abstract class SimpleClipboard implements Clipboard {
|
||||
|
||||
@Override
|
||||
public final int getWidth() {
|
||||
return size.getBlockX();
|
||||
return size.x();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getHeight() {
|
||||
return size.getBlockY();
|
||||
return size.y();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getLength() {
|
||||
return size.getBlockZ();
|
||||
return size.z();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getExtent().getBiomeType(position.getX(), position.getY(), position.getZ());
|
||||
return getExtent().getBiomeType(position.x(), position.y(), position.z());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -396,8 +396,8 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
int locY = loc.getBlockY();
|
||||
int locZ = loc.getBlockZ();
|
||||
BlockVector3 max = min.add(dimensions).subtract(BlockVector3.ONE);
|
||||
if (locX < min.getX() || locY < min.getY() || locZ < min.getZ()
|
||||
|| locX > max.getX() || locY > max.getY() || locZ > max.getZ()) {
|
||||
if (locX < min.x() || locY < min.y() || locZ < min.z()
|
||||
|| locX > max.x() || locY > max.y() || locZ > max.z()) {
|
||||
for (Entity e : clipboard.getEntities()) {
|
||||
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'
|
||||
out.writeNamedTag("Offset", new int[]{
|
||||
min.getBlockX(),
|
||||
min.getBlockY(),
|
||||
min.getBlockZ(),
|
||||
min.x(),
|
||||
min.y(),
|
||||
min.z(),
|
||||
});
|
||||
|
||||
out.writeLazyCompoundTag("Metadata", out1 -> {
|
||||
out1.writeNamedTag("WEOffsetX", offset.getBlockX());
|
||||
out1.writeNamedTag("WEOffsetY", offset.getBlockY());
|
||||
out1.writeNamedTag("WEOffsetZ", offset.getBlockZ());
|
||||
out1.writeNamedTag("WEOffsetX", offset.x());
|
||||
out1.writeNamedTag("WEOffsetY", offset.y());
|
||||
out1.writeNamedTag("WEOffsetZ", offset.z());
|
||||
out1.writeNamedTag("FAWEVersion", Fawe.instance().getVersion().build);
|
||||
});
|
||||
|
||||
@ -162,9 +162,9 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
// Dum.
|
||||
values.remove("id");
|
||||
values.put("Pos", new IntArrayTag(new int[]{
|
||||
pos.getX(),
|
||||
pos.getY(),
|
||||
pos.getZ()
|
||||
pos.x(),
|
||||
pos.y(),
|
||||
pos.z()
|
||||
}));
|
||||
numTiles++;
|
||||
|
||||
@ -237,7 +237,7 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
if (!brokenEntities) {
|
||||
loc = loc.setPosition(loc.add(min.toVector3()));
|
||||
}
|
||||
values.put("Id", new StringTag(state.getType().getId()));
|
||||
values.put("Id", new StringTag(state.getType().id()));
|
||||
values.put("Pos", writeVector(loc));
|
||||
values.put("Rotation", writeRotation(entity.getLocation()));
|
||||
|
||||
@ -282,10 +282,10 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
int length = clipboard.getRegion().getLength();
|
||||
MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||
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++) {
|
||||
int x0 = min.getBlockX() + x;
|
||||
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.getY(), z0));
|
||||
int x0 = min.x() + x;
|
||||
BiomeType biome = clipboard.getBiome(mutable.setComponents(x0, min.y(), z0));
|
||||
task.applyInt(i, biome.getInternalId());
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ public class FastSchematicWriter implements ClipboardWriter {
|
||||
for (int i = 0; i < paletteList.size(); i++) {
|
||||
int ordinal = paletteList.get(i);
|
||||
BiomeType state = BiomeTypes.get(ordinal);
|
||||
out12.writeNamedTag(state.getId(), i);
|
||||
out12.writeNamedTag(state.id(), i);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
|
||||
indexes.put(combined, (Integer) palette.size());
|
||||
HashMap<String, Object> paletteEntry = new HashMap<>();
|
||||
paletteEntry.put("Name", type.getId());
|
||||
paletteEntry.put("Name", type.id());
|
||||
if (block.getInternalId() != type.getInternalId()) {
|
||||
Map<String, Object> properties = null;
|
||||
for (AbstractProperty property : (List<AbstractProperty<?>>) type.getProperties()) {
|
||||
@ -213,8 +213,8 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
if (block.getBlockType() != BlockTypes.STRUCTURE_VOID) {
|
||||
int combined = block.getInternalId();
|
||||
int index = indexes.get(combined);
|
||||
List<Integer> pos = Arrays.asList(point.getX() - min.getX(),
|
||||
point.getY() - min.getY(), point.getZ() - min.getZ()
|
||||
List<Integer> pos = Arrays.asList(point.x() - min.x(),
|
||||
point.y() - min.y(), point.z() - min.z()
|
||||
);
|
||||
if (!block.hasNbtData()) {
|
||||
blocks.add(FaweCache.INSTANCE.asMap("state", index, "pos", pos));
|
||||
@ -231,16 +231,16 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
ArrayList<Map<String, Object>> entities = new ArrayList<>();
|
||||
for (Entity entity : clipboard.getEntities()) {
|
||||
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());
|
||||
BaseEntity state = entity.getState();
|
||||
if (state != null) {
|
||||
CompoundTag nbt = state.getNbtData();
|
||||
Map<String, Tag> nbtMap = nbt.getValue();
|
||||
Map<String, Tag> nbtMap = new HashMap<>(nbt.getValue());
|
||||
// Replace rotation data
|
||||
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
|
||||
nbtMap.put("id", new StringTag(state.getType().getId()));
|
||||
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
|
||||
nbtMap.put("id", new StringTag(state.getType().id()));
|
||||
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", new CompoundTag(nbtMap));
|
||||
entities.add(entityMap);
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user