Update to 1.20.4, and just generally fixing up code. This version actually runs!

This commit is contained in:
desyncfy
2024-06-08 13:16:47 -07:00
parent 16b7726e61
commit e0b79c8454
9 changed files with 63 additions and 104 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
/.gradle/
/build/
/.idea/
/run/

View File

@@ -1,7 +1,9 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id "org.jetbrains.kotlin.jvm" version "1.9.22"
id "org.jetbrains.kotlin.jvm" version "2.0.0"
}
version = project.mod_version
@@ -17,16 +19,10 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
maven {
name = "CottonMC"
url = "https://server.bbkr.space/artifactory/libs-release"
}
maven { url "https://maven.terraformersmc.com/" }
}
loom {
splitEnvironmentSourceSets()
splitEnvironmentSourceSets()
mods {
"scify" {
@@ -46,13 +42,6 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
// implementation group: 'org.kohsuke', name: 'github-api', version: '1.318'
}
processResources {
@@ -67,7 +56,7 @@ tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = 17
}
@@ -92,7 +81,8 @@ jar {
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

View File

@@ -1,15 +1,17 @@
# gradle.properties
kotlin.code.style=official
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.15.6
fabric_kotlin_version=1.10.17+kotlin.1.9.22
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.11
fabric_kotlin_version=1.11.0+kotlin.2.0.0
# yeah
modmenu_version=9.0.0
@@ -20,4 +22,4 @@ maven_group=chickenmanfy.scify
archives_base_name=scify
# Dependencies
fabric_version=0.87.2+1.19.4
fabric_version=0.97.1+1.20.4

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

20
gradlew.bat vendored
View File

@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 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.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +57,11 @@ 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.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View File

@@ -1,7 +1,5 @@
package chickenmanfy.scify
import io.github.prospector.modmenu.api.ConfigScreenFactory
import io.github.prospector.modmenu.api.ModMenuApi
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper
@@ -10,64 +8,25 @@ import net.minecraft.client.option.KeyBinding
import net.minecraft.client.util.InputUtil
import net.minecraft.text.Text
import org.lwjgl.glfw.GLFW
import net.fabricmc.api.EnvType
import net.fabricmc.api.Environment
import net.minecraft.client.gui.screen.Screen
import net.minecraft.client.gui.widget.ButtonWidget
import net.minecraft.client.util.math.MatrixStack
object SciFyClient : ClientModInitializer {
override fun onInitializeClient() {
override fun onInitializeClient() {
val menu = KeyBindingHelper.registerKeyBinding(
KeyBinding(
"Menu",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_RIGHT_SHIFT,
"SciFy"
)
)
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick { client: MinecraftClient ->
while (menu.wasPressed()) {
// Debug
client.player!!.sendMessage(Text.literal("Button input received."), true)
val menu = KeyBindingHelper.registerKeyBinding(
KeyBinding(
"Menu",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_RIGHT_SHIFT,
"SciFy"
)
)
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick { client: MinecraftClient ->
while (menu.wasPressed()) {
// Debug
client.player!!.sendMessage(Text.literal("Button input received."), true)
}
})
}
}
@Environment(EnvType.CLIENT)
class ScifyModMenu : ModMenuApi {
override fun getModConfigScreenFactory(): ConfigScreenFactory<*> {
return ConfigScreenFactory<*> { parent -> menu(parent) }
}
}
@Environment(EnvType.CLIENT)
class menu(private val parent: Screen) : Screen(Text.literal("Your Mod Config")) {
override fun init() {
// Add a button to open Mod Menu
val modMenuButton = ButtonWidget.builder(
Text.literal("Mod Menu")
) { button: ButtonWidget? ->
// Open Mod Menu
ModMenu.getInstance().openConfigScreen()
}
.dimensions(width / 2 - 100, height / 2, 200, 20)
.build()
addDrawableChild(modMenuButton)
}
override fun render(matrices: MatrixStack, mouseX: Int, mouseY: Int, delta: Float) {
renderBackground(matrices)
super.render(matrices, mouseX, mouseY, delta)
}
fun onClose() {
client!!.setScreen(parent)
}
}
})
}
}

View File

@@ -3,6 +3,6 @@ package chickenmanfy.scify
import net.fabricmc.api.ModInitializer
object SciFy : ModInitializer {
override fun onInitialize() {
}
override fun onInitialize() {
}
}

View File

@@ -3,15 +3,22 @@
"id": "scify",
"version": "${version}",
"name": "SciFy",
"description": "A Dungeonfy mod so good you'll think it's science fiction",
"description": "A Dungeonfy mod so good you'll think it's science fiction\n\n\nThanks to the Dungeonfy community for giving me something to do during summer -Chickenmanfy",
"authors": [
"Main Developer: Chickenmanfy",
"Server Owner: Enook",
"Thanks to Endr. for help with some bugs!"
{
"name": "Chickenmanfy",
"role": "Main Developer"
}
],
"contributors": [
{
"name": "Endr.",
"role": "Help with bugs"
}
],
"contact": {
"homepage": "https://modrinth.com",
"sources": "https://github.com/chickenmanfy/scify/",
"homepage": "https://modrinth.com/project/scify",
"sources": "https://github.com/chickenmanfy/scify",
"issues": "https://github.com/chickenmanfy/scify/issues"
},
"license": "MPL-2.0",
@@ -40,7 +47,7 @@
],
"depends": {
"fabricloader": ">=0.15.6",
"minecraft": "~1.19.4",
"minecraft": "~1.20.4",
"java": ">=17",
"fabric-api": "*",
"fabric-language-kotlin": ">=1.9.22"