diff --git a/implementations/fabric-1.15.2/build.gradle.kts b/implementations/fabric-1.15.2/build.gradle.kts deleted file mode 100644 index 9a35f582..00000000 --- a/implementations/fabric-1.15.2/build.gradle.kts +++ /dev/null @@ -1,192 +0,0 @@ -import com.matthewprenger.cursegradle.CurseArtifact -import com.matthewprenger.cursegradle.CurseProject -import com.matthewprenger.cursegradle.CurseRelation -import com.matthewprenger.cursegradle.Options -import net.fabricmc.loom.task.RemapJarTask - -plugins { - java - `java-library` - id("com.diffplug.spotless") version "6.1.2" - id ("com.github.node-gradle.node") version "3.0.1" - id ("com.github.johnrengelman.shadow") version "7.1.2" - id ("fabric-loom") version "1.3-SNAPSHOT" - id ("com.modrinth.minotaur") version "2.+" - id ("com.matthewprenger.cursegradle") version "1.4.0" -} - -group = "de.bluecolored.bluemap.fabric" -version = System.getProperty("bluemap.version") ?: "?" // set by BlueMapCore - -val javaTarget = 11 -java { - sourceCompatibility = JavaVersion.toVersion(javaTarget) - targetCompatibility = JavaVersion.toVersion(javaTarget) - - withSourcesJar() -} - -repositories { - mavenCentral() - maven { - setUrl("https://libraries.minecraft.net") - } - maven { - setUrl("https://jitpack.io") - } - maven { - setUrl("https://maven.fabricmc.net/") - } - maven { - setUrl("https://oss.sonatype.org/content/repositories/snapshots") - } -} - -val shadowInclude: Configuration by configurations.creating - -configurations { - implementation.get().extendsFrom(shadowInclude) -} - -dependencies { - shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { - //exclude dependencies provided by fabric - exclude (group = "com.google.guava", module = "guava") - exclude (group = "com.google.code.gson", module = "gson") - exclude (group = "org.apache.commons", module = "commons-lang3") - exclude (group = "commons-io", module = "commons-io") - exclude (group = "com.mojang", module = "brigadier") - } - - minecraft ("com.mojang:minecraft:1.15.2") - mappings ("net.fabricmc:yarn:1.15.2+build.17:v2") - modImplementation ("net.fabricmc:fabric-loader:0.9.2+build.206") - modImplementation ("net.fabricmc.fabric-api:fabric-api:0.28.5+1.15") - modImplementation("me.lucko:fabric-permissions-api:0.1-SNAPSHOT") - - testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") - testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") -} - -spotless { - java { - target ("src/*/java/**/*.java") - - licenseHeaderFile("../../HEADER") - indentWithSpaces() - trimTrailingWhitespace() - } -} - -tasks.withType(JavaCompile::class).configureEach { - options.apply { - encoding = "utf-8" - } -} - -tasks.withType(AbstractArchiveTask::class).configureEach { - isReproducibleFileOrder = true - isPreserveFileTimestamps = false -} - -tasks.test { - useJUnitPlatform() -} - -tasks.processResources { - inputs.property ("version", project.version) - - filesMatching("fabric.mod.json") { - expand ("version" to project.version) - } -} - -tasks.shadowJar { - configurations = listOf(shadowInclude) - - //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it - relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") - relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") - relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") - relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") - relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") - relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") - relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") - relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") - relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") - relocate ("io.airlift", "de.bluecolored.shadow.airlift") - - relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") - relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") - - relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") - relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") - relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") -} - -tasks.register("remappedShadowJar", type = RemapJarTask::class) { - destinationDirectory.set(file("../../build/release")) - archiveFileName.set("BlueMap-${project.version}-${project.name}.jar") - dependsOn (tasks.shadowJar) - inputFile.set(tasks.shadowJar.get().archiveFile) - addNestedDependencies.set(true) -} - -tasks.register("release") { - dependsOn("remappedShadowJar") -} - -modrinth { - token.set(System.getenv("MODRINTH_TOKEN")) - projectId.set("swbUV1cr") - versionNumber.set("${project.version}-${project.name}") - changelog.set(file("../../release.md") - .readText() - .replace("{version}", project.version.toString())) - uploadFile.set(tasks.findByName("remappedShadowJar")) - gameVersions.addAll("1.15.2") - dependencies { - required.project("P7dR8mSH") // Fabric API - } -} - -curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") ?: "" - project(closureOf { - id = "406463" - changelogType = "markdown" - changelog = file("../../release.md") - .readText() - .replace("{version}", project.version.toString()) - releaseType = "release" - - addGameVersion("Fabric") - - addGameVersion("Java 18") - addGameVersion("Java 17") - addGameVersion("Java 16") - addGameVersion("Java 15") - addGameVersion("Java 14") - addGameVersion("Java 13") - addGameVersion("Java 12") - addGameVersion("Java 11") - - addGameVersion("1.15.2") - - mainArtifact(tasks.findByName("remappedShadowJar"), closureOf { - relations(closureOf { - requiredDependency("fabric-api") - }) - }) - }) - options(closureOf { - javaVersionAutoDetect = false - javaIntegration = false - forgeGradleIntegration = false - }) -} - -tasks.register("publish") { - dependsOn("modrinth") - dependsOn("curseforge") -} diff --git a/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 41d9927a..00000000 Binary files a/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index db9a6b82..00000000 --- a/implementations/fabric-1.15.2/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.15.2/gradlew b/implementations/fabric-1.15.2/gradlew deleted file mode 100644 index 1b6c7873..00000000 --- a/implementations/fabric-1.15.2/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.15.2/gradlew.bat b/implementations/fabric-1.15.2/gradlew.bat deleted file mode 100644 index 107acd32..00000000 --- a/implementations/fabric-1.15.2/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/implementations/fabric-1.15.2/settings.gradle.kts b/implementations/fabric-1.15.2/settings.gradle.kts deleted file mode 100644 index 91537e54..00000000 --- a/implementations/fabric-1.15.2/settings.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -pluginManagement { - repositories { - maven { - name = "Fabric" - url = uri("https://maven.fabricmc.net/") - } - gradlePluginPortal() - } -} - -rootProject.name = "fabric-1.15.2" - -includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java b/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java deleted file mode 100644 index be2e1ae9..00000000 --- a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.CommandSource; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.world.World; -import me.lucko.fabric.api.permissions.v0.Permissions; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.util.math.Vec3d; - -import java.util.Optional; - -public class FabricCommandSource implements CommandSource { - - private final FabricMod mod; - private final Plugin plugin; - private final ServerCommandSource delegate; - - public FabricCommandSource(FabricMod mod, Plugin plugin, ServerCommandSource delegate) { - this.mod = mod; - this.plugin = plugin; - this.delegate = delegate; - } - - @Override - public void sendMessage(Text text) { - delegate.sendFeedback(net.minecraft.text.Text.Serializer.fromJson(text.toJSONString()), false); - } - - @Override - public boolean hasPermission(String permission) { - try { - Class.forName("me.lucko.fabric.api.permissions.v0.Permissions"); - return Permissions.check(delegate, permission, 1); - } catch (ClassNotFoundException ex) { - return delegate.hasPermissionLevel(1); - } - } - - @Override - public Optional getPosition() { - Vec3d pos = delegate.getPosition(); - if (pos != null) { - return Optional.of(new Vector3d(pos.x, pos.y, pos.z)); - } - - return Optional.empty(); - } - - @Override - public Optional getWorld() { - ServerWorld serverWorld = mod.getServerWorld(delegate.getWorld()); - return Optional.ofNullable(plugin.getWorld(serverWorld)); - } - -} diff --git a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java b/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java deleted file mode 100644 index 94fc9b67..00000000 --- a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - -public class FabricEventForwarder { - - private final FabricMod mod; - private final Collection eventListeners; - - public FabricEventForwarder(FabricMod mod) { - this.mod = mod; - this.eventListeners = new ArrayList<>(1); - - ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { - this.onPlayerJoin(server, handler.player); - }); - - ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { - this.onPlayerLeave(server, handler.player); - }); - } - - public synchronized void addEventListener(ServerEventListener listener) { - this.eventListeners.add(listener); - } - - public synchronized void removeAllListeners() { - this.eventListeners.clear(); - } - - public synchronized void onPlayerJoin(MinecraftServer server, ServerPlayerEntity player) { - if (this.mod.getServer() != server) return; - - UUID uuid = player.getUuid(); - for (ServerEventListener listener : eventListeners) listener.onPlayerJoin(uuid); - } - - public synchronized void onPlayerLeave(MinecraftServer server, ServerPlayerEntity player) { - if (this.mod.getServer() != server) return; - - UUID uuid = player.getUuid(); - for (ServerEventListener listener : eventListeners) listener.onPlayerLeave(uuid); - } - -} diff --git a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java b/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java deleted file mode 100644 index 98ad8c55..00000000 --- a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.commands.Commands; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.Server; -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.BlueMap; -import de.bluecolored.bluemap.core.MinecraftVersion; -import de.bluecolored.bluemap.core.logger.Logger; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import net.minecraft.world.dimension.DimensionType; -import org.apache.logging.log4j.LogManager; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -public class FabricMod implements ModInitializer, Server { - - private final Plugin pluginInstance; - private MinecraftServer serverInstance = null; - - private final FabricEventForwarder eventForwarder; - - private final LoadingCache worlds; - - private int playerUpdateIndex = 0; - private final Map onlinePlayerMap; - private final List onlinePlayerList; - - public FabricMod() { - Logger.global.clear(); - Logger.global.put(new Log4jLogger(LogManager.getLogger(Plugin.PLUGIN_NAME))); - - this.onlinePlayerMap = new ConcurrentHashMap<>(); - this.onlinePlayerList = Collections.synchronizedList(new ArrayList<>()); - - pluginInstance = new Plugin("fabric-1.15.2", this); - - this.eventForwarder = new FabricEventForwarder(this); - this.worlds = Caffeine.newBuilder() - .executor(BlueMap.THREAD_POOL) - .weakKeys() - .maximumSize(1000) - .build(FabricWorld::new); - } - - @Override - public void onInitialize() { - - //register commands - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - new Commands<>(pluginInstance, dispatcher, fabricSource -> - new FabricCommandSource(this, pluginInstance, fabricSource) - ) - ); - - ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> { - this.serverInstance = server; - - new Thread(()->{ - Logger.global.logInfo("Loading BlueMap..."); - - try { - pluginInstance.load(); - if (pluginInstance.isLoaded()) Logger.global.logInfo("BlueMap loaded!"); - } catch (IOException e) { - Logger.global.logError("Failed to load bluemap!", e); - pluginInstance.unload(); - } - }, "BlueMap-Plugin-Loading").start(); - }); - - ServerLifecycleEvents.SERVER_STOPPING.register((MinecraftServer server) -> { - pluginInstance.unload(); - Logger.global.logInfo("BlueMap unloaded!"); - }); - - ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { - this.onPlayerJoin(server, handler.player); - }); - - ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { - this.onPlayerLeave(server, handler.player); - }); - - ServerTickEvents.END_SERVER_TICK.register((MinecraftServer server) -> { - if (server == this.serverInstance) this.updateSomePlayers(); - }); - } - - @Override - public MinecraftVersion getMinecraftVersion() { - return new MinecraftVersion(1, 15, 2); - } - - @Override - public void registerListener(ServerEventListener listener) { - eventForwarder.addEventListener(listener); - } - - @Override - public void unregisterAllListeners() { - eventForwarder.removeAllListeners(); - } - - @Override - public Collection getLoadedServerWorlds() { - Collection loadedWorlds = new ArrayList<>(3); - for (net.minecraft.server.world.ServerWorld serverWorld : serverInstance.getWorlds()) { - loadedWorlds.add(worlds.get(serverWorld)); - } - return loadedWorlds; - } - - @Override - public Optional getServerWorld(Object world) { - - if (world instanceof String) { - Identifier identifier = Identifier.tryParse((String) world); - if (identifier != null) world = identifier; - } - - if (world instanceof Identifier) { - DimensionType dimensionType = DimensionType.byId((Identifier) world); - if (dimensionType != null) world = dimensionType; - } - - if (world instanceof DimensionType) { - var serverWorld = serverInstance.getWorld((DimensionType) world); - if (serverWorld != null) world = serverWorld; - } - - if (world instanceof net.minecraft.server.world.ServerWorld) - return Optional.of(getServerWorld((net.minecraft.server.world.ServerWorld) world)); - - return Optional.empty(); - } - - public ServerWorld getServerWorld(net.minecraft.server.world.ServerWorld serverWorld) { - return worlds.get(serverWorld); - } - - @Override - public Path getConfigFolder() { - return Path.of("config", "bluemap"); - } - - @Override - public Optional getModsFolder() { - return Optional.of(Path.of("mods")); - } - - public void onPlayerJoin(MinecraftServer server, ServerPlayerEntity playerInstance) { - if (this.serverInstance != server) return; - - FabricPlayer player = new FabricPlayer(playerInstance.getUuid(), this); - onlinePlayerMap.put(player.getUuid(), player); - onlinePlayerList.add(player); - } - - public void onPlayerLeave(MinecraftServer server, ServerPlayerEntity player) { - if (this.serverInstance != server) return; - - UUID playerUUID = player.getUuid(); - onlinePlayerMap.remove(playerUUID); - synchronized (onlinePlayerList) { - onlinePlayerList.removeIf(p -> p.getUuid().equals(playerUUID)); - } - } - - public MinecraftServer getServer() { - return this.serverInstance; - } - - public Plugin getPluginInstance() { - return pluginInstance; - } - - @Override - public Collection getOnlinePlayers() { - return onlinePlayerMap.values(); - } - - /** - * Only update some of the online players each tick to minimize performance impact on the server-thread. - * Only call this method on the server-thread. - */ - private void updateSomePlayers() { - int onlinePlayerCount = onlinePlayerList.size(); - if (onlinePlayerCount == 0) return; - - int playersToBeUpdated = onlinePlayerCount / 20; //with 20 tps, each player is updated once a second - if (playersToBeUpdated == 0) playersToBeUpdated = 1; - - for (int i = 0; i < playersToBeUpdated; i++) { - playerUpdateIndex++; - if (playerUpdateIndex >= 20 && playerUpdateIndex >= onlinePlayerCount) playerUpdateIndex = 0; - - if (playerUpdateIndex < onlinePlayerCount) { - onlinePlayerList.get(playerUpdateIndex).update(); - } - } - } - -} diff --git a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java b/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java deleted file mode 100644 index 36737389..00000000 --- a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.Gamemode; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.GameMode; -import net.minecraft.world.LightType; - -import java.util.EnumMap; -import java.util.Map; -import java.util.UUID; - -public class FabricPlayer implements Player { - - private static final Map GAMEMODE_MAP = new EnumMap<>(GameMode.class); - static { - GAMEMODE_MAP.put(GameMode.ADVENTURE, Gamemode.ADVENTURE); - GAMEMODE_MAP.put(GameMode.SURVIVAL, Gamemode.SURVIVAL); - GAMEMODE_MAP.put(GameMode.CREATIVE, Gamemode.CREATIVE); - GAMEMODE_MAP.put(GameMode.SPECTATOR, Gamemode.SPECTATOR); - GAMEMODE_MAP.put(GameMode.NOT_SET, Gamemode.SURVIVAL); - } - - private final UUID uuid; - private Text name; - private ServerWorld world; - private Vector3d position; - private Vector3d rotation; - private int skyLight; - private int blockLight; - private boolean sneaking; - private boolean invisible; - private Gamemode gamemode; - - private final FabricMod mod; - - public FabricPlayer(UUID playerUuid, FabricMod mod) { - this.uuid = playerUuid; - this.mod = mod; - - update(); - } - - @Override - public UUID getUuid() { - return this.uuid; - } - - @Override - public Text getName() { - return this.name; - } - - @Override - public ServerWorld getWorld() { - return this.world; - } - - @Override - public Vector3d getPosition() { - return this.position; - } - - @Override - public Vector3d getRotation() { - return rotation; - } - - @Override - public int getSkyLight() { - return skyLight; - } - - @Override - public int getBlockLight() { - return blockLight; - } - - @Override - public boolean isSneaking() { - return this.sneaking; - } - - @Override - public boolean isInvisible() { - return this.invisible; - } - - @Override - public Gamemode getGamemode() { - return this.gamemode; - } - - /** - * Only call on server thread! - */ - public void update() { - MinecraftServer server = mod.getServer(); - if (server == null) return; - - ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid); - if (player == null) return; - - this.gamemode = GAMEMODE_MAP.get(player.interactionManager.getGameMode()); - if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL; - - StatusEffectInstance invis = player.getStatusEffect(StatusEffects.INVISIBILITY); - this.invisible = invis != null && invis.getDuration() > 0; - - this.name = Text.of(player.getName().getString()); - - Vec3d pos = player.getPos(); - this.position = new Vector3d(pos.getX(), pos.getY(), pos.getZ()); - this.rotation = new Vector3d(player.pitch, player.headYaw, 0); - this.sneaking = player.isSneaking(); - - this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos()); - this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos()); - - this.world = mod.getServerWorld(player.getServerWorld()); - } - -} diff --git a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java b/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java deleted file mode 100644 index 6a6de8c5..00000000 --- a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.resources.datapack.DataPack; -import de.bluecolored.bluemap.core.util.Key; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.nio.file.Path; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; - -public class FabricWorld implements ServerWorld { - - private final WeakReference delegate; - private final Path worldFolder; - private final Key dimension; - - public FabricWorld(net.minecraft.server.world.ServerWorld delegate) { - this.delegate = new WeakReference<>(delegate); - this.worldFolder = delegate.getSaveHandler().getWorldDir().toPath(); - - - Identifier id = Registry.DIMENSION_TYPE.getId(delegate.getDimension().getType()); - this.dimension = id != null ? - new Key(id.getNamespace(), id.getPath()) : - DataPack.DIMENSION_OVERWORLD; - } - - @Override - public boolean persistWorldChanges() throws IOException { - net.minecraft.server.world.ServerWorld world = delegate.get(); - if (world == null) return false; - - var taskResult = CompletableFuture.supplyAsync(() -> { - try { - world.save(null, true, false); - return true; - } catch (Exception e) { - throw new CompletionException(e); - } - }, world.getServer()); - - try { - return taskResult.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IOException(e); - } catch (ExecutionException e) { - Throwable t = e.getCause(); - if (t instanceof IOException) throw (IOException) t; - if (t instanceof IllegalArgumentException) throw (IllegalArgumentException) t; - throw new IOException(t); - } - } - - @Override - public Path getWorldFolder() { - return worldFolder; - } - - @Override - public Key getDimension() { - return dimension; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - FabricWorld that = (FabricWorld) o; - Object world = delegate.get(); - return world != null && world.equals(that.delegate.get()); - } - - @Override - public int hashCode() { - Object world = delegate.get(); - return world != null ? world.hashCode() : 0; - } - -} diff --git a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java b/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java deleted file mode 100644 index 9e60f395..00000000 --- a/implementations/fabric-1.15.2/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import org.apache.logging.log4j.Logger; - -import de.bluecolored.bluemap.core.logger.AbstractLogger; - -public class Log4jLogger extends AbstractLogger { - - private final Logger out; - - public Log4jLogger(Logger out) { - this.out = out; - } - - @Override - public void logError(String message, Throwable throwable) { - out.error(message, throwable); - } - - @Override - public void logWarning(String message) { - out.warn(message); - } - - @Override - public void logInfo(String message) { - out.info(message); - } - - @Override - public void logDebug(String message) { - if (out.isDebugEnabled()) out.debug(message); - } - - @Override - public void noFloodDebug(String message) { - if (out.isDebugEnabled()) super.noFloodDebug(message); - } - - @Override - public void noFloodDebug(String key, String message) { - if (out.isDebugEnabled()) super.noFloodDebug(key, message); - } - -} diff --git a/implementations/fabric-1.15.2/src/main/resources/assets/bluemap/icon.png b/implementations/fabric-1.15.2/src/main/resources/assets/bluemap/icon.png deleted file mode 100644 index 65d56d7a..00000000 Binary files a/implementations/fabric-1.15.2/src/main/resources/assets/bluemap/icon.png and /dev/null differ diff --git a/implementations/fabric-1.15.2/src/main/resources/fabric.mod.json b/implementations/fabric-1.15.2/src/main/resources/fabric.mod.json deleted file mode 100644 index 6ae1e992..00000000 --- a/implementations/fabric-1.15.2/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "schemaVersion": 1, - "id": "bluemap", - "version": "${version}", - - "name": "BlueMap", - "description": "A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)", - "authors": [ - "Blue (TBlueF, Lukas Rieger)" - ], - "contact": { - "homepage": "https://github.com/BlueMap-Minecraft", - "sources": "https://github.com/BlueMap-Minecraft/BlueMap" - }, - - "license": "MIT", - "icon": "assets/bluemap/icon.png", - - "environment": "*", - "entrypoints": { - "main": [ - "de.bluecolored.bluemap.fabric.FabricMod" - ] - }, - - "depends": { - "fabricloader": ">=0.9.0", - "fabric": "*", - "minecraft": "1.15.2" - }, - "suggests": {} -} diff --git a/implementations/fabric-1.16.2/build.gradle.kts b/implementations/fabric-1.16.2/build.gradle.kts deleted file mode 100644 index 285285be..00000000 --- a/implementations/fabric-1.16.2/build.gradle.kts +++ /dev/null @@ -1,195 +0,0 @@ -import com.matthewprenger.cursegradle.CurseArtifact -import com.matthewprenger.cursegradle.CurseProject -import com.matthewprenger.cursegradle.CurseRelation -import com.matthewprenger.cursegradle.Options -import net.fabricmc.loom.task.RemapJarTask - -plugins { - java - `java-library` - id("com.diffplug.spotless") version "6.1.2" - id ("com.github.node-gradle.node") version "3.0.1" - id ("com.github.johnrengelman.shadow") version "7.1.2" - id ("fabric-loom") version "1.3-SNAPSHOT" - id ("com.modrinth.minotaur") version "2.+" - id ("com.matthewprenger.cursegradle") version "1.4.0" -} - -group = "de.bluecolored.bluemap.fabric" -version = System.getProperty("bluemap.version") ?: "?" // set by BlueMapCore - -val javaTarget = 11 -java { - sourceCompatibility = JavaVersion.toVersion(javaTarget) - targetCompatibility = JavaVersion.toVersion(javaTarget) - - withSourcesJar() -} - -repositories { - mavenCentral() - maven { - setUrl("https://libraries.minecraft.net") - } - maven { - setUrl("https://jitpack.io") - } - maven { - setUrl("https://maven.fabricmc.net/") - } - maven { - setUrl("https://oss.sonatype.org/content/repositories/snapshots") - } -} - -val shadowInclude: Configuration by configurations.creating - -configurations { - implementation.get().extendsFrom(shadowInclude) -} - -dependencies { - shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { - //exclude dependencies provided by fabric - exclude (group = "com.google.guava", module = "guava") - exclude (group = "com.google.code.gson", module = "gson") - exclude (group = "org.apache.commons", module = "commons-lang3") - exclude (group = "commons-io", module = "commons-io") - exclude (group = "com.mojang", module = "brigadier") - } - - minecraft ("com.mojang:minecraft:1.16.3") - mappings ("net.fabricmc:yarn:1.16.3+build.1:v2") - modImplementation ("net.fabricmc:fabric-loader:0.9.3+build.207") - modImplementation ("net.fabricmc.fabric-api:fabric-api:0.28.4+1.16") - modImplementation("me.lucko:fabric-permissions-api:0.1-SNAPSHOT") - - testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") - testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") -} - -spotless { - java { - target ("src/*/java/**/*.java") - - licenseHeaderFile("../../HEADER") - indentWithSpaces() - trimTrailingWhitespace() - } -} - -tasks.withType(JavaCompile::class).configureEach { - options.apply { - encoding = "utf-8" - } -} - -tasks.withType(AbstractArchiveTask::class).configureEach { - isReproducibleFileOrder = true - isPreserveFileTimestamps = false -} - -tasks.test { - useJUnitPlatform() -} - -tasks.processResources { - inputs.property ("version", project.version) - - filesMatching("fabric.mod.json") { - expand ("version" to project.version) - } -} - -tasks.shadowJar { - configurations = listOf(shadowInclude) - - //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it - relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") - relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") - relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") - relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") - relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") - relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") - relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") - relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") - relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") - relocate ("io.airlift", "de.bluecolored.shadow.airlift") - - relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") - relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") - - relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") - relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") - relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") -} - -tasks.register("remappedShadowJar", type = RemapJarTask::class) { - destinationDirectory.set(file("../../build/release")) - archiveFileName.set("BlueMap-${project.version}-${project.name}.jar") - dependsOn (tasks.shadowJar) - inputFile.set(tasks.shadowJar.get().archiveFile) - addNestedDependencies.set(true) -} - -tasks.register("release") { - dependsOn("remappedShadowJar") -} - -modrinth { - token.set(System.getenv("MODRINTH_TOKEN")) - projectId.set("swbUV1cr") - versionNumber.set("${project.version}-${project.name}") - changelog.set(file("../../release.md") - .readText() - .replace("{version}", project.version.toString())) - uploadFile.set(tasks.findByName("remappedShadowJar")) - gameVersions.addAll("1.16.2", "1.16.3", "1.16.4", "1.16.5") - dependencies { - required.project("P7dR8mSH") // Fabric API - } -} - -curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") ?: "" - project(closureOf { - id = "406463" - changelogType = "markdown" - changelog = file("../../release.md") - .readText() - .replace("{version}", project.version.toString()) - releaseType = "release" - - addGameVersion("Fabric") - - addGameVersion("Java 18") - addGameVersion("Java 17") - addGameVersion("Java 16") - addGameVersion("Java 15") - addGameVersion("Java 14") - addGameVersion("Java 13") - addGameVersion("Java 12") - addGameVersion("Java 11") - - addGameVersion("1.16.2") - addGameVersion("1.16.3") - addGameVersion("1.16.4") - addGameVersion("1.16.5") - - mainArtifact(tasks.findByName("remappedShadowJar"), closureOf { - relations(closureOf { - requiredDependency("fabric-api") - }) - }) - }) - options(closureOf { - javaVersionAutoDetect = false - javaIntegration = false - forgeGradleIntegration = false - }) -} - -tasks.register("publish") { - dependsOn("modrinth") - dependsOn("curseforge") -} diff --git a/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 41d9927a..00000000 Binary files a/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index db9a6b82..00000000 --- a/implementations/fabric-1.16.2/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.16.2/gradlew b/implementations/fabric-1.16.2/gradlew deleted file mode 100644 index 1b6c7873..00000000 --- a/implementations/fabric-1.16.2/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.16.2/gradlew.bat b/implementations/fabric-1.16.2/gradlew.bat deleted file mode 100644 index 107acd32..00000000 --- a/implementations/fabric-1.16.2/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/implementations/fabric-1.16.2/settings.gradle.kts b/implementations/fabric-1.16.2/settings.gradle.kts deleted file mode 100644 index b69aac6c..00000000 --- a/implementations/fabric-1.16.2/settings.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -pluginManagement { - repositories { - maven { - name = "Fabric" - url = uri("https://maven.fabricmc.net/") - } - gradlePluginPortal() - } -} - -rootProject.name = "fabric-1.16.2" - -includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java b/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java deleted file mode 100644 index be2e1ae9..00000000 --- a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.CommandSource; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.world.World; -import me.lucko.fabric.api.permissions.v0.Permissions; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.util.math.Vec3d; - -import java.util.Optional; - -public class FabricCommandSource implements CommandSource { - - private final FabricMod mod; - private final Plugin plugin; - private final ServerCommandSource delegate; - - public FabricCommandSource(FabricMod mod, Plugin plugin, ServerCommandSource delegate) { - this.mod = mod; - this.plugin = plugin; - this.delegate = delegate; - } - - @Override - public void sendMessage(Text text) { - delegate.sendFeedback(net.minecraft.text.Text.Serializer.fromJson(text.toJSONString()), false); - } - - @Override - public boolean hasPermission(String permission) { - try { - Class.forName("me.lucko.fabric.api.permissions.v0.Permissions"); - return Permissions.check(delegate, permission, 1); - } catch (ClassNotFoundException ex) { - return delegate.hasPermissionLevel(1); - } - } - - @Override - public Optional getPosition() { - Vec3d pos = delegate.getPosition(); - if (pos != null) { - return Optional.of(new Vector3d(pos.x, pos.y, pos.z)); - } - - return Optional.empty(); - } - - @Override - public Optional getWorld() { - ServerWorld serverWorld = mod.getServerWorld(delegate.getWorld()); - return Optional.ofNullable(plugin.getWorld(serverWorld)); - } - -} diff --git a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java b/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java deleted file mode 100644 index 94fc9b67..00000000 --- a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - -public class FabricEventForwarder { - - private final FabricMod mod; - private final Collection eventListeners; - - public FabricEventForwarder(FabricMod mod) { - this.mod = mod; - this.eventListeners = new ArrayList<>(1); - - ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { - this.onPlayerJoin(server, handler.player); - }); - - ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { - this.onPlayerLeave(server, handler.player); - }); - } - - public synchronized void addEventListener(ServerEventListener listener) { - this.eventListeners.add(listener); - } - - public synchronized void removeAllListeners() { - this.eventListeners.clear(); - } - - public synchronized void onPlayerJoin(MinecraftServer server, ServerPlayerEntity player) { - if (this.mod.getServer() != server) return; - - UUID uuid = player.getUuid(); - for (ServerEventListener listener : eventListeners) listener.onPlayerJoin(uuid); - } - - public synchronized void onPlayerLeave(MinecraftServer server, ServerPlayerEntity player) { - if (this.mod.getServer() != server) return; - - UUID uuid = player.getUuid(); - for (ServerEventListener listener : eventListeners) listener.onPlayerLeave(uuid); - } - -} diff --git a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java b/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java deleted file mode 100644 index 0a6a2628..00000000 --- a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.commands.Commands; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.Server; -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.BlueMap; -import de.bluecolored.bluemap.core.MinecraftVersion; -import de.bluecolored.bluemap.core.logger.Logger; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; -import org.apache.logging.log4j.LogManager; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -public class FabricMod implements ModInitializer, Server { - - private final Plugin pluginInstance; - private MinecraftServer serverInstance = null; - - private final FabricEventForwarder eventForwarder; - - private final LoadingCache worlds; - - private int playerUpdateIndex = 0; - private final Map onlinePlayerMap; - private final List onlinePlayerList; - - public FabricMod() { - Logger.global.clear(); - Logger.global.put(new Log4jLogger(LogManager.getLogger(Plugin.PLUGIN_NAME))); - - this.onlinePlayerMap = new ConcurrentHashMap<>(); - this.onlinePlayerList = Collections.synchronizedList(new ArrayList<>()); - - pluginInstance = new Plugin("fabric-1.16.2", this); - - this.eventForwarder = new FabricEventForwarder(this); - this.worlds = Caffeine.newBuilder() - .executor(BlueMap.THREAD_POOL) - .weakKeys() - .maximumSize(1000) - .build(FabricWorld::new); - } - - @Override - public void onInitialize() { - - //register commands - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - new Commands<>(pluginInstance, dispatcher, fabricSource -> - new FabricCommandSource(this, pluginInstance, fabricSource) - ) - ); - - ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> { - this.serverInstance = server; - - new Thread(()->{ - Logger.global.logInfo("Loading BlueMap..."); - - try { - pluginInstance.load(); - if (pluginInstance.isLoaded()) Logger.global.logInfo("BlueMap loaded!"); - } catch (IOException e) { - Logger.global.logError("Failed to load bluemap!", e); - pluginInstance.unload(); - } - }, "BlueMap-Plugin-Loading").start(); - }); - - ServerLifecycleEvents.SERVER_STOPPING.register((MinecraftServer server) -> { - pluginInstance.unload(); - Logger.global.logInfo("BlueMap unloaded!"); - }); - - ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { - this.onPlayerJoin(server, handler.player); - }); - - ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { - this.onPlayerLeave(server, handler.player); - }); - - ServerTickEvents.END_SERVER_TICK.register((MinecraftServer server) -> { - if (server == this.serverInstance) this.updateSomePlayers(); - }); - } - - @Override - public MinecraftVersion getMinecraftVersion() { - return new MinecraftVersion(1, 16, 2); - } - - @Override - public void registerListener(ServerEventListener listener) { - eventForwarder.addEventListener(listener); - } - - @Override - public void unregisterAllListeners() { - eventForwarder.removeAllListeners(); - } - - @Override - public Collection getLoadedServerWorlds() { - Collection loadedWorlds = new ArrayList<>(3); - for (net.minecraft.server.world.ServerWorld serverWorld : serverInstance.getWorlds()) { - loadedWorlds.add(worlds.get(serverWorld)); - } - return loadedWorlds; - } - - @SuppressWarnings("unchecked") - @Override - public Optional getServerWorld(Object world) { - - if (world instanceof String) { - Identifier identifier = Identifier.tryParse((String) world); - if (identifier != null) world = serverInstance.getWorld(RegistryKey.of(Registry.DIMENSION, identifier)); - } - - if (world instanceof RegistryKey) { - try { - world = serverInstance.getWorld((RegistryKey) world); - } catch (ClassCastException ignored) {} - } - - if (world instanceof net.minecraft.server.world.ServerWorld) - return Optional.of(getServerWorld((net.minecraft.server.world.ServerWorld) world)); - - return Optional.empty(); - } - - public ServerWorld getServerWorld(net.minecraft.server.world.ServerWorld serverWorld) { - return worlds.get(serverWorld); - } - - @Override - public Path getConfigFolder() { - return Path.of("config", "bluemap"); - } - - @Override - public Optional getModsFolder() { - return Optional.of(Path.of("mods")); - } - - public void onPlayerJoin(MinecraftServer server, ServerPlayerEntity playerInstance) { - if (this.serverInstance != server) return; - - FabricPlayer player = new FabricPlayer(playerInstance.getUuid(), this); - onlinePlayerMap.put(player.getUuid(), player); - onlinePlayerList.add(player); - } - - public void onPlayerLeave(MinecraftServer server, ServerPlayerEntity player) { - if (this.serverInstance != server) return; - - UUID playerUUID = player.getUuid(); - onlinePlayerMap.remove(playerUUID); - synchronized (onlinePlayerList) { - onlinePlayerList.removeIf(p -> p.getUuid().equals(playerUUID)); - } - } - - public MinecraftServer getServer() { - return this.serverInstance; - } - - public Plugin getPluginInstance() { - return pluginInstance; - } - - @Override - public Collection getOnlinePlayers() { - return onlinePlayerMap.values(); - } - - /** - * Only update some of the online players each tick to minimize performance impact on the server-thread. - * Only call this method on the server-thread. - */ - private void updateSomePlayers() { - int onlinePlayerCount = onlinePlayerList.size(); - if (onlinePlayerCount == 0) return; - - int playersToBeUpdated = onlinePlayerCount / 20; //with 20 tps, each player is updated once a second - if (playersToBeUpdated == 0) playersToBeUpdated = 1; - - for (int i = 0; i < playersToBeUpdated; i++) { - playerUpdateIndex++; - if (playerUpdateIndex >= 20 && playerUpdateIndex >= onlinePlayerCount) playerUpdateIndex = 0; - - if (playerUpdateIndex < onlinePlayerCount) { - onlinePlayerList.get(playerUpdateIndex).update(); - } - } - } - -} diff --git a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java b/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java deleted file mode 100644 index 36737389..00000000 --- a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.Gamemode; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.GameMode; -import net.minecraft.world.LightType; - -import java.util.EnumMap; -import java.util.Map; -import java.util.UUID; - -public class FabricPlayer implements Player { - - private static final Map GAMEMODE_MAP = new EnumMap<>(GameMode.class); - static { - GAMEMODE_MAP.put(GameMode.ADVENTURE, Gamemode.ADVENTURE); - GAMEMODE_MAP.put(GameMode.SURVIVAL, Gamemode.SURVIVAL); - GAMEMODE_MAP.put(GameMode.CREATIVE, Gamemode.CREATIVE); - GAMEMODE_MAP.put(GameMode.SPECTATOR, Gamemode.SPECTATOR); - GAMEMODE_MAP.put(GameMode.NOT_SET, Gamemode.SURVIVAL); - } - - private final UUID uuid; - private Text name; - private ServerWorld world; - private Vector3d position; - private Vector3d rotation; - private int skyLight; - private int blockLight; - private boolean sneaking; - private boolean invisible; - private Gamemode gamemode; - - private final FabricMod mod; - - public FabricPlayer(UUID playerUuid, FabricMod mod) { - this.uuid = playerUuid; - this.mod = mod; - - update(); - } - - @Override - public UUID getUuid() { - return this.uuid; - } - - @Override - public Text getName() { - return this.name; - } - - @Override - public ServerWorld getWorld() { - return this.world; - } - - @Override - public Vector3d getPosition() { - return this.position; - } - - @Override - public Vector3d getRotation() { - return rotation; - } - - @Override - public int getSkyLight() { - return skyLight; - } - - @Override - public int getBlockLight() { - return blockLight; - } - - @Override - public boolean isSneaking() { - return this.sneaking; - } - - @Override - public boolean isInvisible() { - return this.invisible; - } - - @Override - public Gamemode getGamemode() { - return this.gamemode; - } - - /** - * Only call on server thread! - */ - public void update() { - MinecraftServer server = mod.getServer(); - if (server == null) return; - - ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid); - if (player == null) return; - - this.gamemode = GAMEMODE_MAP.get(player.interactionManager.getGameMode()); - if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL; - - StatusEffectInstance invis = player.getStatusEffect(StatusEffects.INVISIBILITY); - this.invisible = invis != null && invis.getDuration() > 0; - - this.name = Text.of(player.getName().getString()); - - Vec3d pos = player.getPos(); - this.position = new Vector3d(pos.getX(), pos.getY(), pos.getZ()); - this.rotation = new Vector3d(player.pitch, player.headYaw, 0); - this.sneaking = player.isSneaking(); - - this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos()); - this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos()); - - this.world = mod.getServerWorld(player.getServerWorld()); - } - -} diff --git a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java b/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java deleted file mode 100644 index ff4468d9..00000000 --- a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.util.Key; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.Identifier; -import net.minecraft.util.WorldSavePath; - -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.nio.file.Path; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; - -public class FabricWorld implements ServerWorld { - - private final WeakReference delegate; - private final Path worldFolder; - private final Key dimension; - - public FabricWorld(net.minecraft.server.world.ServerWorld delegate) { - this.delegate = new WeakReference<>(delegate); - - MinecraftServer server = delegate.getServer(); - this.worldFolder = delegate.getServer().getRunDirectory().toPath() - .resolve(server.getSavePath(WorldSavePath.ROOT)); - - Identifier id = delegate.getRegistryKey().getValue(); - this.dimension = new Key(id.getNamespace(), id.getPath()); - } - - @Override - public boolean persistWorldChanges() throws IOException { - net.minecraft.server.world.ServerWorld world = delegate.get(); - if (world == null) return false; - - var taskResult = CompletableFuture.supplyAsync(() -> { - try { - world.save(null, true, false); - return true; - } catch (Exception e) { - throw new CompletionException(e); - } - }, world.getServer()); - - try { - return taskResult.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IOException(e); - } catch (ExecutionException e) { - Throwable t = e.getCause(); - if (t instanceof IOException) throw (IOException) t; - if (t instanceof IllegalArgumentException) throw (IllegalArgumentException) t; - throw new IOException(t); - } - } - - @Override - public Path getWorldFolder() { - return worldFolder; - } - - @Override - public Key getDimension() { - return dimension; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - FabricWorld that = (FabricWorld) o; - Object world = delegate.get(); - return world != null && world.equals(that.delegate.get()); - } - - @Override - public int hashCode() { - Object world = delegate.get(); - return world != null ? world.hashCode() : 0; - } - -} diff --git a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java b/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java deleted file mode 100644 index 9e60f395..00000000 --- a/implementations/fabric-1.16.2/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import org.apache.logging.log4j.Logger; - -import de.bluecolored.bluemap.core.logger.AbstractLogger; - -public class Log4jLogger extends AbstractLogger { - - private final Logger out; - - public Log4jLogger(Logger out) { - this.out = out; - } - - @Override - public void logError(String message, Throwable throwable) { - out.error(message, throwable); - } - - @Override - public void logWarning(String message) { - out.warn(message); - } - - @Override - public void logInfo(String message) { - out.info(message); - } - - @Override - public void logDebug(String message) { - if (out.isDebugEnabled()) out.debug(message); - } - - @Override - public void noFloodDebug(String message) { - if (out.isDebugEnabled()) super.noFloodDebug(message); - } - - @Override - public void noFloodDebug(String key, String message) { - if (out.isDebugEnabled()) super.noFloodDebug(key, message); - } - -} diff --git a/implementations/fabric-1.16.2/src/main/resources/assets/bluemap/icon.png b/implementations/fabric-1.16.2/src/main/resources/assets/bluemap/icon.png deleted file mode 100644 index 65d56d7a..00000000 Binary files a/implementations/fabric-1.16.2/src/main/resources/assets/bluemap/icon.png and /dev/null differ diff --git a/implementations/fabric-1.16.2/src/main/resources/fabric.mod.json b/implementations/fabric-1.16.2/src/main/resources/fabric.mod.json deleted file mode 100644 index ae43643f..00000000 --- a/implementations/fabric-1.16.2/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "schemaVersion": 1, - "id": "bluemap", - "version": "${version}", - - "name": "BlueMap", - "description": "A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)", - "authors": [ - "Blue (TBlueF, Lukas Rieger)" - ], - "contact": { - "homepage": "https://github.com/BlueMap-Minecraft", - "sources": "https://github.com/BlueMap-Minecraft/BlueMap" - }, - - "license": "MIT", - "icon": "assets/bluemap/icon.png", - - "environment": "*", - "entrypoints": { - "main": [ - "de.bluecolored.bluemap.fabric.FabricMod" - ] - }, - - "depends": { - "fabricloader": ">=0.9.0", - "fabric": "*", - "minecraft": ">=1.16.4" - }, - "suggests": {} -} diff --git a/implementations/fabric-1.17/build.gradle.kts b/implementations/fabric-1.17/build.gradle.kts deleted file mode 100644 index 371bb1c0..00000000 --- a/implementations/fabric-1.17/build.gradle.kts +++ /dev/null @@ -1,188 +0,0 @@ -import com.matthewprenger.cursegradle.CurseArtifact -import com.matthewprenger.cursegradle.CurseProject -import com.matthewprenger.cursegradle.CurseRelation -import com.matthewprenger.cursegradle.Options -import net.fabricmc.loom.task.RemapJarTask - -plugins { - java - `java-library` - id("com.diffplug.spotless") version "6.1.2" - id ("com.github.node-gradle.node") version "3.0.1" - id ("com.github.johnrengelman.shadow") version "7.1.2" - id ("fabric-loom") version "1.3-SNAPSHOT" - id ("com.modrinth.minotaur") version "2.+" - id ("com.matthewprenger.cursegradle") version "1.4.0" -} - -group = "de.bluecolored.bluemap.fabric" -version = System.getProperty("bluemap.version") ?: "?" // set by BlueMapCore - -val javaTarget = 16 -java { - sourceCompatibility = JavaVersion.toVersion(javaTarget) - targetCompatibility = JavaVersion.toVersion(javaTarget) - - withSourcesJar() -} - -repositories { - mavenCentral() - maven { - setUrl("https://libraries.minecraft.net") - } - maven { - setUrl("https://jitpack.io") - } - maven { - setUrl("https://maven.fabricmc.net/") - } - maven { - setUrl("https://oss.sonatype.org/content/repositories/snapshots") - } -} - -val shadowInclude: Configuration by configurations.creating - -configurations { - implementation.get().extendsFrom(shadowInclude) -} - -dependencies { - shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { - //exclude dependencies provided by fabric - exclude (group = "com.google.guava", module = "guava") - exclude (group = "com.google.code.gson", module = "gson") - exclude (group = "org.apache.commons", module = "commons-lang3") - exclude (group = "commons-io", module = "commons-io") - exclude (group = "com.mojang", module = "brigadier") - } - - minecraft ("com.mojang:minecraft:1.17") - mappings ("net.fabricmc:yarn:1.17+build.1:v2") - modImplementation ("net.fabricmc:fabric-loader:0.11.3") - modImplementation ("net.fabricmc.fabric-api:fabric-api:0.34.9+1.17") - modImplementation("me.lucko:fabric-permissions-api:0.1-SNAPSHOT") - - testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") - testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") -} - -spotless { - java { - target ("src/*/java/**/*.java") - - licenseHeaderFile("../../HEADER") - indentWithSpaces() - trimTrailingWhitespace() - } -} - -tasks.withType(JavaCompile::class).configureEach { - options.apply { - encoding = "utf-8" - } -} - -tasks.withType(AbstractArchiveTask::class).configureEach { - isReproducibleFileOrder = true - isPreserveFileTimestamps = false -} - -tasks.test { - useJUnitPlatform() -} - -tasks.processResources { - inputs.property ("version", project.version) - - filesMatching("fabric.mod.json") { - expand ("version" to project.version) - } -} - -tasks.shadowJar { - configurations = listOf(shadowInclude) - - //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it - relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") - relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") - relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") - relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") - relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") - relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") - relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") - relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") - relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") - relocate ("io.airlift", "de.bluecolored.shadow.airlift") - - relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") - relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") - - relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") - relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") - relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") -} - -tasks.register("remappedShadowJar", type = RemapJarTask::class) { - destinationDirectory.set(file("../../build/release")) - archiveFileName.set("BlueMap-${project.version}-${project.name}.jar") - dependsOn (tasks.shadowJar) - inputFile.set(tasks.shadowJar.get().archiveFile) - addNestedDependencies.set(true) -} - -tasks.register("release") { - dependsOn("remappedShadowJar") -} - -modrinth { - token.set(System.getenv("MODRINTH_TOKEN")) - projectId.set("swbUV1cr") - versionNumber.set("${project.version}-${project.name}") - changelog.set(file("../../release.md") - .readText() - .replace("{version}", project.version.toString())) - uploadFile.set(tasks.findByName("remappedShadowJar")) - gameVersions.addAll("1.17", "1.17.1") - dependencies { - required.project("P7dR8mSH") // Fabric API - } -} - -curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") ?: "" - project(closureOf { - id = "406463" - changelogType = "markdown" - changelog = file("../../release.md") - .readText() - .replace("{version}", project.version.toString()) - releaseType = "release" - - addGameVersion("Fabric") - - addGameVersion("Java 18") - addGameVersion("Java 17") - addGameVersion("Java 16") - - addGameVersion("1.17") - addGameVersion("1.17.1") - - mainArtifact(tasks.findByName("remappedShadowJar"), closureOf { - relations(closureOf { - requiredDependency("fabric-api") - }) - }) - }) - options(closureOf { - javaVersionAutoDetect = false - javaIntegration = false - forgeGradleIntegration = false - }) -} - -tasks.register("publish") { - dependsOn("modrinth") - dependsOn("curseforge") -} diff --git a/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.jar b/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 41d9927a..00000000 Binary files a/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.properties b/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index db9a6b82..00000000 --- a/implementations/fabric-1.17/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/implementations/fabric-1.17/gradlew b/implementations/fabric-1.17/gradlew deleted file mode 100644 index 1b6c7873..00000000 --- a/implementations/fabric-1.17/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/implementations/fabric-1.17/gradlew.bat b/implementations/fabric-1.17/gradlew.bat deleted file mode 100644 index 107acd32..00000000 --- a/implementations/fabric-1.17/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/implementations/fabric-1.17/settings.gradle.kts b/implementations/fabric-1.17/settings.gradle.kts deleted file mode 100644 index 352cc383..00000000 --- a/implementations/fabric-1.17/settings.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -pluginManagement { - repositories { - maven { - name = "Fabric" - url = uri("https://maven.fabricmc.net/") - } - gradlePluginPortal() - } -} - -rootProject.name = "fabric-1.17" - -includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java b/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java deleted file mode 100644 index be2e1ae9..00000000 --- a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricCommandSource.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.CommandSource; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.world.World; -import me.lucko.fabric.api.permissions.v0.Permissions; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.util.math.Vec3d; - -import java.util.Optional; - -public class FabricCommandSource implements CommandSource { - - private final FabricMod mod; - private final Plugin plugin; - private final ServerCommandSource delegate; - - public FabricCommandSource(FabricMod mod, Plugin plugin, ServerCommandSource delegate) { - this.mod = mod; - this.plugin = plugin; - this.delegate = delegate; - } - - @Override - public void sendMessage(Text text) { - delegate.sendFeedback(net.minecraft.text.Text.Serializer.fromJson(text.toJSONString()), false); - } - - @Override - public boolean hasPermission(String permission) { - try { - Class.forName("me.lucko.fabric.api.permissions.v0.Permissions"); - return Permissions.check(delegate, permission, 1); - } catch (ClassNotFoundException ex) { - return delegate.hasPermissionLevel(1); - } - } - - @Override - public Optional getPosition() { - Vec3d pos = delegate.getPosition(); - if (pos != null) { - return Optional.of(new Vector3d(pos.x, pos.y, pos.z)); - } - - return Optional.empty(); - } - - @Override - public Optional getWorld() { - ServerWorld serverWorld = mod.getServerWorld(delegate.getWorld()); - return Optional.ofNullable(plugin.getWorld(serverWorld)); - } - -} diff --git a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java b/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java deleted file mode 100644 index 411e1c34..00000000 --- a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricEventForwarder.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - -public class FabricEventForwarder { - - private final FabricMod mod; - private final Collection eventListeners; - - public FabricEventForwarder(FabricMod mod) { - this.mod = mod; - this.eventListeners = new ArrayList<>(1); - - ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { - this.onPlayerJoin(server, handler.getPlayer()); - }); - - ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { - this.onPlayerLeave(server, handler.getPlayer()); - }); - } - - public synchronized void addEventListener(ServerEventListener listener) { - this.eventListeners.add(listener); - } - - public synchronized void removeAllListeners() { - this.eventListeners.clear(); - } - - public synchronized void onPlayerJoin(MinecraftServer server, ServerPlayerEntity player) { - if (this.mod.getServer() != server) return; - - UUID uuid = player.getUuid(); - for (ServerEventListener listener : eventListeners) listener.onPlayerJoin(uuid); - } - - public synchronized void onPlayerLeave(MinecraftServer server, ServerPlayerEntity player) { - if (this.mod.getServer() != server) return; - - UUID uuid = player.getUuid(); - for (ServerEventListener listener : eventListeners) listener.onPlayerLeave(uuid); - } - -} diff --git a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java b/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java deleted file mode 100644 index 09ab1ba6..00000000 --- a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricMod.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.commands.Commands; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import de.bluecolored.bluemap.common.serverinterface.Server; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.BlueMap; -import de.bluecolored.bluemap.core.MinecraftVersion; -import de.bluecolored.bluemap.core.logger.Logger; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; -import org.apache.logging.log4j.LogManager; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -public class FabricMod implements ModInitializer, Server { - - private final Plugin pluginInstance; - private MinecraftServer serverInstance = null; - - private final FabricEventForwarder eventForwarder; - - private final LoadingCache worlds; - - private int playerUpdateIndex = 0; - private final Map onlinePlayerMap; - private final List onlinePlayerList; - - public FabricMod() { - Logger.global.clear(); - Logger.global.put(new Log4jLogger(LogManager.getLogger(Plugin.PLUGIN_NAME))); - - this.onlinePlayerMap = new ConcurrentHashMap<>(); - this.onlinePlayerList = Collections.synchronizedList(new ArrayList<>()); - - pluginInstance = new Plugin("fabric-1.17", this); - - this.eventForwarder = new FabricEventForwarder(this); - this.worlds = Caffeine.newBuilder() - .executor(BlueMap.THREAD_POOL) - .weakKeys() - .maximumSize(1000) - .build(FabricWorld::new); - } - - @Override - public void onInitialize() { - - //register commands - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - new Commands<>(pluginInstance, dispatcher, fabricSource -> - new FabricCommandSource(this, pluginInstance, fabricSource) - ) - ); - - ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> { - this.serverInstance = server; - - new Thread(()->{ - Logger.global.logInfo("Loading BlueMap..."); - - try { - pluginInstance.load(); - if (pluginInstance.isLoaded()) Logger.global.logInfo("BlueMap loaded!"); - } catch (IOException e) { - Logger.global.logError("Failed to load bluemap!", e); - pluginInstance.unload(); - } - }, "BlueMap-Plugin-Loading").start(); - }); - - ServerLifecycleEvents.SERVER_STOPPING.register((MinecraftServer server) -> { - pluginInstance.unload(); - Logger.global.logInfo("BlueMap unloaded!"); - }); - - ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { - this.onPlayerJoin(server, handler.getPlayer()); - }); - - ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> { - this.onPlayerLeave(server, handler.getPlayer()); - }); - - ServerTickEvents.END_SERVER_TICK.register((MinecraftServer server) -> { - if (server == this.serverInstance) this.updateSomePlayers(); - }); - } - - @Override - public MinecraftVersion getMinecraftVersion() { - return new MinecraftVersion(1, 17); - } - - @Override - public void registerListener(ServerEventListener listener) { - eventForwarder.addEventListener(listener); - } - - @Override - public void unregisterAllListeners() { - eventForwarder.removeAllListeners(); - } - - @Override - public Collection getLoadedServerWorlds() { - Collection loadedWorlds = new ArrayList<>(3); - for (net.minecraft.server.world.ServerWorld serverWorld : serverInstance.getWorlds()) { - loadedWorlds.add(worlds.get(serverWorld)); - } - return loadedWorlds; - } - - @SuppressWarnings("unchecked") - @Override - public Optional getServerWorld(Object world) { - - if (world instanceof String) { - Identifier identifier = Identifier.tryParse((String) world); - if (identifier != null) world = serverInstance.getWorld(RegistryKey.of(Registry.WORLD_KEY, identifier)); - } - - if (world instanceof RegistryKey) { - try { - world = serverInstance.getWorld((RegistryKey) world); - } catch (ClassCastException ignored) {} - } - - if (world instanceof net.minecraft.server.world.ServerWorld) - return Optional.of(getServerWorld((net.minecraft.server.world.ServerWorld) world)); - - return Optional.empty(); - } - - public ServerWorld getServerWorld(net.minecraft.server.world.ServerWorld serverWorld) { - return worlds.get(serverWorld); - } - - @Override - public Path getConfigFolder() { - return Path.of("config", "bluemap"); - } - - @Override - public Optional getModsFolder() { - return Optional.of(Path.of("mods")); - } - - public void onPlayerJoin(MinecraftServer server, ServerPlayerEntity playerInstance) { - if (this.serverInstance != server) return; - - FabricPlayer player = new FabricPlayer(playerInstance.getUuid(), this); - onlinePlayerMap.put(player.getUuid(), player); - onlinePlayerList.add(player); - } - - public void onPlayerLeave(MinecraftServer server, ServerPlayerEntity player) { - if (this.serverInstance != server) return; - - UUID playerUUID = player.getUuid(); - onlinePlayerMap.remove(playerUUID); - synchronized (onlinePlayerList) { - onlinePlayerList.removeIf(p -> p.getUuid().equals(playerUUID)); - } - } - - public MinecraftServer getServer() { - return this.serverInstance; - } - - public Plugin getPluginInstance() { - return pluginInstance; - } - - @Override - public Collection getOnlinePlayers() { - return onlinePlayerMap.values(); - } - - /** - * Only update some of the online players each tick to minimize performance impact on the server-thread. - * Only call this method on the server-thread. - */ - private void updateSomePlayers() { - int onlinePlayerCount = onlinePlayerList.size(); - if (onlinePlayerCount == 0) return; - - int playersToBeUpdated = onlinePlayerCount / 20; //with 20 tps, each player is updated once a second - if (playersToBeUpdated == 0) playersToBeUpdated = 1; - - for (int i = 0; i < playersToBeUpdated; i++) { - playerUpdateIndex++; - if (playerUpdateIndex >= 20 && playerUpdateIndex >= onlinePlayerCount) playerUpdateIndex = 0; - - if (playerUpdateIndex < onlinePlayerCount) { - onlinePlayerList.get(playerUpdateIndex).update(); - } - } - } - -} diff --git a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java b/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java deleted file mode 100644 index 7025ccda..00000000 --- a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricPlayer.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.Gamemode; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.GameMode; -import net.minecraft.world.LightType; - -import java.util.EnumMap; -import java.util.Map; -import java.util.UUID; - -public class FabricPlayer implements Player { - - private static final Map GAMEMODE_MAP = new EnumMap<>(GameMode.class); - static { - GAMEMODE_MAP.put(GameMode.ADVENTURE, Gamemode.ADVENTURE); - GAMEMODE_MAP.put(GameMode.SURVIVAL, Gamemode.SURVIVAL); - GAMEMODE_MAP.put(GameMode.CREATIVE, Gamemode.CREATIVE); - GAMEMODE_MAP.put(GameMode.SPECTATOR, Gamemode.SPECTATOR); - } - - private final UUID uuid; - private Text name; - private ServerWorld world; - private Vector3d position; - private Vector3d rotation; - private int skyLight; - private int blockLight; - private boolean sneaking; - private boolean invisible; - private Gamemode gamemode; - - private final FabricMod mod; - - public FabricPlayer(UUID playerUuid, FabricMod mod) { - this.uuid = playerUuid; - this.mod = mod; - - update(); - } - - @Override - public UUID getUuid() { - return this.uuid; - } - - @Override - public Text getName() { - return this.name; - } - - @Override - public ServerWorld getWorld() { - return this.world; - } - - @Override - public Vector3d getPosition() { - return this.position; - } - - @Override - public Vector3d getRotation() { - return rotation; - } - - @Override - public int getSkyLight() { - return skyLight; - } - - @Override - public int getBlockLight() { - return blockLight; - } - - @Override - public boolean isSneaking() { - return this.sneaking; - } - - @Override - public boolean isInvisible() { - return this.invisible; - } - - @Override - public Gamemode getGamemode() { - return this.gamemode; - } - - /** - * Only call on server thread! - */ - public void update() { - MinecraftServer server = mod.getServer(); - if (server == null) return; - - ServerPlayerEntity player = server.getPlayerManager().getPlayer(uuid); - if (player == null) return; - - this.gamemode = GAMEMODE_MAP.get(player.interactionManager.getGameMode()); - if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL; - - StatusEffectInstance invis = player.getStatusEffect(StatusEffects.INVISIBILITY); - this.invisible = invis != null && invis.getDuration() > 0; - - this.name = Text.of(player.getName().getString()); - - Vec3d pos = player.getPos(); - this.position = new Vector3d(pos.getX(), pos.getY(), pos.getZ()); - this.rotation = new Vector3d(player.getPitch(), player.getHeadYaw(), 0); - this.sneaking = player.isSneaking(); - - this.skyLight = player.getServerWorld().getLightingProvider().get(LightType.SKY).getLightLevel(player.getBlockPos()); - this.blockLight = player.getServerWorld().getLightingProvider().get(LightType.BLOCK).getLightLevel(player.getBlockPos()); - - this.world = mod.getServerWorld(player.getServerWorld()); - } - -} diff --git a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java b/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java deleted file mode 100644 index ff4468d9..00000000 --- a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/FabricWorld.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.util.Key; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.Identifier; -import net.minecraft.util.WorldSavePath; - -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.nio.file.Path; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; - -public class FabricWorld implements ServerWorld { - - private final WeakReference delegate; - private final Path worldFolder; - private final Key dimension; - - public FabricWorld(net.minecraft.server.world.ServerWorld delegate) { - this.delegate = new WeakReference<>(delegate); - - MinecraftServer server = delegate.getServer(); - this.worldFolder = delegate.getServer().getRunDirectory().toPath() - .resolve(server.getSavePath(WorldSavePath.ROOT)); - - Identifier id = delegate.getRegistryKey().getValue(); - this.dimension = new Key(id.getNamespace(), id.getPath()); - } - - @Override - public boolean persistWorldChanges() throws IOException { - net.minecraft.server.world.ServerWorld world = delegate.get(); - if (world == null) return false; - - var taskResult = CompletableFuture.supplyAsync(() -> { - try { - world.save(null, true, false); - return true; - } catch (Exception e) { - throw new CompletionException(e); - } - }, world.getServer()); - - try { - return taskResult.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IOException(e); - } catch (ExecutionException e) { - Throwable t = e.getCause(); - if (t instanceof IOException) throw (IOException) t; - if (t instanceof IllegalArgumentException) throw (IllegalArgumentException) t; - throw new IOException(t); - } - } - - @Override - public Path getWorldFolder() { - return worldFolder; - } - - @Override - public Key getDimension() { - return dimension; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - FabricWorld that = (FabricWorld) o; - Object world = delegate.get(); - return world != null && world.equals(that.delegate.get()); - } - - @Override - public int hashCode() { - Object world = delegate.get(); - return world != null ? world.hashCode() : 0; - } - -} diff --git a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java b/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java deleted file mode 100644 index 9e60f395..00000000 --- a/implementations/fabric-1.17/src/main/java/de/bluecolored/bluemap/fabric/Log4jLogger.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.fabric; - -import org.apache.logging.log4j.Logger; - -import de.bluecolored.bluemap.core.logger.AbstractLogger; - -public class Log4jLogger extends AbstractLogger { - - private final Logger out; - - public Log4jLogger(Logger out) { - this.out = out; - } - - @Override - public void logError(String message, Throwable throwable) { - out.error(message, throwable); - } - - @Override - public void logWarning(String message) { - out.warn(message); - } - - @Override - public void logInfo(String message) { - out.info(message); - } - - @Override - public void logDebug(String message) { - if (out.isDebugEnabled()) out.debug(message); - } - - @Override - public void noFloodDebug(String message) { - if (out.isDebugEnabled()) super.noFloodDebug(message); - } - - @Override - public void noFloodDebug(String key, String message) { - if (out.isDebugEnabled()) super.noFloodDebug(key, message); - } - -} diff --git a/implementations/fabric-1.17/src/main/resources/assets/bluemap/icon.png b/implementations/fabric-1.17/src/main/resources/assets/bluemap/icon.png deleted file mode 100644 index 65d56d7a..00000000 Binary files a/implementations/fabric-1.17/src/main/resources/assets/bluemap/icon.png and /dev/null differ diff --git a/implementations/fabric-1.17/src/main/resources/fabric.mod.json b/implementations/fabric-1.17/src/main/resources/fabric.mod.json deleted file mode 100644 index cb78cc10..00000000 --- a/implementations/fabric-1.17/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "schemaVersion": 1, - "id": "bluemap", - "version": "${version}", - - "name": "BlueMap", - "description": "A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)", - "authors": [ - "Blue (TBlueF, Lukas Rieger)" - ], - "contact": { - "homepage": "https://github.com/BlueMap-Minecraft", - "sources": "https://github.com/BlueMap-Minecraft/BlueMap" - }, - - "license": "MIT", - "icon": "assets/bluemap/icon.png", - - "environment": "*", - "entrypoints": { - "main": [ - "de.bluecolored.bluemap.fabric.FabricMod" - ] - }, - - "depends": { - "fabricloader": ">=0.11.3", - "fabric": "*", - "fabric-api-base": "*", - "minecraft": ">=1.17.0" - }, - "suggests": {} -} diff --git a/implementations/forge-1.17.1/build.gradle b/implementations/forge-1.17.1/build.gradle deleted file mode 100644 index 54bf3601..00000000 --- a/implementations/forge-1.17.1/build.gradle +++ /dev/null @@ -1,217 +0,0 @@ -buildscript { - repositories { - // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true - } -} - -plugins { - id "java" - id "java-library" - id "com.diffplug.spotless" version "6.1.2" - id "com.github.node-gradle.node" version "3.0.1" - id "com.github.johnrengelman.shadow" version "7.1.2" - id "com.modrinth.minotaur" version "2.+" - id "com.matthewprenger.cursegradle" version "1.4.0" -} - -apply plugin: "net.minecraftforge.gradle" - -group = "de.bluecolored.bluemap.forge" -version = System.getProperty("bluemap.version") ?: "?" // set by BlueMapCore -archivesBaseName = 'bluemap' - -def javaTarget = 16 -java { - sourceCompatibility = JavaVersion.toVersion(javaTarget) - targetCompatibility = JavaVersion.toVersion(javaTarget) - - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} - -minecraft { - mappings channel: 'official', version: '1.17.1' - - runs { - server { - workingDirectory project.file('run') - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - - mods { - bluemap { - source sourceSets.main - } - } - } - } -} - -sourceSets.main.resources { srcDir 'src/generated/resources' } - -repositories { - mavenCentral() - maven { - setUrl("https://libraries.minecraft.net") - } - maven { - setUrl("https://jitpack.io") - } -} - -configurations { - implementation.extendsFrom(shadowInclude) -} - -dependencies { - minecraft 'net.minecraftforge:forge:1.17.1-37.0.109' - - shadowInclude ("de.bluecolored.bluemap.common:BlueMapCommon") { - //exclude dependencies provided by forge - exclude (group: "com.google.guava", module: "guava") - exclude (group: "com.google.code.gson", module: "gson") - exclude (group: "org.apache.commons", module: "commons-lang3") - exclude (group: "commons-io", module: "commons-io") - exclude (group: "com.mojang", module: "brigadier") - } - - testImplementation ("org.junit.jupiter:junit-jupiter:5.8.2") - testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:5.8.2") -} - -spotless { - java { - target ("src/*/java/**/*.java") - - licenseHeaderFile("../../HEADER") - indentWithSpaces() - trimTrailingWhitespace() - } -} - -jar { - manifest { - attributes([ - "Specification-Title" : "bluemap", - "Specification-Vendor" : "bluemap", - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : "bluemap", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } -} - -jar.finalizedBy('reobfJar') - -tasks.withType(JavaCompile).configureEach { - options.encoding = "utf-8" -} - -tasks.withType(AbstractArchiveTask).configureEach { - setReproducibleFileOrder(true) - setPreserveFileTimestamps(false) -} - -test { - useJUnitPlatform() -} - -shadowJar { - destinationDirectory.set(file("../../build/release")) - archiveFileName.set("BlueMap-${project.version}-${project.name}.jar") - - configurations = [project.configurations.shadowInclude] - - //relocate ("com.flowpowered.math", "de.bluecolored.shadow.flowpowered.math") //DON"T relocate this, because the API depends on it - relocate ("com.typesafe.config", "de.bluecolored.shadow.typesafe.config") - relocate ("net.querz.nbt", "de.bluecolored.shadow.querz.nbt") - relocate ("org.spongepowered.configurate", "de.bluecolored.shadow.configurate") - relocate ("com.github.benmanes.caffeine", "de.bluecolored.shadow.benmanes.caffeine") - relocate ("org.aopalliance", "de.bluecolored.shadow.aopalliance") - relocate ("javax.inject", "de.bluecolored.shadow.javax.inject") - relocate ("org.checkerframework", "de.bluecolored.shadow.checkerframework") - relocate ("org.codehaus", "de.bluecolored.shadow.codehaus") - relocate ("io.leangen.geantyref", "de.bluecolored.shadow.geantyref") - relocate ("io.airlift", "de.bluecolored.shadow.airlift") - - relocate ("com.google.errorprone", "de.bluecolored.shadow.google.errorprone") - relocate ("com.google.inject", "de.bluecolored.shadow.google.inject") - - relocate ("org.apache.commons.dbcp2", "de.bluecolored.shadow.apache.commons.dbcp2") - relocate ("org.apache.commons.logging", "de.bluecolored.shadow.apache.commons.logging") - relocate ("org.apache.commons.pool2", "de.bluecolored.shadow.apache.commons.pool2") -} - -processResources { - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info','META-INF/mods.toml' - duplicatesStrategy = DuplicatesStrategy.WARN - - expand ( - version: project.version - ) - } -} - -afterEvaluate { - reobf { - shadowJar { - mappings = createMcpToSrg.output - } - } -} - -task release { - dependsOn(build) -} - -modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = "swbUV1cr" - versionNumber = "${project.version}-${project.name}" - changelog = file("../../release.md") - .getText() - .replace("{version}", project.version.toString()) - uploadFile = shadowJar - gameVersions = ["1.17.1"] -} - -curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") ?: "" - project { - id = "406463" - changelogType = "markdown" - changelog = file("../../release.md") - .getText() - .replace("{version}", project.version.toString()) - releaseType = "release" - - addGameVersion "Forge" - - addGameVersion "Java 18" - addGameVersion "Java 17" - addGameVersion "Java 16" - - addGameVersion "1.17.1" - - mainArtifact shadowJar - } - options { - javaVersionAutoDetect = false - javaIntegration = false - forgeGradleIntegration = false - } -} - -task publish { - dependsOn(tasks.findByName("modrinth")) - dependsOn(tasks.findByName("curseforge")) -} diff --git a/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.jar b/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 41d9927a..00000000 Binary files a/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.properties b/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index db9a6b82..00000000 --- a/implementations/forge-1.17.1/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/implementations/forge-1.17.1/gradlew b/implementations/forge-1.17.1/gradlew deleted file mode 100644 index 1b6c7873..00000000 --- a/implementations/forge-1.17.1/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/implementations/forge-1.17.1/gradlew.bat b/implementations/forge-1.17.1/gradlew.bat deleted file mode 100644 index 107acd32..00000000 --- a/implementations/forge-1.17.1/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/implementations/forge-1.17.1/settings.gradle.kts b/implementations/forge-1.17.1/settings.gradle.kts deleted file mode 100644 index 3894f07f..00000000 --- a/implementations/forge-1.17.1/settings.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -rootProject.name = "forge-1.17.1" - -includeBuild("../../BlueMapCommon") \ No newline at end of file diff --git a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java b/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java deleted file mode 100644 index b19ca3af..00000000 --- a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeCommandSource.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.forge; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.CommandSource; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.world.World; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.network.chat.TextComponent; - -import java.util.Optional; - -public class ForgeCommandSource implements CommandSource { - - private final ForgeMod mod; - private final Plugin plugin; - private final CommandSourceStack delegate; - - public ForgeCommandSource(ForgeMod mod, Plugin plugin, CommandSourceStack delegate) { - this.mod = mod; - this.plugin = plugin; - this.delegate = delegate; - } - - @Override - public void sendMessage(Text text) { - var component = TextComponent.Serializer.fromJsonLenient(text.toJSONString()); - if (component != null) - delegate.sendSuccess(component, false); - } - - @Override - public boolean hasPermission(String permission) { - return delegate.hasPermission(1); - } - - @Override - public Optional getPosition() { - var pos = delegate.getPosition(); - return Optional.of(new Vector3d(pos.x, pos.y, pos.z)); - } - - @Override - public Optional getWorld() { - ServerWorld serverWorld = mod.getServerWorld(delegate.getLevel()); - return Optional.ofNullable(plugin.getWorld(serverWorld)); - } - -} diff --git a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeEventForwarder.java b/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeEventForwarder.java deleted file mode 100644 index ff54d23a..00000000 --- a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeEventForwarder.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.forge; - -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent; -import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - -public class ForgeEventForwarder { - - private final Collection eventListeners; - - public ForgeEventForwarder() { - this.eventListeners = new ArrayList<>(1); - - MinecraftForge.EVENT_BUS.register(this); - } - - public synchronized void addEventListener(ServerEventListener listener) { - this.eventListeners.add(listener); - } - - public synchronized void removeAllListeners() { - this.eventListeners.clear(); - } - - @SubscribeEvent - public synchronized void onPlayerJoin(PlayerLoggedInEvent evt) { - UUID uuid = evt.getPlayer().getUUID(); - for (ServerEventListener listener : eventListeners) listener.onPlayerJoin(uuid); - } - - @SubscribeEvent - public synchronized void onPlayerLeave(PlayerLoggedOutEvent evt) { - UUID uuid = evt.getPlayer().getUUID(); - for (ServerEventListener listener : eventListeners) listener.onPlayerLeave(uuid); - } - -} diff --git a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeMod.java b/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeMod.java deleted file mode 100644 index 5fc046e9..00000000 --- a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeMod.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.forge; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import de.bluecolored.bluemap.common.plugin.Plugin; -import de.bluecolored.bluemap.common.plugin.commands.Commands; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.ServerEventListener; -import de.bluecolored.bluemap.common.serverinterface.Server; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.BlueMap; -import de.bluecolored.bluemap.core.MinecraftVersion; -import de.bluecolored.bluemap.core.logger.Logger; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.level.Level; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegisterCommandsEvent; -import net.minecraftforge.event.TickEvent.ServerTickEvent; -import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent; -import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.IExtensionPoint; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fmllegacy.network.FMLNetworkConstants; -import net.minecraftforge.fmlserverevents.FMLServerStartedEvent; -import net.minecraftforge.fmlserverevents.FMLServerStartingEvent; -import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent; -import org.apache.logging.log4j.LogManager; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -@Mod(Plugin.PLUGIN_ID) -public class ForgeMod implements Server { - - private final Plugin pluginInstance; - private MinecraftServer serverInstance = null; - - private final ForgeEventForwarder eventForwarder; - private final LoadingCache worlds; - - private int playerUpdateIndex = 0; - private final Map onlinePlayerMap; - private final List onlinePlayerList; - - public ForgeMod() { - Logger.global.clear(); - Logger.global.put(new Log4jLogger(LogManager.getLogger(Plugin.PLUGIN_NAME))); - - this.onlinePlayerMap = new ConcurrentHashMap<>(); - this.onlinePlayerList = Collections.synchronizedList(new ArrayList<>()); - - this.pluginInstance = new Plugin("forge-1.17.1", this); - - this.eventForwarder = new ForgeEventForwarder(); - this.worlds = Caffeine.newBuilder() - .executor(BlueMap.THREAD_POOL) - .weakKeys() - .maximumSize(1000) - .build(ForgeWorld::new); - - MinecraftForge.EVENT_BUS.register(this); - - //Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible - ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true)); - } - - @SubscribeEvent - public void onServerStarting(FMLServerStartingEvent event) { - this.serverInstance = event.getServer(); - } - - @SubscribeEvent - public void onRegisterCommands(RegisterCommandsEvent event) { - //register commands - new Commands<>(pluginInstance, event.getDispatcher(), forgeSource -> - new ForgeCommandSource(this, pluginInstance, forgeSource) - ); - } - - @SubscribeEvent - public void onServerStarted(FMLServerStartedEvent event) { - //save worlds to generate level.dat files - serverInstance.saveAllChunks(false, true, true); - - new Thread(() -> { - Logger.global.logInfo("Loading..."); - - try { - pluginInstance.load(); - if (pluginInstance.isLoaded()) Logger.global.logInfo("Loaded!"); - } catch (IOException e) { - Logger.global.logError("Failed to load bluemap!", e); - pluginInstance.unload(); - } - }, "BlueMap-Plugin-Loading").start(); - } - - @SubscribeEvent - public void onServerStopping(FMLServerStoppingEvent event) { - pluginInstance.unload(); - Logger.global.logInfo("BlueMap unloaded!"); - } - - @SubscribeEvent - public void onTick(ServerTickEvent evt) { - updateSomePlayers(); - } - - @Override - public MinecraftVersion getMinecraftVersion() { - return new MinecraftVersion(1, 17, 1); - } - - @Override - public void registerListener(ServerEventListener listener) { - eventForwarder.addEventListener(listener); - } - - @Override - public void unregisterAllListeners() { - eventForwarder.removeAllListeners(); - } - - @Override - public Collection getLoadedServerWorlds() { - Collection loadedWorlds = new ArrayList<>(3); - for (ServerLevel serverWorld : serverInstance.getAllLevels()) { - loadedWorlds.add(worlds.get(serverWorld)); - } - return loadedWorlds; - } - - @SuppressWarnings("unchecked") - @Override - public Optional getServerWorld(Object world) { - - if (world instanceof String) { - ResourceLocation resourceLocation = ResourceLocation.tryParse((String) world); - if (resourceLocation != null) world = serverInstance.getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, resourceLocation)); - } - - if (world instanceof ResourceKey) { - try { - world = serverInstance.getLevel((ResourceKey) world); - } catch (ClassCastException ignored) {} - } - - if (world instanceof ServerLevel) - return Optional.of(getServerWorld((ServerLevel) world)); - - return Optional.empty(); - } - - public ServerWorld getServerWorld(ServerLevel world) { - return worlds.get(world); - } - - @Override - public Path getConfigFolder() { - return Path.of("config", "bluemap"); - } - - @Override - public Optional getModsFolder() { - return Optional.of(Path.of("mods")); - } - - @SubscribeEvent - public void onPlayerJoin(PlayerLoggedInEvent evt) { - var playerInstance = evt.getPlayer(); - if (!(playerInstance instanceof ServerPlayer)) return; - - ForgePlayer player = new ForgePlayer(playerInstance.getUUID(), this); - onlinePlayerMap.put(player.getUuid(), player); - onlinePlayerList.add(player); - } - - @SubscribeEvent - public void onPlayerLeave(PlayerLoggedOutEvent evt) { - var player = evt.getPlayer(); - if (!(player instanceof ServerPlayer)) return; - - UUID playerUUID = player.getUUID(); - onlinePlayerMap.remove(playerUUID); - synchronized (onlinePlayerList) { - onlinePlayerList.removeIf(p -> p.getUuid().equals(playerUUID)); - } - } - - public MinecraftServer getServer() { - return this.serverInstance; - } - - public Plugin getPlugin() { - return this.pluginInstance; - } - - @Override - public Collection getOnlinePlayers() { - return onlinePlayerMap.values(); - } - - /** - * Only update some of the online players each tick to minimize performance impact on the server-thread. - * Only call this method on the server-thread. - */ - private void updateSomePlayers() { - int onlinePlayerCount = onlinePlayerList.size(); - if (onlinePlayerCount == 0) return; - - int playersToBeUpdated = onlinePlayerCount / 20; //with 20 tps, each player is updated once a second - if (playersToBeUpdated == 0) playersToBeUpdated = 1; - - for (int i = 0; i < playersToBeUpdated; i++) { - playerUpdateIndex++; - if (playerUpdateIndex >= 20 && playerUpdateIndex >= onlinePlayerCount) playerUpdateIndex = 0; - - if (playerUpdateIndex < onlinePlayerCount) { - onlinePlayerList.get(playerUpdateIndex).update(); - } - } - } - -} diff --git a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java b/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java deleted file mode 100644 index 07d9fdcd..00000000 --- a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgePlayer.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.forge; - -import com.flowpowered.math.vector.Vector3d; -import de.bluecolored.bluemap.common.plugin.text.Text; -import de.bluecolored.bluemap.common.serverinterface.Gamemode; -import de.bluecolored.bluemap.common.serverinterface.Player; -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import net.minecraft.core.BlockPos; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.level.GameType; -import net.minecraft.world.level.LightLayer; -import net.minecraft.world.phys.Vec3; - -import java.util.EnumMap; -import java.util.Map; -import java.util.UUID; - -public class ForgePlayer implements Player { - - private static final Map GAMEMODE_MAP = new EnumMap<>(GameType.class); - static { - GAMEMODE_MAP.put(GameType.ADVENTURE, Gamemode.ADVENTURE); - GAMEMODE_MAP.put(GameType.SURVIVAL, Gamemode.SURVIVAL); - GAMEMODE_MAP.put(GameType.CREATIVE, Gamemode.CREATIVE); - GAMEMODE_MAP.put(GameType.SPECTATOR, Gamemode.SPECTATOR); - } - - private final UUID uuid; - private Text name; - private ServerWorld world; - private Vector3d position; - private Vector3d rotation; - private int skyLight; - private int blockLight; - private boolean sneaking; - private boolean invisible; - private Gamemode gamemode; - - private final ForgeMod mod; - - public ForgePlayer(UUID playerUuid, ForgeMod mod) { - this.uuid = playerUuid; - this.mod = mod; - - update(); - } - - @Override - public UUID getUuid() { - return this.uuid; - } - - @Override - public Text getName() { - return this.name; - } - - @Override - public ServerWorld getWorld() { - return this.world; - } - - @Override - public Vector3d getPosition() { - return this.position; - } - - @Override - public Vector3d getRotation() { - return rotation; - } - - @Override - public int getSkyLight() { - return skyLight; - } - - @Override - public int getBlockLight() { - return blockLight; - } - - @Override - public boolean isSneaking() { - return this.sneaking; - } - - @Override - public boolean isInvisible() { - return this.invisible; - } - - @Override - public Gamemode getGamemode() { - return this.gamemode; - } - - /** - * Only call on server thread! - */ - public void update() { - MinecraftServer server = mod.getServer(); - if (server == null) return; - - ServerPlayer player = server.getPlayerList().getPlayer(uuid); - if (player == null) return; - - this.gamemode = GAMEMODE_MAP.getOrDefault(player.gameMode.getGameModeForPlayer(), Gamemode.SURVIVAL); - if (this.gamemode == null) this.gamemode = Gamemode.SURVIVAL; - - MobEffectInstance invis = player.getEffect(MobEffects.INVISIBILITY); - this.invisible = invis != null && invis.getDuration() > 0; - - this.name = Text.of(player.getName().getString()); - - Vec3 pos = player.getPosition(1f); - this.position = new Vector3d(pos.x(), pos.y(), pos.z()); - this.rotation = new Vector3d(player.getXRot(), player.getYHeadRot(), 0); - this.sneaking = player.isCrouching(); - - this.skyLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ())); - this.blockLight = player.getLevel().getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getLightValue(new BlockPos(player.getX(), player.getY(), player.getZ())); - - this.world = mod.getServerWorld(player.getLevel()); - } - -} diff --git a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java b/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java deleted file mode 100644 index dc2284be..00000000 --- a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/ForgeWorld.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.forge; - -import de.bluecolored.bluemap.common.serverinterface.ServerWorld; -import de.bluecolored.bluemap.core.util.Key; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.storage.LevelResource; - -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.nio.file.Path; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ExecutionException; - -public class ForgeWorld implements ServerWorld { - - private final WeakReference delegate; - private final Path worldFolder; - private final Key dimension; - - public ForgeWorld(ServerLevel delegate) { - this.delegate = new WeakReference<>(delegate); - - MinecraftServer server = delegate.getServer(); - this.worldFolder = delegate.getServer().getServerDirectory().toPath() - .resolve(server.getWorldPath(LevelResource.ROOT)); - - ResourceLocation id = delegate.dimension().location(); - this.dimension = new Key(id.getNamespace(), id.getPath()); - } - - @Override - public boolean persistWorldChanges() throws IOException { - ServerLevel world = delegate.get(); - if (world == null) return false; - - var taskResult = CompletableFuture.supplyAsync(() -> { - try { - world.save(null, true, false); - return true; - } catch (Exception e) { - throw new CompletionException(e); - } - }, world.getServer()); - - try { - return taskResult.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new IOException(e); - } catch (ExecutionException e) { - Throwable t = e.getCause(); - if (t instanceof IOException) throw (IOException) t; - if (t instanceof IllegalArgumentException) throw (IllegalArgumentException) t; - throw new IOException(t); - } - } - - @Override - public Path getWorldFolder() { - return worldFolder; - } - - @Override - public Key getDimension() { - return dimension; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ForgeWorld that = (ForgeWorld) o; - Object world = delegate.get(); - return world != null && world.equals(that.delegate.get()); - } - - @Override - public int hashCode() { - Object world = delegate.get(); - return world != null ? world.hashCode() : 0; - } - -} diff --git a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/Log4jLogger.java b/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/Log4jLogger.java deleted file mode 100644 index 740b75b2..00000000 --- a/implementations/forge-1.17.1/src/main/java/de/bluecolored/bluemap/forge/Log4jLogger.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of BlueMap, licensed under the MIT License (MIT). - * - * Copyright (c) Blue (Lukas Rieger) - * Copyright (c) contributors - * - * 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. - */ -package de.bluecolored.bluemap.forge; - -import de.bluecolored.bluemap.core.logger.AbstractLogger; -import org.apache.logging.log4j.Logger; - -public class Log4jLogger extends AbstractLogger { - - private final Logger out; - - public Log4jLogger(Logger out) { - this.out = out; - } - - @Override - public void logError(String message, Throwable throwable) { - out.error(message, throwable); - } - - @Override - public void logWarning(String message) { - out.warn(message); - } - - @Override - public void logInfo(String message) { - out.info(message); - } - - @Override - public void logDebug(String message) { - if (out.isDebugEnabled()) out.debug(message); - } - - @Override - public void noFloodDebug(String message) { - if (out.isDebugEnabled()) super.noFloodDebug(message); - } - - @Override - public void noFloodDebug(String key, String message) { - if (out.isDebugEnabled()) super.noFloodDebug(key, message); - } - -} diff --git a/implementations/forge-1.17.1/src/main/resources/META-INF/mods.toml b/implementations/forge-1.17.1/src/main/resources/META-INF/mods.toml deleted file mode 100644 index 299c79ed..00000000 --- a/implementations/forge-1.17.1/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,26 +0,0 @@ -modLoader="javafml" -loaderVersion="[28,)" -license="MIT" -issueTrackerURL="https://github.com/BlueMap-Minecraft/BlueMap/issues" -[[mods]] -modId="bluemap" -version="${version}" -displayName="BlueMap" -displayURL="https://github.com/BlueMap-Minecraft/BlueMap" -authors="Blue (TBlueF, Lukas Rieger)" -description=''' -A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL) -''' - -[[dependencies.bluemap]] - modId="forge" - mandatory=true - versionRange="[32,)" - ordering="NONE" - side="SERVER" -[[dependencies.bluemap]] - modId="minecraft" - mandatory=true - versionRange="[1.16.1,)" - ordering="NONE" - side="SERVER" diff --git a/implementations/forge-1.17.1/src/main/resources/pack.mcmeta b/implementations/forge-1.17.1/src/main/resources/pack.mcmeta deleted file mode 100644 index 49259163..00000000 --- a/implementations/forge-1.17.1/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "BlueMap - A 3d-map of your Minecraft worlds view-able in your browser using three.js (WebGL)", - "pack_format": 5 - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 2596e967..2b03f1c7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,14 +7,10 @@ if (!releaseNotesFile.exists()) releaseNotesFile.createNewFile(); // implementations includeBuild("implementations/cli") -includeBuild("implementations/fabric-1.15.2") -includeBuild("implementations/fabric-1.16.2") -includeBuild("implementations/fabric-1.17") includeBuild("implementations/fabric-1.18") includeBuild("implementations/fabric-1.19.4") includeBuild("implementations/fabric-1.20") -includeBuild("implementations/forge-1.17.1") includeBuild("implementations/forge-1.18.1") includeBuild("implementations/forge-1.19.4") includeBuild("implementations/forge-1.20")