mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-05-20 00:30:20 +00:00
Compare commits
103 Commits
6525df1689
...
dev/wolves
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e890f96e4 | |||
| 4e70ee99c9 | |||
| b149497c60 | |||
| d9f591bdb4 | |||
| a4b74e2e7f | |||
| b53d475f42 | |||
| 4ddb741d0d | |||
| 852f5aa610 | |||
| 953895a8d4 | |||
| 8788eab839 | |||
| 2b62473372 | |||
| 9f546370cd | |||
| 428bf341ef | |||
| 8a61571ceb | |||
| b669f87b79 | |||
| e507675ef6 | |||
| 3322a16f09 | |||
| c658d1a81b | |||
| 56a7234494 | |||
| 217b708177 | |||
| 7d86a41f65 | |||
| 753574fc9b | |||
| 95f89ed2b6 | |||
| cb8aefe8d2 | |||
| 79f9488380 | |||
| 4c2ce65cdc | |||
| 70c448dd0d | |||
| 060bda2ec1 | |||
| 6b60246694 | |||
| 1a1f461550 | |||
| da20e282ce | |||
| 9b14b0ee96 | |||
| 118aeb872f | |||
| 5446b729f9 | |||
| d71c6bb25f | |||
| d8524603c6 | |||
| 85234ddc39 | |||
| 78162eaafe | |||
| 7a041d8a63 | |||
| 8cfa2e1467 | |||
| 5f367c0f2c | |||
| f4db7fc507 | |||
| ad9d16f48c | |||
| 85b6dcc891 | |||
| 29691dfb4d | |||
| 81eab13ce1 | |||
| 68d5b22ca4 | |||
| 40b8c85c75 | |||
| 63367e5f03 | |||
| 1d95e7a87d | |||
| b2e21d8b70 | |||
| 4041239b03 | |||
| 280699bbce | |||
| 6984dc29d0 | |||
| bd253ea5d2 | |||
| d743d7d1df | |||
| 238a7954a7 | |||
| c2319ca4ab | |||
| 95172bfa7e | |||
| 124dbc8836 | |||
| 8706340584 | |||
| 9a9f90aa0d | |||
| 20a5bfdd0f | |||
| 4fee8cdb24 | |||
| 70de38ffcb | |||
| 6722d22f72 | |||
| c5526c86a2 | |||
| 84fa72f96c | |||
| cc5258ce73 | |||
| 748e027282 | |||
| bf6612edd0 | |||
| d90a4200fe | |||
| af9fb211a8 | |||
| e4395cec83 | |||
| bab8923f1e | |||
| b4068e6c59 | |||
| b143c72d0e | |||
| 5f5e70970b | |||
| ec812ef5fb | |||
| 85826071cb | |||
| c4f093210a | |||
| f14d22b264 | |||
| 016961c19c | |||
| 9f3e225b62 | |||
| c95df25d30 | |||
| 0adca3c227 | |||
| 782b300d1f | |||
| 967a4a0b2b | |||
| d3df5e56c3 | |||
| dabc2359b3 | |||
| 1d658bd52d | |||
| 4bef2f5a7f | |||
| 18cb08b622 | |||
| 1b15694878 | |||
| 267994427e | |||
| 248eb174d8 | |||
| 0a93b0fac3 | |||
| 03124cb008 | |||
| 14a07602ee | |||
| 167a712c0e | |||
| 83bc2c9022 | |||
| 06a60b3db4 | |||
| 1b4824c5db |
@@ -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
@@ -1,8 +1,8 @@
|
||||
preRelease(true)
|
||||
|
||||
versionProjects(":common:api", version("6.6.0"))
|
||||
versionProjects(":common:implementation", version("6.6.0"))
|
||||
versionProjects(":platforms", version("6.6.0"))
|
||||
versionProjects(":common:api", version("6.6.5"))
|
||||
versionProjects(":common:implementation", version("6.6.5"))
|
||||
versionProjects(":platforms", version("6.6.5"))
|
||||
|
||||
|
||||
allprojects {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -60,11 +66,14 @@ fun Project.configureDependencies() {
|
||||
maven("https://storehouse.okaeri.eu/repository/maven-public/") {
|
||||
name = "Okaeri"
|
||||
}
|
||||
maven("https://repo.onarandombox.com/multiverse-releases") {
|
||||
name = "onarandombox"
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
object Versions {
|
||||
object Terra {
|
||||
const val overworldConfig = "v1.3.4"
|
||||
const val overworldConfig = "v1.5.2"
|
||||
}
|
||||
|
||||
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.129.0+${Mod.minecraft}"
|
||||
const val cloud = "2.0.0-beta.11"
|
||||
}
|
||||
//
|
||||
// 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.8"
|
||||
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,19 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Bukkit {
|
||||
const val minecraft = "1.21.4"
|
||||
const val paperBuild = "$minecraft-R0.1-20241211.212446-17"
|
||||
const val minecraft = "1.21.8-R0.1"
|
||||
const val paperBuild = "$minecraft-20250717.233435-4"
|
||||
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 cloud = "2.0.0-beta.10"
|
||||
const val paperWeight = "2.0.0-beta.17"
|
||||
const val cloud = "2.0.0-beta.11"
|
||||
const val multiverse = "5.0.2"
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// object Sponge {
|
||||
// const val sponge = "9.0.0-SNAPSHOT"
|
||||
// const val mixin = "0.8.2"
|
||||
@@ -74,15 +76,18 @@ 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.1.3"
|
||||
const val api = "0.4.1"
|
||||
const val gson = "2.13.1"
|
||||
const val mappings = "3626653"
|
||||
const val mappingsGenerator = "366618e"
|
||||
}
|
||||
|
||||
object Minestom {
|
||||
const val minestom = "187931e50b"
|
||||
const val minestom = "1_21_6-c3ccee696b"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
bool thing1 = 2 > (2+2) || false;
|
||||
bool thing1 = 2 > (2 + 2) || false;
|
||||
|
||||
if(2 > 2 || 3 + 4 <= 2 && 4 + 5 > 2 / 3) {
|
||||
if (2 > 2 || 3 + 4 <= 2 && 4 + 5 > 2 / 3) {
|
||||
test("ok", 2);
|
||||
}
|
||||
|
||||
test("minecraft:green_w" + "ool", (2 * (3+1) * (2 * (1+1))));
|
||||
test("minecraft:green_w" + "ool", (2 * (3 + 1) * (2 * (1 + 1))));
|
||||
//
|
||||
|
||||
num testVar = 3.4;
|
||||
@@ -21,7 +21,7 @@ bool iftest = false;
|
||||
bool truetest = false;
|
||||
|
||||
num iterator = 0;
|
||||
num thing = 4 - 2-2+2-2+2;
|
||||
num thing = 4 - 2 - 2 + 2 - 2 + 2;
|
||||
test("4 - 2 = " + thing, 2);
|
||||
|
||||
thing = -2;
|
||||
@@ -31,54 +31,54 @@ test("--2 = " + thing, 2);
|
||||
|
||||
|
||||
|
||||
for(num i = 0; i < 5; i = i + 1) {
|
||||
for (num i = 0; i < 5; i = i + 1) {
|
||||
test("i = " + i, iterator);
|
||||
if(i > 1 + 1) {
|
||||
if (i > 1 + 1) {
|
||||
test("more than 2", iterator);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for(num i = 0; i < 5; i = i + 1) {
|
||||
for (num i = 0; i < 5; i = i + 1) {
|
||||
test("i = " + i, iterator);
|
||||
}
|
||||
|
||||
for(num j = 0; j < 5; j = j + 1) test("single statement j = " + j, iterator);
|
||||
for (num j = 0; j < 5; j = j + 1) test("single statement j = " + j, iterator);
|
||||
|
||||
if(4 + 2 == 2 + 4) {
|
||||
if (4 + 2 == 2 + 4) {
|
||||
test("new thing " + 2, iterator);
|
||||
}
|
||||
|
||||
while(iterator < 5) {
|
||||
while (iterator < 5) {
|
||||
test("always, even after " + 2, iterator);
|
||||
iterator = iterator + 1;
|
||||
if(iterator > 2) {
|
||||
if (iterator > 2) {
|
||||
continue;
|
||||
}
|
||||
test("not after " + 2, iterator);
|
||||
}
|
||||
|
||||
if(true) test("single statement" + 2, iterator);
|
||||
else if(true) test("another single statement" + 2, iterator);
|
||||
if (true) test("single statement" + 2, iterator);
|
||||
else if (true) test("another single statement" + 2, iterator);
|
||||
|
||||
if(true) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if(false) {
|
||||
if (true) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if(false) {
|
||||
test("true again!" + 2, iterator);
|
||||
} else if(true == true) {
|
||||
test("false again!" + 2, iterator);
|
||||
if (false) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("not logged!" + 2, iterator);
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if (false) {
|
||||
test("true again!" + 2, iterator);
|
||||
} else if (true == true) {
|
||||
test("false again!" + 2, iterator);
|
||||
} else {
|
||||
test("not logged!" + 2, iterator);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ fsdfsd
|
||||
|
||||
test("fdsgdf" + 2, 1 + testVar);
|
||||
|
||||
if(true && !(boolean && false) && true) {
|
||||
if (true && !(boolean && false) && true) {
|
||||
num scopedVar = 2;
|
||||
test("if statement" + 2 + stringVar, 1 + testVar + scopedVar);
|
||||
}
|
||||
@@ -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;
|
||||
@@ -106,7 +108,7 @@ public abstract class AbstractPlatform implements Platform {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
protected void load() {
|
||||
protected InternalAddon load() {
|
||||
if(LOADED.get()) {
|
||||
throw new IllegalStateException(
|
||||
"Someone tried to initialize Terra, but Terra has already initialized. This is most likely due to a broken platform " +
|
||||
@@ -157,6 +159,8 @@ public abstract class AbstractPlatform implements Platform {
|
||||
|
||||
logger.info("Terra addons successfully loaded.");
|
||||
logger.info("Finished initialization.");
|
||||
|
||||
return internalAddon;
|
||||
}
|
||||
|
||||
protected InternalAddon loadAddons() {
|
||||
@@ -327,6 +331,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) {
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -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
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
Current mapping version: je 1.21.4 to be 1.21.50
|
||||
|
||||
- `mapping/biomes.json` obtain from GeyserMC/mappings.
|
||||
- `mapping/items.json` obtain from GeyserMC/mappings.
|
||||
- `mapping/blocks.json` generated by using GeyserMC/mappings-generator, and it's origin name is `generator_blocks.json`.
|
||||
- `je_block_default_states.json` converted from https://zh.minecraft.wiki/w/Module:Block_state_values.
|
||||
- `mapping/biomes.json` and `mapping/items.json` obtain from [GeyserMC/mappings](https://github.com/GeyserMC/mappings).
|
||||
- `mapping/blocks.json` generated by using [GeyserMC/mappings-generator](https://github.com/GeyserMC/mappings-generator), and it's origin name is `generator_blocks.json`.
|
||||
- `je_block_default_states.json` converted from [Block state values](https://zh.minecraft.wiki/w/Module:Block_state_values).
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
repositories {
|
||||
ivy {
|
||||
url = uri("https://raw.githubusercontent.com/")
|
||||
patternLayout {
|
||||
artifact("[organisation]/[revision]/[artifact].([ext])")
|
||||
setM2compatible(true)
|
||||
}
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val geyserMappings: Configuration by configurations.register("geyserMappings") {
|
||||
isCanBeConsumed = false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
implementation("com.google.code.gson", "gson", Versions.Allay.gson)
|
||||
|
||||
compileOnly("org.allaymc.allay", "api", Versions.Allay.api)
|
||||
}
|
||||
|
||||
geyserMappings("GeyserMC.mappings", "items", Versions.Allay.mappings, ext = "json")
|
||||
geyserMappings("GeyserMC.mappings", "biomes", Versions.Allay.mappings, ext = "json")
|
||||
geyserMappings("GeyserMC.mappings-generator", "generator_blocks", Versions.Allay.mappingsGenerator, ext = "json")
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
from(geyserMappings) {
|
||||
into("mapping")
|
||||
|
||||
// rather jank, but whatever
|
||||
rename("(?:generator_)?([^-]+)-(.*)\\.json", "$1.json")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,48 @@
|
||||
package com.dfsek.terra.allay;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import org.allaymc.api.block.type.BlockState;
|
||||
import org.allaymc.api.block.type.BlockStateSafeGetter;
|
||||
import org.allaymc.api.block.type.BlockStateSafeGetter.Getter;
|
||||
import org.allaymc.api.block.type.BlockTypes;
|
||||
import org.allaymc.api.item.type.ItemType;
|
||||
import org.allaymc.api.item.type.ItemTypeSafeGetter;
|
||||
import org.allaymc.api.utils.JSONUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
/**
|
||||
* @author daoge_cmd
|
||||
* @author IWareQ
|
||||
*/
|
||||
public final class Mapping {
|
||||
private static final Gson GSON = new GsonBuilder()
|
||||
.registerTypeAdapterFactory(new IgnoreFailureTypeAdapterFactory())
|
||||
.create();
|
||||
|
||||
private static final Map<String, Map<String, String>> JE_BLOCK_DEFAULT_PROPERTIES = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<BlockState, JeBlockState> BLOCK_STATE_BE_TO_JE = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<Integer, BlockState> BLOCK_STATE_JE_HASH_TO_BE = new Int2ObjectOpenHashMap<>();
|
||||
private static final Map<String, ItemType<?>> ITEM_ID_JE_TO_BE = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<String, Integer> BIOME_ID_JE_TO_BE = new Object2IntOpenHashMap<>();
|
||||
private static final Map<BlockState, JeBlockState> BE_BLOCK_STATE_TO_JE = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<Integer, BlockState> JE_BLOCK_STATE_HASH_TO_BE = new Int2ObjectOpenHashMap<>();
|
||||
private static final Map<String, ItemType<?>> JE_ITEM_ID_TO_BE = new Object2ObjectOpenHashMap<>();
|
||||
private static final Map<String, Integer> JE_BIOME_ID_TO_BE = new Object2IntOpenHashMap<>();
|
||||
|
||||
private static final BlockState BE_AIR_STATE = BlockTypes.AIR.getDefaultState();
|
||||
|
||||
public static void init() {
|
||||
@@ -41,11 +53,11 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
public static JeBlockState blockStateBeToJe(BlockState beBlockState) {
|
||||
return BLOCK_STATE_BE_TO_JE.get(beBlockState);
|
||||
return BE_BLOCK_STATE_TO_JE.get(beBlockState);
|
||||
}
|
||||
|
||||
public static BlockState blockStateJeToBe(JeBlockState jeBlockState) {
|
||||
BlockState result = BLOCK_STATE_JE_HASH_TO_BE.get(jeBlockState.getHash());
|
||||
BlockState result = JE_BLOCK_STATE_HASH_TO_BE.get(jeBlockState.getHash());
|
||||
if(result == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find be block state for {}", jeBlockState);
|
||||
return BE_AIR_STATE;
|
||||
@@ -54,7 +66,7 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
public static ItemType<?> itemIdJeToBe(String jeItemId) {
|
||||
return ITEM_ID_JE_TO_BE.get(jeItemId);
|
||||
return JE_ITEM_ID_TO_BE.get(jeItemId);
|
||||
}
|
||||
|
||||
// Enchantment identifiers are same in both versions
|
||||
@@ -68,15 +80,16 @@ public final class Mapping {
|
||||
}
|
||||
|
||||
public static int biomeIdJeToBe(String jeBiomeId) {
|
||||
return BIOME_ID_JE_TO_BE.get(jeBiomeId);
|
||||
return JE_BIOME_ID_TO_BE.get(jeBiomeId);
|
||||
}
|
||||
|
||||
public static Map<String, String> getJeBlockDefaultProperties(String jeBlockIdentifier) {
|
||||
Map<String, String> defaultProperties = JE_BLOCK_DEFAULT_PROPERTIES.get(jeBlockIdentifier);
|
||||
var defaultProperties = JE_BLOCK_DEFAULT_PROPERTIES.get(jeBlockIdentifier);
|
||||
if(defaultProperties == null) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().warn("Failed to find default properties for {}", jeBlockIdentifier);
|
||||
return Map.of();
|
||||
}
|
||||
|
||||
return defaultProperties;
|
||||
}
|
||||
|
||||
@@ -90,8 +103,9 @@ public final class Mapping {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("biomes mapping not found");
|
||||
return false;
|
||||
}
|
||||
Set<Entry<String, Map<String, Integer>>> mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Integer>>>(){}).entrySet();
|
||||
mappings.forEach(mapping -> BIOME_ID_JE_TO_BE.put(mapping.getKey(), mapping.getValue().get("bedrock_id")));
|
||||
|
||||
Map<String, BiomeMapping> mappings = from(stream, new TypeToken<>() {});
|
||||
mappings.forEach((javaId, mapping) -> JE_BIOME_ID_TO_BE.put(javaId, mapping.bedrockId()));
|
||||
} catch(IOException e) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load biomes mapping", e);
|
||||
return false;
|
||||
@@ -105,17 +119,18 @@ public final class Mapping {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("items mapping not found");
|
||||
return false;
|
||||
}
|
||||
Set<Entry<String, Map<String, Object>>> mappings = JSONUtils.from(stream, new TypeToken<Map<String, Map<String, Object>>>() {}).entrySet();
|
||||
mappings.forEach(mapping -> {
|
||||
ItemType<?> item = ItemTypeSafeGetter
|
||||
.name((String) mapping.getValue().get("bedrock_identifier"))
|
||||
// NOTICE: should be cast to double
|
||||
.meta(((Double) mapping.getValue().get("bedrock_data")).intValue())
|
||||
|
||||
Map<String, ItemMapping> mappings = from(stream, new TypeToken<>() {});
|
||||
mappings.forEach((javaId, mapping) -> {
|
||||
ItemType<?> itemType = ItemTypeSafeGetter
|
||||
.name(mapping.bedrockId())
|
||||
.meta(mapping.bedrockData())
|
||||
.itemType();
|
||||
ITEM_ID_JE_TO_BE.put(mapping.getKey(), item);
|
||||
JE_ITEM_ID_TO_BE.put(javaId, itemType);
|
||||
});
|
||||
} catch(IOException e) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load items mapping", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -126,16 +141,18 @@ public final class Mapping {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("blocks mapping not found");
|
||||
return false;
|
||||
}
|
||||
// noinspection unchecked
|
||||
List<Map<String, Map<String, Object>>> mappings = (List<Map<String, Map<String, Object>>>) JSONUtils.from(stream, new TypeToken<Map<String, Object>>() {}).get("mappings");
|
||||
|
||||
Map<String, List<BlockMapping>> root = from(stream, new TypeToken<>() {});
|
||||
List<BlockMapping> mappings = root.get("mappings");
|
||||
mappings.forEach(mapping -> {
|
||||
JeBlockState jeState = createJeBlockState(mapping.get("java_state"));
|
||||
BlockState beState = createBeBlockState(mapping.get("bedrock_state"));
|
||||
BLOCK_STATE_BE_TO_JE.put(beState, jeState);
|
||||
BLOCK_STATE_JE_HASH_TO_BE.put(jeState.getHash(), beState);
|
||||
JeBlockState jeState = createJeBlockState(mapping.javaState());
|
||||
BlockState beState = createBeBlockState(mapping.bedrockState());
|
||||
BE_BLOCK_STATE_TO_JE.put(beState, jeState);
|
||||
JE_BLOCK_STATE_HASH_TO_BE.put(jeState.getHash(), beState);
|
||||
});
|
||||
} catch(IOException e) {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("Failed to load blocks mapping", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -146,30 +163,30 @@ public final class Mapping {
|
||||
TerraAllayPlugin.INSTANCE.getPluginLogger().error("je_block_default_states.json not found");
|
||||
return false;
|
||||
}
|
||||
Map<String, Map<String, String>> states = JSONUtils.from(stream, new TypeToken<>() {});
|
||||
for(Entry<String, Map<String, String>> entry : states.entrySet()) {
|
||||
String identifier = entry.getKey();
|
||||
Map<String, String> properties = entry.getValue();
|
||||
JE_BLOCK_DEFAULT_PROPERTIES.put(identifier, properties);
|
||||
}
|
||||
|
||||
Map<String, Map<String, String>> states = from(stream, new TypeToken<>() {});
|
||||
JE_BLOCK_DEFAULT_PROPERTIES.putAll(states);
|
||||
} catch(IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static BlockState createBeBlockState(Map<String, Object> data) {
|
||||
Getter getter = BlockStateSafeGetter
|
||||
.name("minecraft:" + data.get("bedrock_identifier"));
|
||||
if(data.containsKey("state")) {
|
||||
// noinspection unchecked
|
||||
convertValueType((Map<String, Object>) data.get("state")).forEach(getter::property);
|
||||
private static JeBlockState createJeBlockState(BlockMapping.JavaState state) {
|
||||
Map<String, String> properties = state.properties() == null ? Map.of() : state.properties();
|
||||
return JeBlockState.create(state.name(), new TreeMap<>(properties));
|
||||
}
|
||||
|
||||
private static BlockState createBeBlockState(BlockMapping.BedrockState state) {
|
||||
BlockStateSafeGetter.Getter getter = BlockStateSafeGetter.name("minecraft:" + state.bedrockId());
|
||||
if(state.state() != null) {
|
||||
convertValueType(state.state()).forEach(getter::property);
|
||||
}
|
||||
return getter.blockState();
|
||||
}
|
||||
|
||||
private static Map<String, Object> convertValueType(Map<String, Object> data) {
|
||||
TreeMap<String, Object> result = new TreeMap<>();
|
||||
Map<String, Object> result = new TreeMap<>();
|
||||
for(Entry<String, Object> entry : data.entrySet()) {
|
||||
if(entry.getValue() instanceof Number number) {
|
||||
// Convert double to int because the number in json is double
|
||||
@@ -178,11 +195,78 @@ public final class Mapping {
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static JeBlockState createJeBlockState(Map<String, Object> data) {
|
||||
// noinspection unchecked
|
||||
return JeBlockState.create((String) data.get("Name"), new TreeMap<>((Map<String, String>) data.getOrDefault("Properties", Map.of())));
|
||||
public static <V> V from(InputStream inputStream, TypeToken<V> typeToken) {
|
||||
JsonReader reader = new JsonReader(new InputStreamReader(Objects.requireNonNull(inputStream)));
|
||||
return GSON.fromJson(reader, typeToken.getType());
|
||||
}
|
||||
|
||||
public record BiomeMapping(
|
||||
@SerializedName("bedrock_id")
|
||||
int bedrockId
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public record ItemMapping(
|
||||
@SerializedName("bedrock_identifier")
|
||||
String bedrockId,
|
||||
@SerializedName("bedrock_data")
|
||||
int bedrockData
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public record BlockMapping(
|
||||
@SerializedName("java_state")
|
||||
BlockMapping.JavaState javaState,
|
||||
@SerializedName("bedrock_state")
|
||||
BlockMapping.BedrockState bedrockState
|
||||
) {
|
||||
public record JavaState(
|
||||
@SerializedName("Name")
|
||||
String name,
|
||||
@Nullable
|
||||
@SerializedName("Properties")
|
||||
Map<String, String> properties
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public record BedrockState(
|
||||
@SerializedName("bedrock_identifier")
|
||||
String bedrockId,
|
||||
@Nullable
|
||||
Map<String, Object> state
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// see https://stackoverflow.com/questions/59655279/is-there-an-easy-way-to-make-gson-skip-a-field-if-theres-an-error-deserializing
|
||||
public static class IgnoreFailureTypeAdapterFactory implements TypeAdapterFactory {
|
||||
@Override
|
||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||
TypeAdapter<T> delegate = gson.getDelegateAdapter(this, typeToken);
|
||||
return new TypeAdapter<>() {
|
||||
@Override
|
||||
public void write(JsonWriter writer, T value) throws IOException {
|
||||
delegate.write(writer, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T read(JsonReader reader) throws IOException {
|
||||
try {
|
||||
return delegate.read(reader);
|
||||
} catch(Exception e) {
|
||||
reader.skipValue();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.dfsek.terra.allay.delegate;
|
||||
|
||||
import org.allaymc.api.item.data.ItemId;
|
||||
import org.allaymc.api.item.type.ItemType;
|
||||
import org.allaymc.api.registry.Registries;
|
||||
|
||||
import com.dfsek.terra.api.inventory.Item;
|
||||
|
||||
@@ -16,7 +14,7 @@ public final class AllayItemType implements Item {
|
||||
|
||||
public AllayItemType(ItemType<?> allayItemType) {
|
||||
this.allayItemType = allayItemType;
|
||||
this.maxDurability = Registries.ITEM_DATA.get(ItemId.fromIdentifier(allayItemType.getIdentifier())).maxDamage();
|
||||
this.maxDurability = allayItemType.getItemData().maxDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,197 +0,0 @@
|
||||
{
|
||||
"minecraft:badlands": {
|
||||
"bedrock_id": 37
|
||||
},
|
||||
"minecraft:bamboo_jungle": {
|
||||
"bedrock_id": 48
|
||||
},
|
||||
"minecraft:basalt_deltas": {
|
||||
"bedrock_id": 181
|
||||
},
|
||||
"minecraft:beach": {
|
||||
"bedrock_id": 16
|
||||
},
|
||||
"minecraft:birch_forest": {
|
||||
"bedrock_id": 27
|
||||
},
|
||||
"minecraft:cherry_grove": {
|
||||
"bedrock_id": 192
|
||||
},
|
||||
"minecraft:cold_ocean": {
|
||||
"bedrock_id": 44
|
||||
},
|
||||
"minecraft:crimson_forest": {
|
||||
"bedrock_id": 179
|
||||
},
|
||||
"minecraft:dark_forest": {
|
||||
"bedrock_id": 29
|
||||
},
|
||||
"minecraft:deep_cold_ocean": {
|
||||
"bedrock_id": 45
|
||||
},
|
||||
"minecraft:deep_dark": {
|
||||
"bedrock_id": 190
|
||||
},
|
||||
"minecraft:deep_frozen_ocean": {
|
||||
"bedrock_id": 47
|
||||
},
|
||||
"minecraft:deep_lukewarm_ocean": {
|
||||
"bedrock_id": 43
|
||||
},
|
||||
"minecraft:deep_ocean": {
|
||||
"bedrock_id": 24
|
||||
},
|
||||
"minecraft:desert": {
|
||||
"bedrock_id": 2
|
||||
},
|
||||
"minecraft:dripstone_caves": {
|
||||
"bedrock_id": 188
|
||||
},
|
||||
"minecraft:end_barrens": {
|
||||
"bedrock_id": 9
|
||||
},
|
||||
"minecraft:end_highlands": {
|
||||
"bedrock_id": 9
|
||||
},
|
||||
"minecraft:end_midlands": {
|
||||
"bedrock_id": 9
|
||||
},
|
||||
"minecraft:eroded_badlands": {
|
||||
"bedrock_id": 165
|
||||
},
|
||||
"minecraft:flower_forest": {
|
||||
"bedrock_id": 132
|
||||
},
|
||||
"minecraft:forest": {
|
||||
"bedrock_id": 4
|
||||
},
|
||||
"minecraft:frozen_ocean": {
|
||||
"bedrock_id": 46
|
||||
},
|
||||
"minecraft:frozen_peaks": {
|
||||
"bedrock_id": 183
|
||||
},
|
||||
"minecraft:frozen_river": {
|
||||
"bedrock_id": 11
|
||||
},
|
||||
"minecraft:grove": {
|
||||
"bedrock_id": 185
|
||||
},
|
||||
"minecraft:ice_spikes": {
|
||||
"bedrock_id": 140
|
||||
},
|
||||
"minecraft:jagged_peaks": {
|
||||
"bedrock_id": 182
|
||||
},
|
||||
"minecraft:jungle": {
|
||||
"bedrock_id": 21
|
||||
},
|
||||
"minecraft:lukewarm_ocean": {
|
||||
"bedrock_id": 42
|
||||
},
|
||||
"minecraft:lush_caves": {
|
||||
"bedrock_id": 187
|
||||
},
|
||||
"minecraft:mangrove_swamp": {
|
||||
"bedrock_id": 191
|
||||
},
|
||||
"minecraft:meadow": {
|
||||
"bedrock_id": 186
|
||||
},
|
||||
"minecraft:mushroom_fields": {
|
||||
"bedrock_id": 14
|
||||
},
|
||||
"minecraft:nether_wastes": {
|
||||
"bedrock_id": 8
|
||||
},
|
||||
"minecraft:ocean": {
|
||||
"bedrock_id": 0
|
||||
},
|
||||
"minecraft:old_growth_birch_forest": {
|
||||
"bedrock_id": 155
|
||||
},
|
||||
"minecraft:old_growth_pine_taiga": {
|
||||
"bedrock_id": 32
|
||||
},
|
||||
"minecraft:old_growth_spruce_taiga": {
|
||||
"bedrock_id": 160
|
||||
},
|
||||
"minecraft:pale_garden": {
|
||||
"bedrock_id": 62
|
||||
},
|
||||
"minecraft:plains": {
|
||||
"bedrock_id": 1
|
||||
},
|
||||
"minecraft:river": {
|
||||
"bedrock_id": 7
|
||||
},
|
||||
"minecraft:savanna": {
|
||||
"bedrock_id": 35
|
||||
},
|
||||
"minecraft:savanna_plateau": {
|
||||
"bedrock_id": 36
|
||||
},
|
||||
"minecraft:small_end_islands": {
|
||||
"bedrock_id": 9
|
||||
},
|
||||
"minecraft:snowy_beach": {
|
||||
"bedrock_id": 26
|
||||
},
|
||||
"minecraft:snowy_plains": {
|
||||
"bedrock_id": 12
|
||||
},
|
||||
"minecraft:snowy_slopes": {
|
||||
"bedrock_id": 184
|
||||
},
|
||||
"minecraft:snowy_taiga": {
|
||||
"bedrock_id": 30
|
||||
},
|
||||
"minecraft:soul_sand_valley": {
|
||||
"bedrock_id": 178
|
||||
},
|
||||
"minecraft:sparse_jungle": {
|
||||
"bedrock_id": 23
|
||||
},
|
||||
"minecraft:stony_peaks": {
|
||||
"bedrock_id": 189
|
||||
},
|
||||
"minecraft:stony_shore": {
|
||||
"bedrock_id": 25
|
||||
},
|
||||
"minecraft:sunflower_plains": {
|
||||
"bedrock_id": 129
|
||||
},
|
||||
"minecraft:swamp": {
|
||||
"bedrock_id": 6
|
||||
},
|
||||
"minecraft:taiga": {
|
||||
"bedrock_id": 5
|
||||
},
|
||||
"minecraft:the_end": {
|
||||
"bedrock_id": 9
|
||||
},
|
||||
"minecraft:the_void": {
|
||||
"bedrock_id": 7
|
||||
},
|
||||
"minecraft:warm_ocean": {
|
||||
"bedrock_id": 40
|
||||
},
|
||||
"minecraft:warped_forest": {
|
||||
"bedrock_id": 180
|
||||
},
|
||||
"minecraft:windswept_forest": {
|
||||
"bedrock_id": 34
|
||||
},
|
||||
"minecraft:windswept_gravelly_hills": {
|
||||
"bedrock_id": 131
|
||||
},
|
||||
"minecraft:windswept_hills": {
|
||||
"bedrock_id": 3
|
||||
},
|
||||
"minecraft:windswept_savanna": {
|
||||
"bedrock_id": 163
|
||||
},
|
||||
"minecraft:wooded_badlands": {
|
||||
"bedrock_id": 38
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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_8"))
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ dependencies {
|
||||
|
||||
compileOnly("io.papermc.paper", "paper-api", Versions.Bukkit.paper)
|
||||
|
||||
compileOnly("org.mvplugins.multiverse.core", "multiverse-core", Versions.Bukkit.multiverse)
|
||||
|
||||
shadedApi("io.papermc", "paperlib", Versions.Bukkit.paperLib)
|
||||
|
||||
shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)
|
||||
|
||||
@@ -21,20 +21,18 @@ import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.Initializer;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.dfsek.terra.AbstractPlatform;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.handle.WorldHandle;
|
||||
@@ -57,7 +55,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;
|
||||
}
|
||||
@@ -97,11 +95,6 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
plugin.getGlobalRegionScheduler().run(plugin, task -> runnable.run());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<BaseAddon> platformAddon() {
|
||||
return List.of(Initializer.nmsAddon(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull WorldHandle getWorldHandle() {
|
||||
return handle;
|
||||
@@ -131,8 +124,9 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
|
||||
}
|
||||
|
||||
private BukkitPlatformBiome parseBiome(String id, DepthTracker depthTracker) throws LoadException {
|
||||
if(!id.startsWith("minecraft:")) throw new LoadException("Invalid biome identifier " + id, depthTracker);
|
||||
return new BukkitPlatformBiome(org.bukkit.block.Biome.valueOf(id.toUpperCase(Locale.ROOT).substring(10)));
|
||||
protected BukkitPlatformBiome parseBiome(String id, DepthTracker depthTracker) throws LoadException {
|
||||
NamespacedKey key = NamespacedKey.fromString(id);
|
||||
if(key == null || !key.namespace().equals("minecraft")) throw new LoadException("Invalid biome identifier " + id, depthTracker);
|
||||
return new BukkitPlatformBiome(RegistryAccess.registryAccess().getRegistry(RegistryKey.BIOME).getOrThrow(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ import com.dfsek.terra.bukkit.world.BukkitAdapter;
|
||||
public class TerraBukkitPlugin extends JavaPlugin {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TerraBukkitPlugin.class);
|
||||
|
||||
private final PlatformImpl platform = new PlatformImpl(this);
|
||||
private PlatformImpl platform;
|
||||
private final Map<String, com.dfsek.terra.api.world.chunk.generation.ChunkGenerator> generatorMap = new HashMap<>();
|
||||
|
||||
private AsyncScheduler asyncScheduler = this.getServer().getAsyncScheduler();
|
||||
@@ -64,13 +64,14 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
platform.getEventManager().callEvent(new PlatformInitializationEvent());
|
||||
|
||||
if(!Initializer.init(platform)) {
|
||||
platform = Initializer.init(this);
|
||||
if(platform == null) {
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
platform.getEventManager().callEvent(new PlatformInitializationEvent());
|
||||
|
||||
try {
|
||||
LegacyPaperCommandManager<CommandSender> commandManager = getCommandSenderPaperCommandManager();
|
||||
|
||||
@@ -87,7 +88,7 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new CommonListener(), this); // Register master event listener
|
||||
Bukkit.getPluginManager().registerEvents(new CommonListener(platform), this); // Register master event listener
|
||||
PaperUtil.checkPaper(this);
|
||||
}
|
||||
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.dfsek.terra.bukkit.hooks;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.registry.key.Keyed;
|
||||
|
||||
import org.mvplugins.multiverse.core.MultiverseCoreApi;
|
||||
import org.mvplugins.multiverse.core.world.generators.GeneratorPlugin;
|
||||
import org.mvplugins.multiverse.external.jetbrains.annotations.NotNull;
|
||||
import org.mvplugins.multiverse.external.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public final class MultiverseGeneratorPluginHook implements GeneratorPlugin {
|
||||
|
||||
private final Platform platform;
|
||||
|
||||
public MultiverseGeneratorPluginHook(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<String> suggestIds(@Nullable String s) {
|
||||
return platform.getConfigRegistry().entries().stream()
|
||||
.map(Keyed::getID)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Collection<String> getExampleUsages() {
|
||||
return platform.getConfigRegistry()
|
||||
.entries()
|
||||
.stream()
|
||||
.map(Keyed::getID)
|
||||
.map("/mv create example_world NORMAL -g Terra:%s"::formatted)
|
||||
.limit(5) // reasonable amount
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getInfoLink() {
|
||||
return "https://terra.polydev.org/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getPluginName() {
|
||||
return "Terra";
|
||||
}
|
||||
|
||||
public static void register(Platform platform) {
|
||||
MultiverseCoreApi.get().getGeneratorProvider()
|
||||
.registerGeneratorPlugin(new MultiverseGeneratorPluginHook(platform));
|
||||
}
|
||||
}
|
||||
+108
-1
@@ -17,13 +17,120 @@
|
||||
|
||||
package com.dfsek.terra.bukkit.listeners;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.bukkit.generator.BukkitChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.bukkit.hooks.MultiverseGeneratorPluginHook;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitBiomeInfo;
|
||||
import com.dfsek.terra.bukkit.world.BukkitPlatformBiome;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Wolf.Variant;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Listener for events on all implementations.
|
||||
*/
|
||||
public class CommonListener implements Listener {
|
||||
public CommonListener() {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CommonListener.class);
|
||||
private static final List<SpawnReason> WOLF_VARIANT_SPAWN_REASONS = List.of(
|
||||
SpawnReason.SPAWNER, SpawnReason.TRIAL_SPAWNER, SpawnReason.SPAWNER_EGG, SpawnReason.NATURAL
|
||||
);
|
||||
private final Platform platform;
|
||||
|
||||
public CommonListener(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if(event.getPlugin().getName().equals("Multiverse-Core")) {
|
||||
try {
|
||||
Class.forName("org.mvplugins.multiverse.core.MultiverseCoreApi");
|
||||
MultiverseGeneratorPluginHook.register(platform);
|
||||
} catch(ClassNotFoundException e) {
|
||||
logger.debug("Multiverse v5 is not installed.");
|
||||
} catch(IllegalStateException e) {
|
||||
logger.error("Failed to register Terra generator plugin to multiverse.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyWolfVariant(Wolf wolf) {
|
||||
// Doesn't apply if variant has already been applied
|
||||
if (wolf.getVariant() != Variant.PALE) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = wolf.getWorld();
|
||||
if (!(world.getGenerator() instanceof BukkitChunkGeneratorWrapper wrapper)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigPack pack = platform.getConfigRegistry().get(wrapper.getPack().getRegistryKey()).orElse(null);
|
||||
if (pack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NamespacedKey biomeKey = wolf.getWorld().getBiome(wolf.getLocation()).getKey();
|
||||
pack.getBiomeProvider().stream()
|
||||
.filter(biome -> {
|
||||
NamespacedKey key = ((BukkitPlatformBiome) biome.getPlatformBiome()).getContext()
|
||||
.get(BukkitBiomeInfo.class)
|
||||
.biomeKey();
|
||||
return key.equals(biomeKey);
|
||||
})
|
||||
.findFirst()
|
||||
.ifPresent(biome -> {
|
||||
NamespacedKey vanillaBiomeKey = ((BukkitPlatformBiome) biome.getPlatformBiome()).getHandle().getKey();
|
||||
switch(vanillaBiomeKey.toString()) {
|
||||
case "minecraft:snowy_taiga" -> wolf.setVariant(Variant.ASHEN);
|
||||
case "minecraft:old_growth_pine_taiga" -> wolf.setVariant(Variant.BLACK);
|
||||
case "minecraft:old_growth_spruce_taiga" -> wolf.setVariant(Variant.CHESTNUT);
|
||||
case "minecraft:grove" -> wolf.setVariant(Variant.SNOWY);
|
||||
case "minecraft:forest" -> wolf.setVariant(Variant.WOODS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWolfSpawn(CreatureSpawnEvent event) {
|
||||
if (!(event.getEntity() instanceof Wolf wolf)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WOLF_VARIANT_SPAWN_REASONS.contains(event.getSpawnReason())) {
|
||||
logger.debug("Ignoring wolf spawned with reason: " + event.getSpawnReason());
|
||||
return;
|
||||
}
|
||||
|
||||
applyWolfVariant(wolf);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChunkGenerate(ChunkLoadEvent event) {
|
||||
if (!event.isNewChunk()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity entity : event.getChunk().getEntities()) {
|
||||
if (entity instanceof Wolf wolf) {
|
||||
applyWolfVariant(wolf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.bukkit.nms;
|
||||
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -13,13 +13,11 @@ public interface Initializer {
|
||||
String NMS = VersionUtil.getMinecraftVersionInfo().toString().replace(".", "_");
|
||||
String TERRA_PACKAGE = Initializer.class.getPackageName();
|
||||
|
||||
static boolean init(PlatformImpl platform) {
|
||||
static PlatformImpl init(TerraBukkitPlugin plugin) {
|
||||
Logger logger = LoggerFactory.getLogger(Initializer.class);
|
||||
|
||||
Initializer initializer = constructInitializer();
|
||||
if(initializer != null) {
|
||||
initializer.initialize(platform);
|
||||
} else {
|
||||
PlatformImpl platform = constructPlatform(plugin);
|
||||
if (platform == null) {
|
||||
logger.error("NMS bindings for version {} do not exist. Support for this version is limited.", NMS);
|
||||
logger.error("This is usually due to running Terra on an unsupported Minecraft version.");
|
||||
String bypassKey = "IKnowThereAreNoNMSBindingsFor" + NMS + "ButIWillProceedAnyway";
|
||||
@@ -27,7 +25,7 @@ public interface Initializer {
|
||||
logger.error("Because of this **TERRA HAS BEEN DISABLED**.");
|
||||
logger.error("Do not come ask us why it is not working.");
|
||||
logger.error("If you wish to proceed anyways, you can add the JVM System Property \"{}\" to enable the plugin.", bypassKey);
|
||||
return false;
|
||||
return null;
|
||||
} else {
|
||||
logger.error("");
|
||||
logger.error("");
|
||||
@@ -43,24 +41,21 @@ public interface Initializer {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return platform;
|
||||
}
|
||||
|
||||
static BukkitAddon nmsAddon(PlatformImpl platform) {
|
||||
Initializer initializer = constructInitializer();
|
||||
return initializer != null ? initializer.getNMSAddon(platform) : new BukkitAddon(platform);
|
||||
}
|
||||
|
||||
private static Initializer constructInitializer() {
|
||||
private static PlatformImpl constructPlatform(TerraBukkitPlugin plugin) {
|
||||
try {
|
||||
String packageVersion = NMS;
|
||||
if (NMS.equals("v1_21_4")) {
|
||||
packageVersion = "v1_21_3";
|
||||
if (NMS.equals("v1_21_5") || NMS.equals("v1_21_6") || NMS.equals("v1_21_7")) {
|
||||
packageVersion = "v1_21_8";
|
||||
}
|
||||
|
||||
Class<?> initializerClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSInitializer");
|
||||
Class<?> platformClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSPlatform");
|
||||
try {
|
||||
return (Initializer) initializerClass.getConstructor().newInstance();
|
||||
return (PlatformImpl) platformClass
|
||||
.getConstructor(TerraBukkitPlugin.class)
|
||||
.newInstance(plugin);
|
||||
} catch(ReflectiveOperationException e) {
|
||||
throw new RuntimeException("Error initializing NMS bindings. Report this to Terra.", e);
|
||||
}
|
||||
@@ -68,8 +63,4 @@ public interface Initializer {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void initialize(PlatformImpl plugin);
|
||||
|
||||
BukkitAddon getNMSAddon(PlatformImpl plugin);
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.dfsek.terra.bukkit.world;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
|
||||
public record BukkitBiomeInfo(NamespacedKey biomeKey) implements Properties {}
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.nms.Initializer;
|
||||
|
||||
|
||||
public class NMSInitializer implements Initializer {
|
||||
@Override
|
||||
public void initialize(PlatformImpl platform) {
|
||||
AwfulBukkitHacks.registerBiomes(platform.getRawConfigRegistry());
|
||||
Bukkit.getPluginManager().registerEvents(new NMSInjectListener(), platform.getPlugin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BukkitAddon getNMSAddon(PlatformImpl plugin) {
|
||||
return new NMSAddon(plugin);
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
+17
-6
@@ -1,6 +1,8 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_3.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.VanillaBiomeProperties;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitBiomeInfo;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Holder.Reference;
|
||||
@@ -12,6 +14,7 @@ import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.slf4j.Logger;
|
||||
@@ -22,6 +25,7 @@ import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -46,6 +50,7 @@ public class AwfulBukkitHacks {
|
||||
configRegistry.forEach(pack -> pack.getRegistry(com.dfsek.terra.api.world.biome.Biome.class).forEach((key, biome) -> {
|
||||
try {
|
||||
BukkitPlatformBiome platformBiome = (BukkitPlatformBiome) biome.getPlatformBiome();
|
||||
|
||||
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
|
||||
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
|
||||
vanillaBukkitKey.getKey());
|
||||
@@ -54,16 +59,22 @@ public class AwfulBukkitHacks {
|
||||
|
||||
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(), vanillaBiomeProperties);
|
||||
|
||||
ResourceKey<Biome> delegateKey = ResourceKey.create(
|
||||
Registries.BIOME,
|
||||
ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key))
|
||||
);
|
||||
ResourceLocation delegateMinecraftKey = ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key));
|
||||
NamespacedKey delegateBukkitKey = NamespacedKey.fromString(delegateMinecraftKey.toString());
|
||||
ResourceKey<Biome> delegateKey = ResourceKey.create(Registries.BIOME, delegateMinecraftKey);
|
||||
|
||||
Reference<Biome> holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN);
|
||||
Reflection.REFERENCE.invokeBindValue(holder, platform); // IMPORTANT: bind holder.
|
||||
|
||||
platformBiome.getContext().put(new BukkitBiomeInfo(delegateBukkitKey));
|
||||
platformBiome.getContext().put(new NMSBiomeInfo(delegateKey));
|
||||
|
||||
Map<ResourceKey<Biome>, ResourceKey<VillagerType>> villagerMap = Reflection.VILLAGER_TYPE.getByBiome();
|
||||
|
||||
villagerMap.put(delegateKey,
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
|
||||
villagerMap.getOrDefault(delegateKey, VillagerType.PLAINS)));
|
||||
|
||||
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
|
||||
|
||||
LOGGER.debug("Registered biome: " + delegateKey);
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
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_8.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class NMSAddon extends BukkitAddon {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
+4
-5
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
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_8.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
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.Holder;
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class NMSChunkGeneratorDelegate extends ChunkGenerator {
|
||||
BlockState[] array = new BlockState[world.getHeight()];
|
||||
WorldProperties properties = new NMSWorldProperties(seed, world);
|
||||
BiomeProvider biomeProvider = pack.getBiomeProvider();
|
||||
for(int y = properties.getMaxHeight() - 1; y >= properties.getMinHeight(); y--) {
|
||||
for(int y = properties.getMaxHeight(); y >= properties.getMinHeight(); y--) {
|
||||
array[y - properties.getMinHeight()] = ((CraftBlockData) delegate.getBlock(properties, x, y, z, biomeProvider)
|
||||
.getHandle()).getState();
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import com.dfsek.tectonic.api.TypeRegistry;
|
||||
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.addon.InternalAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.BiomeAdditionsSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.BiomeMoodSoundTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.BiomeParticleConfigTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.EntityTypeTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.MusicSoundTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.SoundEventTemplate;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.SpawnCostConfig;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.SpawnEntryConfig;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.SpawnSettingsTemplate;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.SpawnTypeConfig;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_8.config.VillagerTypeTemplate;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
import net.minecraft.world.level.biome.Biome.Precipitation;
|
||||
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
public class NMSPlatform extends PlatformImpl {
|
||||
|
||||
public NMSPlatform(TerraBukkitPlugin plugin) {
|
||||
super(plugin);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new NMSInjectListener(), plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(TypeRegistry registry) {
|
||||
super.register(registry);
|
||||
registry.registerLoader(PlatformBiome.class, (type, o, loader, depthTracker) -> parseBiome((String) o, depthTracker))
|
||||
.registerLoader(ResourceLocation.class, (type, o, loader, depthTracker) -> {
|
||||
ResourceLocation identifier = ResourceLocation.tryParse((String) o);
|
||||
if(identifier == null)
|
||||
throw new LoadException("Invalid identifier: " + o, depthTracker);
|
||||
return identifier;
|
||||
})
|
||||
.registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(GrassColorModifier.class,
|
||||
(type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(GrassColorModifier.class,
|
||||
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase(
|
||||
Locale.ROOT)))
|
||||
.registerLoader(MobCategory.class, (type, o, loader, depthTracker) -> MobCategory.valueOf((String) o))
|
||||
.registerLoader(AmbientParticleSettings.class, BiomeParticleConfigTemplate::new)
|
||||
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
|
||||
.registerLoader(AmbientMoodSettings.class, BiomeMoodSoundTemplate::new)
|
||||
.registerLoader(AmbientAdditionsSettings.class, BiomeAdditionsSoundTemplate::new)
|
||||
.registerLoader(Music.class, MusicSoundTemplate::new)
|
||||
.registerLoader(EntityType.class, EntityTypeTemplate::new)
|
||||
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
|
||||
.registerLoader(SpawnEntryConfig.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
||||
.registerLoader(MobSpawnSettings.class, SpawnSettingsTemplate::new)
|
||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InternalAddon load() {
|
||||
InternalAddon internalAddon = super.load();
|
||||
|
||||
this.getEventManager().getHandler(FunctionalEventHandler.class)
|
||||
.register(internalAddon, PlatformInitializationEvent.class)
|
||||
.priority(1)
|
||||
.then(event -> AwfulBukkitHacks.registerBiomes(this.getRawConfigRegistry()))
|
||||
.global();
|
||||
|
||||
return internalAddon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<BaseAddon> platformAddon() {
|
||||
return List.of(new NMSAddon(this));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
||||
+11
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Holder.Reference;
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
@@ -36,6 +37,7 @@ public class Reflection {
|
||||
public static final HolderReferenceProxy HOLDER_REFERENCE;
|
||||
public static final HolderSetNamedProxy HOLDER_SET;
|
||||
public static final BiomeProxy BIOME;
|
||||
public static final VillagerTypeProxy VILLAGER_TYPE;
|
||||
|
||||
static {
|
||||
ReflectionRemapper reflectionRemapper = ReflectionRemapper.forReobfMappingsInPaperJar();
|
||||
@@ -50,6 +52,7 @@ public class Reflection {
|
||||
HOLDER_REFERENCE = reflectionProxyFactory.reflectionProxy(HolderReferenceProxy.class);
|
||||
HOLDER_SET = reflectionProxyFactory.reflectionProxy(HolderSetNamedProxy.class);
|
||||
BIOME = reflectionProxyFactory.reflectionProxy(BiomeProxy.class);
|
||||
VILLAGER_TYPE = reflectionProxyFactory.reflectionProxy(VillagerTypeProxy.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,4 +124,11 @@ public class Reflection {
|
||||
@MethodName("getGrassColorFromTexture")
|
||||
int invokeGrassColorFromTexture(Biome instance);
|
||||
}
|
||||
|
||||
@Proxies(VillagerType.class)
|
||||
public interface VillagerTypeProxy {
|
||||
@Static
|
||||
@FieldGetter("BY_BIOME")
|
||||
Map<ResourceKey<Biome>, ResourceKey<VillagerType>> getByBiome();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+8
-5
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
@@ -6,10 +6,12 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.commands.arguments.ParticleArgument;
|
||||
import net.minecraft.core.HolderLookup.Provider;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticleSettings> {
|
||||
@Value("particle")
|
||||
@@ -18,17 +20,18 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
|
||||
|
||||
@Value("probability")
|
||||
@Default
|
||||
private Integer probability = null;
|
||||
private Float probability = 0.1f;
|
||||
|
||||
@Override
|
||||
public AmbientParticleSettings get() {
|
||||
if(particle == null || probability == null) {
|
||||
if(particle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
return new AmbientParticleSettings(ParticleArgument.readParticle(new StringReader(particle),
|
||||
(Provider) BuiltInRegistries.PARTICLE_TYPE.asHolderIdMap()), probability);
|
||||
HolderLookup.Provider.create(Stream.of(BuiltInRegistries.PARTICLE_TYPE))), probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
+12
-4
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.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 getSpawnEntry() {
|
||||
return new SpawnerData(type, minGroupSize, maxGroupSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnerData get() {
|
||||
return new SpawnerData(type, weight, minGroupSize, maxGroupSize);
|
||||
public SpawnEntryConfig get() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.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.getSpawnEntry());
|
||||
}
|
||||
}
|
||||
for(SpawnCostConfig cost : costs) {
|
||||
+3
-4
@@ -1,11 +1,10 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.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;
|
||||
}
|
||||
|
||||
+20
-3
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
@@ -6,6 +6,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
|
||||
import com.dfsek.terra.api.properties.Properties;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.sounds.Music;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
@@ -38,6 +39,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,13 +87,17 @@ 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;
|
||||
|
||||
@Value("villager-type")
|
||||
@Default
|
||||
private VillagerType villagerType = null;
|
||||
private ResourceKey<VillagerType> villagerType = null;
|
||||
|
||||
public Integer getFogColor() {
|
||||
return fogColor;
|
||||
@@ -98,6 +107,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return foliageColor;
|
||||
}
|
||||
|
||||
public Integer getDryFoliageColor() {
|
||||
return dryFoliageColor;
|
||||
}
|
||||
|
||||
public Integer getGrassColor() {
|
||||
return grassColor;
|
||||
}
|
||||
@@ -154,11 +167,15 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return music;
|
||||
}
|
||||
|
||||
public Float getMusicVolume() {
|
||||
return musicVolume;
|
||||
}
|
||||
|
||||
public MobSpawnSettings getSpawnSettings() {
|
||||
return spawnSettings;
|
||||
}
|
||||
|
||||
public VillagerType getVillagerType() {
|
||||
public ResourceKey<VillagerType> getVillagerType() {
|
||||
return villagerType;
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -1,20 +1,21 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_3.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_8.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 net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.npc.VillagerType;
|
||||
|
||||
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
|
||||
public class VillagerTypeTemplate implements ObjectTemplate<ResourceKey<VillagerType>> {
|
||||
@Value("id")
|
||||
@Default
|
||||
private ResourceLocation id = null;
|
||||
|
||||
@Override
|
||||
public VillagerType get() {
|
||||
return BuiltInRegistries.VILLAGER_TYPE.get(id).orElseThrow().value();
|
||||
public ResourceKey<VillagerType> get() {
|
||||
return ResourceKey.create(BuiltInRegistries.VILLAGER_TYPE.key(), id);
|
||||
}
|
||||
}
|
||||
@@ -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.7",
|
||||
"fabric": "*"
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public final class MinestomPlatform extends AbstractPlatform {
|
||||
if(world.generator() instanceof MinestomChunkGeneratorWrapper wrapper) {
|
||||
getConfigRegistry().get(wrapper.getPack().getRegistryKey()).ifPresent(pack -> {
|
||||
wrapper.setPack(pack);
|
||||
LOGGER.info("Replaced pack in chunk generator for instance {}", world.getUniqueId());
|
||||
LOGGER.info("Replaced pack in chunk generator for instance {}", world.getUuid());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -7,9 +7,9 @@ import com.dfsek.tectonic.api.loader.type.TypeLoader;
|
||||
|
||||
import com.dfsek.terra.api.world.biome.PlatformBiome;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
import net.minestom.server.world.biome.Biome;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MinestomBiomeLoader implements TypeLoader<PlatformBiome> {
|
||||
public PlatformBiome load(@NotNull AnnotatedType annotatedType, @NotNull Object o, @NotNull ConfigLoader configLoader,
|
||||
DepthTracker depthTracker) throws LoadException {
|
||||
String id = (String) o;
|
||||
NamespaceID biomeID = NamespaceID.from(id);
|
||||
Key biomeID = Key.key(id);
|
||||
Biome biome = biomeRegistry.get(biomeID);
|
||||
if(biome == null) throw new LoadException("Biome %s does not exist in registry".formatted(id), depthTracker);
|
||||
return new MinestomBiome(biome);
|
||||
|
||||
+7
-1
@@ -4,11 +4,17 @@ import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.minestom.api.BlockEntityFactory;
|
||||
|
||||
import net.minestom.server.coordinate.BlockVec;
|
||||
import net.minestom.server.instance.Instance;
|
||||
|
||||
|
||||
public class DefaultBlockEntityFactory implements BlockEntityFactory {
|
||||
private final Instance instance;
|
||||
public DefaultBlockEntityFactory(Instance instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockVec position) {
|
||||
return null;
|
||||
return new MinestomBlockEntity(instance, position);
|
||||
}
|
||||
}
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.dfsek.terra.minestom.block;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import net.minestom.server.coordinate.BlockVec;
|
||||
import net.minestom.server.instance.Instance;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
|
||||
public class MinestomBlockEntity implements BlockEntity {
|
||||
private final Instance instance;
|
||||
private final BlockVec position;
|
||||
private final Vector3 positionVec;
|
||||
|
||||
public MinestomBlockEntity(Instance instance, BlockVec position) {
|
||||
this.instance = instance;
|
||||
this.position = position;
|
||||
this.positionVec = Vector3.of(position.blockX(), position.blockY(), position.blockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(boolean applyPhysics) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3 getPosition() {
|
||||
return positionVec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return position.blockX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
return position.blockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return position.blockZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState() {
|
||||
return new MinestomBlockState(instance.getBlock(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getHandle() {
|
||||
return instance.getBlock(position);
|
||||
}
|
||||
}
|
||||
+9
-24
@@ -1,15 +1,14 @@
|
||||
package com.dfsek.terra.minestom.block;
|
||||
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockType;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.block.state.properties.Property;
|
||||
|
||||
import net.minestom.server.instance.block.Block;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class MinestomBlockState implements BlockState {
|
||||
private final Block block;
|
||||
@@ -23,24 +22,10 @@ public class MinestomBlockState implements BlockState {
|
||||
}
|
||||
|
||||
public MinestomBlockState(String data) {
|
||||
if(!data.contains("[")) {
|
||||
block = Block.fromNamespaceId(data);
|
||||
return;
|
||||
block = Block.fromState(data);
|
||||
if (block == null) {
|
||||
throw new IllegalArgumentException("Invalid block state: " + data);
|
||||
}
|
||||
|
||||
String[] split = data.split("\\[");
|
||||
String namespaceId = split[0];
|
||||
String properties = split[1].substring(0, split[1].length() - 1);
|
||||
Block block = Block.fromNamespaceId(namespaceId);
|
||||
HashMap<String, String> propertiesMap = new HashMap<>();
|
||||
|
||||
for(String property : properties.split(",")) {
|
||||
String[] kv = property.split("=");
|
||||
propertiesMap.put(kv[0].strip(), kv[1].strip());
|
||||
}
|
||||
|
||||
assert block != null;
|
||||
this.block = block.withProperties(propertiesMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +55,7 @@ public class MinestomBlockState implements BlockState {
|
||||
|
||||
@Override
|
||||
public String getAsString(boolean properties) {
|
||||
String name = block.namespace().asString();
|
||||
String name = block.key().asString();
|
||||
if(!properties || block.properties().isEmpty()) {
|
||||
return name;
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ public class MinestomEntityType implements com.dfsek.terra.api.entity.EntityType
|
||||
private final EntityType delegate;
|
||||
|
||||
public MinestomEntityType(String id) {
|
||||
delegate = EntityType.fromNamespaceId(id);
|
||||
delegate = EntityType.fromKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+15
-15
@@ -5,47 +5,47 @@ import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.item.Material;
|
||||
import net.minestom.server.utils.NamespaceID;
|
||||
|
||||
import java.util.Objects;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.registry.RegistryKey;
|
||||
|
||||
|
||||
public class MinestomEnchantment implements Enchantment {
|
||||
private final net.minestom.server.item.enchant.Enchantment delegate;
|
||||
private final String id;
|
||||
private final net.minestom.server.item.enchant.Enchantment registryItem;
|
||||
private final RegistryKey<net.minestom.server.item.enchant.Enchantment> id;
|
||||
private static final DynamicRegistry<net.minestom.server.item.enchant.Enchantment> enchantmentRegistry =
|
||||
MinecraftServer.getEnchantmentRegistry();
|
||||
|
||||
public MinestomEnchantment(net.minestom.server.item.enchant.Enchantment delegate) {
|
||||
this.delegate = delegate;
|
||||
id = Objects.requireNonNull(delegate.registry()).raw();
|
||||
public MinestomEnchantment(RegistryKey<net.minestom.server.item.enchant.Enchantment> id) {
|
||||
this.id = id;
|
||||
this.registryItem = enchantmentRegistry.get(id);
|
||||
}
|
||||
|
||||
public MinestomEnchantment(String id) {
|
||||
this.delegate = MinecraftServer.getEnchantmentRegistry().get(NamespaceID.from(id));
|
||||
this.id = id;
|
||||
this(RegistryKey.unsafeOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEnchantItem(ItemStack itemStack) {
|
||||
return delegate.supportedItems().contains((Material) itemStack.getType().getHandle());
|
||||
return registryItem.supportedItems().contains((Material) itemStack.getType().getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean conflictsWith(Enchantment other) {
|
||||
return delegate.exclusiveSet().contains(NamespaceID.from(((MinestomEnchantment) other).id));
|
||||
return registryItem.exclusiveSet().contains(((MinestomEnchantment) other).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return id;
|
||||
return id.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLevel() {
|
||||
return delegate.maxLevel();
|
||||
return registryItem.maxLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minestom.server.item.enchant.Enchantment getHandle() {
|
||||
return delegate;
|
||||
return registryItem;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,6 +23,6 @@ public class MinestomItemHandle implements ItemHandle {
|
||||
|
||||
@Override
|
||||
public Set<Enchantment> getEnchantments() {
|
||||
return MinecraftServer.getEnchantmentRegistry().values().stream().map(MinestomEnchantment::new).collect(Collectors.toSet());
|
||||
return MinecraftServer.getEnchantmentRegistry().keys().stream().map(MinestomEnchantment::new).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -6,11 +6,11 @@ import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.item.ItemComponent;
|
||||
import net.minestom.server.component.DataComponents;
|
||||
import net.minestom.server.item.ItemStack;
|
||||
import net.minestom.server.item.component.EnchantmentList;
|
||||
import net.minestom.server.registry.DynamicRegistry;
|
||||
import net.minestom.server.registry.DynamicRegistry.Key;
|
||||
import net.minestom.server.registry.RegistryKey;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -47,11 +47,10 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
@Override
|
||||
public ItemMeta getItemMeta() {
|
||||
HashMap<Enchantment, Integer> enchantments = new HashMap<>();
|
||||
EnchantmentList enchantmentList = base.get(ItemComponent.ENCHANTMENTS);
|
||||
EnchantmentList enchantmentList = base.get(DataComponents.ENCHANTMENTS);
|
||||
if(enchantmentList != null) {
|
||||
enchantmentList.enchantments().forEach((enchantmentKey, integer) -> {
|
||||
enchantments.put(
|
||||
new MinestomEnchantment(Objects.requireNonNull(MinecraftServer.getEnchantmentRegistry().get(enchantmentKey))), integer);
|
||||
enchantments.put(new MinestomEnchantment(enchantmentKey), integer);
|
||||
});
|
||||
}
|
||||
return new MinestomItemMeta(enchantments);
|
||||
@@ -59,7 +58,7 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
|
||||
@Override
|
||||
public void setItemMeta(ItemMeta meta) {
|
||||
HashMap<Key<net.minestom.server.item.enchant.Enchantment>, Integer> enchantments = new HashMap<>();
|
||||
HashMap<RegistryKey<net.minestom.server.item.enchant.Enchantment>, Integer> enchantments = new HashMap<>();
|
||||
DynamicRegistry<net.minestom.server.item.enchant.Enchantment> registry = MinecraftServer.getEnchantmentRegistry();
|
||||
meta.getEnchantments().forEach((key, value) -> {
|
||||
MinestomEnchantment enchantment = (MinestomEnchantment) key;
|
||||
@@ -67,6 +66,6 @@ public class MinestomItemStack implements com.dfsek.terra.api.inventory.ItemStac
|
||||
});
|
||||
|
||||
EnchantmentList list = new EnchantmentList(enchantments);
|
||||
base = base.with(ItemComponent.ENCHANTMENTS, list);
|
||||
base = base.with(DataComponents.ENCHANTMENTS, list);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class MinestomMaterial implements Item {
|
||||
}
|
||||
|
||||
public MinestomMaterial(String id) {
|
||||
this.delegate = Material.fromNamespaceId(id);
|
||||
this.delegate = Material.fromKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-2
@@ -22,9 +22,12 @@ public class TerraMinestomWorldBuilder {
|
||||
private ConfigPack pack;
|
||||
private long seed = new Random().nextLong();
|
||||
private EntityFactory entityFactory = new DefaultEntityFactory();
|
||||
private BlockEntityFactory blockEntityFactory = new DefaultBlockEntityFactory();
|
||||
private BlockEntityFactory blockEntityFactory;
|
||||
|
||||
private TerraMinestomWorldBuilder(Instance instance) { this.instance = instance; }
|
||||
private TerraMinestomWorldBuilder(Instance instance) {
|
||||
this.instance = instance;
|
||||
this.blockEntityFactory = new DefaultBlockEntityFactory(instance);
|
||||
}
|
||||
|
||||
public static TerraMinestomWorldBuilder from(Instance instance) {
|
||||
return new TerraMinestomWorldBuilder(instance);
|
||||
|
||||
@@ -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(SpawnEntryConfig.class, SpawnEntryConfig::new)
|
||||
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
||||
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
|
||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||
|
||||
+6
-4
@@ -10,6 +10,8 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.world.biome.BiomeParticleConfig;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticleConfig> {
|
||||
@Value("particle")
|
||||
@@ -18,19 +20,19 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeParticle
|
||||
|
||||
@Value("probability")
|
||||
@Default
|
||||
private Integer probability = null;
|
||||
private Float probability = 0.1f;
|
||||
|
||||
@Override
|
||||
public BiomeParticleConfig get() {
|
||||
if(particle == null || probability == null) {
|
||||
if(particle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return new BiomeParticleConfig(
|
||||
ParticleEffectArgumentType.readParameters(new StringReader(particle),
|
||||
(RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE),
|
||||
probability);
|
||||
RegistryWrapper.WrapperLookup.of(Stream.of(Registries.PARTICLE_TYPE))),
|
||||
probability);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
+11
-3
@@ -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<SpawnEntryConfig> {
|
||||
@Value("type")
|
||||
@Default
|
||||
private EntityType<?> type = null;
|
||||
@@ -24,8 +24,16 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
|
||||
@Default
|
||||
private Integer maxGroupSize = null;
|
||||
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public SpawnEntry getSpawnEntry() {
|
||||
return new SpawnEntry(type, minGroupSize, maxGroupSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpawnEntry get() {
|
||||
return new SpawnEntry(type, weight, minGroupSize, maxGroupSize);
|
||||
public SpawnEntryConfig get() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -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.getEntries()) {
|
||||
builder.spawn(group, entry.getWeight(), entry.getSpawnEntry());
|
||||
}
|
||||
}
|
||||
for(SpawnCostConfig cost : costs) {
|
||||
|
||||
+3
-4
@@ -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,14 +15,14 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
|
||||
|
||||
@Value("entries")
|
||||
@Default
|
||||
private List<SpawnEntry> entry = null;
|
||||
private List<SpawnEntryConfig> entries = null;
|
||||
|
||||
public SpawnGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public List<SpawnEntry> getEntry() {
|
||||
return entry;
|
||||
public List<SpawnEntryConfig> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+20
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -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;
|
||||
|
||||
@Override
|
||||
public VillagerType get() {
|
||||
return Registries.VILLAGER_TYPE.getEntry(id).orElseThrow().value();
|
||||
public RegistryKey<VillagerType> get() {
|
||||
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, id);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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!");
|
||||
}
|
||||
}
|
||||
|
||||
-28
@@ -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.
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:snowy_taiga"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:old_growth_pine_taiga"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:old_growth_spruce_taiga"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:taiga"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:is_jungle"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:grove"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:is_savanna"
|
||||
]
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:is_badlands"
|
||||
]
|
||||
}
|
||||
+6
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user