Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend the Folia Support from SirYwell #2171

Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a9e1d50
fix: add null-check for brush in traceMask (#2160)
dordsor21 Mar 31, 2023
b42f6a2
Update renovate.json (#2167)
NotMyFault Apr 1, 2023
ec343a9
Add folia support
TheMeinerLP Mar 30, 2023
a6e5950
Set paperweight to local dev build
TheMeinerLP Apr 2, 2023
9095a74
Add a local folia dev build
TheMeinerLP Apr 2, 2023
7bb5815
Add run folia task
TheMeinerLP Apr 2, 2023
2c042b5
Port taskmanager for folia
TheMeinerLP Apr 2, 2023
abc39c3
Fix tasks manager
TheMeinerLP Apr 2, 2023
db4808b
Fix port for folia
TheMeinerLP Apr 2, 2023
4f84e36
Remove maven local
TheMeinerLP Apr 2, 2023
84e7dd4
Build back to paper adapter
TheMeinerLP Apr 2, 2023
07ae60d
Add special adapter load for folia
TheMeinerLP Apr 2, 2023
6c9bf0a
Add folia adapter
TheMeinerLP Apr 2, 2023
5dd8903
Fix package for classes
TheMeinerLP Apr 2, 2023
bd59522
Fix package for classes
TheMeinerLP Apr 2, 2023
240bf81
Improve search for folia adapter
TheMeinerLP Apr 2, 2023
48d50ae
Fix shading of folia adapters
TheMeinerLP Apr 2, 2023
4bee821
Add runFolia with snapshot version of run paper
TheMeinerLP Apr 2, 2023
e763695
Fix regen command
TheMeinerLP Apr 2, 2023
b3a56de
Fix UnsupportedOperationException on disable
TheMeinerLP Apr 2, 2023
7c3c91f
Use new method to check of is running on "main thread"
TheMeinerLP Apr 3, 2023
034aa10
Implement dirty workaround for get data from right ticking region
TheMeinerLP Apr 3, 2023
ba778fe
Implement dirty workaround for get data from right ticking region
TheMeinerLP Apr 3, 2023
b605445
Implement dirty workaround for get data from right ticking region
TheMeinerLP Apr 3, 2023
434a58f
Improve scheduling for chunk data of regen
TheMeinerLP Apr 3, 2023
6c0b7ac
Fix compass tool
TheMeinerLP Apr 3, 2023
eb34a4f
Merge remote-tracking branch 'fork-https/feature/folia-support' into …
TheMeinerLP Apr 5, 2023
2b51896
Improve testability by adding more versions of runPaper to the build …
TheMeinerLP Apr 7, 2023
bb8c9d2
Update dependency org.bstats:bstats-base to v3.0.2 (#2170)
renovate[bot] Apr 7, 2023
2dc8f7b
Update paperweight version for 1.19.4 (#2166)
NotMyFault Apr 7, 2023
a42864e
[ci skip] Move renovate config to .github folder
NotMyFault Apr 7, 2023
da4d966
Fix Misaligned SVG In IJ project view (#2174)
TheMeinerLP Apr 10, 2023
e4158ac
fix: invalidate cached FaweMask when a plot is unlinked (#2157)
dordsor21 Apr 13, 2023
5cd9616
fix: Ensure BaseBlock is not returned when a BlockState is wanted in …
dordsor21 Apr 13, 2023
86acb1c
Simplify command dispatch to ensure command order (#2131)
SirYwell Apr 18, 2023
05afaf0
Address incompatibilities after CraftChunk changes in spigot (#2179)
SirYwell Apr 21, 2023
8cfb8cb
chore: add chunk tickets to all chunks accessed (#2163)
dordsor21 Apr 22, 2023
488a2e5
Add an explanation to Disallowed-Blocks Comment (#2186)
360shvit Apr 22, 2023
c86dfe4
Ensure regen step not running on the main thread (#2185)
SirYwell Apr 23, 2023
abe1202
Release 2.6.1
NotMyFault Apr 23, 2023
9f3c909
Back to snapshot for development
NotMyFault Apr 23, 2023
ffe704d
Update dependency org.mockito:mockito-core to v5.3.1 (#2204)
renovate[bot] May 1, 2023
909b7d2
Update dependency org.ajoberstar.grgit:grgit-gradle to v5.2.0 (#2203)
renovate[bot] May 1, 2023
4779bd4
Update plugin xyz.jpenilla.run-paper to v2.1.0 (#2205)
renovate[bot] May 1, 2023
950a3f9
Update dependency com.github.TownyAdvanced:Towny to v0.99.0.5 (#2202)
renovate[bot] May 1, 2023
92a6ff5
Update dependency io.papermc.paperweight.userdev:io.papermc.paperweig…
renovate[bot] May 1, 2023
e2cb7ea
Merge branch 'main' into feature/folia-support
TheMeinerLP May 31, 2023
f1bb12c
Fix duplicated import
TheMeinerLP May 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import org.ajoberstar.grgit.Grgit
import java.time.format.DateTimeFormatter
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
import xyz.jpenilla.runpaper.task.RunServer
import java.net.URI

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("xyz.jpenilla.run-paper") version "2.0.1"
id("xyz.jpenilla.run-paper") version "2.0.2-SNAPSHOT"
}

if (!File("$rootDir/.git").exists()) {
Expand Down Expand Up @@ -90,6 +91,14 @@ tasks {
.toTypedArray())

}
register<RunServer>("runFolia") {
downloadsApiService.set(xyz.jpenilla.runtask.service.DownloadsAPIService.folia(project))
minecraftVersion("1.19.4")
group = "run paper"
runDirectory.set(file("run-folia"))
pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
.toTypedArray())
}
}

nexusPublishing {
Expand Down
13 changes: 12 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ include("worldedit-libs")
listOf("legacy", "1_17_1", "1_18_2", "1_19", "1_19_3","1_19_4").forEach {
include("worldedit-bukkit:adapters:adapter-$it")
}

listOf("1_19_4").forEach {
include("worldedit-bukkit:folia-adapters:adapter-$it")
}
listOf("bukkit", "core", "cli").forEach {
include("worldedit-libs:$it")
include("worldedit-$it")
Expand All @@ -21,5 +23,14 @@ dependencyResolutionManagement {
}
}
}
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = "jmp repository"
url = uri("https://repo.jpenilla.xyz/snapshots")
}
}
}

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public synchronized net.minecraft.world.level.block.state.BlockState setBlockSta
net.minecraft.world.level.block.state.BlockState blockState
) {
int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return levelChunk.setBlockState(blockPos, blockState,
this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE)
);
Expand Down Expand Up @@ -266,7 +266,7 @@ public void run(Object value) {
}
}
};
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
runnableVal.run();
} else {
TaskManager.taskManager().sync(runnableVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
if (nmsChunk != null) {
return nmsChunk;
}
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
} else {
Expand All @@ -216,7 +216,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
return nmsChunk;
}
// Avoid "async" methods from the main thread.
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
CompletableFuture<org.bukkit.Chunk> future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public synchronized net.minecraft.world.level.block.state.BlockState setBlockSta
net.minecraft.world.level.block.state.BlockState blockState
) {
int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return levelChunk.setBlockState(blockPos, blockState,
this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE)
);
Expand Down Expand Up @@ -266,7 +266,7 @@ public void run(Object value) {
}
}
};
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
runnableVal.run();
} else {
TaskManager.taskManager().sync(runnableVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
if (nmsChunk != null) {
return nmsChunk;
}
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
} else {
Expand All @@ -244,7 +244,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
return nmsChunk;
}
// Avoid "async" methods from the main thread.
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
CompletableFuture<org.bukkit.Chunk> future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public synchronized net.minecraft.world.level.block.state.BlockState setBlockSta
net.minecraft.world.level.block.state.BlockState blockState
) {
int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return levelChunk.setBlockState(blockPos, blockState,
this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE)
);
Expand Down Expand Up @@ -266,7 +266,7 @@ public void run(Object value) {
}
}
};
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
runnableVal.run();
} else {
TaskManager.taskManager().sync(runnableVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
if (nmsChunk != null) {
return nmsChunk;
}
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
} else {
Expand All @@ -277,7 +277,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
return nmsChunk;
}
// Avoid "async" methods from the main thread.
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
CompletableFuture<org.bukkit.Chunk> future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public synchronized net.minecraft.world.level.block.state.BlockState setBlockSta
net.minecraft.world.level.block.state.BlockState blockState
) {
int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return levelChunk.setBlockState(blockPos, blockState,
this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE)
);
Expand Down Expand Up @@ -267,7 +267,7 @@ public void run(Object value) {
}
}
};
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
runnableVal.run();
} else {
TaskManager.taskManager().sync(runnableVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
if (nmsChunk != null) {
return nmsChunk;
}
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
} else {
Expand All @@ -278,7 +278,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
return nmsChunk;
}
// Avoid "async" methods from the main thread.
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
CompletableFuture<org.bukkit.Chunk> future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public synchronized net.minecraft.world.level.block.state.BlockState setBlockSta
net.minecraft.world.level.block.state.BlockState blockState
) {
int currentTick = MinecraftServer.currentTick;
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return levelChunk.setBlockState(blockPos, blockState,
this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE)
);
Expand Down Expand Up @@ -266,7 +266,7 @@ public void run(Object value) {
}
}
};
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
runnableVal.run();
} else {
TaskManager.taskManager().sync(runnableVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
if (nmsChunk != null) {
return nmsChunk;
}
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
} else {
Expand All @@ -274,7 +274,7 @@ public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int c
return nmsChunk;
}
// Avoid "async" methods from the main thread.
if (Fawe.isMainThread()) {
if (Fawe.isTickThread()) {
return serverLevel.getChunk(chunkX, chunkZ);
}
CompletableFuture<org.bukkit.Chunk> future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,6 @@ protected boolean initNewWorld() throws Exception {
WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType())
) : null;

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method must be kept

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is no longer existing at folia. Thats one many reasons why we have multiple adapters and seperated from main adapter

public void tick(BooleanSupplier shouldKeepTicking) { //no ticking
}

@Override
public Holder<Biome> getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ) {
Expand Down
27 changes: 26 additions & 1 deletion worldedit-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ val adapters = configurations.create("adapters") {
attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED))
}
}

