diff --git a/.github/scripts/install-local-dependencies.sh b/.github/scripts/install-local-dependencies.sh
new file mode 100644
index 0000000..548d673
--- /dev/null
+++ b/.github/scripts/install-local-dependencies.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -euo pipefail
+# Run from the repository root after downloading the pinned JARs.
+# Hash-qualified versions prevent different private JARs sharing a Maven cache key.
+sha256sum --check .github/dependencies.sha256
+
+mvn -B --no-transfer-progress org.apache.maven.plugins:maven-install-plugin:3.1.4:install-file \
+ -Dfile="libs/MMOItems-6.10.jar" -DgroupId="local" -DartifactId="MMOItems" \
+ -Dversion="6.10-tfmc-c84700df5942" -Dpackaging=jar -DgeneratePom=true "$@"
+mvn -B --no-transfer-progress org.apache.maven.plugins:maven-install-plugin:3.1.4:install-file \
+ -Dfile="libs/MythicLib-1.7.jar" -DgroupId="local" -DartifactId="MythicLib" \
+ -Dversion="1.6.1-tfmc-660ff2a6ec86" -Dpackaging=jar -DgeneratePom=true "$@"
diff --git a/.github/scripts/prepare-release.sh b/.github/scripts/prepare-release.sh
index d600a11..997f297 100644
--- a/.github/scripts/prepare-release.sh
+++ b/.github/scripts/prepare-release.sh
@@ -5,4 +5,4 @@ ref=2fe025eb9879bab7dfe48e32395d8a8c1dff75f7
mkdir -p libs
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/c84700df5942/MMOItems-6.10.jar?ref=$ref" > "libs/MMOItems-6.10.jar"
curl --fail --location --silent --show-error --retry 3 -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github.raw+json" "https://api.github.com/repos/TF-Minecraft/ServerAssets/contents/jars/660ff2a6ec86/MythicLib-1.7.jar?ref=$ref" > "libs/MythicLib-1.7.jar"
-sha256sum --check .github/dependencies.sha256
+bash .github/scripts/install-local-dependencies.sh "$@"
diff --git a/pom.xml b/pom.xml
index 6e6102c..b64330d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,16 +17,14 @@
local
MMOItems
- 6.10
- system
- ${project.basedir}/libs/MMOItems-6.10.jar
+ 6.10-tfmc-c84700df5942
+ provided
local
MythicLib
- 1.6.1
- system
- ${project.basedir}/libs/MythicLib-1.7.jar
+ 1.6.1-tfmc-660ff2a6ec86
+ provided
org.spigotmc
diff --git a/src/main/java/net/tfminecraft/goldsmithing/InventoryManager.java b/src/main/java/net/tfminecraft/goldsmithing/InventoryManager.java
index e34e753..74458c1 100644
--- a/src/main/java/net/tfminecraft/goldsmithing/InventoryManager.java
+++ b/src/main/java/net/tfminecraft/goldsmithing/InventoryManager.java
@@ -1,5 +1,7 @@
package net.tfminecraft.goldsmithing;
+import net.tfminecraft.goldsmithing.util.LegacyModelData;
+
import java.util.ArrayList;
import java.util.List;
@@ -21,7 +23,7 @@ public void MenuInventory(Player player) {
ItemStack item = new ItemStack(Material.valueOf(t.getMaterial().toUpperCase()), 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + t.getName());
- meta.setCustomModelData(t.getModelData());
+ LegacyModelData.set(meta, t.getModelData());
List lore = new ArrayList();
if(getGoldIngredientAmount(t) > 0) {
lore.add(ChatColor.GRAY + "Requires " + ChatColor.GREEN + getGoldIngredientAmount(t) + " " + ChatColor.GOLD + "Gold Ingredients");
diff --git a/src/main/java/net/tfminecraft/goldsmithing/SmithingEvents.java b/src/main/java/net/tfminecraft/goldsmithing/SmithingEvents.java
index 0227e60..c87735c 100644
--- a/src/main/java/net/tfminecraft/goldsmithing/SmithingEvents.java
+++ b/src/main/java/net/tfminecraft/goldsmithing/SmithingEvents.java
@@ -1,5 +1,7 @@
package net.tfminecraft.goldsmithing;
+import net.tfminecraft.goldsmithing.util.LegacyModelData;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -315,7 +317,7 @@ public void createJewelryItem(Player p, JewelryType t, Integer lvl) {
StringData itemName = (StringData) mmoitem.getData(ItemStats.NAME);
itemName.setString(ChatColor.GOLD + j.getName());
mmoitem.replaceData(ItemStats.NAME, itemName);
- StatHistory hist = StatHistory.from(mmoitem, ItemStats.NAME);
+ StatHistory hist = mmoitem.computeStatHistory(ItemStats.NAME);
if (hist != null) {
NameData og = (NameData) hist.getOriginalData();
og.setString(ChatColor.GOLD + j.getName());
@@ -332,7 +334,7 @@ public void createJewelryItem(Player p, JewelryType t, Integer lvl) {
}
ItemStack finalItem = mmoitem.newBuilder().build();
ItemMeta meta = finalItem.getItemMeta();
- meta.setCustomModelData(j.getModelData());
+ LegacyModelData.set(meta, j.getModelData());
finalItem.setItemMeta(meta);
p.getInventory().addItem(finalItem);
}
diff --git a/src/main/java/net/tfminecraft/goldsmithing/util/LegacyModelData.java b/src/main/java/net/tfminecraft/goldsmithing/util/LegacyModelData.java
new file mode 100644
index 0000000..beed82a
--- /dev/null
+++ b/src/main/java/net/tfminecraft/goldsmithing/util/LegacyModelData.java
@@ -0,0 +1,36 @@
+package net.tfminecraft.goldsmithing.util;
+
+import java.util.List;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.inventory.meta.components.CustomModelDataComponent;
+
+/** Preserves the integer model IDs used by existing configuration and resource packs. */
+public final class LegacyModelData {
+ private LegacyModelData() {}
+
+ public static boolean has(ItemMeta meta) {
+ return !meta.getCustomModelDataComponent().getFloats().isEmpty();
+ }
+
+ public static int get(ItemMeta meta) {
+ List floats = meta.getCustomModelDataComponent().getFloats();
+ if (floats.isEmpty()) {
+ throw new IllegalStateException("We don't have CustomModelData! Check hasCustomModelData first!");
+ }
+ return floats.get(0).intValue();
+ }
+
+ public static void set(ItemMeta meta, Integer value) {
+ if (value == null) {
+ meta.setCustomModelDataComponent(null);
+ return;
+ }
+ CustomModelDataComponent component = meta.getCustomModelDataComponent();
+ // The former integer setter replaced the entire component, not just its first float.
+ component.setFloats(List.of(value.floatValue()));
+ component.setFlags(List.of());
+ component.setStrings(List.of());
+ component.setColors(List.of());
+ meta.setCustomModelDataComponent(component);
+ }
+}