Jump to content

Recommended Posts

Posted

Sorry about the confusing title, I'm not very familiar with coding terminology. 

I'm trying to add a custom arrow type but the arrowhead's model is stuck as the stone one instead of metal. The code to add it into the shapeByType list already works, but I theorize it's being placed at the bottom of the list so it gets overridden by the line above it. Which turns any prior undefined arrowhead type into the stone model. 

If anyone more knowledgeable about patching and knows of way to move my custom item higher in the list please let me know! 

I imagine this is how it is laid out:     

Spoiler

shapeByType: {
        "*-copper": { "base": "item/tool/arrowhead-copper" },
        "*-tinbronze": { "base": "item/tool/arrowhead-copper" },
        "*-bismuthbronze": { "base": "item/tool/arrowhead-copper" },
        "*-blackbronze": { "base": "item/tool/arrowhead-copper" },
        "*-gold": { "base": "item/tool/arrowhead-copper" },
        "*-silver": { "base": "item/tool/arrowhead-copper" },
        "*-iron": { "base": "item/tool/arrowhead-copper" },
        "*-steel": { "base": "item/tool/arrowhead-copper" },
        "*-meteoriciron": { "base": "item/tool/arrowhead-copper" },
        "*": { base: "item/tool/arrowhead-stone" },
        "*-carbonized": { "base": "item/tool/arrowhead-copper" }  <-- Custom item 

    },

And this is the patch I made:

Spoiler

[
  {
    "op": "addmerge",
    "path": "/shapeByType",
    "value": {
        "*-carbonized": { "base": "item/tool/arrowhead-copper" }
    },
    "file": "itemtypes/toolhead/arrowhead.json",
    "side": "Server"
  },
  {
    "op": "addeach",
    "path": "/variantgroups/0/states/10",
    "value": [
            "carbonized"
        ],
    "file": "itemtypes/toolhead/arrowhead.json",
    "side": "Server"
  }
]

 

Posted (edited)
35 minutes ago, SevenIndex said:

The code to add it into the shapeByType list already works, but I theorize it's being placed at the bottom of the list so it gets overridden by the line above it.

You are right, that's exactly what is happening. (Note: Technically this only happens because the line above is a catch-all wildcard ("*").)
You can solve this issues by using the move operation.

Edited by Brady_The
  • Like 1
Posted
1 hour ago, Brady_The said:

You are right, that's exactly what is happening. (Note: Technically this only happens because the line above is a catch-all wildcard ("*").)
You can solve this issues by using the move operation.

Worked like a charm! Thanks again!

2025-04-10_05-58-48.png

  • Like 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.