From 2015735c760a71f85f42ce50cb061da1249c7563 Mon Sep 17 00:00:00 2001
From: ngspace <71827944+NGSpace@users.noreply.github.com>
Date: Sat, 24 Aug 2024 20:52:59 +0300
Subject: [PATCH] trinkets
---
.settings/org.eclipse.jdt.core.prefs | 2 +-
build.gradle | 20 +++++++++++--------
gradle.properties | 2 +-
hudder_1.20.1_client.launch | 17 ++++++++++++++++
hudder_1.20.1_server.launch | 17 ++++++++++++++++
.../ngspace/hudder/meta/MetaCompiler.java | 2 +-
.../hudder/meta/methods/ItemStackMethods.java | 14 ++++++++++++-
7 files changed, 62 insertions(+), 12 deletions(-)
create mode 100644 hudder_1.20.1_client.launch
create mode 100644 hudder_1.20.1_server.launch
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 1329669..5ebdaba 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,5 @@
#
-#Wed May 01 18:14:19 IDT 2024
+#Sat Aug 24 20:33:42 IDT 2024
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
diff --git a/build.gradle b/build.gradle
index 4cb3f0a..f952204 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,13 +16,9 @@ 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 {
+ maven {
name = "TerraformersMC"
- url = uri("https://maven.terraformersmc.com/releases/")
-
- content {
- includeGroup("com.terraformersmc")
- }
+ url = uri("https://maven.terraformersmc.com/")
}
maven {
@@ -33,6 +29,11 @@ repositories {
includeGroup("me.shedaniel.cloth")
}
}
+
+ maven {
+ name = "Ladysnake Libs"
+ url = 'https://maven.ladysnake.org/releases'
+ }
}
configurations {
provided
@@ -52,7 +53,10 @@ dependencies {
//provided group: 'com.github.oshi', name: 'oshi-core', version: '6.5.0'
modImplementation("com.terraformersmc:modmenu:7.2.2")
- modImplementation("me.shedaniel.cloth:cloth-config-fabric:11.0.99")
+ modImplementation("me.shedaniel.cloth:cloth-config-fabric:11.1.106")
+
+ modImplementation "dev.emi:trinkets:3.7.2"
+
}
processResources {
@@ -100,4 +104,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
-}
\ No newline at end of file
+}
diff --git a/gradle.properties b/gradle.properties
index 360b6c7..b13c31f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -14,4 +14,4 @@ maven_group=io.github.ngspace.hudder
archives_base_name=hudder
# Dependencies
-fabric_version=0.92.1+1.20.1
\ No newline at end of file
+fabric_version=0.92.2+1.20.1
diff --git a/hudder_1.20.1_client.launch b/hudder_1.20.1_client.launch
new file mode 100644
index 0000000..7c472e2
--- /dev/null
+++ b/hudder_1.20.1_client.launch
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hudder_1.20.1_server.launch b/hudder_1.20.1_server.launch
new file mode 100644
index 0000000..2dcda79
--- /dev/null
+++ b/hudder_1.20.1_server.launch
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/io/github/ngspace/hudder/meta/MetaCompiler.java b/src/main/java/io/github/ngspace/hudder/meta/MetaCompiler.java
index bdfef76..79d69c8 100644
--- a/src/main/java/io/github/ngspace/hudder/meta/MetaCompiler.java
+++ b/src/main/java/io/github/ngspace/hudder/meta/MetaCompiler.java
@@ -32,7 +32,7 @@ public MetaCompiler() {
//Inventory Rendering
register(new ItemStackMethods(),"slot", "item", "hand", "selectedslot", "hat", "helmet", "chestplate", "leggings",
- "pants", "boots", "offhand");
+ "pants", "boots", "offhand", "slot_trinkets");
//Text and compiling
register((i,m,c,type,args)->m.setTextLocation(type,(float) (args.length>0?args[0].asDouble():i.scale)),
diff --git a/src/main/java/io/github/ngspace/hudder/meta/methods/ItemStackMethods.java b/src/main/java/io/github/ngspace/hudder/meta/methods/ItemStackMethods.java
index 9a1895a..f64ee7e 100644
--- a/src/main/java/io/github/ngspace/hudder/meta/methods/ItemStackMethods.java
+++ b/src/main/java/io/github/ngspace/hudder/meta/methods/ItemStackMethods.java
@@ -2,6 +2,7 @@
import static io.github.ngspace.hudder.Hudder.ins;
+import dev.emi.trinkets.api.TrinketsApi;
import io.github.ngspace.hudder.compilers.ATextCompiler;
import io.github.ngspace.hudder.compilers.CompileException;
import io.github.ngspace.hudder.config.ConfigInfo;
@@ -16,7 +17,7 @@
public class ItemStackMethods implements IMethod {
@Override
public void invoke(ConfigInfo ci, Meta meta, ATextCompiler comp, String type, Value... args) throws CompileException {
- int offset = "slot".equals(type)||"item".equals(type) ? 1:0;
+ int offset = "slot".equals(type)||"item".equals(type)||"slot_trinkets".equals(type) ? 1:0;
if (args.length<2+offset) {
throw new CompileException("\""+type+"\" only accepts \""+type
+("slot".equals(type)?",[slot]":"")
@@ -38,6 +39,17 @@ public void invoke(ConfigInfo ci, Meta meta, ATextCompiler comp, String type, Va
case "offhand": yield inv.offHand.get(0);
case "slot": yield inv.getStack(args[0].asInt());
case "item": yield new ItemStack(Registries.ITEM.get(Identifier.tryParse(args[1].asString())));
+ case "slot_trinkets": {
+ try {
+ var op = TrinketsApi.getTrinketComponent(ins.player);
+ if (op.isEmpty()) throw new CompileException("Optional is empty");
+ var all = op.get().getAllEquipped();
+ yield all.get(args[0].asInt()).getRight();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
default: throw new IllegalArgumentException("Unexpected value: " + type);
};
meta.elements.add(new ItemElement(x, y, stack, scale, showcount));