summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore34
-rw-r--r--build.gradle.kts104
-rw-r--r--gradle.properties16
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 43462 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties7
-rwxr-xr-xgradlew249
-rw-r--r--gradlew.bat92
-rw-r--r--settings.gradle.kts33
-rw-r--r--src/main/java/lv/enes/mc/eriscraft_misc/SecretDoorWailaPlugin.java35
-rw-r--r--src/main/resources/quilt.mod.json24
-rw-r--r--src/main/resources/waila_plugins.json7
11 files changed, 601 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..32968af
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,34 @@
1# Gradle
2.gradle/
3build/
4out/
5classes/
6
7# Quilt Loom
8remappedSrc/
9run/
10
11# Eclipse
12*.launch
13
14# IDEA
15.idea/
16*.iml
17*.ipr
18*.iws
19
20# Fleet
21.fleet/
22
23# VS Code
24.settings/
25.vscode/
26bin/
27.classpath
28.project
29
30# Eclipse JDT LS
31workspace/
32
33# macOS
34*.DS_Store \ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..81b16a8
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,104 @@
1plugins {
2 `maven-publish`
3 id("org.quiltmc.loom")
4}
5
6val groupid: String by project
7val jakartaAnnotationVersion: String by project
8val loaderVersion: String by project
9val modid: String by project
10val modVersion: String by project
11val minecraftVersion: String by project
12val quiltMappings: String by project
13val wthitVersion: String by project
14
15group = groupid
16version = modVersion
17
18repositories {
19 maven {
20 // For WTHIT
21 url = uri("https://maven2.bai.lol")
22 content {
23 includeGroup("lol.bai")
24 includeGroup("mcp.mobius.waila")
25 }
26 }
27}
28
29loom {
30 mods {
31 register(modid) {
32 sourceSet("main")
33 }
34 }
35}
36
37dependencies {
38 minecraft("com.mojang:minecraft:${minecraftVersion}")
39 mappings(loom.layered {
40 mappings("org.quiltmc:quilt-mappings:${minecraftVersion}+build.${quiltMappings}:intermediary-v2")
41 officialMojangMappings()
42 })
43 modImplementation("org.quiltmc:quilt-loader:${loaderVersion}")
44
45 modCompileOnly("mcp.mobius.waila:wthit-api:quilt-${wthitVersion}")
46
47 compileOnly("jakarta.annotation:jakarta.annotation-api:${jakartaAnnotationVersion}")
48}
49
50java {
51 toolchain {
52 languageVersion.set(JavaLanguageVersion.of(17))
53 }
54
55 withJavadocJar()
56 withSourcesJar()
57}
58
59publishing {
60 publications {
61 create<MavenPublication>("maven") {
62 from(components["java"])
63 }
64 }
65
66 repositories {
67 maven {
68 url = uri("https://mvn.enes.lv/")
69 credentials {
70 username = (findProperty("mvnUsername") ?: System.getenv("MVN_USERNAME")).toString()
71 password = (findProperty("mvnPassword") ?: System.getenv("MVN_PASSWORD")).toString()
72 }
73 }
74 }
75}
76
77tasks.processResources {
78 inputs.property("loader_version", loaderVersion)
79 inputs.property("minecraft_version", minecraftVersion)
80 inputs.property("version", version)
81
82 filesMatching("quilt.mod.json") {
83 expand(
84 "loader_version" to loaderVersion,
85 "minecraft_version" to minecraftVersion,
86 "version" to version
87 )
88 }
89}
90
91tasks.withType<JavaCompile>().configureEach {
92 options.encoding = "UTF-8"
93 options.release = 17
94}
95
96tasks.javadoc {
97 (options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
98}
99
100tasks.jar {
101 from("LICENSE") {
102 rename { "${it}_${name}" }
103 }
104}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..f8402b4
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,16 @@
1org.gradle.jvmargs = -Xmx1G
2org.gradle.parallel = true
3
4groupid = lv.enes.mc
5modid = eriscraft_misc
6modVersion = 1.0
7
8loomPluginVersion = 1.4.1
9
10minecraftVersion = 1.20.1
11quiltMappings = 23
12loaderVersion = 0.23.0
13
14wthitVersion = 8.5.0
15
16jakartaAnnotationVersion = 3.0.0-M1 \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..d64cd49
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1af9e09
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
1distributionBase=GRADLE_USER_HOME
2distributionPath=wrapper/dists
3distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4networkTimeout=10000
5validateDistributionUrl=true
6zipStoreBase=GRADLE_USER_HOME
7zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..1aa94a4
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,249 @@
1#!/bin/sh
2
3#
4# Copyright © 2015-2021 the original authors.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# https://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19##############################################################################
20#
21# Gradle start up script for POSIX generated by Gradle.
22#
23# Important for running:
24#
25# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26# noncompliant, but you have some other compliant shell such as ksh or
27# bash, then to run this script, type that shell name before the whole
28# command line, like:
29#
30# ksh Gradle
31#
32# Busybox and similar reduced shells will NOT work, because this script
33# requires all of these POSIX shell features:
34# * functions;
35# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37# * compound commands having a testable exit status, especially «case»;
38# * various built-in commands including «command», «set», and «ulimit».
39#
40# Important for patching:
41#
42# (2) This script targets any POSIX shell, so it avoids extensions provided
43# by Bash, Ksh, etc; in particular arrays are avoided.
44#
45# The "traditional" practice of packing multiple parameters into a
46# space-separated string is a well documented source of bugs and security
47# problems, so this is (mostly) avoided, by progressively accumulating
48# options in "$@", and eventually passing that to Java.
49#
50# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52# see the in-line comments for details.
53#
54# There are tweaks for specific operating systems such as AIX, CygWin,
55# Darwin, MinGW, and NonStop.
56#
57# (3) This script is generated from the Groovy template
58# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59# within the Gradle project.
60#
61# You can find Gradle at https://github.com/gradle/gradle/.
62#
63##############################################################################
64
65# Attempt to set APP_HOME
66
67# Resolve links: $0 may be a link
68app_path=$0
69
70# Need this for daisy-chained symlinks.
71while
72 APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 [ -h "$app_path" ]
74do
75 ls=$( ls -ld "$app_path" )
76 link=${ls#*' -> '}
77 case $link in #(
78 /*) app_path=$link ;; #(
79 *) app_path=$APP_HOME$link ;;
80 esac
81done
82
83# This is normally unused
84# shellcheck disable=SC2034
85APP_BASE_NAME=${0##*/}
86# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
88
89# Use the maximum available, or set MAX_FD != -1 to use that value.
90MAX_FD=maximum
91
92warn () {
93 echo "$*"
94} >&2
95
96die () {
97 echo
98 echo "$*"
99 echo
100 exit 1
101} >&2
102
103# OS specific support (must be 'true' or 'false').
104cygwin=false
105msys=false
106darwin=false
107nonstop=false
108case "$( uname )" in #(
109 CYGWIN* ) cygwin=true ;; #(
110 Darwin* ) darwin=true ;; #(
111 MSYS* | MINGW* ) msys=true ;; #(
112 NONSTOP* ) nonstop=true ;;
113esac
114
115CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
116
117
118# Determine the Java command to use to start the JVM.
119if [ -n "$JAVA_HOME" ] ; then
120 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 # IBM's JDK on AIX uses strange locations for the executables
122 JAVACMD=$JAVA_HOME/jre/sh/java
123 else
124 JAVACMD=$JAVA_HOME/bin/java
125 fi
126 if [ ! -x "$JAVACMD" ] ; then
127 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128
129Please set the JAVA_HOME variable in your environment to match the
130location of your Java installation."
131 fi
132else
133 JAVACMD=java
134 if ! command -v java >/dev/null 2>&1
135 then
136 die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
138Please set the JAVA_HOME variable in your environment to match the
139location of your Java installation."
140 fi
141fi
142
143# Increase the maximum file descriptors if we can.
144if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145 case $MAX_FD in #(
146 max*)
147 # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148 # shellcheck disable=SC2039,SC3045
149 MAX_FD=$( ulimit -H -n ) ||
150 warn "Could not query maximum file descriptor limit"
151 esac
152 case $MAX_FD in #(
153 '' | soft) :;; #(
154 *)
155 # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156 # shellcheck disable=SC2039,SC3045
157 ulimit -n "$MAX_FD" ||
158 warn "Could not set maximum file descriptor limit to $MAX_FD"
159 esac
160fi
161
162# Collect all arguments for the java command, stacking in reverse order:
163# * args from the command line
164# * the main class name
165# * -classpath
166# * -D...appname settings
167# * --module-path (only if needed)
168# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
169
170# For Cygwin or MSYS, switch paths to Windows format before running java
171if "$cygwin" || "$msys" ; then
172 APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173 CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174
175 JAVACMD=$( cygpath --unix "$JAVACMD" )
176
177 # Now convert the arguments - kludge to limit ourselves to /bin/sh
178 for arg do
179 if
180 case $arg in #(
181 -*) false ;; # don't mess with options #(
182 /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 [ -e "$t" ] ;; #(
184 *) false ;;
185 esac
186 then
187 arg=$( cygpath --path --ignore --mixed "$arg" )
188 fi
189 # Roll the args list around exactly as many times as the number of
190 # args, so each arg winds up back in the position where it started, but
191 # possibly modified.
192 #
193 # NB: a `for` loop captures its iteration list before it begins, so
194 # changing the positional parameters here affects neither the number of
195 # iterations, nor the values presented in `arg`.
196 shift # remove old arg
197 set -- "$@" "$arg" # push replacement arg
198 done
199fi
200
201
202# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
205# Collect all arguments for the java command:
206# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207# and any embedded shellness will be escaped.
208# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209# treated as '${Hostname}' itself on the command line.
210
211set -- \
212 "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 -classpath "$CLASSPATH" \
214 org.gradle.wrapper.GradleWrapperMain \
215 "$@"
216
217# Stop when "xargs" is not available.
218if ! command -v xargs >/dev/null 2>&1
219then
220 die "xargs is not available"
221fi
222
223# Use "xargs" to parse quoted args.
224#
225# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
226#
227# In Bash we could simply go:
228#
229# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
230# set -- "${ARGS[@]}" "$@"
231#
232# but POSIX shell has neither arrays nor command substitution, so instead we
233# post-process each arg (as a line of input to sed) to backslash-escape any
234# character that might be a shell metacharacter, then use eval to reverse
235# that process (while maintaining the separation between arguments), and wrap
236# the whole thing up as a single "set" statement.
237#
238# This will of course break if any of these variables contains a newline or
239# an unmatched quote.
240#
241
242eval "set -- $(
243 printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
244 xargs -n1 |
245 sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246 tr '\n' ' '
247 )" '"$@"'
248
249exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
1@rem
2@rem Copyright 2015 the original author or authors.
3@rem
4@rem Licensed under the Apache License, Version 2.0 (the "License");
5@rem you may not use this file except in compliance with the License.
6@rem You may obtain a copy of the License at
7@rem
8@rem https://www.apache.org/licenses/LICENSE-2.0
9@rem
10@rem Unless required by applicable law or agreed to in writing, software
11@rem distributed under the License is distributed on an "AS IS" BASIS,
12@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13@rem See the License for the specific language governing permissions and
14@rem limitations under the License.
15@rem
16
17@if "%DEBUG%"=="" @echo off
18@rem ##########################################################################
19@rem
20@rem Gradle startup script for Windows
21@rem
22@rem ##########################################################################
23
24@rem Set local scope for the variables with windows NT shell
25if "%OS%"=="Windows_NT" setlocal
26
27set DIRNAME=%~dp0
28if "%DIRNAME%"=="" set DIRNAME=.
29@rem This is normally unused
30set APP_BASE_NAME=%~n0
31set APP_HOME=%DIRNAME%
32
33@rem Resolve any "." and ".." in APP_HOME to make it shorter.
34for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35
36@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38
39@rem Find java.exe
40if defined JAVA_HOME goto findJavaFromJavaHome
41
42set JAVA_EXE=java.exe
43%JAVA_EXE% -version >NUL 2>&1
44if %ERRORLEVEL% equ 0 goto execute
45
46echo.
47echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48echo.
49echo Please set the JAVA_HOME variable in your environment to match the
50echo location of your Java installation.
51
52goto fail
53
54:findJavaFromJavaHome
55set JAVA_HOME=%JAVA_HOME:"=%
56set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57
58if exist "%JAVA_EXE%" goto execute
59
60echo.
61echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62echo.
63echo Please set the JAVA_HOME variable in your environment to match the
64echo location of your Java installation.
65
66goto fail
67
68:execute
69@rem Setup the command line
70
71set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72
73
74@rem Execute Gradle
75"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76
77:end
78@rem End local scope for the variables with windows NT shell
79if %ERRORLEVEL% equ 0 goto mainEnd
80
81:fail
82rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83rem the _cmd.exe /c_ return code!
84set EXIT_CODE=%ERRORLEVEL%
85if %EXIT_CODE% equ 0 set EXIT_CODE=1
86if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87exit /b %EXIT_CODE%
88
89:mainEnd
90if "%OS%"=="Windows_NT" endlocal
91
92:omega
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..c3a3536
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,33 @@
1pluginManagement {
2 repositories {
3 maven {
4 name = "Quilt"
5 url = uri("https://maven.quiltmc.org/repository/release")
6 content {
7 includeGroup("org.quiltmc")
8 includeGroup("org.quiltmc.loom")
9 includeGroup("org.quiltmc.parsers")
10 }
11 }
12
13 maven {
14 name = "Fabric"
15 url = uri("https://maven.fabricmc.net/")
16 content {
17 includeGroup("net.fabricmc")
18 }
19 }
20
21 gradlePluginPortal()
22 }
23
24 val loomPluginVersion: String by settings
25 plugins {
26 id("org.quiltmc.loom") version loomPluginVersion
27 }
28}
29
30val modid: String by settings
31val minecraftVersion: String by settings
32
33rootProject.name = "${modid}-mc${minecraftVersion}" \ No newline at end of file
diff --git a/src/main/java/lv/enes/mc/eriscraft_misc/SecretDoorWailaPlugin.java b/src/main/java/lv/enes/mc/eriscraft_misc/SecretDoorWailaPlugin.java
new file mode 100644
index 0000000..f4aaca9
--- /dev/null
+++ b/src/main/java/lv/enes/mc/eriscraft_misc/SecretDoorWailaPlugin.java
@@ -0,0 +1,35 @@
1package lv.enes.mc.eriscraft_misc;
2
3import mcp.mobius.waila.api.*;
4import net.minecraft.core.registries.BuiltInRegistries;
5import net.minecraft.resources.ResourceLocation;
6import net.minecraft.world.level.block.Blocks;
7import net.minecraft.world.level.block.DoorBlock;
8import net.minecraft.world.level.block.state.BlockState;
9
10/** When looking at secret doors as provided by the chipped mod, we say it's a bookshelf :3
11 * <p>
12 * TODO: Currently only secret oak doors are considered */
13@SuppressWarnings("unused")
14public class SecretDoorWailaPlugin implements IWailaPlugin {
15 @Override
16 public void register(IRegistrar registrar) {
17 registrar.addOverride(Overrider.INSTANCE, DoorBlock.class);
18 System.out.println("Hello, World!");
19 }
20
21 private enum Overrider implements IBlockComponentProvider {
22 INSTANCE;
23
24 @Override
25 public BlockState getOverride(IBlockAccessor accessor, IPluginConfig config) {
26 var id = BuiltInRegistries.BLOCK.getKey(accessor.getBlock());
27 // TODO: Somehow get the full list from chipped?
28 if (id.equals(new ResourceLocation("chipped", "secret_oak_door"))) {
29 return Blocks.BOOKSHELF.defaultBlockState();
30 } else {
31 return accessor.getBlockState();
32 }
33 }
34 }
35}
diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json
new file mode 100644
index 0000000..c2ec5a6
--- /dev/null
+++ b/src/main/resources/quilt.mod.json
@@ -0,0 +1,24 @@
1{
2 "schema_version": 1,
3 "quilt_loader": {
4 "group": "lv.enes.mc",
5 "id": "eriscraft_misc",
6 "version": "${version}",
7 "metadata": {
8 "name": "ErisCraft Miscellany",
9 "description": "Miscellaneous things for my modpack :3",
10 "contributors": {
11 "Eris": "Owner"
12 }
13 },
14 "intermediate_mappings": "net.fabricmc:intermediary",
15 "entrypoints": {},
16 "depends": [{
17 "id": "quilt_loader",
18 "versions": "^${loader_version}"
19 }, {
20 "id": "minecraft",
21 "versions": "=${minecraft_version}"
22 }]
23 }
24} \ No newline at end of file
diff --git a/src/main/resources/waila_plugins.json b/src/main/resources/waila_plugins.json
new file mode 100644
index 0000000..2dafe26
--- /dev/null
+++ b/src/main/resources/waila_plugins.json
@@ -0,0 +1,7 @@
1{
2 "eris_alchemy:secret_doors": {
3 "initializer": "lv.enes.mc.eriscraft_misc.SecretDoorWailaPlugin",
4 "side": "*",
5 "required": []
6 }
7} \ No newline at end of file