Skip to content

Commit 1a9a5d8

Browse files
Merge pull request #1223 from VolmitSoftware/dev
3.7.10
2 parents 709f05c + c5c7f9b commit 1a9a5d8

File tree

178 files changed

+5985
-1677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+5985
-1677
lines changed

build.gradle.kts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import kotlin.system.exitProcess
2424

2525
buildscript {
2626
repositories.maven("https://jitpack.io")
27-
dependencies.classpath("com.github.VolmitSoftware:NMSTools:c5cbc46ce6")
27+
dependencies.classpath("com.github.VolmitSoftware:NMSTools:c88961416f")
2828
}
2929

3030
plugins {
@@ -62,10 +62,10 @@ val serverMinHeap = "2G"
6262
val serverMaxHeap = "8G"
6363
//Valid values are: none, truecolor, indexed256, indexed16, indexed8
6464
val color = "truecolor"
65-
val errorReporting = false
65+
val errorReporting = findProperty("errorReporting") as Boolean? ?: false
6666

6767
val nmsBindings = mapOf(
68-
"v1_21_R5" to "1.21.7-R0.1-SNAPSHOT",
68+
"v1_21_R5" to "1.21.8-R0.1-SNAPSHOT",
6969
"v1_21_R4" to "1.21.5-R0.1-SNAPSHOT",
7070
"v1_21_R3" to "1.21.4-R0.1-SNAPSHOT",
7171
"v1_21_R2" to "1.21.3-R0.1-SNAPSHOT",
@@ -81,10 +81,6 @@ nmsBindings.forEach { key, value ->
8181
apply<JavaPlugin>()
8282
apply<NMSToolsPlugin>()
8383

84-
repositories {
85-
maven("https://libraries.minecraft.net")
86-
}
87-
8884
extensions.configure(NMSToolsExtension::class) {
8985
jvm = jvmVersion.getOrDefault(key, 21)
9086
version = value

core/build.gradle.kts

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ plugins {
2828
alias(libs.plugins.sentry)
2929
alias(libs.plugins.slimjar)
3030
alias(libs.plugins.grgit)
31+
alias(libs.plugins.kotlin.jvm)
32+
alias(libs.plugins.kotlin.lombok)
3133
}
3234

3335
val apiVersion = "1.19"
@@ -81,18 +83,31 @@ dependencies {
8183
slim(libs.commons.io)
8284
slim(libs.commons.lang)
8385
slim(libs.commons.lang3)
86+
slim(libs.commons.math3)
8487
slim(libs.oshi)
8588
slim(libs.lz4)
8689
slim(libs.fastutil)
8790
slim(libs.lru)
8891
slim(libs.zip)
8992
slim(libs.gson)
9093
slim(libs.asm)
91-
slim(libs.bsf)
92-
slim(libs.rhino)
9394
slim(libs.caffeine)
9495
slim(libs.byteBuddy.core)
9596
slim(libs.byteBuddy.agent)
97+
slim(libs.dom4j)
98+
slim(libs.jaxen)
99+
100+
// Script Engine
101+
slim(libs.kotlin.stdlib)
102+
slim(libs.kotlin.coroutines)
103+
slim(libs.kotlin.scripting.common)
104+
slim(libs.kotlin.scripting.jvm)
105+
slim(libs.kotlin.scripting.jvm.host)
106+
slim(libs.kotlin.scripting.dependencies.maven) {
107+
constraints {
108+
slim(libs.mavenCore)
109+
}
110+
}
96111
}
97112

98113
java {
@@ -120,6 +135,13 @@ slimJar {
120135
relocate("net.kyori", "$lib.kyori")
121136
relocate("org.bstats", "$lib.metrics")
122137
relocate("io.sentry", "$lib.sentry")
138+
relocate("org.apache.maven", "$lib.maven")
139+
relocate("org.codehaus.plexus", "$lib.plexus")
140+
relocate("org.eclipse.sisu", "$lib.sisu")
141+
relocate("org.eclipse.aether", "$lib.aether")
142+
relocate("com.google.inject", "$lib.guice")
143+
relocate("org.dom4j", "$lib.dom4j")
144+
relocate("org.jaxen", "$lib.jaxen")
123145
}
124146

125147
tasks {
@@ -140,15 +162,6 @@ tasks {
140162
"version" to rootProject.version,
141163
"apiVersion" to apiVersion,
142164
"main" to main,
143-
"environment" to if (project.hasProperty("release")) "production" else "development",
144-
"commit" to provider {
145-
val res = runCatching { project.extensions.getByType<Grgit>().head().id }
146-
res.getOrDefault("")
147-
.takeIf { it.length == 40 } ?: {
148-
logger.error("Git commit hash not found", res.exceptionOrNull())
149-
"unknown"
150-
}()
151-
},
152165
)
153166
filesMatching("**/plugin.yml") {
154167
expand(inputs.properties)
@@ -163,9 +176,35 @@ tasks {
163176
}
164177
}
165178

166-
/**
167-
* Gradle is weird sometimes, we need to delete the plugin yml from the build folder to actually filter properly.
168-
*/
169-
afterEvaluate {
170-
layout.buildDirectory.file("resources/main/plugin.yml").get().asFile.delete()
179+
val templateSource = file("src/main/templates")
180+
val templateDest = layout.buildDirectory.dir("generated/sources/templates")
181+
val generateTemplates = tasks.register<Copy>("generateTemplates") {
182+
inputs.properties(
183+
"environment" to if (project.hasProperty("release")) "production" else "development",
184+
"commit" to provider {
185+
val res = runCatching { project.extensions.getByType<Grgit>().head().id }
186+
res.getOrDefault("")
187+
.takeIf { it.length == 40 } ?: {
188+
logger.error("Git commit hash not found", res.exceptionOrNull())
189+
"unknown"
190+
}()
191+
},
192+
)
193+
194+
from(templateSource)
195+
into(templateDest)
196+
rename { "com/volmit/iris/$it" }
197+
expand(inputs.properties)
198+
}
199+
200+
tasks.generateSentryBundleIdJava {
201+
dependsOn(generateTemplates)
202+
}
203+
204+
rootProject.tasks.named("prepareKotlinBuildScriptModel") {
205+
dependsOn(generateTemplates)
206+
}
207+
208+
sourceSets.main {
209+
java.srcDir(generateTemplates.map { it.outputs })
171210
}

core/src/main/java/com/volmit/iris/Iris.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ public void addShutdownHook() {
485485
.forEach(PlatformChunkGenerator::close);
486486

487487
MultiBurst.burst.close();
488+
MultiBurst.ioBurst.close();
488489
services.clear();
489490
});
490491
Runtime.getRuntime().addShutdownHook(shutdownHook);
@@ -566,7 +567,7 @@ public void onDisable() {
566567
postShutdown.forEach(Runnable::run);
567568
super.onDisable();
568569

569-
J.attempt(new JarScanner(instance.getJarFile(), "", false)::scan);
570+
J.attempt(new JarScanner(instance.getJarFile(), "", false)::scanAll);
570571
}
571572

572573
private void setupPapi() {
@@ -706,7 +707,11 @@ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
706707
Iris.debug("Generator Config: " + w.toString());
707708

708709
File ff = new File(w.worldFolder(), "iris/pack");
709-
if (!ff.exists() || ff.listFiles().length == 0) {
710+
var files = ff.listFiles();
711+
if (files == null || files.length == 0)
712+
IO.delete(ff);
713+
714+
if (!ff.exists()) {
710715
ff.mkdirs();
711716
service(StudioSVC.class).installIntoWorld(getSender(), dim.getLoadKey(), w.worldFolder());
712717
}
@@ -716,13 +721,13 @@ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
716721

717722
@Nullable
718723
public static IrisDimension loadDimension(@NonNull String worldName, @NonNull String id) {
719-
var data = IrisData.get(new File(Bukkit.getWorldContainer(), String.join(File.separator, worldName, "iris", "pack")));
720-
var dimension = data.getDimensionLoader().load(id);
721-
if (dimension == null) dimension = IrisData.loadAnyDimension(id);
724+
File pack = new File(Bukkit.getWorldContainer(), String.join(File.separator, worldName, "iris", "pack"));
725+
var dimension = pack.isDirectory() ? IrisData.get(pack).getDimensionLoader().load(id) : null;
726+
if (dimension == null) dimension = IrisData.loadAnyDimension(id, null);
722727
if (dimension == null) {
723728
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
724729
Iris.service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, false);
725-
dimension = IrisData.loadAnyDimension(id);
730+
dimension = IrisData.loadAnyDimension(id, null);
726731

727732
if (dimension != null) {
728733
Iris.info("Resolved missing dimension, proceeding.");
@@ -741,7 +746,7 @@ public void splash() {
741746
String padd2 = Form.repeat(" ", 4);
742747
String[] info = {"", "", "", "", "", padd2 + C.IRIS + " Iris", padd2 + C.GRAY + " by " + "<rainbow>Volmit Software", padd2 + C.GRAY + " v" + C.IRIS + getDescription().getVersion()};
743748
if (unstablemode) {
744-
info = new String[]{"", "", "", "", "", padd2 + C.RED + " Iris", padd2 + C.GRAY + " by " + C.DARK_RED + "Volmit Software", padd2 + C.GRAY + " v" + C.RED + getDescription().getVersion()};
749+
info = new String[]{"", "", "", "", "", padd2 + C.RED + " Iris", padd2 + C.GRAY + " by " + C.DARK_RED + "Volmit Software", padd2 + C.GRAY + " v" + C.RED + getDescription().getVersion()};
745750
}
746751
if (warningmode) {
747752
info = new String[]{"", "", "", "", "", padd2 + C.GOLD + " Iris", padd2 + C.GRAY + " by " + C.GOLD + "Volmit Software", padd2 + C.GRAY + " v" + C.GOLD + getDescription().getVersion()};

core/src/main/java/com/volmit/iris/core/IrisSettings.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ public class IrisSettings {
4949
private IrisSettingsSentry sentry = new IrisSettingsSentry();
5050

5151
public static int getThreadCount(int c) {
52-
return switch (c) {
52+
return Math.max(switch (c) {
5353
case -1, -2, -4 -> Runtime.getRuntime().availableProcessors() / -c;
54-
case 0, 1, 2 -> 1;
5554
default -> Math.max(c, 2);
56-
};
55+
}, 1);
5756
}
5857

5958
public static IrisSettings get() {
@@ -138,6 +137,7 @@ public static class IrisSettingsWorld {
138137
@Data
139138
public static class IrisSettingsConcurrency {
140139
public int parallelism = -1;
140+
public int ioParallelism = -2;
141141
public int worldGenParallelism = -1;
142142

143143
public int getWorldGenThreads() {
@@ -243,6 +243,8 @@ public static class IrisSettingsGenerator {
243243
public int maxBiomeChildDepth = 4;
244244
public boolean preventLeafDecay = true;
245245
public boolean useMulticore = false;
246+
public boolean offsetNoiseTypes = false;
247+
public boolean earlyCustomBlocks = false;
246248
}
247249

248250
@Data

core/src/main/java/com/volmit/iris/core/IrisWorlds.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ private void put0(String name, String type) {
6666
}
6767

6868
public KMap<String, String> getWorlds() {
69+
clean();
6970
return readBukkitWorlds().put(worlds);
7071
}
7172

@@ -76,8 +77,7 @@ public Stream<IrisData> getPacks() {
7677
}
7778

7879
public Stream<IrisDimension> getDimensions() {
79-
return readBukkitWorlds()
80-
.put(worlds)
80+
return getWorlds()
8181
.entrySet()
8282
.stream()
8383
.map(entry -> Iris.loadDimension(entry.getKey(), entry.getValue()))

core/src/main/java/com/volmit/iris/core/ServerConfigurator.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ private static KList<File> getDatapacksFolder() {
103103
return worlds;
104104
}
105105

106-
public static void installDataPacks(boolean fullInstall) {
107-
installDataPacks(DataVersion.getDefault(), fullInstall);
106+
public static boolean installDataPacks(boolean fullInstall) {
107+
return installDataPacks(DataVersion.getDefault(), fullInstall);
108108
}
109109

110-
public static void installDataPacks(IDataFixer fixer, boolean fullInstall) {
110+
public static boolean installDataPacks(IDataFixer fixer, boolean fullInstall) {
111111
if (fixer == null) {
112112
Iris.error("Unable to install datapacks, fixer is null!");
113-
return;
113+
return false;
114114
}
115115
Iris.info("Checking Data Packs...");
116116
DimensionHeight height = new DimensionHeight(fixer);
@@ -129,11 +129,10 @@ public static void installDataPacks(IDataFixer fixer, boolean fullInstall) {
129129
IrisDimension.writeShared(folders, height);
130130
Iris.info("Data Packs Setup!");
131131

132-
if (fullInstall)
133-
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
132+
return fullInstall && verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
134133
}
135134

136-
private static void verifyDataPacksPost(boolean allowRestarting) {
135+
private static boolean verifyDataPacksPost(boolean allowRestarting) {
137136
try (Stream<IrisData> stream = allPacks()) {
138137
boolean bad = stream
139138
.map(data -> {
@@ -148,7 +147,7 @@ private static void verifyDataPacksPost(boolean allowRestarting) {
148147
})
149148
.toList()
150149
.contains(true);
151-
if (!bad) return;
150+
if (!bad) return false;
152151
}
153152

154153

@@ -172,6 +171,7 @@ private static void verifyDataPacksPost(boolean allowRestarting) {
172171

173172
J.sleep(3000);
174173
}
174+
return true;
175175
}
176176

177177
public static void restart() {

0 commit comments

Comments
 (0)