From 08795c697ec4d2117b0cacfd454b820590d229f4 Mon Sep 17 00:00:00 2001 From: nobaboy <84668101+nobaboy@users.noreply.github.com> Date: Thu, 3 Oct 2024 08:21:10 +0300 Subject: [PATCH] There is no way I did not include the package. (this is the worst script file) --- make-my-own.sh | 24 +++++++++++++------ .../fabricmodtemplate/mixins/ClientMixin.java | 2 +- .../fabricmodtemplate/FabricModTemplate.kt | 2 ++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/make-my-own.sh b/make-my-own.sh index 96bab03..3d7d77b 100644 --- a/make-my-own.sh +++ b/make-my-own.sh @@ -36,19 +36,29 @@ echo "Setting package dir to $package_dir" # Update settings.gradle.kts sed -i "s/rootProject.name = \"FabricModTemplate\"/rootProject.name = \"$modid\"/" "$base"/settings.gradle.kts - # Update and rename the main .kt file - sed -i "s/FabricModTemplate/$project_name/g" "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt - mv "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/"$project_name.kt" + # Update main .kt file + sed -i \ + -e "s/fabricmodtemplate/$modid/g" \ + -e "s/FabricModTemplate/$project_name/g" \ + -e "s/nobaboy/$project_owner/g" \ + "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt + + # Update the mixin file + sed -i \ + -e "s/fabricmodtemplate/$modid/g" \ + -e "s/nobaboy/$project_owner/g" \ + "$base"/src/main/java/me/nobaboy/fabricmodtemplate/ClientMixin.java # Rename directories - # Java dir - mkdir -p "$base"/src/main/java/"$package_dir" - mv "$base"/src/main/java/me/nobaboy/fabricmodtemplate/* "$base"/src/main/java/"$package_dir" - rm -r "$base"/src/main/java/me/nobaboy/fabricmodtemplate # Kotlin dir + mv "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/"$project_name.kt" mkdir -p "$base"/src/main/kotlin/"$package_dir" mv "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate/* "$base"/src/main/kotlin/"$package_dir" rm -r "$base"/src/main/kotlin/me/nobaboy/fabricmodtemplate + # Java dir + mkdir -p "$base"/src/main/java/"$package_dir" + mv "$base"/src/main/java/me/nobaboy/fabricmodtemplate/* "$base"/src/main/java/"$package_dir" + rm -r "$base"/src/main/java/me/nobaboy/fabricmodtemplate # Update fabric.mod.json sed -i \ diff --git a/src/main/java/me/nobaboy/fabricmodtemplate/mixins/ClientMixin.java b/src/main/java/me/nobaboy/fabricmodtemplate/mixins/ClientMixin.java index dcd900d..5897c4a 100644 --- a/src/main/java/me/nobaboy/fabricmodtemplate/mixins/ClientMixin.java +++ b/src/main/java/me/nobaboy/fabricmodtemplate/mixins/ClientMixin.java @@ -1,4 +1,4 @@ -package com.example.mixin.client; +package me.nobaboy.fabricmodtemplate.mixins; import net.minecraft.client.MinecraftClient; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt b/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt index 22122b1..480a97c 100644 --- a/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt +++ b/src/main/kotlin/me/nobaboy/fabricmodtemplate/FabricModTemplate.kt @@ -1,3 +1,5 @@ +package me.nobaboy.fabricmodtemplate + import com.mojang.logging.LogUtils import kotlinx.coroutines.* import net.fabricmc.api.ClientModInitializer