diff --git a/.gitignore b/.gitignore
index ef5a135..fb826b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ build/*
/fabric/.gradle/
/fabric/build/
/fabric/run/
+
/run/
/common/src/main/generated/
/neoforge/src/main/generated/
@@ -18,3 +19,4 @@ build/*
/.idea/
!/.idea/copyright/
/*/.architectury-transformer/
+/common/run/
diff --git a/build.gradle b/build.gradle
index 5748614..a6d3fe5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -110,7 +110,6 @@ subprojects {
}
-
dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
// mappings loom.officialMojangMappings()
diff --git a/common/src/main/java/org/ayamemc/ayame/client/AyameClient.java b/common/src/main/java/org/ayamemc/ayame/client/AyameClient.java
index 6837c20..35978c3 100644
--- a/common/src/main/java/org/ayamemc/ayame/client/AyameClient.java
+++ b/common/src/main/java/org/ayamemc/ayame/client/AyameClient.java
@@ -22,8 +22,6 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.client.Minecraft;
-import org.ayamemc.ayame.client.gui.screen.ModelSelectMenuScreen;
import org.ayamemc.ayame.client.resource.ModelScanner;
import org.ayamemc.ayame.util.ConfigUtil;
@@ -36,7 +34,5 @@ public static void init() {
ModelScanner.scanModel();
}
- public static void openSelectMenuKeyPressed() {
- ModelSelectMenuScreen.openDefaultModelSelectMenu(Minecraft.getInstance().screen);
- }
+
}
diff --git a/common/src/main/java/org/ayamemc/ayame/client/DefaultAyameModels.java b/common/src/main/java/org/ayamemc/ayame/client/DefaultAyameModels.java
index bc1f78e..df366e4 100644
--- a/common/src/main/java/org/ayamemc/ayame/client/DefaultAyameModels.java
+++ b/common/src/main/java/org/ayamemc/ayame/client/DefaultAyameModels.java
@@ -27,8 +27,6 @@
import org.ayamemc.ayame.model.AyameModelType;
import org.ayamemc.ayame.model.DefaultAyameModelType;
import org.ayamemc.ayame.util.FileUtil;
-import org.ayamemc.ayame.util.TaskManager;
-import org.ayamemc.ayame.util.ZipFileManager;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
@@ -60,8 +58,8 @@ public class DefaultAyameModels {
public static void init() {
//TaskManager.TaskManagerImpls.CLIENT_IN_WORLD_TASKS.addTask(() -> {
- GRMMY_NEKO_MODEL_RESOURCE = createModelResource("grmmy_neko");
- GRMMY_NEKO_MODEL = createModel(GRMMY_NEKO_MODEL_RESOURCE);
+ GRMMY_NEKO_MODEL_RESOURCE = createModelResource("grmmy_neko");
+ GRMMY_NEKO_MODEL = createModel(GRMMY_NEKO_MODEL_RESOURCE);
//});
}
diff --git a/common/src/main/java/org/ayamemc/ayame/client/gui/screen/ModelSelectMenuScreen.java b/common/src/main/java/org/ayamemc/ayame/client/gui/screen/ModelSelectMenuScreen.java
index 24652f9..4cd14c7 100644
--- a/common/src/main/java/org/ayamemc/ayame/client/gui/screen/ModelSelectMenuScreen.java
+++ b/common/src/main/java/org/ayamemc/ayame/client/gui/screen/ModelSelectMenuScreen.java
@@ -26,7 +26,10 @@
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
-import net.minecraft.client.gui.components.*;
+import net.minecraft.client.gui.components.EditBox;
+import net.minecraft.client.gui.components.ImageButton;
+import net.minecraft.client.gui.components.Tooltip;
+import net.minecraft.client.gui.components.WidgetSprites;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
diff --git a/common/src/main/java/org/ayamemc/ayame/client/event/RenderCustomHandEventHandler.java b/common/src/main/java/org/ayamemc/ayame/client/handler/EventHandler.java
similarity index 78%
rename from common/src/main/java/org/ayamemc/ayame/client/event/RenderCustomHandEventHandler.java
rename to common/src/main/java/org/ayamemc/ayame/client/handler/EventHandler.java
index 42dd577..2f34cb5 100644
--- a/common/src/main/java/org/ayamemc/ayame/client/event/RenderCustomHandEventHandler.java
+++ b/common/src/main/java/org/ayamemc/ayame/client/handler/EventHandler.java
@@ -18,14 +18,18 @@
* along with Ayame. If not, see .
*/
-package org.ayamemc.ayame.client.event;
+package org.ayamemc.ayame.client.handler;
import com.mojang.blaze3d.vertex.PoseStack;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
+import org.ayamemc.ayame.client.gui.screen.ModelSelectMenuScreen;
+
+public class EventHandler {
+ final private static Minecraft minecraft = Minecraft.getInstance();
-public class RenderCustomHandEventHandler {
public static void renderCustomHandEventHandler(
InteractionHand hand,
PoseStack poseStack,
@@ -37,7 +41,10 @@ public static void renderCustomHandEventHandler(
float equipProgress,
ItemStack stack
) {
- //
}
+
+ public static void openSelectMenuKeyPressed() {
+ ModelSelectMenuScreen.openDefaultModelSelectMenu(minecraft.screen);
+ }
}
diff --git a/common/src/main/java/org/ayamemc/ayame/client/resource/AyameModelResource.java b/common/src/main/java/org/ayamemc/ayame/client/resource/AyameModelResource.java
index 20b1cd2..993eeb0 100644
--- a/common/src/main/java/org/ayamemc/ayame/client/resource/AyameModelResource.java
+++ b/common/src/main/java/org/ayamemc/ayame/client/resource/AyameModelResource.java
@@ -49,7 +49,7 @@ public class AyameModelResource implements IModelResource {
* @param content 模型内容
*/
public AyameModelResource(ZipFileManager content) throws IOException {
- if (content == null){
+ if (content == null) {
throw new RuntimeException("Model File Content is null");
}
this.content = content;
@@ -72,7 +72,7 @@ public String getType() {
public ModelDataResource getDefault() {
try {
- if (FileUtil.inputStreamToString(content.readFileContent("index.json")).equalsIgnoreCase("")){
+ if (FileUtil.inputStreamToString(content.readFileContent("index.json")).equalsIgnoreCase("")) {
throw new RuntimeException("Model File index is null");
}
return ModelDataResource.Builder.create().getDefaultFromZip(content).build();
diff --git a/common/src/main/java/org/ayamemc/ayame/model/IndexData.java b/common/src/main/java/org/ayamemc/ayame/model/IndexData.java
index 3838db1..567d616 100644
--- a/common/src/main/java/org/ayamemc/ayame/model/IndexData.java
+++ b/common/src/main/java/org/ayamemc/ayame/model/IndexData.java
@@ -50,7 +50,7 @@ public Builder parseJson(@NotNull JsonInterpreter json) {
this.metaData(ModelMetaData.Builder.create().parseJson(json.getJsonInterpreter("metadata")).build());
this.defaultModel(ModelData.Builder.create().parseJson(json.getJsonInterpreter("default")).build());
List ps = new ArrayList<>();
- json.getJsonList("presets").forEach(preset ->{
+ json.getJsonList("presets").forEach(preset -> {
if (!preset.isNullOrEmpty()) {
ps.add(ModelData.Builder.create().parseJson(preset).build());
}
diff --git a/common/src/main/java/org/ayamemc/ayame/util/JsonInterpreter.java b/common/src/main/java/org/ayamemc/ayame/util/JsonInterpreter.java
index 827a559..7500353 100644
--- a/common/src/main/java/org/ayamemc/ayame/util/JsonInterpreter.java
+++ b/common/src/main/java/org/ayamemc/ayame/util/JsonInterpreter.java
@@ -45,8 +45,8 @@ public JsonInterpreter(String jsonString) {
Gson gson = new Gson();
// 将 JSON 字符串转换为 JsonObject
this.jsonObject = gson.fromJson(jsonString, JsonObject.class);
- if (jsonObject == null){
- throw new RuntimeException("JsonObject is null,the content of it:"+original);
+ if (jsonObject == null) {
+ throw new RuntimeException("JsonObject is null,the content of it:" + original);
}
}
@@ -80,14 +80,6 @@ public JsonInterpreter(Path filePath) throws IOException {
this.filePath = filePath;
}
- public boolean isEmpty() {
- return jsonObject.entrySet().isEmpty();
- }
-
- public boolean isNullOrEmpty() {
- return this.jsonObject == null || this.isEmpty();
- }
-
public static JsonInterpreter of(String jsonString) {
return new JsonInterpreter(jsonString);
}
@@ -109,6 +101,14 @@ public static JsonInterpreter of(InputStream content) {
return new JsonInterpreter(FileUtil.inputStreamToString(content));
}
+ public boolean isEmpty() {
+ return jsonObject.entrySet().isEmpty();
+ }
+
+ public boolean isNullOrEmpty() {
+ return this.jsonObject == null || this.isEmpty();
+ }
+
/**
* 读取值
*
diff --git a/fabric/build.gradle b/fabric/build.gradle
index 63be8eb..086038e 100644
--- a/fabric/build.gradle
+++ b/fabric/build.gradle
@@ -79,7 +79,6 @@ processResources {
}
-
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
diff --git a/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClient.java b/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClient.java
index c16a41c..5821e7e 100644
--- a/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClient.java
+++ b/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClient.java
@@ -23,7 +23,6 @@
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.client.KeyMapping;
import org.ayamemc.ayame.client.AyameClient;
import org.ayamemc.ayame.fabric.client.event.AyameKeyMappingEventHandler;
diff --git a/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClientEvents.java b/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClientEvents.java
index 6886c40..a07fa68 100644
--- a/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClientEvents.java
+++ b/fabric/src/main/java/org/ayamemc/ayame/fabric/client/AyameFabricClientEvents.java
@@ -33,7 +33,7 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.ItemStack;
-import org.ayamemc.ayame.client.event.RenderCustomHandEventHandler;
+import org.ayamemc.ayame.client.handler.EventHandler;
import org.ayamemc.ayame.fabric.client.api.event.RenderArmCallback;
import org.ayamemc.ayame.fabric.client.event.AyameKeyMappingEventHandler;
import org.ayamemc.ayame.util.TaskManager;
@@ -94,7 +94,7 @@ private static InteractionResult renderCustomHand(
ItemStack stack,
LocalPlayer player
) {
- RenderCustomHandEventHandler.renderCustomHandEventHandler(
+ EventHandler.renderCustomHandEventHandler(
hand,
poseStack,
multiBufferSource,
diff --git a/fabric/src/main/java/org/ayamemc/ayame/fabric/client/event/AyameKeyMappingEventHandler.java b/fabric/src/main/java/org/ayamemc/ayame/fabric/client/event/AyameKeyMappingEventHandler.java
index 1e3c2b6..4a24365 100644
--- a/fabric/src/main/java/org/ayamemc/ayame/fabric/client/event/AyameKeyMappingEventHandler.java
+++ b/fabric/src/main/java/org/ayamemc/ayame/fabric/client/event/AyameKeyMappingEventHandler.java
@@ -27,10 +27,10 @@
import net.minecraft.client.KeyMapping;
import org.ayamemc.ayame.client.AyameClient;
import org.ayamemc.ayame.client.gui.screen.ModelSelectMenuScreen;
+import org.ayamemc.ayame.client.handler.EventHandler;
import org.ayamemc.ayame.fabric.client.util.AyameTMSKeyMappings;
import org.ayamemc.ayame.util.JavaUtil;
import org.ayamemc.ayame.util.TranslatableName;
-import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
@@ -91,7 +91,7 @@ public static void init() {
*/
public static void processKeyPressed() {
while (AyameKeyMappingEventHandler.MODEL_SELECT_MENU.consumeClick()) {
- AyameClient.openSelectMenuKeyPressed();
+ EventHandler.openSelectMenuKeyPressed();
}
}
}
diff --git a/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/OpenModelSelectMenuEventHandler.java b/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/OpenModelSelectMenuEventHandler.java
index fb111c5..da1f550 100644
--- a/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/OpenModelSelectMenuEventHandler.java
+++ b/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/OpenModelSelectMenuEventHandler.java
@@ -26,8 +26,8 @@
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.ClientTickEvent;
import org.ayamemc.ayame.Ayame;
-import org.ayamemc.ayame.client.AyameClient;
import org.ayamemc.ayame.client.gui.screen.ModelSelectMenuScreen;
+import org.ayamemc.ayame.client.handler.EventHandler;
/**
@@ -43,7 +43,7 @@ public class OpenModelSelectMenuEventHandler {
@SubscribeEvent
public static void onClientClick(ClientTickEvent.Post event) {
while (RegisterKeyMappingEventHandler.MODEL_SELECT_MENU.get().consumeClick()) {
- AyameClient.openSelectMenuKeyPressed();
+ EventHandler.openSelectMenuKeyPressed();
}
}
}
diff --git a/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/RenderCustomModelHandEventHandler.java b/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/RenderCustomModelHandEventHandler.java
index 47dd67f..14b5c0d 100644
--- a/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/RenderCustomModelHandEventHandler.java
+++ b/neoforge/src/main/java/org/ayamemc/ayame/neoforge/client/event/RenderCustomModelHandEventHandler.java
@@ -30,7 +30,7 @@
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RenderHandEvent;
import org.ayamemc.ayame.Ayame;
-import org.ayamemc.ayame.client.event.RenderCustomHandEventHandler;
+import org.ayamemc.ayame.client.handler.EventHandler;
@OnlyIn(Dist.CLIENT)
@@ -48,7 +48,7 @@ public static void renderCustomModelHand(RenderHandEvent event) {
float equipProgress = event.getEquipProgress();
ItemStack stack = event.getItemStack();
event.setCanceled(true); // 取消渲染默认手臂
- RenderCustomHandEventHandler.renderCustomHandEventHandler(
+ EventHandler.renderCustomHandEventHandler(
hand,
poseStack,
multiBufferSource,
diff --git a/settings.gradle b/settings.gradle
index 005893e..cd75c09 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,22 +1,22 @@
- /*
- * Custom player model mod. Powered by GeckoLib.
- * Copyright (C) 2024 CrystalNeko, HappyRespawnanchor, pertaz(Icon Designer)
- *
- * This file is part of Ayame.
- *
- * Ayame is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Ayame is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Ayame. If not, see .
- */
+/*
+* Custom player model mod. Powered by GeckoLib.
+* Copyright (C) 2024 CrystalNeko, HappyRespawnanchor, pertaz(Icon Designer)
+*
+* This file is part of Ayame.
+*
+* Ayame is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* Ayame is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with Ayame. If not, see .
+*/
pluginManagement {
repositories {