val foliaAdapters = configurations.create("foliaAdapters") {
description = "Adapters to include in the JAR"
isCanBeConsumed = false
isCanBeResolved = true
shouldResolveConsistentlyWith(configurations["runtimeClasspath"])
attributes {
attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED))
}
}
dependencies {
// Modules
api(projects.worldeditCore)
Expand All @@ -59,11 +67,19 @@ dependencies {
project.project(":worldedit-bukkit:adapters").subprojects.forEach {
"adapters"(project(it.path))
}
project.project(":worldedit-bukkit:folia-adapters").subprojects.forEach {
"foliaAdapters"(project(it.path))
}

// Minecraft expectations
implementation(libs.fastutil)

// Platform expectations
compileOnly("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT") {
exclude("junit", "junit")
exclude(group = "org.slf4j", module = "slf4j-api")
exclude(group = "net.kyori")
}
compileOnly("io.papermc.paper:paper-api") {
exclude("junit", "junit")
exclude(group = "org.slf4j", module = "slf4j-api")
Expand Down Expand Up @@ -132,6 +148,7 @@ addJarManifest(WorldEditKind.Plugin, includeClasspath = true)

tasks.named<ShadowJar>("shadowJar") {
dependsOn(project.project(":worldedit-bukkit:adapters").subprojects.map { it.tasks.named("assemble") })
dependsOn(project.project(":worldedit-bukkit:folia-adapters").subprojects.map { it.tasks.named("assemble") })
from(Callable {
adapters.resolve()
.map { f ->
Expand All @@ -140,6 +157,14 @@ tasks.named<ShadowJar>("shadowJar") {
}
}
})
from(Callable {
foliaAdapters.resolve()
.map { f ->
zipTree(f).matching {
exclude("META-INF/")
}
}
})
archiveFileName.set("${rootProject.name}-Bukkit-${project.version}.${archiveExtension.getOrElse("jar")}")
dependencies {
// In tandem with not bundling log4j, we shouldn't relocate base package here.
Expand Down
14 changes: 14 additions & 0 deletions worldedit-bukkit/folia-adapters/adapter-1_19_4/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
java
}

applyPaperweightAdapterConfiguration()

repositories {
gradlePluginPortal()
}

dependencies {
paperweightDevBundle("dev.folia", "1.19.4-R0.1-SNAPSHOT")
compileOnly("io.papermc:paperlib")
}
Loading