add reset token

This commit is contained in:
hyperdefined
2025-01-26 14:37:24 -05:00
parent 4dda215805
commit 73e472af3a
5 changed files with 214 additions and 3 deletions

View File

@@ -100,6 +100,12 @@ public class TokenCrafting {
flightTimeRecipe.setIngredient('F', Material.FEATHER);
recipes.add(flightTimeRecipe);
NamespacedKey resetKey = new NamespacedKey(toolStats, "reset-token");
ShapedRecipe resetRecipe = new ShapedRecipe(resetKey, toolStats.tokenItems.resetToken());
resetRecipe.shape(" P ", "P P", " P ");
resetRecipe.setIngredient('P', Material.PAPER);
recipes.add(resetRecipe);
tokenTypes.add("crops-mined");
tokenTypes.add("blocks-mined");
tokenTypes.add("damage-taken");
@@ -109,6 +115,7 @@ public class TokenCrafting {
tokenTypes.add("sheep-sheared");
tokenTypes.add("flight-time");
tokenTypes.add("fish-caught");
tokenTypes.add("reset");
}
public Set<ShapedRecipe> getRecipes() {

View File

@@ -215,4 +215,23 @@ public class TokenItems {
token.setItemMeta(tokenMeta);
return token;
}
public ItemStack resetToken() {
// set up the item
ItemStack token = new ItemStack(Material.PAPER);
ItemMeta tokenMeta = token.getItemMeta();
PersistentDataContainer tokenData = tokenMeta.getPersistentDataContainer();
// set the title and lore
Component title = toolStats.configTools.format("tokens.data.reset.title");
Component lore = toolStats.configTools.format("tokens.data.reset.lore");
tokenMeta.displayName(title);
List<Component> newLore = new ArrayList<>();
newLore.add(lore);
tokenMeta.lore(newLore);
// set the PDC
tokenData.set(toolStats.tokenType, PersistentDataType.STRING, "reset");
token.setItemMeta(tokenMeta);
return token;
}
}