#Hello i m trying to do some custom
1 messages · Page 1 of 1 (latest)
Here some of my code:
public static void registerRecipe(){
ShapedRecipe ChromatinScrapRecipe = new ShapedRecipe(new NamespacedKey(Main.instance,"chromatin_crap"), CUSTOM_ITEMS.CHROMATIN_SCRAP.getItem());
ChromatinScrapRecipe.shape(" X ","YZY"," X ");
ChromatinScrapRecipe.setIngredient('X', Material.IRON_BLOCK);
ChromatinScrapRecipe.setIngredient('Y', Material.DIAMOND_BLOCK);
ChromatinScrapRecipe.setIngredient('Z', Material.NETHERITE_INGOT);
Bukkit.addRecipe(ChromatinScrapRecipe);
ShapedRecipe ChromatinShardRecipe = new ShapedRecipe(new NamespacedKey(Main.instance,"chromatin_shard"), CUSTOM_ITEMS.CHROMATIN_SHARD.getItem());
ChromatinShardRecipe.shape(" X ","XYX"," X ");
ChromatinShardRecipe.setIngredient('X', new RecipeChoice.ExactChoice(CUSTOM_ITEMS.CHROMATIN_SCRAP.getItem()));
ChromatinShardRecipe.setIngredient('Y', Material.AMETHYST_SHARD);
Bukkit.addRecipe(ChromatinShardRecipe);
SmithingRecipe ChromatinSwordRecipe = new SmithingRecipe(new NamespacedKey(Main.instance, "chromatin_sword"), CUSTOM_ITEMS.CHROMATIN_SWORD.getItem(), new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD), new RecipeChoice.ExactChoice(CUSTOM_ITEMS.CHROMATIN_SHARD.getItem()));
Bukkit.addRecipe(ChromatinSwordRecipe);
}
public enum CUSTOM_ITEMS {
CHROMATIN_SCRAP(() -> new ItemBuilder(Material.PAPER, false).addName("§rChromatin Scrap").construct()),
CHROMATIN_SHARD(() -> new ItemBuilder(Material.PAPER, false).addName("§rChromatin Shard").construct()),
CHROMATIN_SWORD(() -> new ItemBuilder(Material.NETHERITE_SWORD).addName("§rChromatin Sword")
.addAttribute(Attribute.GENERIC_ATTACK_DAMAGE, AttributeModifier.Operation.ADD_NUMBER,8, EquipmentSlot.HAND)
.addAttribute(Attribute.GENERIC_ATTACK_SPEED, AttributeModifier.Operation.ADD_NUMBER,-2.4, EquipmentSlot.HAND)
.addItemFlag(ItemFlag.HIDE_ATTRIBUTES)
.addBonusDurability(500)
.addLore("","§fWhen in Main Hand:"," §29 Attack Damage"," §21.6 Attack Speed","§fBonus Durability: 500")
.construct()),
private Supplier<CustomItemStack> item;
CUSTOM_ITEMS(Supplier<CustomItemStack> item){
this.item = item;
}
public CustomItemStack getItem(){
return item.get();
}
}```
And the result in game:
So yeah the only difference in my print are the itemStack size, the doc say :
This method is the same as equals, but does not consider stack size (amount).
Params:
stack – the item stack to compare to
Returns:
true if the two stacks are equal, ignoring the amount```
And i get a false result i dont undersant what is the issue
What do you mean ? Recipe work just fine, but smithing table take name, enchantment, ... from the source item cause you can enchant your diamond sword and upgrade it and keep all enchant
So it override my custom itemMeta
To bypass that i try to check with event and not use recipe, but the isSimilar() function dont let me do wwhat i want