Merge branch 'master' into dev/1.21.6

This commit is contained in:
Zoë Gidiere 2025-06-13 22:08:53 -06:00
commit bd253ea5d2
25 changed files with 234 additions and 12 deletions

View File

@ -17,16 +17,16 @@ jobs:
contents: read
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/checkout@v4.2.2
- name: Set up JDK 21
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
uses: actions/setup-java@v4.7.1
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- uses: burrunan/gradle-cache-action@03c71a8ba93d670980695505f48f49daf43704a6
- uses: burrunan/gradle-cache-action@v3.0.1
name: Build Terra
with:
# Specifies arguments for Gradle execution

View File

@ -1,8 +1,8 @@
preRelease(true)
versionProjects(":common:api", version("6.6.1"))
versionProjects(":common:implementation", version("6.6.1"))
versionProjects(":platforms", version("6.6.1"))
versionProjects(":common:api", version("6.6.3"))
versionProjects(":common:implementation", version("6.6.3"))
versionProjects(":platforms", version("6.6.3"))
allprojects {

View File

@ -31,6 +31,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@ -328,6 +330,28 @@ public abstract class AbstractPlatform implements Platform {
}
private static final String moonrise = "Moonrise";
public static int getMoonriseGenerationThreadsWithReflection() {
try {
Class<?> prioritisedThreadPoolClazz = Class.forName("ca.spottedleaf.concurrentutil.executor.thread.PrioritisedThreadPool");
Method getCoreThreadsMethod = prioritisedThreadPoolClazz.getDeclaredMethod("getCoreThreads");
getCoreThreadsMethod.setAccessible(true);
Class<?> moonriseCommonClazz = Class.forName("ca.spottedleaf.moonrise.common.util.MoonriseCommon");
Object pool = moonriseCommonClazz.getDeclaredField("WORKER_POOL").get(null);
int threads = ((Thread[]) getCoreThreadsMethod.invoke(pool)).length;
logger.info("{} found, setting {} generation threads.", moonrise, threads);
return threads;
} catch (ClassNotFoundException e) {
logger.info("{} not found.", moonrise);
} catch (NoSuchMethodException | NoSuchFieldException e) {
logger.warn("{} found, but field/method not found this probably means {0} has changed its code and " +
"Terra has not updated to reflect that.", moonrise);
} catch (IllegalAccessException | InvocationTargetException e) {
logger.error("Failed to access thread values in {}, assuming 1 generation thread.", moonrise, e);
}
return 0;
}
@Override
public void register(TypeRegistry registry) {
loaders.register(registry);

View File

@ -55,7 +55,7 @@ public class ConfigRegistry extends OpenRegistryImpl<ConfigPack> {
for(File dir : Objects.requireNonNull(packsFolder.listFiles(File::isDirectory))) {
try {
load(dir, platform);
} catch(ConfigException e) {
} catch(RuntimeException e) {
logger.error("Error loading config pack {}", dir.getName(), e);
valid = false;
}
@ -65,7 +65,7 @@ public class ConfigRegistry extends OpenRegistryImpl<ConfigPack> {
try {
logger.info("Loading ZIP archive: {}", zip.getName());
load(new ZipFile(zip), platform);
} catch(IOException | ConfigException e) {
} catch(IOException | RuntimeException e) {
logger.error("Error loading config pack {}", zip.getName(), e);
valid = false;
}

View File

@ -57,7 +57,7 @@ public class PlatformImpl extends AbstractPlatform {
private int generationThreads;
public PlatformImpl(TerraBukkitPlugin plugin) {
generationThreads = getGenerationThreadsWithReflection("ca.spottedleaf.moonrise.common.util.MoonriseCommon", "WORKER_THREADS", "Moonrise");
generationThreads = getMoonriseGenerationThreadsWithReflection();
if (generationThreads == 0) {
generationThreads = 1;
}

View File

@ -35,7 +35,7 @@
"depends": {
"fabricloader": ">=0.16.10",
"java": ">=21",
"minecraft": ">=1.21.4",
"minecraft": ">=1.21.5",
"fabric": "*"
}
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:snowy_taiga"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:old_growth_pine_taiga"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:old_growth_spruce_taiga"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:taiga"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_jungle"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:grove"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_savanna"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_badlands"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:forest"
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_ashen_angry",
"tame": "minecraft:entity/wolf/wolf_ashen_tame",
"wild": "minecraft:entity/wolf/wolf_ashen"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/ashen"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_black_angry",
"tame": "minecraft:entity/wolf/wolf_black_tame",
"wild": "minecraft:entity/wolf/wolf_black"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/black"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_chestnut_angry",
"tame": "minecraft:entity/wolf/wolf_chestnut_tame",
"wild": "minecraft:entity/wolf/wolf_chestnut"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/chestnut"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_angry",
"tame": "minecraft:entity/wolf/wolf_tame",
"wild": "minecraft:entity/wolf/wolf"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/pale"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_rusty_angry",
"tame": "minecraft:entity/wolf/wolf_rusty_tame",
"wild": "minecraft:entity/wolf/wolf_rusty"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/rusty"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_snowy_angry",
"tame": "minecraft:entity/wolf/wolf_snowy_tame",
"wild": "minecraft:entity/wolf/wolf_snowy"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/snowy"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_spotted_angry",
"tame": "minecraft:entity/wolf/wolf_spotted_tame",
"wild": "minecraft:entity/wolf/wolf_spotted"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/spotted"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_striped_angry",
"tame": "minecraft:entity/wolf/wolf_striped_tame",
"wild": "minecraft:entity/wolf/wolf_striped"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/striped"
},
"priority": 1
}
]
}

View File

@ -0,0 +1,16 @@
{
"assets": {
"angry": "minecraft:entity/wolf/wolf_woods_angry",
"tame": "minecraft:entity/wolf/wolf_woods_tame",
"wild": "minecraft:entity/wolf/wolf_woods"
},
"spawn_conditions": [
{
"condition": {
"type": "minecraft:biome",
"biomes": "#c:has_wolf_variant/woods"
},
"priority": 1
}
]
}

View File

@ -45,7 +45,7 @@ public abstract class LifecyclePlatform extends ModPlatform {
public LifecyclePlatform() {
generationThreads = getGenerationThreadsWithReflection("com.ishland.c2me.base.common.GlobalExecutors", "GLOBAL_EXECUTOR_PARALLELISM", "C2ME");
if (generationThreads == 0) {
generationThreads = getGenerationThreadsWithReflection("ca.spottedleaf.moonrise.common.util.MoonriseCommon", "WORKER_THREADS", "Moonrise");
generationThreads = getMoonriseGenerationThreadsWithReflection();
} if (generationThreads == 0) {
generationThreads = 1;
}