Compare commits

..

33 Commits

Author SHA1 Message Date
Zoë Gidiere 4041239b03 fix build 2025-06-17 15:28:47 -06:00
Zoë Gidiere 280699bbce Update to 1.21.6 and fix a lot of bugs in fabric impl 2025-06-17 15:21:21 -06:00
Zoë Gidiere 6984dc29d0 Fix fabric 2025-06-14 00:45:32 -06:00
Zoë Gidiere bd253ea5d2 Merge branch 'master' into dev/1.21.6 2025-06-13 22:08:53 -06:00
OakLoaf d743d7d1df Updated fabric to rc1 2025-06-13 22:50:55 +01:00
OakLoaf 238a7954a7 Added paperweight to bukkit platform for runDevBundleServer task 2025-06-13 21:56:54 +01:00
OakLoaf c2319ca4ab Updated to 1.21.6-rc.1 2025-06-13 20:17:56 +01:00
Zoë Gidiere 8706340584 Fix wolves 2025-06-12 16:25:14 -06:00
OakLoaf 9a9f90aa0d Updated fabric platform to 1.21.6 2025-06-10 12:01:17 +01:00
OakLoaf 20a5bfdd0f Updated bukkit platform to 1.21.6 2025-06-10 11:44:10 +01:00
Zoë Gidiere 84fa72f96c Catch all runtime errors when loading packs 2025-06-07 22:14:36 -06:00
Zoë Gidiere cc5258ce73 bump version 2025-06-07 21:12:26 -06:00
Zoë Gidiere 748e027282 Merge pull request #505 from HaHaWTH/master
Identify Moonrise worker threads correctly
2025-06-07 07:18:45 +00:00
HaHaWTH bf6612edd0 Identify Moonrise worker threads correctly 2025-06-07 00:17:51 +14:00
Zoë Gidiere d90a4200fe Update gradle-build.yml 2025-06-05 19:19:43 -06:00
Zoë Gidiere af9fb211a8 bump fabric minecraft dep 2025-06-05 17:50:44 -06:00
Zoë Gidiere e4395cec83 bump version 2025-06-05 17:18:55 -06:00
Zoë Gidiere bab8923f1e update overworld version 2025-06-04 00:21:14 -06:00
Zoë Gidiere b4068e6c59 Merge branch 'dev/1.21.5' 2025-06-03 22:28:48 -06:00
Zoë Gidiere b143c72d0e Dev/1.21.5 (#495)
* Bukkit Build Fix (#494)

* Bukkit Build Fix

* remove comments

* remove papermc repo from gradle settings

* add back gradle shasum

* fix formatting, update gradle hash

* Initial Fabric 1.21.5

* Updated dependencies

* Updated SpawnerData with backwards compat

* Updated dependencies

* Updated setBlockState usage - needs verifying as flags are confusing

* Refactored Bukkit NMS packages

* Initial attempt at updating mixin-commons

* Continue fabric 1.21.5 WIP

* Some additional logging

* Update deps

* Build fixes and update allay

* Add oak to authors

---------

Co-authored-by: Mikal <Ifiht@users.noreply.github.com>
Co-authored-by: OakLoaf <oak@beaconstudios.org>
2025-06-03 22:20:23 -06:00
Zoë Gidiere 5f5e70970b Add oak to authors 2025-06-03 21:40:14 -06:00
Zoë Gidiere ec812ef5fb Build fixes and update allay 2025-06-03 21:33:56 -06:00
Zoë Gidiere 85826071cb Update deps 2025-06-03 20:25:55 -06:00
Zoë Gidiere c4f093210a Some additional logging 2025-06-03 15:15:07 -06:00
Zoë Gidiere f14d22b264 Continue fabric 1.21.5 WIP 2025-06-03 13:59:11 -06:00
OakLoaf 016961c19c Initial attempt at updating mixin-commons 2025-04-17 17:41:45 +01:00
OakLoaf 9f3e225b62 Refactored Bukkit NMS packages 2025-04-17 16:32:59 +01:00
OakLoaf c95df25d30 Updated setBlockState usage - needs verifying as flags are confusing 2025-03-27 20:22:35 +00:00
OakLoaf 0adca3c227 Updated dependencies 2025-03-27 20:21:13 +00:00
OakLoaf 782b300d1f Updated SpawnerData with backwards compat 2025-03-27 19:22:34 +00:00
OakLoaf 967a4a0b2b Updated dependencies 2025-03-27 19:22:23 +00:00
Zoë Gidiere d3df5e56c3 Initial Fabric 1.21.5 2025-03-25 16:26:43 -06:00
Mikal dabc2359b3 Bukkit Build Fix (#494)
* Bukkit Build Fix

* remove comments

* remove papermc repo from gradle settings

* add back gradle shasum

* fix formatting, update gradle hash
2025-03-25 16:25:51 -06:00
85 changed files with 521 additions and 226 deletions
+4 -4
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
@@ -44,4 +44,4 @@ jobs:
# Properties are passed as -Pname=value
properties: |
kotlin.js.compiler=ir
kotlin.parallel.tasks.in.project=true
kotlin.parallel.tasks.in.project=true
+3 -3
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 {
+11 -5
View File
@@ -6,6 +6,12 @@ plugins {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://maven.solo-studios.ca/releases") {
name = "Solo Studios"
}
maven("https://maven.solo-studios.ca/snapshots") {
name = "Solo Studios"
}
maven("https://repo.codemc.org/repository/maven-public") {
name = "CodeMC"
}
@@ -16,11 +22,11 @@ repositories {
dependencies {
//TODO Allow pulling from Versions.kt
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.1")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.2")
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.6")
implementation("org.ow2.asm", "asm", "9.7")
implementation("org.ow2.asm", "asm-tree", "9.7")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "2.0.0-beta.17")
implementation("org.ow2.asm", "asm", "9.8")
implementation("org.ow2.asm", "asm-tree", "9.8")
implementation("com.dfsek.tectonic", "common", "4.2.1")
implementation("org.yaml", "snakeyaml", "2.3")
implementation("org.yaml", "snakeyaml", "2.4")
}
+8 -2
View File
@@ -30,6 +30,12 @@ fun Project.configureDependencies() {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://maven.solo-studios.ca/releases") {
name = "Solo Studios"
}
maven("https://maven.solo-studios.ca/snapshots") {
name = "Solo Studios"
}
maven("https://maven.fabricmc.net/") {
name = "FabricMC"
}
@@ -63,8 +69,8 @@ fun Project.configureDependencies() {
}
dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter-api", Versions.Libraries.Internal.junit)
testImplementation("org.junit.jupiter", "junit-jupiter-engine", Versions.Libraries.Internal.junit)
testImplementation("org.junit.jupiter", "junit-jupiter", Versions.Libraries.Internal.junit)
"testRuntimeOnly"("org.junit.platform", "junit-platform-launcher")
compileOnly("org.jetbrains", "annotations", Versions.Libraries.Internal.jetBrainsAnnotations)
compileOnly("com.google.guava", "guava", Versions.Libraries.Internal.guava)
+29 -28
View File
@@ -1,6 +1,6 @@
object Versions {
object Terra {
const val overworldConfig = "v1.3.4"
const val overworldConfig = "v1.5.1"
}
object Libraries {
@@ -10,26 +10,26 @@ object Versions {
const val cloud = "2.0.0"
const val caffeine = "3.1.8"
const val caffeine = "3.2.1"
const val slf4j = "2.0.16"
const val slf4j = "2.0.17"
object Internal {
const val shadow = "8.3.3"
const val apacheText = "1.12.0"
const val apacheIO = "2.17.0"
const val guava = "33.3.1-jre"
const val asm = "9.7.1"
const val snakeYml = "2.3"
const val jetBrainsAnnotations = "26.0.1"
const val junit = "5.11.3"
const val shadow = "8.3.6"
const val apacheText = "1.13.1"
const val apacheIO = "2.19.0"
const val guava = "33.4.8-jre"
const val asm = "9.8"
const val snakeYml = "2.4"
const val jetBrainsAnnotations = "26.0.2"
const val junit = "5.13.1"
const val nbt = "6.1"
}
}
object Fabric {
const val fabricAPI = "0.118.0+${Mod.minecraft}"
const val cloud = "2.0.0-beta.9"
const val fabricAPI = "0.127.0+${Mod.minecraft}"
const val cloud = "2.0.0-beta.10"
}
//
// object Quilt {
@@ -38,14 +38,15 @@ object Versions {
// }
object Mod {
const val mixin = "0.15.3+mixin.0.8.7"
const val mixin = "0.15.5+mixin.0.8.7"
const val mixinExtras = "0.4.1"
const val minecraft = "1.21.4"
const val yarn = "$minecraft+build.8"
const val fabricLoader = "0.16.10"
const val minecraft = "1.21.6"
const val yarn = "$minecraft+build.1"
const val fabricLoader = "0.16.14"
const val architecuryLoom = "1.7.413"
const val architecturyPlugin = "3.4.159"
const val architecuryLoom = "1.10.431"
const val architecturyPlugin = "3.4.161"
}
//
@@ -55,18 +56,18 @@ object Versions {
// }
object Bukkit {
const val minecraft = "1.21.4"
const val paperBuild = "$minecraft-R0.1-20241211.212446-17"
const val minecraft = "1.21.6-R0.1"
const val paperBuild = "$minecraft-20250617.170821-8"
const val paper = paperBuild
const val paperLib = "1.0.8"
const val reflectionRemapper = "0.1.1"
const val reflectionRemapper = "0.1.2"
const val paperDevBundle = paperBuild
const val runPaper = "2.3.1"
const val paperWeight = "1.7.2"
const val paperWeight = "2.0.0-beta.17"
const val cloud = "2.0.0-beta.10"
}
//
//
// object Sponge {
// const val sponge = "9.0.0-SNAPSHOT"
// const val mixin = "0.8.2"
@@ -74,13 +75,13 @@ object Versions {
// }
//
object CLI {
const val logback = "1.5.8"
const val picocli = "4.7.6"
const val logback = "1.5.18"
const val picocli = "4.7.7"
}
object Allay {
const val api = "0.2.0"
const val gson = "2.12.1"
const val api = "0.4.1"
const val gson = "2.13.1"
const val mappings = "3626653"
const val mappingsGenerator = "366618e"
}
+1
View File
@@ -2,6 +2,7 @@ dependencies {
api("ca.solo-studios", "strata", Versions.Libraries.strata)
compileOnlyApi("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
api("org.incendo", "cloud-core", Versions.Libraries.cloud)
api("com.dfsek.tectonic", "common", Versions.Libraries.tectonic)
@@ -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;
@@ -327,6 +329,28 @@ public abstract class AbstractPlatform implements Platform {
return 0;
}
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) {
@@ -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;
}
Binary file not shown.
+2 -2
View File
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionSha256Sum=845952a9d6afa783db70bb3b0effaae45ae5542ca2bb7929619e8af49cb634cf
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+4 -5
View File
@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -115,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -206,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
@@ -214,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+2 -2
View File
@@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
@@ -16,8 +16,8 @@ import org.allaymc.api.block.type.BlockStateSafeGetter;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.item.type.ItemType;
import org.allaymc.api.item.type.ItemTypeSafeGetter;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -38,7 +38,7 @@ public record AllayItemStack(ItemStack allayItemStack) implements com.dfsek.terr
allayItemStack.addEnchantment(enchantment.getType(), enchantment.getLevel());
}
allayItemStack.setLore(targetItem.getLore());
allayItemStack.setDurability(targetItem.getDurability());
allayItemStack.setDamage(targetItem.getDamage());
allayItemStack.setCustomName(targetItem.getCustomName());
allayItemStack.setMeta(targetItem.getMeta());
}
+10 -1
View File
@@ -1,10 +1,14 @@
plugins {
id("io.papermc.paperweight.userdev")
id("xyz.jpenilla.run-paper") version Versions.Bukkit.runPaper
}
dependencies {
// Required for :platforms:bukkit:runDevBundleServer task
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
shaded(project(":platforms:bukkit:common"))
shaded(project(":platforms:bukkit:nms:v1_21_3", configuration = "reobf"))
shaded(project(":platforms:bukkit:nms:v1_21_6"))
shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
}
@@ -26,6 +30,11 @@ tasks {
minecraftVersion(Versions.Bukkit.minecraft)
dependsOn(shadowJar)
pluginJars(shadowJar.get().archiveFile)
downloadPlugins {
modrinth("viaversion", "5.3.2")
modrinth("viabackwards", "5.3.2")
}
}
}
@@ -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;
}
@@ -54,8 +54,8 @@ public interface Initializer {
private static Initializer constructInitializer() {
try {
String packageVersion = NMS;
if (NMS.equals("v1_21_4")) {
packageVersion = "v1_21_3";
if (NMS.equals("v1_21_5")) {
packageVersion = "v1_21_6";
}
Class<?> initializerClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSInitializer");
@@ -2,7 +2,7 @@ name: "Terra"
main: "com.dfsek.terra.bukkit.TerraBukkitPlugin"
version: "@VERSION@"
load: "STARTUP"
authors: [ "dfsek", "duplexsystem", "Astrash", "solonovamax", "Sancires", "Aureus", "RogueShade" ]
authors: [ "dfsek", "duplexsystem", "Astrash", "solonovamax", "Sancires", "Aureus", "RogueShade", "OakLoaf" ]
website: "@WIKI@"
api-version: "1.21.1"
description: "@DESCRIPTION@"
@@ -1,13 +0,0 @@
apply(plugin = "io.papermc.paperweight.userdev")
dependencies {
api(project(":platforms:bukkit:common"))
paperDevBundle(Versions.Bukkit.paperDevBundle)
implementation("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
}
tasks {
assemble {
dependsOn("reobfJar")
}
}
@@ -0,0 +1,9 @@
plugins {
id("io.papermc.paperweight.userdev")
}
dependencies {
api(project(":platforms:bukkit:common"))
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
implementation("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
}
@@ -1,6 +1,6 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import com.dfsek.terra.bukkit.nms.v1_21_3.config.VanillaBiomeProperties;
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
import net.minecraft.core.Holder;
import net.minecraft.core.Holder.Reference;
@@ -1,11 +1,11 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import com.dfsek.terra.api.event.events.config.ConfigurationLoadEvent;
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
import com.dfsek.terra.api.world.biome.Biome;
import com.dfsek.terra.bukkit.BukkitAddon;
import com.dfsek.terra.bukkit.PlatformImpl;
import com.dfsek.terra.bukkit.nms.v1_21_3.config.VanillaBiomeProperties;
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
public class NMSAddon extends BukkitAddon {
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
@@ -12,7 +12,7 @@ import java.util.Objects;
import java.util.Optional;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.bukkit.nms.v1_21_3.config.VanillaBiomeProperties;
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
public class NMSBiomeInjector {
@@ -33,9 +33,8 @@ public class NMSBiomeInjector {
.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()))
.waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getSpecialEffects().getGrassColorModifier()));
// .grassColorOverride(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColor(), vanilla.getSpecialEffects().getGrassColorOverride().orElseGet(() -> Reflection.BIOME.invokeGrassColorFromTexture(vanilla))))
// .foliageColorOverride(Objects.requireNonNullElse(vanillaBiomeProperties.getFoliageColor(), vanilla.getFoliageColor()));
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getSpecialEffects().getGrassColorModifier()))
.backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
if(vanillaBiomeProperties.getGrassColor() == null) {
vanilla.getSpecialEffects().getGrassColorOverride().ifPresent(effects::grassColorOverride);
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import com.mojang.serialization.MapCodec;
import net.minecraft.core.Holder;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
@@ -116,10 +116,10 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
if(noise > threshold) {
chunk.setBlockState(new BlockPos(x, y, z), ((CraftBlockData) ((BukkitBlockState) delegate
.getPalette(x + xi, y, z + zi, world, biomeProvider)
.get(depth, x + xi, y, z + zi, world.getSeed())).getHandle()).getState(), false);
.get(depth, x + xi, y, z + zi, world.getSeed())).getHandle()).getState(), 0);
depth++;
} else if(noise < airThreshold) {
chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.defaultBlockState(), false);
chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.defaultBlockState(), 0);
} else {
depth = 0;
}
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import com.dfsek.terra.bukkit.BukkitAddon;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerLevel;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import net.minecraft.world.level.LevelHeightAccessor;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import net.minecraft.core.Holder;
import net.minecraft.core.Holder.Reference;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3;
package com.dfsek.terra.bukkit.nms.v1_21_6;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -7,7 +7,7 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
public class SpawnEntryTemplate implements ObjectTemplate<SpawnerData> {
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntryConfig> {
@Value("type")
@Default
private EntityType<?> type = null;
@@ -23,9 +23,17 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnerData> {
@Value("max-group-size")
@Default
private Integer maxGroupSize = null;
public Integer getWeight() {
return weight;
}
public SpawnerData getSpawnerData() {
return new SpawnerData(type, minGroupSize, maxGroupSize);
}
@Override
public SpawnerData get() {
return new SpawnerData(type, weight, minGroupSize, maxGroupSize);
public SpawnEntryConfig get() {
return this;
}
}
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
@@ -6,7 +6,6 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import java.util.List;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,8 +32,8 @@ public class SpawnSettingsTemplate implements ObjectTemplate<MobSpawnSettings> {
MobSpawnSettings.Builder builder = new MobSpawnSettings.Builder();
for(SpawnTypeConfig spawn : spawns) {
MobCategory group = spawn.getGroup();
for(SpawnerData entry : spawn.getEntries()) {
builder.addSpawn(group, entry);
for(SpawnEntryConfig entry : spawn.getEntries()) {
builder.addSpawn(group, entry.getWeight(), entry.getSpawnerData());
}
}
for(SpawnCostConfig cost : costs) {
@@ -1,11 +1,10 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import java.util.List;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
@@ -15,13 +14,13 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
@Value("entries")
@Default
private List<SpawnerData> entries = null;
private List<SpawnEntryConfig> entries = null;
public MobCategory getGroup() {
return group;
}
public List<SpawnerData> getEntries() {
public List<SpawnEntryConfig> getEntries() {
return entries;
}
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
import com.dfsek.tectonic.api.config.template.annotations.Default;
@@ -38,6 +38,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Default
private Integer foliageColor = null;
@Value("colors.dry-foliage")
@Default
private Integer dryFoliageColor = null;
@Value("colors.sky")
@Default
private Integer skyColor = null;
@@ -82,6 +86,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Default
private Music music = null;
@Value("sound.music-volume")
@Default
private Float musicVolume = null;
@Value("spawning")
@Default
private MobSpawnSettings spawnSettings = null;
@@ -98,6 +106,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return foliageColor;
}
public Integer getDryFoliageColor() {
return dryFoliageColor;
}
public Integer getGrassColor() {
return grassColor;
}
@@ -154,6 +166,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return music;
}
public Float getMusicVolume() {
return musicVolume;
}
public MobSpawnSettings getSpawnSettings() {
return spawnSettings;
}
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
+3 -1
View File
@@ -26,7 +26,9 @@ dependencies {
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
exclude("me.lucko", "fabric-permissions-api")
}
include("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
@@ -11,7 +11,8 @@
"solonovamax",
"Sancires",
"Aureus",
"RogueShade"
"RogueShade",
"OakLoaf"
],
"contact": {
"homepage": "@WIKI@",
@@ -34,7 +35,7 @@
"depends": {
"fabricloader": ">=0.16.10",
"java": ">=21",
"minecraft": ">=1.21.4",
"minecraft": ">=1.21.5",
"fabric": "*"
}
}
@@ -44,7 +44,7 @@ import com.dfsek.terra.mod.config.MusicSoundTemplate;
import com.dfsek.terra.mod.config.ProtoPlatformBiome;
import com.dfsek.terra.mod.config.SoundEventTemplate;
import com.dfsek.terra.mod.config.SpawnCostConfig;
import com.dfsek.terra.mod.config.SpawnEntryTemplate;
import com.dfsek.terra.mod.config.SpawnEntryConfig;
import com.dfsek.terra.mod.config.SpawnSettingsTemplate;
import com.dfsek.terra.mod.config.SpawnTypeConfig;
import com.dfsek.terra.mod.config.VillagerTypeTemplate;
@@ -90,7 +90,7 @@ public abstract class ModPlatform extends AbstractPlatform {
.registerLoader(MusicSound.class, MusicSoundTemplate::new)
.registerLoader(EntityType.class, EntityTypeTemplate::new)
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
.registerLoader(SpawnEntry.class, SpawnEntryTemplate::new)
.registerLoader(SpawnEntry.class, SpawnEntryConfig::new)
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
@@ -7,7 +7,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
@Value("type")
@Default
private EntityType<?> type = null;
@@ -24,8 +24,12 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
@Default
private Integer maxGroupSize = null;
public Integer getWeight() {
return weight;
}
@Override
public SpawnEntry get() {
return new SpawnEntry(type, weight, minGroupSize, maxGroupSize);
return new SpawnEntry(type, minGroupSize, maxGroupSize);
}
}
@@ -5,7 +5,6 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import java.util.List;
@@ -28,8 +27,8 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
SpawnSettings.Builder builder = new SpawnSettings.Builder();
for(SpawnTypeConfig spawn : spawns) {
SpawnGroup group = spawn.getGroup();
for(SpawnEntry entry : spawn.getEntry()) {
builder.spawn(group, entry);
for(SpawnEntryConfig entry : spawn.getEntry()) {
builder.spawn(group, entry.getWeight(), entry.get());
}
}
for(SpawnCostConfig cost : costs) {
@@ -4,7 +4,6 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import java.util.List;
@@ -16,13 +15,13 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
@Value("entries")
@Default
private List<SpawnEntry> entry = null;
private List<SpawnEntryConfig> entry = null;
public SpawnGroup getGroup() {
return group;
}
public List<SpawnEntry> getEntry() {
public List<SpawnEntryConfig> getEntry() {
return entry;
}
@@ -3,6 +3,7 @@ package com.dfsek.terra.mod.config;
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BiomeAdditionsSound;
import net.minecraft.sound.BiomeMoodSound;
import net.minecraft.sound.MusicSound;
@@ -37,6 +38,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Default
private Integer foliageColor = null;
@Value("colors.dry-foliage")
@Default
private Integer dryFoliageColor = null;
@Value("colors.sky")
@Default
private Integer skyColor = null;
@@ -81,13 +86,18 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Default
private MusicSound music = null;
@Value("sound.music-volume")
@Default
private Float musicVolume = null;
@Value("spawning")
@Default
private SpawnSettings spawnSettings = null;
@Value("villager-type")
@Default
private VillagerType villagerType = null;
private
RegistryKey<VillagerType> villagerType = null;
public Integer getGrassColor() {
return grassColor;
@@ -109,6 +119,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return foliageColor;
}
public Integer getDryFoliageColor() {
return dryFoliageColor;
}
public Integer getSkyColor() {
return skyColor;
}
@@ -153,11 +167,15 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return music;
}
public Float getMusicVolume() {
return musicVolume;
}
public SpawnSettings getSpawnSettings() {
return spawnSettings;
}
public VillagerType getVillagerType() {
public RegistryKey<VillagerType> getVillagerType() {
return villagerType;
}
}
@@ -4,17 +4,19 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.village.VillagerType;
public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
public class VillagerTypeTemplate implements ObjectTemplate<RegistryKey<VillagerType>> {
@Value("id")
@Default
private Identifier id = null;
private String id = null;
@Override
public VillagerType get() {
return Registries.VILLAGER_TYPE.getEntry(id).orElseThrow().value();
public RegistryKey<VillagerType> get() {
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, Identifier.ofVanilla(id));
}
}
@@ -140,10 +140,10 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
if(noise > threshold) {
chunk.setBlockState(new BlockPos(x, y, z), (BlockState) delegate
.getPalette(x + xi, y, z + zi, world, biomeProvider)
.get(depth, x + xi, y, z + zi, world.getSeed()), false);
.get(depth, x + xi, y, z + zi, world.getSeed()), 0);
depth++;
} else if(noise < airThreshold) {
chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.getDefaultState(), false);
chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.getDefaultState(), 0);
} else {
depth = 0;
}
@@ -12,7 +12,7 @@ import java.util.Map;
@Mixin(VillagerType.class)
public interface VillagerTypeAccessor {
@Accessor("BIOME_TO_TYPE")
static Map<RegistryKey<Biome>, VillagerType> getBiomeTypeToIdMap() {
static Map<RegistryKey<Biome>, RegistryKey<VillagerType>> getBiomeTypeToIdMap() {
throw new AssertionError("Untransformed Accessor!");
}
}
@@ -1,28 +0,0 @@
package com.dfsek.terra.mod.mixin.fix;
import net.minecraft.entity.passive.BeeEntity.MoveToFlowerGoal;
import net.minecraft.entity.passive.BeeEntity.MoveToHiveGoal;
import net.minecraft.util.math.random.CheckedRandom;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.dfsek.terra.mod.CommonPlatform;
/**
* Bees spawning uses world.random without synchronization. This causes issues when spawning bees during world generation.
*/
@Mixin({
MoveToHiveGoal.class,
MoveToFlowerGoal.class
})
public class BeeMoveGoalsUnsynchronizedRandomAccessFix {
@Redirect(method = "<init>",
at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;random:Lnet/minecraft/util/math/random/Random;"))
public Random redirectRandomAccess(World instance) {
return new CheckedRandom(CommonPlatform.get().getServer().getTicks()); // replace with new random seeded by tick time.
}
}
@@ -55,7 +55,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
public EntityType terra$getSpawnedType() {
return (EntityType) Registries.ENTITY_TYPE.getEntry(
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id"))).orElseThrow();
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id").orElseThrow())).orElseThrow();
}
public void terra$setSpawnedType(@NotNull EntityType creatureType) {
@@ -47,11 +47,11 @@ public abstract class WorldChunkMixin {
@Shadow
@Nullable
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, boolean moved);
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, int flags);
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
BlockPos blockPos = new BlockPos(x, y, z);
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);
setBlockState(blockPos, (net.minecraft.block.BlockState) data, 0);
if(physics) {
net.minecraft.block.BlockState state = ((net.minecraft.block.BlockState) data);
if(state.isLiquid()) {
@@ -65,7 +65,7 @@ public abstract class WorldChunkMixin {
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), (net.minecraft.block.BlockState) blockState,
false);
0);
}
@Intrinsic
@@ -40,7 +40,7 @@ public abstract class ProtoChunkMixin {
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), (net.minecraft.block.BlockState) blockState,
false);
0);
}
public @NotNull BlockState terra$getBlock(int x, int y, int z) {
@@ -35,9 +35,25 @@ public class BiomeUtil {
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
.grassColorModifier(
Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getEffects().getGrassColorModifier()))
.grassColor(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColor(),
vanilla.getEffects().getGrassColor().orElseGet(() -> ((BiomeInvoker) ((Object) vanilla)).invokeGetDefaultGrassColor())))
.foliageColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFoliageColor(), vanilla.getFoliageColor()));
.musicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getMusicVolume()));
if(vanillaBiomeProperties.getGrassColor() == null) {
vanilla.getEffects().getGrassColor().ifPresent(effects::grassColor);
} else {
effects.grassColor(vanillaBiomeProperties.getGrassColor());
}
if(vanillaBiomeProperties.getFoliageColor() == null) {
vanilla.getEffects().getFoliageColor().ifPresent(effects::foliageColor);
} else {
effects.foliageColor(vanillaBiomeProperties.getFoliageColor());
}
if(vanillaBiomeProperties.getDryFoliageColor() == null) {
vanilla.getEffects().getDryFoliageColor().ifPresent(effects::dryFoliageColor);
} else {
effects.dryFoliageColor(vanillaBiomeProperties.getDryFoliageColor());
}
if(vanillaBiomeProperties.getParticleConfig() == null) {
vanilla.getEffects().getParticleConfig().ifPresent(effects::particleConfig);
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:snowy_taiga"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:old_growth_pine_taiga"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:old_growth_spruce_taiga"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:taiga"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_jungle"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:grove"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_savanna"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#minecraft:is_badlands"
]
}
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:forest"
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -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
}
]
}
@@ -9,7 +9,6 @@
"access.StateAccessor",
"access.StructureAccessorAccessor",
"access.VillagerTypeAccessor",
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
"fix.NetherFossilOptimization",
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
"implementations.terra.BiomeMixin",
@@ -7,6 +7,7 @@ dependencies {
shadedApi(project(":common:implementation:base"))
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
compileOnly("io.github.llamalad7:mixinextras-common:${Versions.Mod.mixinExtras}")
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
@@ -18,6 +19,7 @@ dependencies {
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
exclude("me.lucko", "fabric-permissions-api")
}
}
@@ -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;
}
@@ -107,7 +107,7 @@ public abstract class LifecyclePlatform extends ModPlatform {
super.platformAddon().forEach(addons::add);
String mcVersion = MinecraftVersion.CURRENT.getName();
String mcVersion = MinecraftVersion.CURRENT.name();
try {
addons.add(new EphemeralAddon(Versions.parseVersion(mcVersion), "minecraft"));
} catch(ParseException e) {
@@ -1,27 +0,0 @@
package com.dfsek.terra.lifecycle.mixin.lifecycle;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.mod.CommonPlatform;
import com.dfsek.terra.mod.ModPlatform;
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized;
@Mixin(CreateWorldScreen.class)
public class CreateWorldScreenMixin {
@Inject(method = "onCloseScreen()V", at = @At("HEAD"))
public void onClose(CallbackInfo ci) {
ModPlatform platform = CommonPlatform.get();
platform.getRawConfigRegistry().clear();
initialized = false;
}
}
@@ -34,11 +34,4 @@ public class MinecraftServerMixin {
WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory, CallbackInfo ci) {
LifecyclePlatform.setServer((MinecraftServer) (Object) this);
}
@Inject(method = "shutdown()V", at = @At("RETURN"))
private void injectShutdown(CallbackInfo ci) {
ModPlatform platform = CommonPlatform.get();
platform.getRawConfigRegistry().clear();
initialized = false;
}
}
@@ -1,5 +1,8 @@
package com.dfsek.terra.lifecycle.mixin.lifecycle;
import com.dfsek.terra.mod.CommonPlatform;
import com.dfsek.terra.mod.ModPlatform;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.registry.MutableRegistry;
import net.minecraft.registry.Registry;
@@ -7,6 +10,7 @@ import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryLoader;
import net.minecraft.registry.RegistryLoader.Loader;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.MultiNoiseBiomeSourceParameterList;
import net.minecraft.world.dimension.DimensionType;
@@ -18,10 +22,27 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.llamalad7.mixinextras.sugar.Local;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Coerce;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryLoader;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.resource.ResourceManager;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import com.dfsek.terra.lifecycle.LifecyclePlatform;
@@ -38,31 +59,39 @@ public class RegistryLoaderMixin {
@Final
private static Logger LOGGER;
@Redirect(
@Unique
private static final AtomicBoolean LOADING_DYNAMIC_REGISTRIES = new AtomicBoolean(false);
@Inject(method = "loadFromResource(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", at = @At("HEAD"))
private static void loadFromResources(ResourceManager resourceManager, List<RegistryWrapper.Impl<?>> registries, List<RegistryLoader.Entry<?>> entries, CallbackInfoReturnable<DynamicRegistryManager.Immutable> cir) {
LOADING_DYNAMIC_REGISTRIES.set(entries.stream().anyMatch(entry -> entry.key() == RegistryKeys.BIOME));
}
@Inject(
method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;",
at = @At(
value = "INVOKE",
target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V",
ordinal = 1 // we want right after the first forEach
)
ordinal = 1
)
)
private static void grabManager(List<RegistryLoader.Loader<?>> instance, Consumer<? super Loader<?>> consumer) {
if(!initialized) {
MutableRegistry<Biome> biomes = extractRegistry(instance, RegistryKeys.BIOME).orElseThrow();
MutableRegistry<DimensionType> dimensionTypes = extractRegistry(instance, RegistryKeys.DIMENSION_TYPE).orElseThrow();
MutableRegistry<WorldPreset> worldPresets = extractRegistry(instance, RegistryKeys.WORLD_PRESET).orElseThrow();
MutableRegistry<ChunkGeneratorSettings> chunkGeneratorSettings = extractRegistry(instance,
private static void beforeFreeze(@Coerce Object loadable, List<RegistryWrapper.Impl<?>> wrappers, List<RegistryLoader.Entry<?>> entries, CallbackInfoReturnable<DynamicRegistryManager.Immutable> cir, @Local(ordinal = 2) List<RegistryLoader.Loader<?>> registriesList) {
if (LOADING_DYNAMIC_REGISTRIES.getAndSet(false)) {
ModPlatform platform = CommonPlatform.get();
platform.getRawConfigRegistry().clear();
MutableRegistry<Biome> biomes = extractRegistry(registriesList, RegistryKeys.BIOME).orElseThrow();
MutableRegistry<DimensionType> dimensionTypes = extractRegistry(registriesList, RegistryKeys.DIMENSION_TYPE).orElseThrow();
MutableRegistry<WorldPreset> worldPresets = extractRegistry(registriesList, RegistryKeys.WORLD_PRESET).orElseThrow();
MutableRegistry<ChunkGeneratorSettings> chunkGeneratorSettings = extractRegistry(registriesList,
RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow();
MutableRegistry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterLists = extractRegistry(instance,
MutableRegistry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterLists = extractRegistry(registriesList,
RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow();
MutableRegistry<Enchantment> enchantments = extractRegistry(instance, RegistryKeys.ENCHANTMENT).orElseThrow();
MutableRegistry<Enchantment> enchantments = extractRegistry(registriesList, RegistryKeys.ENCHANTMENT).orElseThrow();
LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists,
enchantments);
LifecycleUtil.initialize(biomes, worldPresets);
initialized = true;
}
instance.forEach(consumer);
}
@Unique
@@ -51,13 +51,35 @@ public final class LifecycleBiomeUtil {
Registry<net.minecraft.world.biome.Biome> registry) {
RegistryKey<net.minecraft.world.biome.Biome> vanilla = ((ProtoPlatformBiome) biome.getPlatformBiome()).get(registry);
if (vanilla == null) {
logger.error("""
Failed to get Vanilla Biome Regiestry key!
Terra Biome ID: {}
Vanilla Biome: {}""", biome.getID(), biome.getPlatformBiome());
}
if(pack.getContext().get(PreLoadCompatibilityOptions.class).useVanillaBiomes()) {
((ProtoPlatformBiome) biome.getPlatformBiome()).setDelegate(registry.getEntry(registry.get(vanilla)));
} else {
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
net.minecraft.world.biome.Biome minecraftBiome = BiomeUtil.createBiome(Objects.requireNonNull(registry.get(vanilla)),
net.minecraft.world.biome.Biome vanilaBiome = registry.get(vanilla);
if (vanilaBiome == null) {
String vanillaBiomeName;
if (vanilla != null ) {
vanillaBiomeName = vanilla.getValue().toString();
} else {
vanillaBiomeName = "NULL";
}
logger.error("""
Failed to get Vanilla Biome!
Terra Biome ID: {}
Vanilla Biome: {}""", biome.getID(), vanillaBiomeName);
return;
}
net.minecraft.world.biome.Biome minecraftBiome = BiomeUtil.createBiome(Objects.requireNonNull(vanilaBiome),
vanillaBiomeProperties);
Identifier identifier = Identifier.of("terra", BiomeUtil.createBiomeID(pack, id));
@@ -72,7 +94,7 @@ public final class LifecycleBiomeUtil {
minecraftBiome));
}
Map<RegistryKey<net.minecraft.world.biome.Biome>, VillagerType> villagerMap = VillagerTypeAccessor.getBiomeTypeToIdMap();
Map<RegistryKey<net.minecraft.world.biome.Biome>, RegistryKey<VillagerType>> villagerMap = VillagerTypeAccessor.getBiomeTypeToIdMap();
villagerMap.put(RegistryKey.of(RegistryKeys.BIOME, identifier),
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
@@ -12,9 +12,6 @@
"lifecycle.RegistryLoaderMixin",
"lifecycle.SaveLoadingMixin"
],
"client": [
"lifecycle.CreateWorldScreenMixin"
],
"server": [
],
"injectors": {
+6
View File
@@ -26,6 +26,12 @@ include(":platforms:minestom:example")
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://maven.solo-studios.ca/releases") {
name = "Solo Studios"
}
maven("https://maven.solo-studios.ca/snapshots") {
name = "Solo Studios"
}
maven("https://maven.fabricmc.net") {
name = "Fabric Maven"
}