Update FaWe #7

Zusammengeführt
Lixfel hat 467 Commits von update nach main 2024-11-28 22:27:32 +01:00 zusammengeführt
6 geänderte Dateien mit 20 neuen und 47 gelöschten Zeilen
Nur Änderungen aus Commit 41d294e73b werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -83,7 +83,7 @@ allprojects {
}
applyCommonConfiguration()
val supportedVersions = listOf("1.19.4", "1.20", "1.20.4", "1.20.5", "1.20.6", "1.21")
val supportedVersions = listOf("1.19.4", "1.20", "1.20.4", "1.20.5", "1.20.6", "1.21", "1.21.1")
Review

Wir brauchen unbedingt weiterhin: 1.18.2, 1.19.3, 1.20.1 Support!

Wir brauchen unbedingt weiterhin: 1.18.2, 1.19.3, 1.20.1 Support!
Review

Geht net, es gibt keinen Support für diese Versionen mehr, und finde es viel zu viel aufwand, diesen noch künstlich am Leben zu erhalten.

Habe deshalb von anfang an schon eher als >1.21 FaWe geplant, also wäre dieser Support auch nicht nötig, da wir noch das alte hätten.

Geht net, es gibt keinen Support für diese Versionen mehr, und finde es viel zu viel aufwand, diesen noch künstlich am Leben zu erhalten. Habe deshalb von anfang an schon eher als >1.21 FaWe geplant, also wäre dieser Support auch nicht nötig, da wir noch das alte hätten.
Review

So viel Aufwand war das bei meinen bisherigen Portierungen nicht (1.18.2, 1.19.3 Support gabs da auch schon lange nicht mehr). Problem ist dann eher der SchematicReader (siehe SpigotCore)

So viel Aufwand war das bei meinen bisherigen Portierungen nicht (1.18.2, 1.19.3 Support gabs da auch schon lange nicht mehr). Problem ist dann eher der SchematicReader (siehe SpigotCore)
tasks {
supportedVersions.forEach {

Datei anzeigen

@ -24,7 +24,7 @@ dependencies {
implementation(gradleApi())
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2")
implementation("com.github.johnrengelman:shadow:8.1.1")
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.7.1")
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.7.2")
constraints {
val asmVersion = "[9.7,)"
implementation("org.ow2.asm:asm:$asmVersion") {

Datei anzeigen

@ -11,7 +11,7 @@ repositories {
}
dependencies {
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.21-R0.1-SNAPSHOT/
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.21-R0.1-20240629.091304-42")
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.21.1-R0.1-SNAPSHOT/
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.21.1-R0.1-20240810.223713-4")
compileOnly(libs.paperlib)
}

Datei anzeigen

@ -195,8 +195,8 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
CraftServer.class.cast(Bukkit.getServer());
int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion();
if (dataVersion != 3953) {
throw new UnsupportedClassVersionError("Not 1.21!");
if (dataVersion != 3953 && dataVersion != 3955) {
throw new UnsupportedClassVersionError("Not 1.21(.1)!");
}
serverWorldsField = CraftServer.class.getDeclaredField("worlds");

Datei anzeigen

@ -624,15 +624,14 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
private boolean wasAccessibleSinceLastSave(ChunkHolder holder) {
if (!PaperLib.isPaper() || !PaperweightPlatformAdapter.POST_CHUNK_REWRITE) {
try {
return (boolean) CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE.invoke(holder);
} catch (IllegalAccessException | InvocationTargetException ignored) {
// fall-through
}
if (PaperLib.isPaper()) { // Papers new chunk system has no related replacement - therefor we assume true.
return true;
}
try {
return (boolean) CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE.invoke(holder);
} catch (IllegalAccessException | InvocationTargetException ignored) {
return false;
}
// Papers new chunk system has no related replacement - therefor we assume true.
return true;
}
}

Datei anzeigen

@ -2,7 +2,6 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1;
import ca.spottedleaf.moonrise.patches.chunk_system.level.entity.ChunkEntitySlices;
import ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager;
import com.destroystokyo.paper.util.maplist.EntityList;
import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter;
import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore;
import com.fastasyncworldedit.bukkit.adapter.NMSAdapter;
@ -117,9 +116,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
private static final Logger LOGGER = LogManagerCompat.getLogger();
static final boolean POST_CHUNK_REWRITE;
private static Method PAPER_CHUNK_GEN_ALL_ENTITIES;
private static Field LEVEL_CHUNK_ENTITIES;
private static Field SERVER_LEVEL_ENTITY_MANAGER;
static {
@ -189,28 +186,15 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "p"));
fieldRemove.setAccessible(true);
boolean chunkRewrite;
try {
Level.class.getDeclaredMethod("moonrise$getEntityLookup");
chunkRewrite = true;
PAPER_CHUNK_GEN_ALL_ENTITIES = ChunkEntitySlices.class.getDeclaredMethod("getAllEntities");
PAPER_CHUNK_GEN_ALL_ENTITIES.setAccessible(true);
} catch (NoSuchMethodException ignored) {
chunkRewrite = false;
}
try {
// Paper - Pre-Chunk-Update
LEVEL_CHUNK_ENTITIES = LevelChunk.class.getDeclaredField("entities");
LEVEL_CHUNK_ENTITIES.setAccessible(true);
} catch (NoSuchFieldException ignored) {
}
try {
// Non-Paper
SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "N"));
SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true);
} catch (NoSuchFieldException ignored) {
}
POST_CHUNK_REWRITE = chunkRewrite;
} catch (RuntimeException | Error e) {
throw e;
} catch (Exception e) {
@ -657,32 +641,22 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
}
static List<Entity> getEntities(LevelChunk chunk) {
ExceptionCollector<RuntimeException> collector = new ExceptionCollector<>();
if (PaperLib.isPaper()) {
if (POST_CHUNK_REWRITE) {
try {
//noinspection unchecked
return (List<Entity>) PAPER_CHUNK_GEN_ALL_ENTITIES.invoke(chunk.level.moonrise$getEntityLookup().getChunk(chunk.locX, chunk.locZ));
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=true]", e);
}
}
try {
EntityList entityList = (EntityList) LEVEL_CHUNK_ENTITIES.get(chunk);
return List.of(entityList.getRawData());
} catch (IllegalAccessException e) {
collector.add(new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=false]", e));
// fall through
//noinspection unchecked
return (List<Entity>) PAPER_CHUNK_GEN_ALL_ENTITIES.invoke(chunk.level
.moonrise$getEntityLookup()
.getChunk(chunk.locX, chunk.locZ));
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException("Failed to lookup entities [PAPER=true]", e);
}
}
try {
//noinspection unchecked
return ((PersistentEntitySectionManager<Entity>) (SERVER_LEVEL_ENTITY_MANAGER.get(chunk.level))).getEntities(chunk.getPos());
} catch (IllegalAccessException e) {
collector.add(new RuntimeException("Failed to lookup entities [PAPER=false]", e));
throw new RuntimeException("Failed to lookup entities [PAPER=false]", e);
}
collector.throwIfPresent();
return List.of();
}
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {