From a3eefc762376cc364604c2860d477381af4aa9f3 Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 18 Aug 2025 21:14:45 +0100 Subject: [PATCH 01/12] Init on modded adapters --- .gitignore | 2 + build.gradle.kts | 2 +- buildSrc/build.gradle.kts | 7 +- .../adapters.modded-conventions.gradle.kts | 62 +++++++++++ buildSrc/src/main/kotlin/extensions.kt | 102 ++++++++++++++++++ gradle.properties | 3 +- gradle/wrapper/gradle-wrapper.properties | 2 +- modded/v1_21_5/common/build.gradle.kts | 42 ++++++++ .../modded/v1_21_5/WorldAdapter_v1_21_5.java | 86 +++++++++++++++ modded/v1_21_5/fabric/build.gradle.kts | 62 +++++++++++ .../fabric/v1_21_5/Fabric_v1_21_5.java | 37 +++++++ .../fabric/src/main/resources/fabric.mod.json | 25 +++++ modded/v1_21_5/neoforge/build.gradle.kts | 51 +++++++++ modded/v1_21_5/neoforge/gradle.properties | 1 + .../neoforge/v1_21_5/NeoForge_v1_21_5.java | 41 +++++++ .../resources/META-INF/neoforge.mods.toml | 31 ++++++ settings.gradle.kts | 7 ++ spigot/all/build.gradle.kts | 2 +- spigot/v1_21_R3/build.gradle.kts | 2 +- 19 files changed, 561 insertions(+), 6 deletions(-) create mode 100644 buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts create mode 100644 buildSrc/src/main/kotlin/extensions.kt create mode 100644 modded/v1_21_5/common/build.gradle.kts create mode 100644 modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java create mode 100644 modded/v1_21_5/fabric/build.gradle.kts create mode 100644 modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java create mode 100644 modded/v1_21_5/fabric/src/main/resources/fabric.mod.json create mode 100644 modded/v1_21_5/neoforge/build.gradle.kts create mode 100644 modded/v1_21_5/neoforge/gradle.properties create mode 100644 modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java create mode 100644 modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml diff --git a/.gitignore b/.gitignore index a279c6e..fe55dfc 100644 --- a/.gitignore +++ b/.gitignore @@ -272,3 +272,5 @@ gradle-app.setting # End of https://www.toptal.com/developers/gitignore/api/git,java,maven,eclipse,netbeans,jetbrains+all,visualstudiocode,gradle .paper-nms *.iml +run/ +.idea/runConfigurations/ diff --git a/build.gradle.kts b/build.gradle.kts index e345d53..0528389 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ allprojects { group = "org.geysermc.geyser.adapters" - version = "1.16-SNAPSHOT" + version = "1.17-SNAPSHOT" description = "Adapters for Geyser" } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 6f20bd1..26cd0af 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -3,10 +3,15 @@ plugins { } dependencies { - implementation("io.papermc.paperweight:paperweight-userdev:1.7.7") + implementation("io.papermc.paperweight:paperweight-userdev:2.0.0-beta.18") implementation("com.github.johnrengelman", "shadow", "8.1.1") + implementation("architectury-plugin:architectury-plugin.gradle.plugin:3.4-SNAPSHOT") + implementation("dev.architectury:architectury-loom:1.10-SNAPSHOT") } repositories { gradlePluginPortal() + maven("https://maven.fabricmc.net/") + maven("https://maven.architectury.dev/") + maven("https://maven.neoforged.net/releases/") } diff --git a/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts b/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts new file mode 100644 index 0000000..2068f6a --- /dev/null +++ b/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.publish-conventions") + id("architectury-plugin") + id("dev.architectury.loom") +} + +configurations { + create("shadowCommon") { + isCanBeResolved = true + isCanBeConsumed = false + isCanBeDeclared = true + isTransitive = false + } +} + +loom { + silentMojangMappingsLicense() +} + +tasks.compileJava { + options.encoding = "UTF-8" +} + +tasks.shadowJar { + configurations = listOf(project.configurations.getByName("shadowCommon")) + archiveClassifier = "dev-shadow" +} + +tasks.remapJar { + injectAccessWidener = true + dependsOn(tasks.shadowJar) +} + +repositories { + maven("https://maven.fabricmc.net/") + maven("https://maven.neoforged.net/releases/") +} diff --git a/buildSrc/src/main/kotlin/extensions.kt b/buildSrc/src/main/kotlin/extensions.kt new file mode 100644 index 0000000..2bbb13c --- /dev/null +++ b/buildSrc/src/main/kotlin/extensions.kt @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +import gradle.kotlin.dsl.accessors._3f80d1312ff9f42b2eab22e9378c2e48.* +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.expand +import org.gradle.kotlin.dsl.withType +import org.gradle.language.jvm.tasks.ProcessResources + +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +fun Project.minecraftVersion(version: String): Map { + return this.minecraftVersion(version, HashMap()) +} + +fun Project.minecraftVersion(version: String, bonusData: Map): Map { + val metaProperties = HashMap() + metaProperties["id"] = "geyser_modded_adapters_${version.replace('.', '_')}" + metaProperties["version"] = version + + val fabricLoaderVersion = "0.17.2" + + dependencies { + minecraft("com.mojang:minecraft:$version") + mappings(loom.officialMojangMappings()) + modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion") + } + + architectury { + minecraft = version + platformSetupLoomIde() + } + + tasks { + withType { + filesMatching(listOf("fabric.mod.json", "neoforge.mods.toml")) { + expand( + "id" to metaProperties["id"], + "minecraft-version" to metaProperties["version"], + "version" to version, + "name" to "Geyser Mod Adapter", + "description" to "An adapter to access version-specific data in modded versions of Minecraft.", + "author" to "GeyserMC", + "website" to "https://geysermc.org", + "license" to "MIT" + ) + + bonusData.forEach { entry -> + expand(entry.key, entry.value) + } + } + } + } + + return metaProperties +} diff --git a/gradle.properties b/gradle.properties index 102c41c..feea0d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ org.gradle.caching=true org.gradle.configureondemand=true -org.gradle.parallel=true \ No newline at end of file +org.gradle.parallel=true +org.gradle.jvmargs=-Xmx1024m \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3499ded..3c44eb1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/modded/v1_21_5/common/build.gradle.kts b/modded/v1_21_5/common/build.gradle.kts new file mode 100644 index 0000000..c65fded --- /dev/null +++ b/modded/v1_21_5/common/build.gradle.kts @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +minecraftVersion("1.21.5") + +dependencies { + implementation(project(":common")) +} diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java new file mode 100644 index 0000000..73a9292 --- /dev/null +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_5; + +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import org.geysermc.geyser.adapters.WorldAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + +public class WorldAdapter_v1_21_5 extends WorldAdapter { + public static MinecraftServer server = null; + + @Override + public int getBlockAt(ServerLevel world, int x, int y, int z) { + if (y < world.getMinY()) { + return 0; + } + + BlockState blockState = world.getBlockState(new BlockPos(x, y, z)); + + return Block.getId(blockState); + } + + @Override + public IntList getAllBlockStates() { + IntList blockStates = new IntArrayList(); + for (BlockState block : Block.BLOCK_STATE_REGISTRY) { + blockStates.add(Block.getId(block)); + } + return blockStates; + } + + @Override + public String[] getBiomeSuggestions(boolean tags) { + if (server == null) return new String[]{}; + + Registry registry = server.registryAccess() + .lookupOrThrow(Registries.BIOME); + if (!tags) { + return getBiomes(registry).toArray(String[]::new); + } + + List keys = new ArrayList<>(registry.getTags().map(tag -> "#" + tag.key().location()).toList()); + keys.addAll(getBiomes(registry).toList()); + return keys.toArray(new String[0]); + } + + private Stream getBiomes(Registry registry) { + return registry.keySet().stream().map(ResourceLocation::toString); + } +} diff --git a/modded/v1_21_5/fabric/build.gradle.kts b/modded/v1_21_5/fabric/build.gradle.kts new file mode 100644 index 0000000..61b89d7 --- /dev/null +++ b/modded/v1_21_5/fabric/build.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val metaProperties = minecraftVersion("1.21.5") + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + fabric() +} + +dependencies { + modApi("net.fabricmc.fabric-api:fabric-api:0.128.2+1.21.5") + + api(project(path = ":modded_common_v1_21_7", configuration = "namedElements")) + shadowCommon(project(path = ":modded_common_v1_21_7", configuration = "transformProductionFabric")) +} + +tasks { + withType { + filesMatching("fabric.mod.json") { + expand( + "id" to metaProperties["id"], + "minecraft-version" to metaProperties["version"], + "version" to version + ) + } + } +} diff --git a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java new file mode 100644 index 0000000..4d7e7f2 --- /dev/null +++ b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.fabric.v1_21_5; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; + +public class Fabric_v1_21_5 implements ModInitializer { + @Override + public void onInitialize() { + ServerLifecycleEvents.SERVER_STARTING.register(server -> WorldAdapter_v1_21_5.server = server); + } +} diff --git a/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json b/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..9331708 --- /dev/null +++ b/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,25 @@ +{ + "schemaVersion": 1, + "id": "${id}", + "version": "${version}", + "name": "${name}", + "description": "${description}", + "authors": ["${author}"], + "contact": { + "website": "${website}", + "repo": "https://github.com/GeyserMC/geyser-adapters" + }, + "license": "${license}", + "icon": "assets/geyser/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "org.geysermc.geyser.adapters.fabric.v1_21_5.Fabric_v1_21_5" + ] + }, + "depends": { + "fabricloader": ">=0.16.7", + "fabric-api": "*", + "minecraft": ">=${minecraft_version}" + } +} \ No newline at end of file diff --git a/modded/v1_21_5/neoforge/build.gradle.kts b/modded/v1_21_5/neoforge/build.gradle.kts new file mode 100644 index 0000000..ff31949 --- /dev/null +++ b/modded/v1_21_5/neoforge/build.gradle.kts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val neoVersion = "21.5.91" +val metaProperties = minecraftVersion("1.21.5", mapOf("neoVersion" to neoVersion)) + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +dependencies { + neoForge("net.neoforged:neoforge:$neoVersion") + + api(project(":modded_common_v1_21_7", configuration = "namedElements")) + shadowCommon(project(":modded_common_v1_21_7", configuration = "transformProductionNeoForge")) +} diff --git a/modded/v1_21_5/neoforge/gradle.properties b/modded/v1_21_5/neoforge/gradle.properties new file mode 100644 index 0000000..2914393 --- /dev/null +++ b/modded/v1_21_5/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge \ No newline at end of file diff --git a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java new file mode 100644 index 0000000..c44224c --- /dev/null +++ b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.neoforge.v1_21_5; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; + +@Mod("geyser_modded_adapters_1_21_5") +public class NeoForge_v1_21_5 { + public NeoForge_v1_21_5(IEventBus bus, ModContainer modContainer) { + bus.addListener(ServerStartingEvent.class, event -> { + WorldAdapter_v1_21_5.server = event.getServer(); + }); + } +} diff --git a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..d8e3acc --- /dev/null +++ b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,31 @@ +modLoader="javafml" +loaderVersion="[1,)" +license="${license}" + +[[mods]] +modId="${id}" +version="${version}" +displayName="${name}" +displayURL="${website}" +authors="${author}" +description='''${description}''' + +#[[mixins]] +#config="${id}.mixins.json" + +#[[accessTransformers]] +#file="META-INF/accesstransformer.cfg" + +[[dependencies.${id}]] +modId="neoforge" +type="required" +versionRange="[${neo_version},)" +ordering="NONE" +side="BOTH" + +[[dependencies.${mod_id}]] +modId="minecraft" +type="required" +versionRange="[${minecraft_version},)" +ordering="NONE" +side="BOTH" diff --git a/settings.gradle.kts b/settings.gradle.kts index 123fa3f..e1d5baa 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,3 +26,10 @@ include(":paper:all") include(":paper:base") include(":paper:v766") include(":paper:v768") + +// For whatever reason, the name cannot be ":modded:v1_21_7:common", the fabric and neoforge modules won't +// be able to find the module, but if the name is unique like this, it's fine +include(":modded_common_v1_21_7") +project(":modded_common_v1_21_7").projectDir = file("modded/v1_21_7/common") +include(":modded:v1_21_7:fabric") +include(":modded:v1_21_7:neoforge") diff --git a/spigot/all/build.gradle.kts b/spigot/all/build.gradle.kts index 41d7a50..4ff09fe 100644 --- a/spigot/all/build.gradle.kts +++ b/spigot/all/build.gradle.kts @@ -9,7 +9,7 @@ val shadowOnly: Configuration by configurations.creating dependencies { // target the reobf configuration otherwise we get the mapped classes - fun adapter(version: String) = shadowOnly(project(":spigot:v$version", "reobf")) + fun adapter(version: String) = shadowOnly(project(":spigot:v$version")) api(projects.spigot.base) adapter("1_17_R1") diff --git a/spigot/v1_21_R3/build.gradle.kts b/spigot/v1_21_R3/build.gradle.kts index 23f707e..b7295ef 100644 --- a/spigot/v1_21_R3/build.gradle.kts +++ b/spigot/v1_21_R3/build.gradle.kts @@ -13,5 +13,5 @@ java { dependencies { implementation(projects.spigot.base) - paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT") + paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.4-R0.1-SNAPSHOT") } From 1beb4213f694ef75e98edf56062bfb1bf1b5881f Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 18 Aug 2025 21:16:40 +0100 Subject: [PATCH 02/12] Have the correct module name --- modded/v1_21_5/fabric/build.gradle.kts | 4 ++-- modded/v1_21_5/neoforge/build.gradle.kts | 4 ++-- settings.gradle.kts | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modded/v1_21_5/fabric/build.gradle.kts b/modded/v1_21_5/fabric/build.gradle.kts index 61b89d7..95aacd0 100644 --- a/modded/v1_21_5/fabric/build.gradle.kts +++ b/modded/v1_21_5/fabric/build.gradle.kts @@ -45,8 +45,8 @@ architectury { dependencies { modApi("net.fabricmc.fabric-api:fabric-api:0.128.2+1.21.5") - api(project(path = ":modded_common_v1_21_7", configuration = "namedElements")) - shadowCommon(project(path = ":modded_common_v1_21_7", configuration = "transformProductionFabric")) + api(project(path = ":modded_common_v1_21_5", configuration = "namedElements")) + shadowCommon(project(path = ":modded_common_v1_21_5", configuration = "transformProductionFabric")) } tasks { diff --git a/modded/v1_21_5/neoforge/build.gradle.kts b/modded/v1_21_5/neoforge/build.gradle.kts index ff31949..a717768 100644 --- a/modded/v1_21_5/neoforge/build.gradle.kts +++ b/modded/v1_21_5/neoforge/build.gradle.kts @@ -46,6 +46,6 @@ architectury { dependencies { neoForge("net.neoforged:neoforge:$neoVersion") - api(project(":modded_common_v1_21_7", configuration = "namedElements")) - shadowCommon(project(":modded_common_v1_21_7", configuration = "transformProductionNeoForge")) + api(project(":modded_common_v1_21_5", configuration = "namedElements")) + shadowCommon(project(":modded_common_v1_21_5", configuration = "transformProductionNeoForge")) } diff --git a/settings.gradle.kts b/settings.gradle.kts index e1d5baa..7a991bd 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,9 +27,9 @@ include(":paper:base") include(":paper:v766") include(":paper:v768") -// For whatever reason, the name cannot be ":modded:v1_21_7:common", the fabric and neoforge modules won't +// For whatever reason, the name cannot be ":modded:v1_21_5:common", the fabric and neoforge modules won't // be able to find the module, but if the name is unique like this, it's fine -include(":modded_common_v1_21_7") -project(":modded_common_v1_21_7").projectDir = file("modded/v1_21_7/common") -include(":modded:v1_21_7:fabric") -include(":modded:v1_21_7:neoforge") +include(":modded_common_v1_21_5") +project(":modded_common_v1_21_5").projectDir = file("modded/v1_21_5/common") +include(":modded:v1_21_5:fabric") +include(":modded:v1_21_5:neoforge") From dbfa2a63ce026dbae0d4c0b8c158fd0d82d42b4d Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 18 Aug 2025 22:28:02 +0100 Subject: [PATCH 03/12] make it compile --- buildSrc/src/main/kotlin/extensions.kt | 33 +++++++------------ modded/v1_21_5/common/build.gradle.kts | 5 +++ modded/v1_21_5/fabric/build.gradle.kts | 6 +--- modded/v1_21_5/neoforge/build.gradle.kts | 10 +++++- .../resources/META-INF/neoforge.mods.toml | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/buildSrc/src/main/kotlin/extensions.kt b/buildSrc/src/main/kotlin/extensions.kt index 2bbb13c..7d57efa 100644 --- a/buildSrc/src/main/kotlin/extensions.kt +++ b/buildSrc/src/main/kotlin/extensions.kt @@ -62,7 +62,7 @@ fun Project.minecraftVersion(version: String): Map { fun Project.minecraftVersion(version: String, bonusData: Map): Map { val metaProperties = HashMap() metaProperties["id"] = "geyser_modded_adapters_${version.replace('.', '_')}" - metaProperties["version"] = version + metaProperties["minecraft_version"] = version val fabricLoaderVersion = "0.17.2" @@ -77,26 +77,17 @@ fun Project.minecraftVersion(version: String, bonusData: Map): M platformSetupLoomIde() } - tasks { - withType { - filesMatching(listOf("fabric.mod.json", "neoforge.mods.toml")) { - expand( - "id" to metaProperties["id"], - "minecraft-version" to metaProperties["version"], - "version" to version, - "name" to "Geyser Mod Adapter", - "description" to "An adapter to access version-specific data in modded versions of Minecraft.", - "author" to "GeyserMC", - "website" to "https://geysermc.org", - "license" to "MIT" - ) - - bonusData.forEach { entry -> - expand(entry.key, entry.value) - } - } - } - } + metaProperties.putAll(bonusData) + metaProperties.putAll( + mapOf( + "name" to "Geyser Mod Adapter", + "description" to "An adapter to access version-specific data in modded versions of Minecraft.", + "author" to "GeyserMC", + "website" to "https://geysermc.org", + "license" to "MIT", + "version" to this.version.toString() + ) + ) return metaProperties } diff --git a/modded/v1_21_5/common/build.gradle.kts b/modded/v1_21_5/common/build.gradle.kts index c65fded..c89cdd8 100644 --- a/modded/v1_21_5/common/build.gradle.kts +++ b/modded/v1_21_5/common/build.gradle.kts @@ -35,6 +35,11 @@ java { } } +architectury { + platformSetupLoomIde() + common("fabric", "neoforge") +} + minecraftVersion("1.21.5") dependencies { diff --git a/modded/v1_21_5/fabric/build.gradle.kts b/modded/v1_21_5/fabric/build.gradle.kts index 95aacd0..a31829c 100644 --- a/modded/v1_21_5/fabric/build.gradle.kts +++ b/modded/v1_21_5/fabric/build.gradle.kts @@ -52,11 +52,7 @@ dependencies { tasks { withType { filesMatching("fabric.mod.json") { - expand( - "id" to metaProperties["id"], - "minecraft-version" to metaProperties["version"], - "version" to version - ) + expand(metaProperties) } } } diff --git a/modded/v1_21_5/neoforge/build.gradle.kts b/modded/v1_21_5/neoforge/build.gradle.kts index a717768..1f4f480 100644 --- a/modded/v1_21_5/neoforge/build.gradle.kts +++ b/modded/v1_21_5/neoforge/build.gradle.kts @@ -28,7 +28,7 @@ plugins { } val neoVersion = "21.5.91" -val metaProperties = minecraftVersion("1.21.5", mapOf("neoVersion" to neoVersion)) +val metaProperties = minecraftVersion("1.21.5", mapOf("neo_version" to neoVersion)) java { sourceCompatibility = JavaVersion.VERSION_21 @@ -49,3 +49,11 @@ dependencies { api(project(":modded_common_v1_21_5", configuration = "namedElements")) shadowCommon(project(":modded_common_v1_21_5", configuration = "transformProductionNeoForge")) } + +tasks { + withType { + filesMatching("META-INF/neoforge.mods.toml") { + expand(metaProperties) + } + } +} diff --git a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml index d8e3acc..86dc143 100644 --- a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -23,7 +23,7 @@ versionRange="[${neo_version},)" ordering="NONE" side="BOTH" -[[dependencies.${mod_id}]] +[[dependencies.${id}]] modId="minecraft" type="required" versionRange="[${minecraft_version},)" From 05e21a72331afb6f167e5fb5e6f266684c192e80 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 11 Sep 2025 22:04:30 +0100 Subject: [PATCH 04/12] Add CommandManagerAdapter --- .../adapters.base-conventions.gradle.kts | 3 + .../adapters/CommandManagerAdapter.java | 65 ++++++++++++ .../command/CommandSenderDefinition.java | 46 +++++++++ gradle.properties | 4 +- .../CommandManagerAdapter_v1_21_5.java | 65 ++++++++++++ .../modded/v1_21_5/GeyserAdapter_v1_21_5.java | 42 ++++++++ .../modded/v1_21_5/WorldAdapter_v1_21_5.java | 6 +- .../v1_21_5/command/ModCommandSource.java | 98 +++++++++++++++++++ modded/v1_21_5/fabric/build.gradle.kts | 4 + .../FabricCommandManagerAdapter_v1_21_5.java | 43 ++++++++ .../fabric/v1_21_5/Fabric_v1_21_5.java | 5 +- modded/v1_21_5/neoforge/build.gradle.kts | 4 + .../neoforge/v1_21_5/NeoForge_v1_21_5.java | 6 +- settings.gradle.kts | 5 + 14 files changed, 389 insertions(+), 7 deletions(-) create mode 100644 common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java create mode 100644 common/src/main/java/org/geysermc/geyser/adapters/command/CommandSenderDefinition.java create mode 100644 modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java create mode 100644 modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java create mode 100644 modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java create mode 100644 modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java diff --git a/buildSrc/src/main/kotlin/adapters.base-conventions.gradle.kts b/buildSrc/src/main/kotlin/adapters.base-conventions.gradle.kts index f184fc2..3ea5366 100644 --- a/buildSrc/src/main/kotlin/adapters.base-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/adapters.base-conventions.gradle.kts @@ -17,6 +17,9 @@ tasks { dependencies { compileOnly("com.nukkitx.fastutil:fastutil-int-object-maps:8.3.1") + compileOnly("org.incendo:cloud-core:2.0.0-rc.2") + compileOnly("net.kyori:adventure-api:4.24.0") + compileOnly("net.kyori:adventure-text-serializer-gson:4.24.0") } repositories { diff --git a/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java b/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java new file mode 100644 index 0000000..b8484f1 --- /dev/null +++ b/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters; + +import org.geysermc.geyser.adapters.command.CommandSenderDefinition; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; + +import java.util.UUID; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +public abstract class CommandManagerAdapter { + public abstract CommandManager getCommandManager( + Function converter, + CommandSourceConverter sourceConverter, + Consumer logger + ); + + public interface CommandSourceConverter { + SenderMapper getSenderMapper( + Class senderClass, + Function playerLookup, + Function senderLookup, + Supplier consoleLookup, + Function commandSourceLookup + ); + } + + // This works because sub-mods are only loaded if the version matches correctly + // So the sub-mod can just set this field and the main mod can access this class + private static CommandManagerAdapter COMMAND_MANAGER_ADAPTER; + + public static CommandManagerAdapter get() { + return COMMAND_MANAGER_ADAPTER; + } + + public static void set(CommandManagerAdapter commandManagerAdapter) { + COMMAND_MANAGER_ADAPTER = commandManagerAdapter; + } +} diff --git a/common/src/main/java/org/geysermc/geyser/adapters/command/CommandSenderDefinition.java b/common/src/main/java/org/geysermc/geyser/adapters/command/CommandSenderDefinition.java new file mode 100644 index 0000000..33603f9 --- /dev/null +++ b/common/src/main/java/org/geysermc/geyser/adapters/command/CommandSenderDefinition.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.command; + +import net.kyori.adventure.text.Component; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; +import java.util.function.Consumer; + +public interface CommandSenderDefinition { + String name(); + + void sendMessage(String message); + + void sendMessage(Component message, Consumer superDefinition); + + boolean isConsole(); + + @Nullable UUID playerUuid(); + + Object handle(); +} diff --git a/gradle.properties b/gradle.properties index feea0d2..fda7a91 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,6 @@ org.gradle.caching=true org.gradle.configureondemand=true org.gradle.parallel=true -org.gradle.jvmargs=-Xmx1024m \ No newline at end of file +# Decompiling 15 versions of Minecraft, not a good idea. +org.gradle.workers.max=4 +org.gradle.jvmargs=-Xmx2048m \ No newline at end of file diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java new file mode 100644 index 0000000..e299357 --- /dev/null +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_5; + +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.level.ServerPlayer; +import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.command.CommandSenderDefinition; +import org.geysermc.geyser.adapters.modded.v1_21_5.command.ModCommandSource; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; + +import java.util.function.Consumer; +import java.util.function.Function; + +public abstract class CommandManagerAdapter_v1_21_5 extends CommandManagerAdapter { + public CommandManagerAdapter_v1_21_5() { + CommandManagerAdapter. + } + + @Override + public CommandManager getCommandManager( + Function converter, + CommandSourceConverter sourceConverter, + Consumer logger + ) { + SenderMapper mapper = sourceConverter.getSenderMapper( + CommandSourceStack.class, + id -> GeyserAdapter_v1_21_5.getServer().getPlayerList().getPlayer(id), + ServerPlayer::createCommandSourceStack, + () -> GeyserAdapter_v1_21_5.getServer().createCommandSourceStack(), + commandSourceStack -> converter.apply(new ModCommandSource( + commandSourceStack, + logger + )) + ); + + return getCommandManager(mapper); + } + + public abstract CommandManager getCommandManager(SenderMapper mapper); +} diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java new file mode 100644 index 0000000..b9d30dd --- /dev/null +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_5; + +import net.minecraft.server.MinecraftServer; + +public class GeyserAdapter_v1_21_5 { + private static MinecraftServer server; + + public static void setServer(MinecraftServer server) { + if (GeyserAdapter_v1_21_5.server != null) throw new IllegalStateException("Server is already defined."); + + GeyserAdapter_v1_21_5.server = server; + } + + public static MinecraftServer getServer() { + return server; + } +} diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java index 73a9292..e963a43 100644 --- a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java @@ -43,8 +43,6 @@ import java.util.stream.Stream; public class WorldAdapter_v1_21_5 extends WorldAdapter { - public static MinecraftServer server = null; - @Override public int getBlockAt(ServerLevel world, int x, int y, int z) { if (y < world.getMinY()) { @@ -67,9 +65,9 @@ public IntList getAllBlockStates() { @Override public String[] getBiomeSuggestions(boolean tags) { - if (server == null) return new String[]{}; + if (GeyserAdapter_v1_21_5.getServer() == null) return new String[]{}; - Registry registry = server.registryAccess() + Registry registry = GeyserAdapter_v1_21_5.getServer().registryAccess() .lookupOrThrow(Registries.BIOME); if (!tags) { return getBiomes(registry).toArray(String[]::new); diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java new file mode 100644 index 0000000..084b969 --- /dev/null +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_5.command; + +import com.google.gson.JsonElement; +import com.mojang.serialization.JsonOps; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.ComponentSerialization; +import net.minecraft.resources.RegistryOps; +import net.minecraft.server.level.ServerPlayer; +import org.geysermc.geyser.adapters.command.CommandSenderDefinition; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; +import java.util.function.Consumer; +import java.util.function.Function; + +public class ModCommandSource implements CommandSenderDefinition { + private final CommandSourceStack sender; + private final Consumer logger; + + public ModCommandSource( + CommandSourceStack sender, + Consumer logger + ) { + this.sender = sender; // TODO find locale? + this.logger = logger; + } + + @Override + public String name() { + return sender.getTextName(); + } + + @Override + public void sendMessage(String message) { + if (sender.getEntity() instanceof ServerPlayer player) { + player.sendSystemMessage(net.minecraft.network.chat.Component.literal(message), false); + } else { + logger.accept(message); + } + } + + @Override + public void sendMessage(Component message, Consumer superDefinition) { + if (sender.getEntity() instanceof ServerPlayer player) { + JsonElement jsonComponent = GsonComponentSerializer.gson().serializeToTree(message); + player.displayClientMessage(ComponentSerialization.CODEC.parse( + RegistryOps.create(JsonOps.INSTANCE, player.registryAccess()), jsonComponent + ).getOrThrow(), false); + return; + } + superDefinition.accept(message); + } + + @Override + public boolean isConsole() { + return !(sender.getEntity() instanceof ServerPlayer); + } + + @Override + public @Nullable UUID playerUuid() { + if (sender.getEntity() instanceof ServerPlayer player) { + return player.getUUID(); + } + return null; + } + + @Override + public Object handle() { + return sender; + } +} diff --git a/modded/v1_21_5/fabric/build.gradle.kts b/modded/v1_21_5/fabric/build.gradle.kts index a31829c..ed88ea5 100644 --- a/modded/v1_21_5/fabric/build.gradle.kts +++ b/modded/v1_21_5/fabric/build.gradle.kts @@ -47,6 +47,10 @@ dependencies { api(project(path = ":modded_common_v1_21_5", configuration = "namedElements")) shadowCommon(project(path = ":modded_common_v1_21_5", configuration = "transformProductionFabric")) + + compileOnly(project(":common")) + modImplementation("org.incendo:cloud-fabric:2.0.0-beta.12") + include("org.incendo:cloud-fabric:2.0.0-beta.12") } tasks { diff --git a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java new file mode 100644 index 0000000..7e30608 --- /dev/null +++ b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.fabric.v1_21_5; + +import net.minecraft.commands.CommandSourceStack; +import org.geysermc.geyser.adapters.modded.v1_21_5.CommandManagerAdapter_v1_21_5; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.execution.ExecutionCoordinator; +import org.incendo.cloud.fabric.FabricServerCommandManager; + +public class FabricCommandManagerAdapter_v1_21_5 extends CommandManagerAdapter_v1_21_5 { + @Override + public CommandManager getCommandManager(SenderMapper mapper) { + return new FabricServerCommandManager<>( + ExecutionCoordinator.simpleCoordinator(), + mapper + ); + } +} diff --git a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java index 4d7e7f2..790f3fa 100644 --- a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java +++ b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java @@ -27,11 +27,14 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.modded.v1_21_5.GeyserAdapter_v1_21_5; import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; public class Fabric_v1_21_5 implements ModInitializer { @Override public void onInitialize() { - ServerLifecycleEvents.SERVER_STARTING.register(server -> WorldAdapter_v1_21_5.server = server); + ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_21_5::setServer); + CommandManagerAdapter.set(new FabricCommandManagerAdapter_v1_21_5()); } } diff --git a/modded/v1_21_5/neoforge/build.gradle.kts b/modded/v1_21_5/neoforge/build.gradle.kts index 1f4f480..a423887 100644 --- a/modded/v1_21_5/neoforge/build.gradle.kts +++ b/modded/v1_21_5/neoforge/build.gradle.kts @@ -48,6 +48,10 @@ dependencies { api(project(":modded_common_v1_21_5", configuration = "namedElements")) shadowCommon(project(":modded_common_v1_21_5", configuration = "transformProductionNeoForge")) + + compileOnly(project(":common")) + modImplementation("org.incendo:cloud-neoforge:2.0.0-beta.12") + include("org.incendo:cloud-neoforge:2.0.0-beta.12") } tasks { diff --git a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java index c44224c..a97af35 100644 --- a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java +++ b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java @@ -29,13 +29,17 @@ import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.modded.v1_21_5.GeyserAdapter_v1_21_5; import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; @Mod("geyser_modded_adapters_1_21_5") public class NeoForge_v1_21_5 { public NeoForge_v1_21_5(IEventBus bus, ModContainer modContainer) { bus.addListener(ServerStartingEvent.class, event -> { - WorldAdapter_v1_21_5.server = event.getServer(); + GeyserAdapter_v1_21_5.setServer(event.getServer()); }); + + CommandManagerAdapter.set(new NeoForgeCommandManagerAdapter_v1_21_5()); } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 7a991bd..d32a292 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -33,3 +33,8 @@ include(":modded_common_v1_21_5") project(":modded_common_v1_21_5").projectDir = file("modded/v1_21_5/common") include(":modded:v1_21_5:fabric") include(":modded:v1_21_5:neoforge") + +include(":modded_common_v1_21_1") +project(":modded_common_v1_21_1").projectDir = file("modded/v1_21_1/common") +include(":modded:v1_21_1:fabric") +include(":modded:v1_21_1:neoforge") From 75cc4ef3713d3994495e82b11dd6d05805c78fee Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 11 Sep 2025 22:05:36 +0100 Subject: [PATCH 05/12] Fix 1.21.5 --- .../modded/v1_21_5/CommandManagerAdapter_v1_21_5.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java index e299357..0b66870 100644 --- a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java @@ -37,10 +37,6 @@ import java.util.function.Function; public abstract class CommandManagerAdapter_v1_21_5 extends CommandManagerAdapter { - public CommandManagerAdapter_v1_21_5() { - CommandManagerAdapter. - } - @Override public CommandManager getCommandManager( Function converter, From 48bc4e2527b8764900a60479472649cf5bda7542 Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 12 Sep 2025 10:35:47 +0100 Subject: [PATCH 06/12] Add 1.21.1 modded --- modded/v1_21_1/common/build.gradle.kts | 47 +++++++++ .../CommandManagerAdapter_v1_21_1.java | 61 ++++++++++++ .../modded/v1_21_1/GeyserAdapter_v1_21_1.java | 42 ++++++++ .../modded/v1_21_1/WorldAdapter_v1_21_1.java | 84 ++++++++++++++++ .../v1_21_1/command/ModCommandSource.java | 98 +++++++++++++++++++ modded/v1_21_1/fabric/build.gradle.kts | 62 ++++++++++++ .../FabricCommandManagerAdapter_v1_21_1.java | 43 ++++++++ .../fabric/v1_21_1/Fabric_v1_21_1.java | 39 ++++++++ .../fabric/src/main/resources/fabric.mod.json | 25 +++++ modded/v1_21_1/neoforge/build.gradle.kts | 63 ++++++++++++ modded/v1_21_1/neoforge/gradle.properties | 1 + ...NeoForgeCommandManagerAdapter_v1_21_1.java | 43 ++++++++ .../neoforge/v1_21_1/NeoForge_v1_21_1.java | 41 ++++++++ .../resources/META-INF/neoforge.mods.toml | 31 ++++++ ...NeoForgeCommandManagerAdapter_v1_21_5.java | 43 ++++++++ 15 files changed, 723 insertions(+) create mode 100644 modded/v1_21_1/common/build.gradle.kts create mode 100644 modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java create mode 100644 modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java create mode 100644 modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java create mode 100644 modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java create mode 100644 modded/v1_21_1/fabric/build.gradle.kts create mode 100644 modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java create mode 100644 modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java create mode 100644 modded/v1_21_1/fabric/src/main/resources/fabric.mod.json create mode 100644 modded/v1_21_1/neoforge/build.gradle.kts create mode 100644 modded/v1_21_1/neoforge/gradle.properties create mode 100644 modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java create mode 100644 modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java create mode 100644 modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml create mode 100644 modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java diff --git a/modded/v1_21_1/common/build.gradle.kts b/modded/v1_21_1/common/build.gradle.kts new file mode 100644 index 0000000..0f5a255 --- /dev/null +++ b/modded/v1_21_1/common/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + common("fabric", "neoforge") +} + +minecraftVersion("1.21.1") + +dependencies { + implementation(project(":common")) +} diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java new file mode 100644 index 0000000..789884d --- /dev/null +++ b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_1; + +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.level.ServerPlayer; +import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.command.CommandSenderDefinition; +import org.geysermc.geyser.adapters.modded.v1_21_1.command.ModCommandSource; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; + +import java.util.function.Consumer; +import java.util.function.Function; + +public abstract class CommandManagerAdapter_v1_21_1 extends CommandManagerAdapter { + @Override + public CommandManager getCommandManager( + Function converter, + CommandSourceConverter sourceConverter, + Consumer logger + ) { + SenderMapper mapper = sourceConverter.getSenderMapper( + CommandSourceStack.class, + id -> GeyserAdapter_v1_21_1.getServer().getPlayerList().getPlayer(id), + ServerPlayer::createCommandSourceStack, + () -> GeyserAdapter_v1_21_1.getServer().createCommandSourceStack(), + commandSourceStack -> converter.apply(new ModCommandSource( + commandSourceStack, + logger + )) + ); + + return getCommandManager(mapper); + } + + public abstract CommandManager getCommandManager(SenderMapper mapper); +} diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java new file mode 100644 index 0000000..cb04ea5 --- /dev/null +++ b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_1; + +import net.minecraft.server.MinecraftServer; + +public class GeyserAdapter_v1_21_1 { + private static MinecraftServer server; + + public static void setServer(MinecraftServer server) { + if (GeyserAdapter_v1_21_1.server != null) throw new IllegalStateException("Server is already defined."); + + GeyserAdapter_v1_21_1.server = server; + } + + public static MinecraftServer getServer() { + return server; + } +} diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java new file mode 100644 index 0000000..1eb26e6 --- /dev/null +++ b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_1; + +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import org.geysermc.geyser.adapters.WorldAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + +public class WorldAdapter_v1_21_1 extends WorldAdapter { + @Override + public int getBlockAt(ServerLevel world, int x, int y, int z) { + if (y < world.getMinBuildHeight()) { + return 0; + } + + BlockState blockState = world.getBlockState(new BlockPos(x, y, z)); + + return Block.getId(blockState); + } + + @Override + public IntList getAllBlockStates() { + IntList blockStates = new IntArrayList(); + for (BlockState block : Block.BLOCK_STATE_REGISTRY) { + blockStates.add(Block.getId(block)); + } + return blockStates; + } + + @Override + public String[] getBiomeSuggestions(boolean tags) { + if (GeyserAdapter_v1_21_1.getServer() == null) return new String[]{}; + + Registry registry = GeyserAdapter_v1_21_1.getServer() + .registryAccess() + .registry(Registries.BIOME).orElseThrow(); + if (!tags) { + return getBiomes(registry).toArray(String[]::new); + } + + List keys = new ArrayList<>(registry.getTagNames().map(tag -> "#" + tag.location()).toList()); + keys.addAll(getBiomes(registry).toList()); + return keys.toArray(new String[0]); + } + + private Stream getBiomes(Registry registry) { + return registry.keySet().stream().map(ResourceLocation::toString); + } +} diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java new file mode 100644 index 0000000..2163a4d --- /dev/null +++ b/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.v1_21_1.command; + +import com.google.gson.JsonElement; +import com.mojang.serialization.JsonOps; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.ComponentSerialization; +import net.minecraft.resources.RegistryOps; +import net.minecraft.server.level.ServerPlayer; +import org.geysermc.geyser.adapters.command.CommandSenderDefinition; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; +import java.util.function.Consumer; +import java.util.function.Function; + +public class ModCommandSource implements CommandSenderDefinition { + private final CommandSourceStack sender; + private final Consumer logger; + + public ModCommandSource( + CommandSourceStack sender, + Consumer logger + ) { + this.sender = sender; // TODO find locale? + this.logger = logger; + } + + @Override + public String name() { + return sender.getTextName(); + } + + @Override + public void sendMessage(String message) { + if (sender.getEntity() instanceof ServerPlayer player) { + player.sendSystemMessage(net.minecraft.network.chat.Component.literal(message), false); + } else { + logger.accept(message); + } + } + + @Override + public void sendMessage(Component message, Consumer superDefinition) { + if (sender.getEntity() instanceof ServerPlayer player) { + JsonElement jsonComponent = GsonComponentSerializer.gson().serializeToTree(message); + player.displayClientMessage(ComponentSerialization.CODEC.parse( + RegistryOps.create(JsonOps.INSTANCE, player.registryAccess()), jsonComponent + ).getOrThrow(), false); + return; + } + superDefinition.accept(message); + } + + @Override + public boolean isConsole() { + return !(sender.getEntity() instanceof ServerPlayer); + } + + @Override + public @Nullable UUID playerUuid() { + if (sender.getEntity() instanceof ServerPlayer player) { + return player.getUUID(); + } + return null; + } + + @Override + public Object handle() { + return sender; + } +} diff --git a/modded/v1_21_1/fabric/build.gradle.kts b/modded/v1_21_1/fabric/build.gradle.kts new file mode 100644 index 0000000..7c25f6c --- /dev/null +++ b/modded/v1_21_1/fabric/build.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val metaProperties = minecraftVersion("1.21.1") + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + fabric() +} + +dependencies { + modApi("net.fabricmc.fabric-api:fabric-api:0.116.6+1.21.1") + + api(project(path = ":modded_common_v1_21_1", configuration = "namedElements")) + shadowCommon(project(path = ":modded_common_v1_21_1", configuration = "transformProductionFabric")) + + compileOnly(project(":common")) + modImplementation("org.incendo:cloud-fabric:2.0.0-beta.10") + include("org.incendo:cloud-fabric:2.0.0-beta.10") +} + +tasks { + withType { + filesMatching("fabric.mod.json") { + expand(metaProperties) + } + } +} diff --git a/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java b/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java new file mode 100644 index 0000000..85b1629 --- /dev/null +++ b/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.fabric.v1_21_1; + +import net.minecraft.commands.CommandSourceStack; +import org.geysermc.geyser.adapters.modded.v1_21_1.CommandManagerAdapter_v1_21_1; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.execution.ExecutionCoordinator; +import org.incendo.cloud.fabric.FabricServerCommandManager; + +public class FabricCommandManagerAdapter_v1_21_1 extends CommandManagerAdapter_v1_21_1 { + @Override + public CommandManager getCommandManager(SenderMapper mapper) { + return new FabricServerCommandManager<>( + ExecutionCoordinator.simpleCoordinator(), + mapper + ); + } +} diff --git a/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java b/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java new file mode 100644 index 0000000..0c27031 --- /dev/null +++ b/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.fabric.v1_21_1; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.modded.v1_21_1.GeyserAdapter_v1_21_1; + +public class Fabric_v1_21_1 implements ModInitializer { + @Override + public void onInitialize() { + ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_21_1::setServer); + CommandManagerAdapter.set(new FabricCommandManagerAdapter_v1_21_1()); + } +} diff --git a/modded/v1_21_1/fabric/src/main/resources/fabric.mod.json b/modded/v1_21_1/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..06705bc --- /dev/null +++ b/modded/v1_21_1/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,25 @@ +{ + "schemaVersion": 1, + "id": "${id}", + "version": "${version}", + "name": "${name}", + "description": "${description}", + "authors": ["${author}"], + "contact": { + "website": "${website}", + "repo": "https://github.com/GeyserMC/geyser-adapters" + }, + "license": "${license}", + "icon": "assets/geyser/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "org.geysermc.geyser.adapters.fabric.v1_21_1.Fabric_v1_21_1" + ] + }, + "depends": { + "fabricloader": ">=0.16.7", + "fabric-api": "*", + "minecraft": ">=${minecraft_version}" + } +} \ No newline at end of file diff --git a/modded/v1_21_1/neoforge/build.gradle.kts b/modded/v1_21_1/neoforge/build.gradle.kts new file mode 100644 index 0000000..59ab01e --- /dev/null +++ b/modded/v1_21_1/neoforge/build.gradle.kts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val neoVersion = "21.1.208" +val metaProperties = minecraftVersion("1.21.1", mapOf("neo_version" to neoVersion)) + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +dependencies { + neoForge("net.neoforged:neoforge:$neoVersion") + + api(project(":modded_common_v1_21_1", configuration = "namedElements")) + shadowCommon(project(":modded_common_v1_21_1", configuration = "transformProductionNeoForge")) + + compileOnly(project(":common")) + modImplementation("org.incendo:cloud-neoforge:2.0.0-beta.10") + include("org.incendo:cloud-neoforge:2.0.0-beta.10") +} + +tasks { + withType { + filesMatching("META-INF/neoforge.mods.toml") { + expand(metaProperties) + } + } +} diff --git a/modded/v1_21_1/neoforge/gradle.properties b/modded/v1_21_1/neoforge/gradle.properties new file mode 100644 index 0000000..2914393 --- /dev/null +++ b/modded/v1_21_1/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge \ No newline at end of file diff --git a/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java b/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java new file mode 100644 index 0000000..7054cff --- /dev/null +++ b/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.neoforge.v1_21_1; + +import net.minecraft.commands.CommandSourceStack; +import org.geysermc.geyser.adapters.modded.v1_21_1.CommandManagerAdapter_v1_21_1; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.execution.ExecutionCoordinator; +import org.incendo.cloud.neoforge.NeoForgeServerCommandManager; + +public class NeoForgeCommandManagerAdapter_v1_21_1 extends CommandManagerAdapter_v1_21_1 { + @Override + public CommandManager getCommandManager(SenderMapper mapper) { + return new NeoForgeServerCommandManager<>( + ExecutionCoordinator.simpleCoordinator(), + mapper + ); + } +} diff --git a/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java b/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java new file mode 100644 index 0000000..5eaec74 --- /dev/null +++ b/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.neoforge.v1_21_1; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.geysermc.geyser.adapters.modded.v1_21_1.GeyserAdapter_v1_21_1; + +@Mod("geyser_modded_adapters_1_21_5") +public class NeoForge_v1_21_1 { + public NeoForge_v1_21_1(IEventBus bus, ModContainer modContainer) { + bus.addListener(ServerStartingEvent.class, event -> { + GeyserAdapter_v1_21_1.setServer(event.getServer()); + }); + } +} diff --git a/modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..86dc143 --- /dev/null +++ b/modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,31 @@ +modLoader="javafml" +loaderVersion="[1,)" +license="${license}" + +[[mods]] +modId="${id}" +version="${version}" +displayName="${name}" +displayURL="${website}" +authors="${author}" +description='''${description}''' + +#[[mixins]] +#config="${id}.mixins.json" + +#[[accessTransformers]] +#file="META-INF/accesstransformer.cfg" + +[[dependencies.${id}]] +modId="neoforge" +type="required" +versionRange="[${neo_version},)" +ordering="NONE" +side="BOTH" + +[[dependencies.${id}]] +modId="minecraft" +type="required" +versionRange="[${minecraft_version},)" +ordering="NONE" +side="BOTH" diff --git a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java new file mode 100644 index 0000000..2f8c358 --- /dev/null +++ b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.neoforge.v1_21_5; + +import net.minecraft.commands.CommandSourceStack; +import org.geysermc.geyser.adapters.modded.v1_21_5.CommandManagerAdapter_v1_21_5; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.execution.ExecutionCoordinator; +import org.incendo.cloud.neoforge.NeoForgeServerCommandManager; + +public class NeoForgeCommandManagerAdapter_v1_21_5 extends CommandManagerAdapter_v1_21_5 { + @Override + public CommandManager getCommandManager(SenderMapper mapper) { + return new NeoForgeServerCommandManager<>( + ExecutionCoordinator.simpleCoordinator(), + mapper + ); + } +} From 1a1a5f26e0b75854f628af55ea771e4a588af0ba Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 12 Sep 2025 17:13:23 +0100 Subject: [PATCH 07/12] 1.21.1 to 1.20.6 (1.21.1 will work on 1.20.6) --- buildSrc/src/main/kotlin/extensions.kt | 2 +- .../{v1_21_1 => v1_20_6}/common/build.gradle.kts | 2 +- .../v1_20_6/CommandManagerAdapter_v1_20_6.java} | 10 +++++----- .../modded/v1_20_6/GeyserAdapter_v1_20_6.java} | 8 ++++---- .../modded/v1_20_6/WorldAdapter_v1_20_6.java} | 8 ++++---- .../modded/v1_20_6}/command/ModCommandSource.java | 5 ++--- .../{v1_21_1 => v1_20_6}/fabric/build.gradle.kts | 9 +++++---- .../FabricCommandManagerAdapter_v1_20_6.java} | 6 +++--- .../adapters/fabric/v1_20_6/Fabric_v1_20_6.java} | 10 +++++----- .../fabric/src/main/resources/fabric.mod.json | 5 +++-- .../neoforge/build.gradle.kts | 9 +++++---- .../neoforge/gradle.properties | 0 .../NeoForgeCommandManagerAdapter_v1_20_6.java} | 6 +++--- .../neoforge/v1_20_6/NeoForge_v1_20_6.java} | 10 +++++----- .../main/resources/META-INF/neoforge.mods.toml | 9 ++++++++- modded/v1_21_5/fabric/build.gradle.kts | 1 + .../fabric/src/main/resources/fabric.mod.json | 3 ++- modded/v1_21_5/neoforge/build.gradle.kts | 1 + .../main/resources/META-INF/neoforge.mods.toml | 7 +++++++ settings.gradle.kts | 15 +++++++++++---- 20 files changed, 76 insertions(+), 50 deletions(-) rename modded/{v1_21_1 => v1_20_6}/common/build.gradle.kts (98%) rename modded/{v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java => v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java} (88%) rename modded/{v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java => v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java} (88%) rename modded/{v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java => v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java} (92%) rename modded/{v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1 => v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6}/command/ModCommandSource.java (95%) rename modded/{v1_21_1 => v1_20_6}/fabric/build.gradle.kts (87%) rename modded/{v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java => v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java} (88%) rename modded/{v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java => v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java} (87%) rename modded/{v1_21_1 => v1_20_6}/fabric/src/main/resources/fabric.mod.json (76%) rename modded/{v1_21_1 => v1_20_6}/neoforge/build.gradle.kts (88%) rename modded/{v1_21_1 => v1_20_6}/neoforge/gradle.properties (100%) rename modded/{v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java => v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java} (88%) rename modded/{v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java => v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java} (83%) rename modded/{v1_21_1 => v1_20_6}/neoforge/src/main/resources/META-INF/neoforge.mods.toml (76%) diff --git a/buildSrc/src/main/kotlin/extensions.kt b/buildSrc/src/main/kotlin/extensions.kt index 7d57efa..b594438 100644 --- a/buildSrc/src/main/kotlin/extensions.kt +++ b/buildSrc/src/main/kotlin/extensions.kt @@ -61,7 +61,7 @@ fun Project.minecraftVersion(version: String): Map { fun Project.minecraftVersion(version: String, bonusData: Map): Map { val metaProperties = HashMap() - metaProperties["id"] = "geyser_modded_adapters_${version.replace('.', '_')}" + metaProperties["id"] = "geyser_modded_adapters_v${version.replace('.', '_')}" metaProperties["minecraft_version"] = version val fabricLoaderVersion = "0.17.2" diff --git a/modded/v1_21_1/common/build.gradle.kts b/modded/v1_20_6/common/build.gradle.kts similarity index 98% rename from modded/v1_21_1/common/build.gradle.kts rename to modded/v1_20_6/common/build.gradle.kts index 0f5a255..7f2e115 100644 --- a/modded/v1_21_1/common/build.gradle.kts +++ b/modded/v1_20_6/common/build.gradle.kts @@ -40,7 +40,7 @@ architectury { common("fabric", "neoforge") } -minecraftVersion("1.21.1") +minecraftVersion("1.20.6") dependencies { implementation(project(":common")) diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java similarity index 88% rename from modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java rename to modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java index 789884d..437e09f 100644 --- a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/CommandManagerAdapter_v1_21_1.java +++ b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.modded.v1_21_1; +package org.geysermc.geyser.adapters.modded.v1_20_6; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.level.ServerPlayer; import org.geysermc.geyser.adapters.CommandManagerAdapter; import org.geysermc.geyser.adapters.command.CommandSenderDefinition; -import org.geysermc.geyser.adapters.modded.v1_21_1.command.ModCommandSource; +import org.geysermc.geyser.adapters.modded.v1_20_6.command.ModCommandSource; import org.incendo.cloud.CommandManager; import org.incendo.cloud.SenderMapper; import java.util.function.Consumer; import java.util.function.Function; -public abstract class CommandManagerAdapter_v1_21_1 extends CommandManagerAdapter { +public abstract class CommandManagerAdapter_v1_20_6 extends CommandManagerAdapter { @Override public CommandManager getCommandManager( Function converter, @@ -45,9 +45,9 @@ public CommandManager getCommandManager( ) { SenderMapper mapper = sourceConverter.getSenderMapper( CommandSourceStack.class, - id -> GeyserAdapter_v1_21_1.getServer().getPlayerList().getPlayer(id), + id -> GeyserAdapter_v1_20_6.getServer().getPlayerList().getPlayer(id), ServerPlayer::createCommandSourceStack, - () -> GeyserAdapter_v1_21_1.getServer().createCommandSourceStack(), + () -> GeyserAdapter_v1_20_6.getServer().createCommandSourceStack(), commandSourceStack -> converter.apply(new ModCommandSource( commandSourceStack, logger diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java similarity index 88% rename from modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java rename to modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java index cb04ea5..520045b 100644 --- a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/GeyserAdapter_v1_21_1.java +++ b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.modded.v1_21_1; +package org.geysermc.geyser.adapters.modded.v1_20_6; import net.minecraft.server.MinecraftServer; -public class GeyserAdapter_v1_21_1 { +public class GeyserAdapter_v1_20_6 { private static MinecraftServer server; public static void setServer(MinecraftServer server) { - if (GeyserAdapter_v1_21_1.server != null) throw new IllegalStateException("Server is already defined."); + if (GeyserAdapter_v1_20_6.server != null) throw new IllegalStateException("Server is already defined."); - GeyserAdapter_v1_21_1.server = server; + GeyserAdapter_v1_20_6.server = server; } public static MinecraftServer getServer() { diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java similarity index 92% rename from modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java rename to modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java index 1eb26e6..eaf0170 100644 --- a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/WorldAdapter_v1_21_1.java +++ b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.modded.v1_21_1; +package org.geysermc.geyser.adapters.modded.v1_20_6; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; @@ -41,7 +41,7 @@ import java.util.List; import java.util.stream.Stream; -public class WorldAdapter_v1_21_1 extends WorldAdapter { +public class WorldAdapter_v1_20_6 extends WorldAdapter { @Override public int getBlockAt(ServerLevel world, int x, int y, int z) { if (y < world.getMinBuildHeight()) { @@ -64,9 +64,9 @@ public IntList getAllBlockStates() { @Override public String[] getBiomeSuggestions(boolean tags) { - if (GeyserAdapter_v1_21_1.getServer() == null) return new String[]{}; + if (GeyserAdapter_v1_20_6.getServer() == null) return new String[]{}; - Registry registry = GeyserAdapter_v1_21_1.getServer() + Registry registry = GeyserAdapter_v1_20_6.getServer() .registryAccess() .registry(Registries.BIOME).orElseThrow(); if (!tags) { diff --git a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java similarity index 95% rename from modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java rename to modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java index 2163a4d..7f48f1a 100644 --- a/modded/v1_21_1/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_1/command/ModCommandSource.java +++ b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.modded.v1_21_1.command; +package org.geysermc.geyser.adapters.modded.v1_20_6.command; import com.google.gson.JsonElement; import com.mojang.serialization.JsonOps; @@ -38,7 +38,6 @@ import java.util.UUID; import java.util.function.Consumer; -import java.util.function.Function; public class ModCommandSource implements CommandSenderDefinition { private final CommandSourceStack sender; @@ -70,7 +69,7 @@ public void sendMessage(String message) { public void sendMessage(Component message, Consumer superDefinition) { if (sender.getEntity() instanceof ServerPlayer player) { JsonElement jsonComponent = GsonComponentSerializer.gson().serializeToTree(message); - player.displayClientMessage(ComponentSerialization.CODEC.parse( + player.sendSystemMessage(ComponentSerialization.CODEC.parse( RegistryOps.create(JsonOps.INSTANCE, player.registryAccess()), jsonComponent ).getOrThrow(), false); return; diff --git a/modded/v1_21_1/fabric/build.gradle.kts b/modded/v1_20_6/fabric/build.gradle.kts similarity index 87% rename from modded/v1_21_1/fabric/build.gradle.kts rename to modded/v1_20_6/fabric/build.gradle.kts index 7c25f6c..a2a3558 100644 --- a/modded/v1_21_1/fabric/build.gradle.kts +++ b/modded/v1_20_6/fabric/build.gradle.kts @@ -27,7 +27,7 @@ plugins { id("adapters.modded-conventions") } -val metaProperties = minecraftVersion("1.21.1") +val metaProperties = minecraftVersion("1.20.6") java { sourceCompatibility = JavaVersion.VERSION_21 @@ -43,10 +43,10 @@ architectury { } dependencies { - modApi("net.fabricmc.fabric-api:fabric-api:0.116.6+1.21.1") + modApi("net.fabricmc.fabric-api:fabric-api:0.100.8+1.20.6") - api(project(path = ":modded_common_v1_21_1", configuration = "namedElements")) - shadowCommon(project(path = ":modded_common_v1_21_1", configuration = "transformProductionFabric")) + api(project(path = ":modded_common_v1_20_6", configuration = "namedElements")) + shadowCommon(project(path = ":modded_common_v1_20_6", configuration = "transformProductionFabric")) compileOnly(project(":common")) modImplementation("org.incendo:cloud-fabric:2.0.0-beta.10") @@ -55,6 +55,7 @@ dependencies { tasks { withType { + filteringCharset = "UTF-8" filesMatching("fabric.mod.json") { expand(metaProperties) } diff --git a/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java b/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java similarity index 88% rename from modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java rename to modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java index 85b1629..07b7440 100644 --- a/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/FabricCommandManagerAdapter_v1_21_1.java +++ b/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.fabric.v1_21_1; +package org.geysermc.geyser.adapters.fabric.v1_20_6; import net.minecraft.commands.CommandSourceStack; -import org.geysermc.geyser.adapters.modded.v1_21_1.CommandManagerAdapter_v1_21_1; +import org.geysermc.geyser.adapters.modded.v1_20_6.CommandManagerAdapter_v1_20_6; import org.incendo.cloud.CommandManager; import org.incendo.cloud.SenderMapper; import org.incendo.cloud.execution.ExecutionCoordinator; import org.incendo.cloud.fabric.FabricServerCommandManager; -public class FabricCommandManagerAdapter_v1_21_1 extends CommandManagerAdapter_v1_21_1 { +public class FabricCommandManagerAdapter_v1_20_6 extends CommandManagerAdapter_v1_20_6 { @Override public CommandManager getCommandManager(SenderMapper mapper) { return new FabricServerCommandManager<>( diff --git a/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java b/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java similarity index 87% rename from modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java rename to modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java index 0c27031..79436a6 100644 --- a/modded/v1_21_1/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_1/Fabric_v1_21_1.java +++ b/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.fabric.v1_21_1; +package org.geysermc.geyser.adapters.fabric.v1_20_6; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import org.geysermc.geyser.adapters.CommandManagerAdapter; -import org.geysermc.geyser.adapters.modded.v1_21_1.GeyserAdapter_v1_21_1; +import org.geysermc.geyser.adapters.modded.v1_20_6.GeyserAdapter_v1_20_6; -public class Fabric_v1_21_1 implements ModInitializer { +public class Fabric_v1_20_6 implements ModInitializer { @Override public void onInitialize() { - ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_21_1::setServer); - CommandManagerAdapter.set(new FabricCommandManagerAdapter_v1_21_1()); + ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_20_6::setServer); + CommandManagerAdapter.set(new FabricCommandManagerAdapter_v1_20_6()); } } diff --git a/modded/v1_21_1/fabric/src/main/resources/fabric.mod.json b/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json similarity index 76% rename from modded/v1_21_1/fabric/src/main/resources/fabric.mod.json rename to modded/v1_20_6/fabric/src/main/resources/fabric.mod.json index 06705bc..73a158d 100644 --- a/modded/v1_21_1/fabric/src/main/resources/fabric.mod.json +++ b/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json @@ -14,12 +14,13 @@ "environment": "*", "entrypoints": { "main": [ - "org.geysermc.geyser.adapters.fabric.v1_21_1.Fabric_v1_21_1" + "org.geysermc.geyser.adapters.fabric.v1_20_6.Fabric_v1_20_6" ] }, "depends": { "fabricloader": ">=0.16.7", "fabric-api": "*", - "minecraft": ">=${minecraft_version}" + "minecraft": ">=${minecraft_version} <=1.21.4", + "geyser-fabric": "*" } } \ No newline at end of file diff --git a/modded/v1_21_1/neoforge/build.gradle.kts b/modded/v1_20_6/neoforge/build.gradle.kts similarity index 88% rename from modded/v1_21_1/neoforge/build.gradle.kts rename to modded/v1_20_6/neoforge/build.gradle.kts index 59ab01e..8e09ff8 100644 --- a/modded/v1_21_1/neoforge/build.gradle.kts +++ b/modded/v1_20_6/neoforge/build.gradle.kts @@ -27,8 +27,8 @@ plugins { id("adapters.modded-conventions") } -val neoVersion = "21.1.208" -val metaProperties = minecraftVersion("1.21.1", mapOf("neo_version" to neoVersion)) +val neoVersion = "20.6.138" +val metaProperties = minecraftVersion("1.20.6", mapOf("neo_version" to neoVersion)) java { sourceCompatibility = JavaVersion.VERSION_21 @@ -46,8 +46,8 @@ architectury { dependencies { neoForge("net.neoforged:neoforge:$neoVersion") - api(project(":modded_common_v1_21_1", configuration = "namedElements")) - shadowCommon(project(":modded_common_v1_21_1", configuration = "transformProductionNeoForge")) + api(project(":modded_common_v1_20_6", configuration = "namedElements")) + shadowCommon(project(":modded_common_v1_20_6", configuration = "transformProductionNeoForge")) compileOnly(project(":common")) modImplementation("org.incendo:cloud-neoforge:2.0.0-beta.10") @@ -56,6 +56,7 @@ dependencies { tasks { withType { + filteringCharset = "UTF-8" filesMatching("META-INF/neoforge.mods.toml") { expand(metaProperties) } diff --git a/modded/v1_21_1/neoforge/gradle.properties b/modded/v1_20_6/neoforge/gradle.properties similarity index 100% rename from modded/v1_21_1/neoforge/gradle.properties rename to modded/v1_20_6/neoforge/gradle.properties diff --git a/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java b/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java similarity index 88% rename from modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java rename to modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java index 7054cff..c703e28 100644 --- a/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForgeCommandManagerAdapter_v1_21_1.java +++ b/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.neoforge.v1_21_1; +package org.geysermc.geyser.adapters.neoforge.v1_20_6; import net.minecraft.commands.CommandSourceStack; -import org.geysermc.geyser.adapters.modded.v1_21_1.CommandManagerAdapter_v1_21_1; +import org.geysermc.geyser.adapters.modded.v1_20_6.CommandManagerAdapter_v1_20_6; import org.incendo.cloud.CommandManager; import org.incendo.cloud.SenderMapper; import org.incendo.cloud.execution.ExecutionCoordinator; import org.incendo.cloud.neoforge.NeoForgeServerCommandManager; -public class NeoForgeCommandManagerAdapter_v1_21_1 extends CommandManagerAdapter_v1_21_1 { +public class NeoForgeCommandManagerAdapter_v1_20_6 extends CommandManagerAdapter_v1_20_6 { @Override public CommandManager getCommandManager(SenderMapper mapper) { return new NeoForgeServerCommandManager<>( diff --git a/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java b/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java similarity index 83% rename from modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java rename to modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java index 5eaec74..f015ed3 100644 --- a/modded/v1_21_1/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_1/NeoForge_v1_21_1.java +++ b/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.neoforge.v1_21_1; +package org.geysermc.geyser.adapters.neoforge.v1_20_6; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.server.ServerStartingEvent; -import org.geysermc.geyser.adapters.modded.v1_21_1.GeyserAdapter_v1_21_1; +import org.geysermc.geyser.adapters.modded.v1_20_6.GeyserAdapter_v1_20_6; @Mod("geyser_modded_adapters_1_21_5") -public class NeoForge_v1_21_1 { - public NeoForge_v1_21_1(IEventBus bus, ModContainer modContainer) { +public class NeoForge_v1_20_6 { + public NeoForge_v1_20_6(IEventBus bus, ModContainer modContainer) { bus.addListener(ServerStartingEvent.class, event -> { - GeyserAdapter_v1_21_1.setServer(event.getServer()); + GeyserAdapter_v1_20_6.setServer(event.getServer()); }); } } diff --git a/modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml similarity index 76% rename from modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml rename to modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 86dc143..5090d4e 100644 --- a/modded/v1_21_1/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -26,6 +26,13 @@ side="BOTH" [[dependencies.${id}]] modId="minecraft" type="required" -versionRange="[${minecraft_version},)" +versionRange="[${minecraft_version},1.21.4]" +ordering="NONE" +side="BOTH" + +[[dependencies.${id}]] +modId="geyser_neoforge" +type="required" +versionRange="[1.0.0,)" ordering="NONE" side="BOTH" diff --git a/modded/v1_21_5/fabric/build.gradle.kts b/modded/v1_21_5/fabric/build.gradle.kts index ed88ea5..cc1736f 100644 --- a/modded/v1_21_5/fabric/build.gradle.kts +++ b/modded/v1_21_5/fabric/build.gradle.kts @@ -55,6 +55,7 @@ dependencies { tasks { withType { + filteringCharset = "UTF-8" filesMatching("fabric.mod.json") { expand(metaProperties) } diff --git a/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json b/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json index 9331708..f20a3ae 100644 --- a/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json +++ b/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json @@ -20,6 +20,7 @@ "depends": { "fabricloader": ">=0.16.7", "fabric-api": "*", - "minecraft": ">=${minecraft_version}" + "minecraft": ">=${minecraft_version}", + "geyser-fabric": "*" } } \ No newline at end of file diff --git a/modded/v1_21_5/neoforge/build.gradle.kts b/modded/v1_21_5/neoforge/build.gradle.kts index a423887..c7b91b9 100644 --- a/modded/v1_21_5/neoforge/build.gradle.kts +++ b/modded/v1_21_5/neoforge/build.gradle.kts @@ -56,6 +56,7 @@ dependencies { tasks { withType { + filteringCharset = "UTF-8" filesMatching("META-INF/neoforge.mods.toml") { expand(metaProperties) } diff --git a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 86dc143..a542630 100644 --- a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -29,3 +29,10 @@ type="required" versionRange="[${minecraft_version},)" ordering="NONE" side="BOTH" + +[[dependencies.${id}]] +modId="geyser_neoforge" +type="required" +versionRange="[1.0.0,)" +ordering="NONE" +side="BOTH" diff --git a/settings.gradle.kts b/settings.gradle.kts index d32a292..99a0b26 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,8 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") rootProject.name = "geyser-adapters" include(":common") + +// Spigot include(":spigot") include(":spigot:all") include(":spigot:base") @@ -21,20 +23,25 @@ include(":spigot:v1_21_R1") include(":spigot:v1_21_R2") include(":spigot:v1_21_R3") +// Paper include(":paper") include(":paper:all") include(":paper:base") include(":paper:v766") include(":paper:v768") +// Modded // For whatever reason, the name cannot be ":modded:v1_21_5:common", the fabric and neoforge modules won't // be able to find the module, but if the name is unique like this, it's fine + +// 1.21.5+ include(":modded_common_v1_21_5") project(":modded_common_v1_21_5").projectDir = file("modded/v1_21_5/common") include(":modded:v1_21_5:fabric") include(":modded:v1_21_5:neoforge") -include(":modded_common_v1_21_1") -project(":modded_common_v1_21_1").projectDir = file("modded/v1_21_1/common") -include(":modded:v1_21_1:fabric") -include(":modded:v1_21_1:neoforge") +// 1.20.6 - 1.21.4 +include(":modded_common_v1_20_6") +project(":modded_common_v1_20_6").projectDir = file("modded/v1_20_6/common") +include(":modded:v1_20_6:fabric") +include(":modded:v1_20_6:neoforge") From 8e8db032aa6c63651da7209e938547038a36ad95 Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 12 Sep 2025 21:34:52 +0100 Subject: [PATCH 08/12] Shadow common, getCommandSenderDefinition, use different endpoint --- .../kotlin/adapters.modded-conventions.gradle.kts | 14 +++++++++----- .../kotlin/adapters.publish-conventions.gradle.kts | 5 +++++ .../geyser/adapters/CommandManagerAdapter.java | 2 ++ .../v1_20_6/CommandManagerAdapter_v1_20_6.java | 5 +++++ .../fabric/src/main/resources/fabric.mod.json | 2 +- .../v1_21_5/CommandManagerAdapter_v1_21_5.java | 5 +++++ .../fabric/src/main/resources/fabric.mod.json | 2 +- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts b/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts index 2068f6a..8bfa495 100644 --- a/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/adapters.modded-conventions.gradle.kts @@ -1,3 +1,6 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import net.fabricmc.loom.task.RemapJarTask + /* * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org * @@ -29,10 +32,10 @@ plugins { id("dev.architectury.loom") } -configurations { +project.configurations { create("shadowCommon") { isCanBeResolved = true - isCanBeConsumed = false + isCanBeConsumed = true isCanBeDeclared = true isTransitive = false } @@ -46,14 +49,15 @@ tasks.compileJava { options.encoding = "UTF-8" } -tasks.shadowJar { +val shadowJar = tasks.named("shadowJar") { configurations = listOf(project.configurations.getByName("shadowCommon")) archiveClassifier = "dev-shadow" } -tasks.remapJar { +tasks.named("remapJar") { injectAccessWidener = true - dependsOn(tasks.shadowJar) + dependsOn(shadowJar) + inputFile.set(shadowJar.get().archiveFile) } repositories { diff --git a/buildSrc/src/main/kotlin/adapters.publish-conventions.gradle.kts b/buildSrc/src/main/kotlin/adapters.publish-conventions.gradle.kts index 07b6584..548845d 100644 --- a/buildSrc/src/main/kotlin/adapters.publish-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/adapters.publish-conventions.gradle.kts @@ -41,9 +41,14 @@ publishing { /** * Subprojects are prefixed with the name of the parent project. e.g. "spigot-all" * Projects at the root level use the originalId. e.g. "common" + * + * e.g. for modded platforms "modded-v1_20_6-fabric" */ fun Project.determineArtifactId(originalId: String): String { if (project.parent != null && project.parent != rootProject) { + if (project.parent!!.parent != null && project.parent!!.parent != rootProject) { + return "${project.parent!!.parent!!.name}-${project.parent!!.name}-${project.name}" + } return "${project.parent!!.name}-${project.name}" } return originalId diff --git a/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java b/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java index b8484f1..ea93c7f 100644 --- a/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java +++ b/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java @@ -41,6 +41,8 @@ public abstract CommandManager getCommandManager( Consumer logger ); + public abstract CommandSenderDefinition getCommandSenderDefinition(P handle, Consumer logger); + public interface CommandSourceConverter { SenderMapper getSenderMapper( Class senderClass, diff --git a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java index 437e09f..a48b577 100644 --- a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java +++ b/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java @@ -57,5 +57,10 @@ public CommandManager getCommandManager( return getCommandManager(mapper); } + @Override + public CommandSenderDefinition getCommandSenderDefinition(ServerPlayer handle, Consumer logger) { + return new ModCommandSource(handle.createCommandSourceStack(), logger); + } + public abstract CommandManager getCommandManager(SenderMapper mapper); } diff --git a/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json b/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json index 73a158d..2130805 100644 --- a/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json +++ b/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json @@ -13,7 +13,7 @@ "icon": "assets/geyser/icon.png", "environment": "*", "entrypoints": { - "main": [ + "geyser:adapter": [ "org.geysermc.geyser.adapters.fabric.v1_20_6.Fabric_v1_20_6" ] }, diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java index 0b66870..ca1bf2e 100644 --- a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java +++ b/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java @@ -57,5 +57,10 @@ public CommandManager getCommandManager( return getCommandManager(mapper); } + @Override + public CommandSenderDefinition getCommandSenderDefinition(ServerPlayer handle, Consumer logger) { + return new ModCommandSource(handle.createCommandSourceStack(), logger); + } + public abstract CommandManager getCommandManager(SenderMapper mapper); } diff --git a/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json b/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json index f20a3ae..a6364d7 100644 --- a/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json +++ b/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json @@ -13,7 +13,7 @@ "icon": "assets/geyser/icon.png", "environment": "*", "entrypoints": { - "main": [ + "geyser:adapter": [ "org.geysermc.geyser.adapters.fabric.v1_21_5.Fabric_v1_21_5" ] }, From ff8082abe80f1007bae342385b187d9b3c664c5e Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 12 Sep 2025 22:10:06 +0100 Subject: [PATCH 09/12] Load before on NeoForge --- .../neoforge/src/main/resources/META-INF/neoforge.mods.toml | 2 +- .../neoforge/src/main/resources/META-INF/neoforge.mods.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 5090d4e..4896922 100644 --- a/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -34,5 +34,5 @@ side="BOTH" modId="geyser_neoforge" type="required" versionRange="[1.0.0,)" -ordering="NONE" +ordering="BEFORE" side="BOTH" diff --git a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml index a542630..317406d 100644 --- a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -34,5 +34,5 @@ side="BOTH" modId="geyser_neoforge" type="required" versionRange="[1.0.0,)" -ordering="NONE" +ordering="BEFORE" side="BOTH" From 9cca056f2ed3972a7900869b7a07e614a7fdb1bc Mon Sep 17 00:00:00 2001 From: Aurora Date: Sat, 4 Oct 2025 14:03:47 +0100 Subject: [PATCH 10/12] Support WorldManagers when using modded adapters --- .../adapters/CommandManagerAdapter.java | 12 ----- .../geyser/adapters/PlatformAdapters.java | 52 +++++++++++++++++++ .../fabric/v1_20_6/Fabric_v1_20_6.java | 5 +- .../neoforge/v1_20_6/NeoForge_v1_20_6.java | 7 ++- .../fabric/v1_21_5/Fabric_v1_21_5.java | 4 +- .../neoforge/v1_21_5/NeoForge_v1_21_5.java | 4 +- .../geyser/adapters/paper/PaperAdapters.java | 11 ++-- .../adapters/spigot/SpigotAdapters.java | 11 ++-- 8 files changed, 76 insertions(+), 30 deletions(-) create mode 100644 common/src/main/java/org/geysermc/geyser/adapters/PlatformAdapters.java diff --git a/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java b/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java index ea93c7f..e785d00 100644 --- a/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java +++ b/common/src/main/java/org/geysermc/geyser/adapters/CommandManagerAdapter.java @@ -52,16 +52,4 @@ SenderMapper getSenderMapper( Function commandSourceLookup ); } - - // This works because sub-mods are only loaded if the version matches correctly - // So the sub-mod can just set this field and the main mod can access this class - private static CommandManagerAdapter COMMAND_MANAGER_ADAPTER; - - public static CommandManagerAdapter get() { - return COMMAND_MANAGER_ADAPTER; - } - - public static void set(CommandManagerAdapter commandManagerAdapter) { - COMMAND_MANAGER_ADAPTER = commandManagerAdapter; - } } diff --git a/common/src/main/java/org/geysermc/geyser/adapters/PlatformAdapters.java b/common/src/main/java/org/geysermc/geyser/adapters/PlatformAdapters.java new file mode 100644 index 0000000..2e58fd1 --- /dev/null +++ b/common/src/main/java/org/geysermc/geyser/adapters/PlatformAdapters.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters; + +public final class PlatformAdapters { + private PlatformAdapters() {} // never to be + + private static CommandManagerAdapter COMMAND_MANAGER_ADAPTER; + + public static CommandManagerAdapter getCommandManagerAdapter() { + return COMMAND_MANAGER_ADAPTER; + } + + public static void setCommandManagerAdapter(CommandManagerAdapter commandManagerAdapter) { + if (COMMAND_MANAGER_ADAPTER != null) throw new IllegalStateException("CommandManagerAdapter has already been registered."); + COMMAND_MANAGER_ADAPTER = commandManagerAdapter; + } + + private static WorldAdapter WORLD_ADAPTER; + + public static WorldAdapter getWorldAdapter() { + return WORLD_ADAPTER; + } + + public static void setWorldAdapter(WorldAdapter worldAdapter) { + if (COMMAND_MANAGER_ADAPTER != null) throw new IllegalStateException("WorldAdapter has already been registered."); + WORLD_ADAPTER = worldAdapter; + } +} diff --git a/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java b/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java index 79436a6..511ba2f 100644 --- a/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java +++ b/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java @@ -28,12 +28,15 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_20_6.GeyserAdapter_v1_20_6; +import org.geysermc.geyser.adapters.modded.v1_20_6.WorldAdapter_v1_20_6; public class Fabric_v1_20_6 implements ModInitializer { @Override public void onInitialize() { ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_20_6::setServer); - CommandManagerAdapter.set(new FabricCommandManagerAdapter_v1_20_6()); + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_20_6()); + PlatformAdapters.setCommandManagerAdapter(new FabricCommandManagerAdapter_v1_20_6()); } } diff --git a/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java b/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java index f015ed3..c7d42b5 100644 --- a/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java +++ b/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java @@ -29,13 +29,18 @@ import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_20_6.GeyserAdapter_v1_20_6; +import org.geysermc.geyser.adapters.modded.v1_20_6.WorldAdapter_v1_20_6; -@Mod("geyser_modded_adapters_1_21_5") +@Mod("geyser_modded_adapters_1_20_6") public class NeoForge_v1_20_6 { public NeoForge_v1_20_6(IEventBus bus, ModContainer modContainer) { bus.addListener(ServerStartingEvent.class, event -> { GeyserAdapter_v1_20_6.setServer(event.getServer()); }); + + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_20_6()); + PlatformAdapters.setCommandManagerAdapter(new NeoForgeCommandManagerAdapter_v1_20_6()); } } diff --git a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java index 790f3fa..9d99498 100644 --- a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java +++ b/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java @@ -28,6 +28,7 @@ import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_21_5.GeyserAdapter_v1_21_5; import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; @@ -35,6 +36,7 @@ public class Fabric_v1_21_5 implements ModInitializer { @Override public void onInitialize() { ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_21_5::setServer); - CommandManagerAdapter.set(new FabricCommandManagerAdapter_v1_21_5()); + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_21_5()); + PlatformAdapters.setCommandManagerAdapter(new FabricCommandManagerAdapter_v1_21_5()); } } diff --git a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java index a97af35..5fc2739 100644 --- a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java +++ b/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java @@ -30,6 +30,7 @@ import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.server.ServerStartingEvent; import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_21_5.GeyserAdapter_v1_21_5; import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; @@ -40,6 +41,7 @@ public NeoForge_v1_21_5(IEventBus bus, ModContainer modContainer) { GeyserAdapter_v1_21_5.setServer(event.getServer()); }); - CommandManagerAdapter.set(new NeoForgeCommandManagerAdapter_v1_21_5()); + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_21_5()); + PlatformAdapters.setCommandManagerAdapter(new NeoForgeCommandManagerAdapter_v1_21_5()); } } diff --git a/paper/all/src/main/java/org/geysermc/geyser/adapters/paper/PaperAdapters.java b/paper/all/src/main/java/org/geysermc/geyser/adapters/paper/PaperAdapters.java index c7ecf82..385900a 100644 --- a/paper/all/src/main/java/org/geysermc/geyser/adapters/paper/PaperAdapters.java +++ b/paper/all/src/main/java/org/geysermc/geyser/adapters/paper/PaperAdapters.java @@ -25,11 +25,12 @@ package org.geysermc.geyser.adapters.paper; +import org.geysermc.geyser.adapters.PlatformAdapters; +import org.geysermc.geyser.adapters.WorldAdapter; + import java.util.Arrays; public final class PaperAdapters { - private static PaperWorldAdapter worldAdapter; - private static final int[] protocols = new int[] {766, 768}; public static void registerClosestWorldAdapter(int version) throws Exception { @@ -53,11 +54,7 @@ public static void registerClosestWorldAdapter(int version) throws Exception { public static void registerWorldAdapter(int version) throws Exception { // This way we can have classes loaded on later Java versions. Class adapterVersion = Class.forName("org.geysermc.geyser.adapters.paper.v" + version + ".WorldAdapter_v" + version); - worldAdapter = (PaperWorldAdapter) adapterVersion.getConstructor().newInstance(); - } - - public static PaperWorldAdapter getWorldAdapter() { - return worldAdapter; + PlatformAdapters.setWorldAdapter((WorldAdapter) adapterVersion.getConstructor().newInstance()); } private PaperAdapters() { diff --git a/spigot/all/src/main/java/org/geysermc/geyser/adapters/spigot/SpigotAdapters.java b/spigot/all/src/main/java/org/geysermc/geyser/adapters/spigot/SpigotAdapters.java index 146f669..ea1be36 100644 --- a/spigot/all/src/main/java/org/geysermc/geyser/adapters/spigot/SpigotAdapters.java +++ b/spigot/all/src/main/java/org/geysermc/geyser/adapters/spigot/SpigotAdapters.java @@ -25,17 +25,14 @@ package org.geysermc.geyser.adapters.spigot; -public final class SpigotAdapters { - private static SpigotWorldAdapter worldAdapter; +import org.geysermc.geyser.adapters.PlatformAdapters; +import org.geysermc.geyser.adapters.WorldAdapter; +public final class SpigotAdapters { public static void registerWorldAdapter(String version) throws Exception { // This way we can have classes loaded on later Java versions. Class adapterVersion = Class.forName("org.geysermc.geyser.adapters.spigot." + version + ".WorldAdapter_" + version); - worldAdapter = (SpigotWorldAdapter) adapterVersion.getConstructor().newInstance(); - } - - public static SpigotWorldAdapter getWorldAdapter() { - return worldAdapter; + PlatformAdapters.setWorldAdapter((WorldAdapter) adapterVersion.getConstructor().newInstance()); } private SpigotAdapters() { From a7acdec5cb182e5412aca81ee1f019dfd1c23a46 Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 5 Nov 2025 16:10:10 +0000 Subject: [PATCH 11/12] Update and split up modded adapters into world and command, support 1.18.2+ with world adapters --- buildSrc/src/main/kotlin/extensions.kt | 10 +-- .../command/v1_20_6/common/build.gradle.kts | 47 +++++++++++ .../CommandManagerAdapter_v1_20_6.java | 0 .../modded/v1_20_6/GeyserAdapter_v1_20_6.java | 0 .../v1_20_6/command/ModCommandSource.java | 0 .../v1_20_6/fabric/build.gradle.kts | 6 +- .../FabricCommandManagerAdapter_v1_20_6.java | 0 .../fabric/v1_20_6/Fabric_v1_20_6.java | 2 - .../fabric/src/main/resources/fabric.mod.json | 0 .../v1_20_6/neoforge/build.gradle.kts | 6 +- .../v1_20_6/neoforge/gradle.properties | 0 ...NeoForgeCommandManagerAdapter_v1_20_6.java | 0 .../neoforge/v1_20_6/NeoForge_v1_20_6.java | 4 +- .../resources/META-INF/neoforge.mods.toml | 0 .../command/v1_21_5/common/build.gradle.kts | 47 +++++++++++ .../CommandManagerAdapter_v1_21_5.java | 0 .../modded/v1_21_5/GeyserAdapter_v1_21_5.java | 0 .../v1_21_5/command/ModCommandSource.java | 0 .../v1_21_5/fabric/build.gradle.kts | 6 +- .../FabricCommandManagerAdapter_v1_21_5.java | 0 .../fabric/v1_21_5/Fabric_v1_21_5.java | 2 - .../fabric/src/main/resources/fabric.mod.json | 0 .../v1_21_5/neoforge/build.gradle.kts | 8 +- .../v1_21_5/neoforge/gradle.properties | 0 ...NeoForgeCommandManagerAdapter_v1_21_5.java | 0 .../neoforge/v1_21_5/NeoForge_v1_21_5.java | 4 +- .../resources/META-INF/neoforge.mods.toml | 0 .../v1_20_6/common/build.gradle.kts | 2 +- .../world/v1_20_6/GeyserAdapter_v1_20_6.java | 42 ++++++++++ .../world}/v1_20_6/WorldAdapter_v1_20_6.java | 34 +++++--- modded/world/v1_20_6/fabric/build.gradle.kts | 61 ++++++++++++++ .../fabric/world/v1_20_6/Fabric_v1_20_6.java | 41 ++++++++++ .../fabric/src/main/resources/fabric.mod.json | 26 ++++++ .../world/v1_20_6/neoforge/build.gradle.kts | 62 +++++++++++++++ .../world/v1_20_6/neoforge/gradle.properties | 1 + .../world/v1_20_6/NeoForge_v1_20_6.java | 45 +++++++++++ .../resources/META-INF/neoforge.mods.toml | 38 +++++++++ .../v1_21_3}/common/build.gradle.kts | 2 +- .../world/v1_21_3/GeyserAdapter_v1_21_3.java | 42 ++++++++++ .../world/v1_21_3/WorldAdapter_v1_21_3.java} | 9 +-- modded/world/v1_21_3/fabric/build.gradle.kts | 61 ++++++++++++++ .../fabric/world/v1_21_3/Fabric_v1_21_3.java | 40 ++++++++++ .../fabric/src/main/resources/fabric.mod.json | 26 ++++++ .../world/v1_21_3/neoforge/build.gradle.kts | 62 +++++++++++++++ .../world/v1_21_3/neoforge/gradle.properties | 1 + .../world/v1_21_3/NeoForge_v1_21_3.java | 45 +++++++++++ .../resources/META-INF/neoforge.mods.toml | 38 +++++++++ settings.gradle.kts | 79 +++++++++++-------- 48 files changed, 819 insertions(+), 80 deletions(-) create mode 100644 modded/command/v1_20_6/common/build.gradle.kts rename modded/{ => command}/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java (100%) rename modded/{ => command}/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java (100%) rename modded/{ => command}/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java (100%) rename modded/{ => command}/v1_20_6/fabric/build.gradle.kts (87%) rename modded/{ => command}/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java (100%) rename modded/{ => command}/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java (92%) rename modded/{ => command}/v1_20_6/fabric/src/main/resources/fabric.mod.json (100%) rename modded/{ => command}/v1_20_6/neoforge/build.gradle.kts (87%) rename modded/{ => command}/v1_20_6/neoforge/gradle.properties (100%) rename modded/{ => command}/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java (100%) rename modded/{ => command}/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java (91%) rename modded/{ => command}/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml (100%) create mode 100644 modded/command/v1_21_5/common/build.gradle.kts rename modded/{ => command}/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java (100%) rename modded/{ => command}/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java (100%) rename modded/{ => command}/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java (100%) rename modded/{ => command}/v1_21_5/fabric/build.gradle.kts (87%) rename modded/{ => command}/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java (100%) rename modded/{ => command}/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java (92%) rename modded/{ => command}/v1_21_5/fabric/src/main/resources/fabric.mod.json (100%) rename modded/{ => command}/v1_21_5/neoforge/build.gradle.kts (85%) rename modded/{ => command}/v1_21_5/neoforge/gradle.properties (100%) rename modded/{ => command}/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java (100%) rename modded/{ => command}/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java (91%) rename modded/{ => command}/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml (100%) rename modded/{ => world}/v1_20_6/common/build.gradle.kts (97%) create mode 100644 modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/GeyserAdapter_v1_20_6.java rename modded/{v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded => world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world}/v1_20_6/WorldAdapter_v1_20_6.java (73%) create mode 100644 modded/world/v1_20_6/fabric/build.gradle.kts create mode 100644 modded/world/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_20_6/Fabric_v1_20_6.java create mode 100644 modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json create mode 100644 modded/world/v1_20_6/neoforge/build.gradle.kts create mode 100644 modded/world/v1_20_6/neoforge/gradle.properties create mode 100644 modded/world/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_20_6/NeoForge_v1_20_6.java create mode 100644 modded/world/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml rename modded/{v1_21_5 => world/v1_21_3}/common/build.gradle.kts (97%) create mode 100644 modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/GeyserAdapter_v1_21_3.java rename modded/{v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java => world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/WorldAdapter_v1_21_3.java} (91%) create mode 100644 modded/world/v1_21_3/fabric/build.gradle.kts create mode 100644 modded/world/v1_21_3/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_21_3/Fabric_v1_21_3.java create mode 100644 modded/world/v1_21_3/fabric/src/main/resources/fabric.mod.json create mode 100644 modded/world/v1_21_3/neoforge/build.gradle.kts create mode 100644 modded/world/v1_21_3/neoforge/gradle.properties create mode 100644 modded/world/v1_21_3/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_21_3/NeoForge_v1_21_3.java create mode 100644 modded/world/v1_21_3/neoforge/src/main/resources/META-INF/neoforge.mods.toml diff --git a/buildSrc/src/main/kotlin/extensions.kt b/buildSrc/src/main/kotlin/extensions.kt index b594438..e7af298 100644 --- a/buildSrc/src/main/kotlin/extensions.kt +++ b/buildSrc/src/main/kotlin/extensions.kt @@ -55,13 +55,13 @@ import org.gradle.language.jvm.tasks.ProcessResources * @link https://github.com/GeyserMC/Geyser */ -fun Project.minecraftVersion(version: String): Map { - return this.minecraftVersion(version, HashMap()) +fun Project.minecraftVersion(version: String, type: String): Map { + return this.minecraftVersion(version, type, HashMap()) } -fun Project.minecraftVersion(version: String, bonusData: Map): Map { +fun Project.minecraftVersion(version: String, type: String, bonusData: Map): Map { val metaProperties = HashMap() - metaProperties["id"] = "geyser_modded_adapters_v${version.replace('.', '_')}" + metaProperties["id"] = "geyser_modded_${type}_adapters_v${version.replace('.', '_')}" metaProperties["minecraft_version"] = version val fabricLoaderVersion = "0.17.2" @@ -80,7 +80,7 @@ fun Project.minecraftVersion(version: String, bonusData: Map): M metaProperties.putAll(bonusData) metaProperties.putAll( mapOf( - "name" to "Geyser Mod Adapter", + "name" to "Geyser Mod Adapter (${type})", "description" to "An adapter to access version-specific data in modded versions of Minecraft.", "author" to "GeyserMC", "website" to "https://geysermc.org", diff --git a/modded/command/v1_20_6/common/build.gradle.kts b/modded/command/v1_20_6/common/build.gradle.kts new file mode 100644 index 0000000..06d7188 --- /dev/null +++ b/modded/command/v1_20_6/common/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + common("fabric", "neoforge") +} + +minecraftVersion("1.20.6", "command") + +dependencies { + implementation(project(":common")) +} diff --git a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java b/modded/command/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java similarity index 100% rename from modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java rename to modded/command/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/CommandManagerAdapter_v1_20_6.java diff --git a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java b/modded/command/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java similarity index 100% rename from modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java rename to modded/command/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/GeyserAdapter_v1_20_6.java diff --git a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java b/modded/command/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java similarity index 100% rename from modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java rename to modded/command/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/command/ModCommandSource.java diff --git a/modded/v1_20_6/fabric/build.gradle.kts b/modded/command/v1_20_6/fabric/build.gradle.kts similarity index 87% rename from modded/v1_20_6/fabric/build.gradle.kts rename to modded/command/v1_20_6/fabric/build.gradle.kts index a2a3558..07151f6 100644 --- a/modded/v1_20_6/fabric/build.gradle.kts +++ b/modded/command/v1_20_6/fabric/build.gradle.kts @@ -27,7 +27,7 @@ plugins { id("adapters.modded-conventions") } -val metaProperties = minecraftVersion("1.20.6") +val metaProperties = minecraftVersion("1.20.6", "command") java { sourceCompatibility = JavaVersion.VERSION_21 @@ -45,8 +45,8 @@ architectury { dependencies { modApi("net.fabricmc.fabric-api:fabric-api:0.100.8+1.20.6") - api(project(path = ":modded_common_v1_20_6", configuration = "namedElements")) - shadowCommon(project(path = ":modded_common_v1_20_6", configuration = "transformProductionFabric")) + api(project(path = ":modded_command_common_v1_20_6", configuration = "namedElements")) + shadowCommon(project(path = ":modded_command_common_v1_20_6", configuration = "transformProductionFabric")) compileOnly(project(":common")) modImplementation("org.incendo:cloud-fabric:2.0.0-beta.10") diff --git a/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java b/modded/command/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java similarity index 100% rename from modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java rename to modded/command/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/FabricCommandManagerAdapter_v1_20_6.java diff --git a/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java b/modded/command/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java similarity index 92% rename from modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java rename to modded/command/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java index 511ba2f..ca2fca7 100644 --- a/modded/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java +++ b/modded/command/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_20_6/Fabric_v1_20_6.java @@ -30,13 +30,11 @@ import org.geysermc.geyser.adapters.CommandManagerAdapter; import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_20_6.GeyserAdapter_v1_20_6; -import org.geysermc.geyser.adapters.modded.v1_20_6.WorldAdapter_v1_20_6; public class Fabric_v1_20_6 implements ModInitializer { @Override public void onInitialize() { ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_20_6::setServer); - PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_20_6()); PlatformAdapters.setCommandManagerAdapter(new FabricCommandManagerAdapter_v1_20_6()); } } diff --git a/modded/v1_20_6/fabric/src/main/resources/fabric.mod.json b/modded/command/v1_20_6/fabric/src/main/resources/fabric.mod.json similarity index 100% rename from modded/v1_20_6/fabric/src/main/resources/fabric.mod.json rename to modded/command/v1_20_6/fabric/src/main/resources/fabric.mod.json diff --git a/modded/v1_20_6/neoforge/build.gradle.kts b/modded/command/v1_20_6/neoforge/build.gradle.kts similarity index 87% rename from modded/v1_20_6/neoforge/build.gradle.kts rename to modded/command/v1_20_6/neoforge/build.gradle.kts index 8e09ff8..dcd6873 100644 --- a/modded/v1_20_6/neoforge/build.gradle.kts +++ b/modded/command/v1_20_6/neoforge/build.gradle.kts @@ -28,7 +28,7 @@ plugins { } val neoVersion = "20.6.138" -val metaProperties = minecraftVersion("1.20.6", mapOf("neo_version" to neoVersion)) +val metaProperties = minecraftVersion("1.20.6", "command", mapOf("neo_version" to neoVersion)) java { sourceCompatibility = JavaVersion.VERSION_21 @@ -46,8 +46,8 @@ architectury { dependencies { neoForge("net.neoforged:neoforge:$neoVersion") - api(project(":modded_common_v1_20_6", configuration = "namedElements")) - shadowCommon(project(":modded_common_v1_20_6", configuration = "transformProductionNeoForge")) + api(project(":modded_command_common_v1_20_6", configuration = "namedElements")) + shadowCommon(project(":modded_command_common_v1_20_6", configuration = "transformProductionNeoForge")) compileOnly(project(":common")) modImplementation("org.incendo:cloud-neoforge:2.0.0-beta.10") diff --git a/modded/v1_20_6/neoforge/gradle.properties b/modded/command/v1_20_6/neoforge/gradle.properties similarity index 100% rename from modded/v1_20_6/neoforge/gradle.properties rename to modded/command/v1_20_6/neoforge/gradle.properties diff --git a/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java b/modded/command/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java similarity index 100% rename from modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java rename to modded/command/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForgeCommandManagerAdapter_v1_20_6.java diff --git a/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java b/modded/command/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java similarity index 91% rename from modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java rename to modded/command/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java index c7d42b5..4d8c045 100644 --- a/modded/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java +++ b/modded/command/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_20_6/NeoForge_v1_20_6.java @@ -31,16 +31,14 @@ import net.neoforged.neoforge.event.server.ServerStartingEvent; import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_20_6.GeyserAdapter_v1_20_6; -import org.geysermc.geyser.adapters.modded.v1_20_6.WorldAdapter_v1_20_6; -@Mod("geyser_modded_adapters_1_20_6") +@Mod("geyser_modded_command_adapters_1_20_6") public class NeoForge_v1_20_6 { public NeoForge_v1_20_6(IEventBus bus, ModContainer modContainer) { bus.addListener(ServerStartingEvent.class, event -> { GeyserAdapter_v1_20_6.setServer(event.getServer()); }); - PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_20_6()); PlatformAdapters.setCommandManagerAdapter(new NeoForgeCommandManagerAdapter_v1_20_6()); } } diff --git a/modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/command/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml similarity index 100% rename from modded/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml rename to modded/command/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml diff --git a/modded/command/v1_21_5/common/build.gradle.kts b/modded/command/v1_21_5/common/build.gradle.kts new file mode 100644 index 0000000..0b4117f --- /dev/null +++ b/modded/command/v1_21_5/common/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + common("fabric", "neoforge") +} + +minecraftVersion("1.21.5", "command") + +dependencies { + implementation(project(":common")) +} diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java b/modded/command/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java similarity index 100% rename from modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java rename to modded/command/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/CommandManagerAdapter_v1_21_5.java diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java b/modded/command/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java similarity index 100% rename from modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java rename to modded/command/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/GeyserAdapter_v1_21_5.java diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java b/modded/command/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java similarity index 100% rename from modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java rename to modded/command/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/command/ModCommandSource.java diff --git a/modded/v1_21_5/fabric/build.gradle.kts b/modded/command/v1_21_5/fabric/build.gradle.kts similarity index 87% rename from modded/v1_21_5/fabric/build.gradle.kts rename to modded/command/v1_21_5/fabric/build.gradle.kts index cc1736f..96f3186 100644 --- a/modded/v1_21_5/fabric/build.gradle.kts +++ b/modded/command/v1_21_5/fabric/build.gradle.kts @@ -27,7 +27,7 @@ plugins { id("adapters.modded-conventions") } -val metaProperties = minecraftVersion("1.21.5") +val metaProperties = minecraftVersion("1.21.5", "command") java { sourceCompatibility = JavaVersion.VERSION_21 @@ -45,8 +45,8 @@ architectury { dependencies { modApi("net.fabricmc.fabric-api:fabric-api:0.128.2+1.21.5") - api(project(path = ":modded_common_v1_21_5", configuration = "namedElements")) - shadowCommon(project(path = ":modded_common_v1_21_5", configuration = "transformProductionFabric")) + api(project(path = ":modded_command_common_v1_21_5", configuration = "namedElements")) + shadowCommon(project(path = ":modded_command_common_v1_21_5", configuration = "transformProductionFabric")) compileOnly(project(":common")) modImplementation("org.incendo:cloud-fabric:2.0.0-beta.12") diff --git a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java b/modded/command/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java similarity index 100% rename from modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java rename to modded/command/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/FabricCommandManagerAdapter_v1_21_5.java diff --git a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java b/modded/command/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java similarity index 92% rename from modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java rename to modded/command/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java index 9d99498..6f2df2c 100644 --- a/modded/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java +++ b/modded/command/v1_21_5/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/v1_21_5/Fabric_v1_21_5.java @@ -30,13 +30,11 @@ import org.geysermc.geyser.adapters.CommandManagerAdapter; import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_21_5.GeyserAdapter_v1_21_5; -import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; public class Fabric_v1_21_5 implements ModInitializer { @Override public void onInitialize() { ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_21_5::setServer); - PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_21_5()); PlatformAdapters.setCommandManagerAdapter(new FabricCommandManagerAdapter_v1_21_5()); } } diff --git a/modded/v1_21_5/fabric/src/main/resources/fabric.mod.json b/modded/command/v1_21_5/fabric/src/main/resources/fabric.mod.json similarity index 100% rename from modded/v1_21_5/fabric/src/main/resources/fabric.mod.json rename to modded/command/v1_21_5/fabric/src/main/resources/fabric.mod.json diff --git a/modded/v1_21_5/neoforge/build.gradle.kts b/modded/command/v1_21_5/neoforge/build.gradle.kts similarity index 85% rename from modded/v1_21_5/neoforge/build.gradle.kts rename to modded/command/v1_21_5/neoforge/build.gradle.kts index c7b91b9..31e6ec8 100644 --- a/modded/v1_21_5/neoforge/build.gradle.kts +++ b/modded/command/v1_21_5/neoforge/build.gradle.kts @@ -27,8 +27,8 @@ plugins { id("adapters.modded-conventions") } -val neoVersion = "21.5.91" -val metaProperties = minecraftVersion("1.21.5", mapOf("neo_version" to neoVersion)) +val neoVersion = "21.5.95" +val metaProperties = minecraftVersion("1.21.5", "command", mapOf("neo_version" to neoVersion)) java { sourceCompatibility = JavaVersion.VERSION_21 @@ -46,8 +46,8 @@ architectury { dependencies { neoForge("net.neoforged:neoforge:$neoVersion") - api(project(":modded_common_v1_21_5", configuration = "namedElements")) - shadowCommon(project(":modded_common_v1_21_5", configuration = "transformProductionNeoForge")) + api(project(":modded_command_common_v1_21_5", configuration = "namedElements")) + shadowCommon(project(":modded_command_common_v1_21_5", configuration = "transformProductionNeoForge")) compileOnly(project(":common")) modImplementation("org.incendo:cloud-neoforge:2.0.0-beta.12") diff --git a/modded/v1_21_5/neoforge/gradle.properties b/modded/command/v1_21_5/neoforge/gradle.properties similarity index 100% rename from modded/v1_21_5/neoforge/gradle.properties rename to modded/command/v1_21_5/neoforge/gradle.properties diff --git a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java b/modded/command/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java similarity index 100% rename from modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java rename to modded/command/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForgeCommandManagerAdapter_v1_21_5.java diff --git a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java b/modded/command/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java similarity index 91% rename from modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java rename to modded/command/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java index 5fc2739..596d82a 100644 --- a/modded/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java +++ b/modded/command/v1_21_5/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/v1_21_5/NeoForge_v1_21_5.java @@ -32,16 +32,14 @@ import org.geysermc.geyser.adapters.CommandManagerAdapter; import org.geysermc.geyser.adapters.PlatformAdapters; import org.geysermc.geyser.adapters.modded.v1_21_5.GeyserAdapter_v1_21_5; -import org.geysermc.geyser.adapters.modded.v1_21_5.WorldAdapter_v1_21_5; -@Mod("geyser_modded_adapters_1_21_5") +@Mod("geyser_command_modded_adapters_1_21_5") public class NeoForge_v1_21_5 { public NeoForge_v1_21_5(IEventBus bus, ModContainer modContainer) { bus.addListener(ServerStartingEvent.class, event -> { GeyserAdapter_v1_21_5.setServer(event.getServer()); }); - PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_21_5()); PlatformAdapters.setCommandManagerAdapter(new NeoForgeCommandManagerAdapter_v1_21_5()); } } diff --git a/modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/command/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml similarity index 100% rename from modded/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml rename to modded/command/v1_21_5/neoforge/src/main/resources/META-INF/neoforge.mods.toml diff --git a/modded/v1_20_6/common/build.gradle.kts b/modded/world/v1_20_6/common/build.gradle.kts similarity index 97% rename from modded/v1_20_6/common/build.gradle.kts rename to modded/world/v1_20_6/common/build.gradle.kts index 7f2e115..287360a 100644 --- a/modded/v1_20_6/common/build.gradle.kts +++ b/modded/world/v1_20_6/common/build.gradle.kts @@ -40,7 +40,7 @@ architectury { common("fabric", "neoforge") } -minecraftVersion("1.20.6") +minecraftVersion("1.20.6", "world") dependencies { implementation(project(":common")) diff --git a/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/GeyserAdapter_v1_20_6.java b/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/GeyserAdapter_v1_20_6.java new file mode 100644 index 0000000..d66fe5b --- /dev/null +++ b/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/GeyserAdapter_v1_20_6.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.world.v1_20_6; + +import net.minecraft.server.MinecraftServer; + +public class GeyserAdapter_v1_20_6 { + private static MinecraftServer server; + + public static void setServer(MinecraftServer server) { + if (GeyserAdapter_v1_20_6.server != null) throw new IllegalStateException("Server is already defined."); + + GeyserAdapter_v1_20_6.server = server; + } + + public static MinecraftServer getServer() { + return server; + } +} diff --git a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java b/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java similarity index 73% rename from modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java rename to modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java index eaf0170..931f9ab 100644 --- a/modded/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_20_6/WorldAdapter_v1_20_6.java +++ b/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.modded.v1_20_6; +package org.geysermc.geyser.adapters.modded.world.v1_20_6; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; @@ -44,7 +44,13 @@ public class WorldAdapter_v1_20_6 extends WorldAdapter { @Override public int getBlockAt(ServerLevel world, int x, int y, int z) { - if (y < world.getMinBuildHeight()) { + int minHeight = 0; + + try { + minHeight = world.getMinBuildHeight(); // Modern features, not available in 1.16.5 + } catch (NoSuchMethodError ignored) {} + + if (y < minHeight) { return 0; } @@ -64,18 +70,22 @@ public IntList getAllBlockStates() { @Override public String[] getBiomeSuggestions(boolean tags) { - if (GeyserAdapter_v1_20_6.getServer() == null) return new String[]{}; + try { + if (GeyserAdapter_v1_20_6.getServer() == null) return new String[]{}; - Registry registry = GeyserAdapter_v1_20_6.getServer() - .registryAccess() - .registry(Registries.BIOME).orElseThrow(); - if (!tags) { - return getBiomes(registry).toArray(String[]::new); - } + Registry registry = GeyserAdapter_v1_20_6.getServer() + .registryAccess() + .registry(Registries.BIOME).orElseThrow(); + if (!tags) { + return getBiomes(registry).toArray(String[]::new); + } - List keys = new ArrayList<>(registry.getTagNames().map(tag -> "#" + tag.location()).toList()); - keys.addAll(getBiomes(registry).toList()); - return keys.toArray(new String[0]); + List keys = new ArrayList<>(registry.getTagNames().map(tag -> "#" + tag.location()).toList()); + keys.addAll(getBiomes(registry).toList()); + return keys.toArray(new String[0]); + } catch (NoClassDefFoundError ignored) { + return null; + } } private Stream getBiomes(Registry registry) { diff --git a/modded/world/v1_20_6/fabric/build.gradle.kts b/modded/world/v1_20_6/fabric/build.gradle.kts new file mode 100644 index 0000000..091eede --- /dev/null +++ b/modded/world/v1_20_6/fabric/build.gradle.kts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val metaProperties = minecraftVersion("1.20.6", "world") + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + fabric() +} + +dependencies { + modApi("net.fabricmc.fabric-api:fabric-api:0.100.8+1.20.6") + + api(project(path = ":modded_world_common_v1_20_6", configuration = "namedElements")) + shadowCommon(project(path = ":modded_world_common_v1_20_6", configuration = "transformProductionFabric")) + + compileOnly(project(":common")) +} + +tasks { + withType { + filteringCharset = "UTF-8" + filesMatching("fabric.mod.json") { + expand(metaProperties) + } + } +} diff --git a/modded/world/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_20_6/Fabric_v1_20_6.java b/modded/world/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_20_6/Fabric_v1_20_6.java new file mode 100644 index 0000000..c585f54 --- /dev/null +++ b/modded/world/v1_20_6/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_20_6/Fabric_v1_20_6.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.fabric.world.v1_20_6; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import org.geysermc.geyser.adapters.CommandManagerAdapter; +import org.geysermc.geyser.adapters.PlatformAdapters; +import org.geysermc.geyser.adapters.modded.world.v1_20_6.GeyserAdapter_v1_20_6; +import org.geysermc.geyser.adapters.modded.world.v1_20_6.WorldAdapter_v1_20_6; + +public class Fabric_v1_20_6 implements ModInitializer { + @Override + public void onInitialize() { + ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_20_6::setServer); + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_20_6()); + } +} diff --git a/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json b/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..267001f --- /dev/null +++ b/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,26 @@ +{ + "schemaVersion": 1, + "id": "${id}", + "version": "${version}", + "name": "${name}", + "description": "${description}", + "authors": ["${author}"], + "contact": { + "website": "${website}", + "repo": "https://github.com/GeyserMC/geyser-adapters" + }, + "license": "${license}", + "icon": "assets/geyser/icon.png", + "environment": "*", + "entrypoints": { + "geyser:adapter": [ + "org.geysermc.geyser.adapters.fabric.world.v1_20_6.Fabric_v1_20_6" + ] + }, + "depends": { + "fabricloader": ">=0.16.7", + "fabric-api": "*", + "minecraft": "1.18.2 1.19 1.20", + "geyser-fabric": "*" + } +} \ No newline at end of file diff --git a/modded/world/v1_20_6/neoforge/build.gradle.kts b/modded/world/v1_20_6/neoforge/build.gradle.kts new file mode 100644 index 0000000..304fdd0 --- /dev/null +++ b/modded/world/v1_20_6/neoforge/build.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val neoVersion = "20.6.138" +val metaProperties = minecraftVersion("1.20.6", "world", mapOf("neo_version" to neoVersion)) + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +dependencies { + neoForge("net.neoforged:neoforge:$neoVersion") + + api(project(":modded_world_common_v1_20_6", configuration = "namedElements")) + shadowCommon(project(":modded_world_common_v1_20_6", configuration = "transformProductionNeoForge")) + + compileOnly(project(":common")) +} + +tasks { + withType { + filteringCharset = "UTF-8" + filesMatching("META-INF/neoforge.mods.toml") { + expand(metaProperties) + } + } +} diff --git a/modded/world/v1_20_6/neoforge/gradle.properties b/modded/world/v1_20_6/neoforge/gradle.properties new file mode 100644 index 0000000..2914393 --- /dev/null +++ b/modded/world/v1_20_6/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge \ No newline at end of file diff --git a/modded/world/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_20_6/NeoForge_v1_20_6.java b/modded/world/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_20_6/NeoForge_v1_20_6.java new file mode 100644 index 0000000..55b4c30 --- /dev/null +++ b/modded/world/v1_20_6/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_20_6/NeoForge_v1_20_6.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.neoforge.world.v1_20_6; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.geysermc.geyser.adapters.PlatformAdapters; +import org.geysermc.geyser.adapters.modded.world.v1_20_6.GeyserAdapter_v1_20_6; +import org.geysermc.geyser.adapters.modded.world.v1_20_6.WorldAdapter_v1_20_6; + +@Mod("geyser_modded_world_adapters_1_20_6") +public class NeoForge_v1_20_6 { + public NeoForge_v1_20_6(IEventBus bus, ModContainer modContainer) { + bus.addListener(ServerStartingEvent.class, event -> { + GeyserAdapter_v1_20_6.setServer(event.getServer()); + }); + + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_20_6()); + } +} diff --git a/modded/world/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/world/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..b45f12a --- /dev/null +++ b/modded/world/v1_20_6/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,38 @@ +modLoader="javafml" +loaderVersion="[1,)" +license="${license}" + +[[mods]] +modId="${id}" +version="${version}" +displayName="${name}" +displayURL="${website}" +authors="${author}" +description='''${description}''' + +#[[mixins]] +#config="${id}.mixins.json" + +#[[accessTransformers]] +#file="META-INF/accesstransformer.cfg" + +[[dependencies.${id}]] +modId="neoforge" +type="required" +versionRange="[${neo_version},)" +ordering="NONE" +side="BOTH" + +[[dependencies.${id}]] +modId="minecraft" +type="required" +versionRange="[${minecraft_version},1.20.2]" +ordering="NONE" +side="BOTH" + +[[dependencies.${id}]] +modId="geyser_neoforge" +type="required" +versionRange="[1.0.0,)" +ordering="BEFORE" +side="BOTH" diff --git a/modded/v1_21_5/common/build.gradle.kts b/modded/world/v1_21_3/common/build.gradle.kts similarity index 97% rename from modded/v1_21_5/common/build.gradle.kts rename to modded/world/v1_21_3/common/build.gradle.kts index c89cdd8..6976967 100644 --- a/modded/v1_21_5/common/build.gradle.kts +++ b/modded/world/v1_21_3/common/build.gradle.kts @@ -40,7 +40,7 @@ architectury { common("fabric", "neoforge") } -minecraftVersion("1.21.5") +minecraftVersion("1.21.3", "world") dependencies { implementation(project(":common")) diff --git a/modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/GeyserAdapter_v1_21_3.java b/modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/GeyserAdapter_v1_21_3.java new file mode 100644 index 0000000..01e21c0 --- /dev/null +++ b/modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/GeyserAdapter_v1_21_3.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.modded.world.v1_21_3; + +import net.minecraft.server.MinecraftServer; + +public class GeyserAdapter_v1_21_3 { + private static MinecraftServer server; + + public static void setServer(MinecraftServer server) { + if (GeyserAdapter_v1_21_3.server != null) throw new IllegalStateException("Server is already defined."); + + GeyserAdapter_v1_21_3.server = server; + } + + public static MinecraftServer getServer() { + return server; + } +} diff --git a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java b/modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/WorldAdapter_v1_21_3.java similarity index 91% rename from modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java rename to modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/WorldAdapter_v1_21_3.java index e963a43..1cb0f1f 100644 --- a/modded/v1_21_5/common/src/main/java/org/geysermc/geyser/adapters/modded/v1_21_5/WorldAdapter_v1_21_5.java +++ b/modded/world/v1_21_3/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_21_3/WorldAdapter_v1_21_3.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.adapters.modded.v1_21_5; +package org.geysermc.geyser.adapters.modded.world.v1_21_3; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; @@ -31,7 +31,6 @@ import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; @@ -42,7 +41,7 @@ import java.util.List; import java.util.stream.Stream; -public class WorldAdapter_v1_21_5 extends WorldAdapter { +public class WorldAdapter_v1_21_3 extends WorldAdapter { @Override public int getBlockAt(ServerLevel world, int x, int y, int z) { if (y < world.getMinY()) { @@ -65,9 +64,9 @@ public IntList getAllBlockStates() { @Override public String[] getBiomeSuggestions(boolean tags) { - if (GeyserAdapter_v1_21_5.getServer() == null) return new String[]{}; + if (GeyserAdapter_v1_21_3.getServer() == null) return new String[]{}; - Registry registry = GeyserAdapter_v1_21_5.getServer().registryAccess() + Registry registry = GeyserAdapter_v1_21_3.getServer().registryAccess() .lookupOrThrow(Registries.BIOME); if (!tags) { return getBiomes(registry).toArray(String[]::new); diff --git a/modded/world/v1_21_3/fabric/build.gradle.kts b/modded/world/v1_21_3/fabric/build.gradle.kts new file mode 100644 index 0000000..0bf3d7f --- /dev/null +++ b/modded/world/v1_21_3/fabric/build.gradle.kts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val metaProperties = minecraftVersion("1.21.3", "world") + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + fabric() +} + +dependencies { + modApi("net.fabricmc.fabric-api:fabric-api:0.114.1+1.21.3") + + api(project(path = ":modded_world_common_v1_21_3", configuration = "namedElements")) + shadowCommon(project(path = ":modded_world_common_v1_21_3", configuration = "transformProductionFabric")) + + compileOnly(project(":common")) +} + +tasks { + withType { + filteringCharset = "UTF-8" + filesMatching("fabric.mod.json") { + expand(metaProperties) + } + } +} diff --git a/modded/world/v1_21_3/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_21_3/Fabric_v1_21_3.java b/modded/world/v1_21_3/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_21_3/Fabric_v1_21_3.java new file mode 100644 index 0000000..db21892 --- /dev/null +++ b/modded/world/v1_21_3/fabric/src/main/java/org/geysermc/geyser/adapters/fabric/world/v1_21_3/Fabric_v1_21_3.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.fabric.world.v1_21_3; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import org.geysermc.geyser.adapters.PlatformAdapters; +import org.geysermc.geyser.adapters.modded.world.v1_21_3.GeyserAdapter_v1_21_3; +import org.geysermc.geyser.adapters.modded.world.v1_21_3.WorldAdapter_v1_21_3; + +public class Fabric_v1_21_3 implements ModInitializer { + @Override + public void onInitialize() { + ServerLifecycleEvents.SERVER_STARTING.register(GeyserAdapter_v1_21_3::setServer); + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_21_3()); + } +} diff --git a/modded/world/v1_21_3/fabric/src/main/resources/fabric.mod.json b/modded/world/v1_21_3/fabric/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..a6364d7 --- /dev/null +++ b/modded/world/v1_21_3/fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,26 @@ +{ + "schemaVersion": 1, + "id": "${id}", + "version": "${version}", + "name": "${name}", + "description": "${description}", + "authors": ["${author}"], + "contact": { + "website": "${website}", + "repo": "https://github.com/GeyserMC/geyser-adapters" + }, + "license": "${license}", + "icon": "assets/geyser/icon.png", + "environment": "*", + "entrypoints": { + "geyser:adapter": [ + "org.geysermc.geyser.adapters.fabric.v1_21_5.Fabric_v1_21_5" + ] + }, + "depends": { + "fabricloader": ">=0.16.7", + "fabric-api": "*", + "minecraft": ">=${minecraft_version}", + "geyser-fabric": "*" + } +} \ No newline at end of file diff --git a/modded/world/v1_21_3/neoforge/build.gradle.kts b/modded/world/v1_21_3/neoforge/build.gradle.kts new file mode 100644 index 0000000..bbdf4e0 --- /dev/null +++ b/modded/world/v1_21_3/neoforge/build.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +plugins { + id("adapters.modded-conventions") +} + +val neoVersion = "21.3.94" +val metaProperties = minecraftVersion("1.21.3", "world", mapOf("neo_version" to neoVersion)) + +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +dependencies { + neoForge("net.neoforged:neoforge:$neoVersion") + + api(project(":modded_world_common_v1_21_3", configuration = "namedElements")) + shadowCommon(project(":modded_world_common_v1_21_3", configuration = "transformProductionNeoForge")) + + compileOnly(project(":common")) +} + +tasks { + withType { + filteringCharset = "UTF-8" + filesMatching("META-INF/neoforge.mods.toml") { + expand(metaProperties) + } + } +} diff --git a/modded/world/v1_21_3/neoforge/gradle.properties b/modded/world/v1_21_3/neoforge/gradle.properties new file mode 100644 index 0000000..2914393 --- /dev/null +++ b/modded/world/v1_21_3/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge \ No newline at end of file diff --git a/modded/world/v1_21_3/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_21_3/NeoForge_v1_21_3.java b/modded/world/v1_21_3/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_21_3/NeoForge_v1_21_3.java new file mode 100644 index 0000000..8f564ae --- /dev/null +++ b/modded/world/v1_21_3/neoforge/src/main/java/org/geysermc/geyser/adapters/neoforge/world/v1_21_3/NeoForge_v1_21_3.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019-2025 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.geyser.adapters.neoforge.world.v1_21_3; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.geysermc.geyser.adapters.PlatformAdapters; +import org.geysermc.geyser.adapters.modded.world.v1_21_3.GeyserAdapter_v1_21_3; +import org.geysermc.geyser.adapters.modded.world.v1_21_3.WorldAdapter_v1_21_3; + +@Mod("geyser_modded_world_adapters_1_21_3") +public class NeoForge_v1_21_3 { + public NeoForge_v1_21_3(IEventBus bus, ModContainer modContainer) { + bus.addListener(ServerStartingEvent.class, event -> { + GeyserAdapter_v1_21_3.setServer(event.getServer()); + }); + + PlatformAdapters.setWorldAdapter(new WorldAdapter_v1_21_3()); + } +} diff --git a/modded/world/v1_21_3/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/modded/world/v1_21_3/neoforge/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..317406d --- /dev/null +++ b/modded/world/v1_21_3/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,38 @@ +modLoader="javafml" +loaderVersion="[1,)" +license="${license}" + +[[mods]] +modId="${id}" +version="${version}" +displayName="${name}" +displayURL="${website}" +authors="${author}" +description='''${description}''' + +#[[mixins]] +#config="${id}.mixins.json" + +#[[accessTransformers]] +#file="META-INF/accesstransformer.cfg" + +[[dependencies.${id}]] +modId="neoforge" +type="required" +versionRange="[${neo_version},)" +ordering="NONE" +side="BOTH" + +[[dependencies.${id}]] +modId="minecraft" +type="required" +versionRange="[${minecraft_version},)" +ordering="NONE" +side="BOTH" + +[[dependencies.${id}]] +modId="geyser_neoforge" +type="required" +versionRange="[1.0.0,)" +ordering="BEFORE" +side="BOTH" diff --git a/settings.gradle.kts b/settings.gradle.kts index 99a0b26..0c0835e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,42 +6,55 @@ rootProject.name = "geyser-adapters" include(":common") // Spigot -include(":spigot") -include(":spigot:all") -include(":spigot:base") -include(":spigot:v1_17_R1") -include(":spigot:v1_18_R1") -include(":spigot:v1_18_R2") -include(":spigot:v1_19_R1") -include(":spigot:v1_19_R2") -include(":spigot:v1_19_R3") -include(":spigot:v1_20_R1") -include(":spigot:v1_20_R2") -include(":spigot:v1_20_R3") -include(":spigot:v1_20_R4") -include(":spigot:v1_21_R1") -include(":spigot:v1_21_R2") -include(":spigot:v1_21_R3") +//include(":spigot") +//include(":spigot:all") +//include(":spigot:base") +//include(":spigot:v1_17_R1") +//include(":spigot:v1_18_R1") +//include(":spigot:v1_18_R2") +//include(":spigot:v1_19_R1") +//include(":spigot:v1_19_R2") +//include(":spigot:v1_19_R3") +//include(":spigot:v1_20_R1") +//include(":spigot:v1_20_R2") +//include(":spigot:v1_20_R3") +//include(":spigot:v1_20_R4") +//include(":spigot:v1_21_R1") +//include(":spigot:v1_21_R2") +//include(":spigot:v1_21_R3") // Paper -include(":paper") -include(":paper:all") -include(":paper:base") -include(":paper:v766") -include(":paper:v768") +//include(":paper") +//include(":paper:all") +//include(":paper:base") +//include(":paper:v766") +//include(":paper:v768") // Modded -// For whatever reason, the name cannot be ":modded:v1_21_5:common", the fabric and neoforge modules won't -// be able to find the module, but if the name is unique like this, it's fine - +// Modded Adapters are split up since it makes more sense when you consider the versions required for Command Adapters (a lot) +// and which are required for World Adapters (2 currently), it starts to become a bit of a management mess. + +fun defineModdedAdapters(version: String, type: String) { + // We have different names since the fabric and neoforge module get a little angry finding the common module otherwise. + val versionString = version.replace(".", "_") + include(":modded_${type}_common_v${versionString}") + project(":modded_${type}_common_v${versionString}").projectDir = file("modded/${type}/v${versionString}/common") + include(":modded_${type}_fabric_v${versionString}") + project(":modded_${type}_fabric_v${versionString}").projectDir = file("modded/${type}/v${versionString}/fabric") + include(":modded_${type}_neoforge_v${versionString}") + project(":modded_${type}_neoforge_v${versionString}").projectDir = file("modded/${type}/v${versionString}/neoforge") +} + +// Modded World Adapters +// 1.21.3+ +defineModdedAdapters("1.21.3", "world") +// 1.16.5 - 1.21.2 (excellent comptibility! thanks Mojang :3) +// Use 1.20.6, since we *can* benefit from biome suggestions and min world height, +// but on older versions we can leave it/use a default +defineModdedAdapters("1.20.6", "world") + +// Modded Command Adapters // 1.21.5+ -include(":modded_common_v1_21_5") -project(":modded_common_v1_21_5").projectDir = file("modded/v1_21_5/common") -include(":modded:v1_21_5:fabric") -include(":modded:v1_21_5:neoforge") - +defineModdedAdapters("1.21.5", "command") // 1.20.6 - 1.21.4 -include(":modded_common_v1_20_6") -project(":modded_common_v1_20_6").projectDir = file("modded/v1_20_6/common") -include(":modded:v1_20_6:fabric") -include(":modded:v1_20_6:neoforge") +defineModdedAdapters("1.20.6", "command") \ No newline at end of file From c49335a564a49cd9a563f871bada149ce5f59cb7 Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 5 Nov 2025 17:22:09 +0000 Subject: [PATCH 12/12] Remove 1.16.5/1.17.x support, fix fabric.mod.json minecraft dep --- .../modded/world/v1_20_6/WorldAdapter_v1_20_6.java | 8 +------- .../v1_20_6/fabric/src/main/resources/fabric.mod.json | 2 +- settings.gradle.kts | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java b/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java index 931f9ab..952694b 100644 --- a/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java +++ b/modded/world/v1_20_6/common/src/main/java/org/geysermc/geyser/adapters/modded/world/v1_20_6/WorldAdapter_v1_20_6.java @@ -44,13 +44,7 @@ public class WorldAdapter_v1_20_6 extends WorldAdapter { @Override public int getBlockAt(ServerLevel world, int x, int y, int z) { - int minHeight = 0; - - try { - minHeight = world.getMinBuildHeight(); // Modern features, not available in 1.16.5 - } catch (NoSuchMethodError ignored) {} - - if (y < minHeight) { + if (y < world.getMinBuildHeight()) { return 0; } diff --git a/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json b/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json index 267001f..22194d7 100644 --- a/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json +++ b/modded/world/v1_20_6/fabric/src/main/resources/fabric.mod.json @@ -20,7 +20,7 @@ "depends": { "fabricloader": ">=0.16.7", "fabric-api": "*", - "minecraft": "1.18.2 1.19 1.20", + "minecraft": ">=1.18.2 <=1.21.2", "geyser-fabric": "*" } } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 0c0835e..d8cd16c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -48,7 +48,7 @@ fun defineModdedAdapters(version: String, type: String) { // Modded World Adapters // 1.21.3+ defineModdedAdapters("1.21.3", "world") -// 1.16.5 - 1.21.2 (excellent comptibility! thanks Mojang :3) +// 1.18.2 - 1.21.2 (excellent comptibility! thanks Mojang :3) // Use 1.20.6, since we *can* benefit from biome suggestions and min world height, // but on older versions we can leave it/use a default defineModdedAdapters("1.20.6", "world")