3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00

Merge branch 'main' into major/2.0.0/1.18

Dieser Commit ist enthalten in:
dordsor21 2021-12-20 20:28:15 +00:00
Commit c697eb8d41
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
9 geänderte Dateien mit 58 neuen und 50 gelöschten Zeilen

13
.whitesource Normale Datei
Datei anzeigen

@ -0,0 +1,13 @@
{
"scanSettings": {
"baseBranches": ["main"]
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure",
"displayMode": "diff"
},
"issueSettings": {
"minSeverityLevel": "LOW"
},
"enableRenovate": "true"
}

10
Jenkinsfile vendored Normale Datei
Datei anzeigen

@ -0,0 +1,10 @@
pipeline {
agent any
stages {
stage('Build pull request') {
steps {
sh './gradlew clean build'
}
}
}
}

Datei anzeigen

@ -29,8 +29,8 @@ val properties = Properties().also { props ->
dependencies {
implementation(gradleApi())
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.0")
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.1")
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.1")
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.3.0-SNAPSHOT")
}

Datei anzeigen

@ -1,7 +1,7 @@
[versions]
# Minecraft expectations
fastutil = "8.5.6"
log4j = "2.14.1"
log4j = "2.17.0"
guava = "31.0.1-jre"
gson = "2.8.8"
@ -17,9 +17,9 @@ griefprevention = "16.17.1"
griefdefender = "920a610"
mcore = "7.0.1"
residence = "4.5._13.1"
towny = "0.97.2.15"
towny = "0.97.5.0"
protocollib = "4.7.0"
plotsquaredV6 = "6.1.4"
plotsquaredV6 = "6.2.0"
plotsquaredV4 = "4.514"
redprotect = "1.9.6"
@ -33,7 +33,7 @@ sparsebitset = "1.2"
parallelgzip = "1.0.5"
adventure = "4.9.3"
truezip = "6.8.4"
auto-value = "1.8.2"
auto-value = "1.9"
findbugs = "3.0.2"
rhino-runtime = "1.7.13"
zstd-jni = "1.4.8-1" # Not latest as it can be difficult to obtain latest ZSTD libs
@ -50,11 +50,11 @@ text = "3.0.4"
piston = "0.5.7"
# Tests
mockito = "4.1.0"
checker-qual = "3.19.0"
mockito = "4.2.0"
checker-qual = "3.21.0"
# Gradle plugins
pluginyml = "0.5.0"
pluginyml = "0.5.1"
[libraries]
# Minecraft expectations

Datei anzeigen

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Datei anzeigen

@ -658,7 +658,9 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
}
}
private WorldGenSettings replaceSeed(ServerLevel originalWorld, long seed, WorldGenSettings originalOpts) {
// FAWE start - private -> public static
public static WorldGenSettings replaceSeed(ServerLevel originalWorld, long seed, WorldGenSettings originalOpts) {
// FAWE end
RegistryWriteOps<net.minecraft.nbt.Tag> nbtReadRegOps = RegistryWriteOps.create(
NbtOps.INSTANCE,
originalWorld.getServer().registryAccess()
@ -685,8 +687,10 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
);
}
// FAWE start - private -> private static
@SuppressWarnings("unchecked")
private Dynamic<net.minecraft.nbt.Tag> recursivelySetSeed(
private static Dynamic<net.minecraft.nbt.Tag> recursivelySetSeed(
// FAWE end
Dynamic<net.minecraft.nbt.Tag> dynamic,
long seed,
Set<Dynamic<net.minecraft.nbt.Tag>> seen

Datei anzeigen

@ -9,9 +9,9 @@ import com.fastasyncworldedit.core.util.TaskManager;
import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec;
import com.mojang.serialization.Dynamic;
import com.mojang.serialization.Lifecycle;
import com.sk89q.worldedit.bukkit.adapter.Refraction;
import com.sk89q.worldedit.bukkit.adapter.ext.fawe.PaperweightAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_17_R1_2.PaperweightGetBlocks;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.internal.util.LogManagerCompat;
@ -21,12 +21,9 @@ import com.sk89q.worldedit.world.RegenOptions;
import io.papermc.lib.PaperLib;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.data.worldgen.biome.Biomes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtOps;
import net.minecraft.resources.RegistryReadOps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
@ -78,12 +75,10 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BooleanSupplier;
@ -220,19 +215,11 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
PrimaryLevelData levelProperties = (PrimaryLevelData) server.getWorldData();
RegistryReadOps<net.minecraft.nbt.Tag> nbtRegOps = RegistryReadOps.createAndLoad(
NbtOps.INSTANCE, server.resources.getResourceManager(),
RegistryAccess.builtin()
);
WorldGenSettings newOpts = WorldGenSettings.CODEC
.encodeStart(nbtRegOps, levelProperties.worldGenSettings())
.flatMap(tag -> WorldGenSettings.CODEC.parse(this.recursivelySetSeed(
new Dynamic<>(nbtRegOps, tag),
seed,
new HashSet<>()
)))
.result()
.orElseThrow(() -> new IllegalStateException("Unable to map GeneratorOptions"));
WorldGenSettings originalOpts = levelProperties.worldGenSettings();
WorldGenSettings newOpts = options.getSeed().isPresent()
? PaperweightAdapter.replaceSeed(originalServerWorld, seed, originalOpts)
: originalOpts;
LevelSettings newWorldSettings = new LevelSettings(
"worldeditregentempworld",
originalWorldData.settings.gameType(),
@ -438,23 +425,6 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
}
}
private Dynamic<net.minecraft.nbt.Tag> recursivelySetSeed(
Dynamic<net.minecraft.nbt.Tag> dynamic,
long seed,
Set<Dynamic<net.minecraft.nbt.Tag>> dynamicSet
) {
return !dynamicSet.add(dynamic) ? dynamic : dynamic.updateMapValues((pair) -> {
if (pair.getFirst().asString("").equals("seed")) {
return pair.mapSecond((v) -> v.createLong(seed));
} else {
return ((Dynamic) pair.getSecond()).getValue() instanceof CompoundTag
? pair.mapSecond((v) -> this.recursivelySetSeed((Dynamic) v, seed, dynamicSet))
: pair;
}
});
}
private BiomeSource fastOverworldBiomeSource(BiomeSource biomeSource) throws Exception {
Field legacyBiomeInitLayerField = OverworldBiomeSource.class.getDeclaredField(
Refraction.pickName("legacyBiomeInitLayer", "i"));

Datei anzeigen

@ -398,9 +398,20 @@ public class LocalSession implements TextureHolder {
* Clear history.
*/
public void clearHistory() {
history.clear();
//FAWE start
historyWriteLock.lock();
try {
// Ensure that changesets are properly removed
for (Object item : history) {
getChangeSet(item).delete();
}
history.clear();
} finally {
historyWriteLock.unlock();
}
historyNegativeIndex = 0;
save();
historySize = 0;
currentWorld = null;
//FAWE end

Datei anzeigen

@ -28,7 +28,7 @@ dependencies {
})
api("org.apache.logging.log4j:log4j-api")
api("org.bstats:bstats-sponge:1.7")
testImplementation("org.mockito:mockito-core:4.1.0")
testImplementation("org.mockito:mockito-core:4.2.0")
}
<<<<<<< HEAD