Solved Custom texture not working.

Discussion in 'Spigot Plugin Development' started by kowagatte, Jun 26, 2016.

  1. Trying to get custom textures by durability working, can not get it to work, have been sitting here for atleast an hour. Following tutorial here: https://www.spigotmc.org/threads/tutorial-custom-item-models-in-1-9.134255/

    I have a pack.mcmeta
    Contents:
    Code (Text):
    {
      "pack": {
        "pack_format": 2,
        "description": "Official Damocles Resource Pack"
      }
    }
     
    I have folders going from pack\assets\minecraft\models\item
    in my item folder I have a flint_and_steel.json
    contents:
    Code (Text):
    {
        "parent": "item/handheld",
        "textures": {
            "layer0": "item/flint_and_steel"
        },
        "overrides": [
            { "predicate": {"damaged": 0, "damage": 0}, "model": "item/flint_and_steel"},
            { "predicate": {"damaged": 0, "damage": 0.015384615384615385}, "model": "item/flint_and_steel"},
            { "predicate": {"damaged": 0, "damage": 0.03076923076923077}, "model": "item/flint_and_steel1"},
            { "predicate": {"damaged": 0, "damage": 0.046153846153846156}, "model": "item/flint_and_steel2"},
            { "predicate": {"damaged": 0, "damage": 0.06153846153846154}, "model": "item/flint_and_steel3"},
            { "predicate": {"damaged": 0, "damage": 0.07692307692307693}, "model": "item/flint_and_steel4"},
            { "predicate": {"damaged": 0, "damage": 0.09230769230769231}, "model": "item/flint_and_steel5"},
            { "predicate": {"damaged": 0, "damage": 0.1076923076923077}, "model": "item/flint_and_steel6"},
            { "predicate": {"damaged": 0, "damage": 0.12307692307692308}, "model": "item/flint_and_steel7"},
            { "predicate": {"damaged": 0, "damage": 0.13846153846153847}, "model": "item/flint_and_steel8"},
            { "predicate": {"damaged": 0, "damage": 0.15384615384615385}, "model": "item/flint_and_steel9"},
            { "predicate": {"damaged": 0, "damage": 0.16923076923076924}, "model": "item/flint_and_steel10"},
            { "predicate": {"damaged": 0, "damage": 0.18461538461538463}, "model": "item/flint_and_steel11"},
            { "predicate": {"damaged": 0, "damage": 0.2}, "model": "item/flint_and_steel12"},
            { "predicate": {"damaged": 0, "damage": 0.2153846153846154}, "model": "item/flint_and_steel13"},
            { "predicate": {"damaged": 0, "damage": 0.23076923076923078}, "model": "item/flint_and_steel14"},
            { "predicate": {"damaged": 0, "damage": 0.24615384615384617}, "model": "item/flint_and_steel15"},
            { "predicate": {"damaged": 0, "damage": 0.26153846153846155}, "model": "item/flint_and_steel16"},
            { "predicate": {"damaged": 0, "damage": 0.27692307692307694}, "model": "item/flint_and_steel17"},
            { "predicate": {"damaged": 0, "damage": 0.2923076923076923}, "model": "item/flint_and_steel18"},
            { "predicate": {"damaged": 0, "damage": 0.3076923076923077}, "model": "item/flint_and_steel19"},
            { "predicate": {"damaged": 0, "damage": 0.3230769230769231}, "model": "item/flint_and_steel20"},
            { "predicate": {"damaged": 0, "damage": 0.3384615384615385}, "model": "item/flint_and_steel21"},
            { "predicate": {"damaged": 0, "damage": 0.35384615384615387}, "model": "item/flint_and_steel22"},
            { "predicate": {"damaged": 0, "damage": 0.36923076923076925}, "model": "item/flint_and_steel23"},
            { "predicate": {"damaged": 0, "damage": 0.38461538461538464}, "model": "item/flint_and_steel24"},
            { "predicate": {"damaged": 0, "damage": 0.4}, "model": "item/flint_and_steel25"},
            { "predicate": {"damaged": 0, "damage": 0.4153846153846154}, "model": "item/flint_and_steel26"},
            { "predicate": {"damaged": 0, "damage": 0.4307692307692308}, "model": "item/flint_and_steel27"},
            { "predicate": {"damaged": 0, "damage": 0.4461538461538462}, "model": "item/flint_and_steel28"},
            { "predicate": {"damaged": 0, "damage": 0.46153846153846156}, "model": "item/flint_and_steel29"},
            { "predicate": {"damaged": 0, "damage": 0.47692307692307695}, "model": "item/flint_and_steel30"},
            { "predicate": {"damaged": 0, "damage": 0.49230769230769234}, "model": "item/flint_and_steel31"},
            { "predicate": {"damaged": 0, "damage": 0.5076923076923077}, "model": "item/flint_and_steel32"},
            { "predicate": {"damaged": 0, "damage": 0.5230769230769231}, "model": "item/flint_and_steel33"},
            { "predicate": {"damaged": 0, "damage": 0.5384615384615385}, "model": "item/flint_and_steel34"},
            { "predicate": {"damaged": 0, "damage": 0.5538461538461539}, "model": "item/flint_and_steel35"},
            { "predicate": {"damaged": 0, "damage": 0.5692307692307692}, "model": "item/flint_and_steel36"},
            { "predicate": {"damaged": 0, "damage": 0.5846153846153846}, "model": "item/flint_and_steel37"},
            { "predicate": {"damaged": 0, "damage": 0.6000000000000001}, "model": "item/flint_and_steel38"},
            { "predicate": {"damaged": 0, "damage": 0.6153846153846154}, "model": "item/flint_and_steel39"},
            { "predicate": {"damaged": 0, "damage": 0.6307692307692307}, "model": "item/flint_and_steel40"},
            { "predicate": {"damaged": 0, "damage": 0.6461538461538462}, "model": "item/flint_and_steel41"},
            { "predicate": {"damaged": 0, "damage": 0.6615384615384616}, "model": "item/flint_and_steel42"},
            { "predicate": {"damaged": 0, "damage": 0.676923076923077}, "model": "item/flint_and_steel43"},
            { "predicate": {"damaged": 0, "damage": 0.6923076923076923}, "model": "item/flint_and_steel44"},
            { "predicate": {"damaged": 0, "damage": 0.7076923076923077}, "model": "item/flint_and_steel45"},
            { "predicate": {"damaged": 0, "damage": 0.7230769230769232}, "model": "item/flint_and_steel46"},
            { "predicate": {"damaged": 0, "damage": 0.7384615384615385}, "model": "item/flint_and_steel47"},
            { "predicate": {"damaged": 0, "damage": 0.7538461538461538}, "model": "item/flint_and_steel48"},
            { "predicate": {"damaged": 0, "damage": 0.7692307692307693}, "model": "item/flint_and_steel49"},
            { "predicate": {"damaged": 0, "damage": 0.7846153846153847}, "model": "item/flint_and_steel50"},
            { "predicate": {"damaged": 0, "damage": 0.8}, "model": "item/flint_and_steel51"},
            { "predicate": {"damaged": 0, "damage": 0.8153846153846154}, "model": "item/flint_and_steel52"},
            { "predicate": {"damaged": 0, "damage": 0.8307692307692308}, "model": "item/flint_and_steel53"},
            { "predicate": {"damaged": 0, "damage": 0.8461538461538463}, "model": "item/flint_and_steel54"},
            { "predicate": {"damaged": 0, "damage": 0.8615384615384616}, "model": "item/flint_and_steel55"},
            { "predicate": {"damaged": 0, "damage": 0.8769230769230769}, "model": "item/flint_and_steel56"},
            { "predicate": {"damaged": 0, "damage": 0.8923076923076924}, "model": "item/flint_and_steel57"},
            { "predicate": {"damaged": 0, "damage": 0.9076923076923078}, "model": "item/flint_and_steel58"},
            { "predicate": {"damaged": 0, "damage": 0.9230769230769231}, "model": "item/flint_and_steel59"},
            { "predicate": {"damaged": 0, "damage": 0.9384615384615385}, "model": "item/flint_and_steel60"},
            { "predicate": {"damaged": 0, "damage": 0.9538461538461539}, "model": "item/flint_and_steel61"},
            { "predicate": {"damaged": 0, "damage": 0.9692307692307693}, "model": "item/flint_and_steel62"},
            { "predicate": {"damaged": 0, "damage": 0.9846153846153847}, "model": "item/flint_and_steel63"},
            { "predicate": {"damaged": 1, "damage": 0}, "model": "item/flint_and_steel"}
        ]
    }
    and two png files, titled flint_and_steel, flint_and_steel1

    the Item I am spawning in is
    Code (Text):
            ItemStack x = new ItemStack(material, amount);
            net.minecraft.server.v1_10_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(x);
            NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
            compound.set("Unbreakable", new NBTTagByte((byte) 1));
            nmsStack.setTag(compound);
            x = CraftItemStack.asBukkitCopy(nmsStack);
            ItemMeta im = x.getItemMeta();
            im.setDisplayName(name);
            im.setLore(lore);
            x.setDurability((short)durability);
            im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
            x.setItemMeta(im);
    Debug messages states my flint and steel items durability is 2 and it has the unbreakable tag, but it just has the untextured purple and black checkered cube texture.
    What am I doing wrong?
     
  2. Did you fixed?
     
  3. oh yea sorry, forgot to change to solved.
     
  4. Can you tell us how did you fixed?
    I'm having the same issue
     
  5. The main JSON message has to be the exact name of the item JSON that would have been in that file.
    So if I was changing my diamond sword models, with this file:
    Code (Text):
    {
        "parent": "item/handheld",
        "textures": {
            "layer0": "item/diamond_sword"
        },
        "overrides": [
            { "predicate": {"damaged": 0, "damage": 0}, "model": "item/default_diamond_sword"},
            { "predicate": {"damaged": 0, "damage": 0.0006402048655569782}, "model": "item/excalibur"},
            { "predicate": {"damaged": 0, "damage": 0.0012804097311139564}, "model": "item/hammer"},
            { "predicate": {"damaged": 0, "damage": 0.0019206145966709346}, "model": "item/bat"},
            { "predicate": {"damaged": 0, "damage": 0.002560819462227913}, "model": "item/kendo"},
            { "predicate": {"damaged": 0, "damage": 0.003201024327784891}, "model": "item/muramasa"},
            { "predicate": {"damaged": 1, "damage": 0}, "model": "item/default_diamond_sword"}
        ]
    }
     
    it would have to be titled: diamond_sword
     
  6. Excuse me sir, what is the format of your files
    excalibur, hammer, bat, kendo, muramasa?

    .png 16x16 ?

    they are located in
    "assets\minecraft\models\item"
    ?

    I can't get it
    11.png
     
  7. They are JSON files. They are 3d models.
     
  8. thank you sir!!
    11.png
     
  9. Make sure to remember that the textures your 3d model uses should be put in the pack\assets\minecraft\textures\items
    folder.
     
  10. hello.
    How do you define its durability in game?