Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/scripts/install-local-dependencies.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion .github/scripts/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
10 changes: 4 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
<dependency>
<groupId>local</groupId>
<artifactId>MMOItems</artifactId>
<version>6.10</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/MMOItems-6.10.jar</systemPath>
<version>6.10-tfmc-c84700df5942</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>local</groupId>
<artifactId>MythicLib</artifactId>
<version>1.6.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/MythicLib-1.7.jar</systemPath>
<version>1.6.1-tfmc-660ff2a6ec86</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.tfminecraft.goldsmithing;

import net.tfminecraft.goldsmithing.util.LegacyModelData;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -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<String> lore = new ArrayList<String>();
if(getGoldIngredientAmount(t) > 0) {
lore.add(ChatColor.GRAY + "Requires " + ChatColor.GREEN + getGoldIngredientAmount(t) + " " + ChatColor.GOLD + "Gold Ingredients");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Float> 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);
}
}