1.15.2 How to correlate the setDurability with predicate damage flag on texturepack.

Discussion in 'Spigot Plugin Development' started by NocturnalDev, Feb 9, 2020.

  1. Hello,

    I am currently altering the damage of a music disc to have the damage of 70 through setDurability. How would I be able to read this in my pack in order to switch the model?
  2. Disc dont have durability , so you can set thier durability.
    You can use CustomModelData instead.
    ItemMeta contains the ModelData which only can be a number (higher than 0)
  3. You're sure that music disc is Damageable? Durability is not used anymore. Instead use CustomModelData.
  4. ItemStack item = new ItemStack(Material.MUSIC_DISC_STAL);
    ItemMeta meta = item.getItemMeta();

    and then in your resource pack

    "overrides": [
    {"predicate": {"custom_model_data":8675309}, "model": "item/yourSpecialModelFile"}

    This is great because now you can have tools with special appearance that will wear down instead of them all being unbreakable.
  5. Thanks for the reply, I use Custom Model Data; however, in order to texture for the versions below, for those who don't want to switch, durability works for them and not CustomModelData?
  6. Yes, but with durability only those item's texture can be changed,which have durability by default
  7. The number you use in the resource pack is the current durability of the item divided by the maximum durability of the item. You end up with a number between 0.0 and 1.0 the item also has to be set as unbreakable so that its durability wont change and thus its appearance. Then you use a flag to hide the fact that its unbreakable.