Jump to content

Recommended Posts

Posted (edited)

Hi! I'm a newbie modder so I humbly ask for some advice on a feature in my jug mod. I want to make jugs attachable to elk. I partially succeeded: empty jugs can be attached, but once they contain a drinkable liquid they become unattachable. Any ideas how could I force it to be attachable?

2026-01-18_00-06-55.png

Edited by JeanPierre
Posted

Hey @JeanPierre, welcome to the forums! I wouldn't consider myself a very experience modder myself but I do believe that filled vessels (jugs, pots, barrels, etc.) are considered different blocks/entities compared to when they're not filled. If anyone else knows better please lemme know if I'm wrong here! 

How are you currently attaching the empty jugs to the elk? If you have any snippets of code I might be able to help you further (no guarantees though, sorry!)

  • Like 2
Posted

Hey! Thank you, happy to be here ^^ Interesting, it would make sense since they go from block to a liquid container, however I can attach jugs filled with water which means something happens when the liquid inside is drinkable (cuz instead of attaching it, player just attempts to drink it). I'm curious if there is a way to perhaps to stop player from drinking it, therefore allowing it to be attached.

To attach the jugs I used this:

attachableToEntity: {
            categoryCode: "gear",
            attachShape: { base: "item/wearable/hooved/elk/wjug" },
            texturePrefixCode: "moonshinejug-{color}-fired",
            attachedShapeBySlotCode: {
                    "gearleft": { base: "item/wearable/hooved/elk/wjug1" },
                    "gearback": { base: "item/wearable/hooved/elk/wjug2" },
                    "gearright": { base: "item/wearable/hooved/elk/wjug3" }
                }
            }  

As you can see In the case of small jugs I used the gear slots to attach them there.
Thanks for reaching out!

Posted

Lemme dig through some of my old unreleased mods here today/tomorrow. I know I had attempted something similar in the past and ran into the same issue. There is a way to stop the player interaction from happing on an interactive object if they're looking at something else like in this case the elks gear slot. I don't recall if I ended up needing to custom code it with C# or if there is a way to flag it in JSON. 

Posted

Hi,
I had a very similar problem while creating PetAI

Are your jugs custom made by your mod? If so, can you try adding the following to the item behaviors

{"name": "considerpetfood"}

If they are base game jugs you are trying to modify, please try the following:

[
    {
        "op": "add",
        "path": "/behaviors",
        "value": [
            {
                "name": "considerpetfood"
            }
        ],
        "file": "game:path/to/the/item.json"
    }
]

Then install and enable PetAI (it adds the consider pet food behavior) and check if it works.
If it does, the fix is located here.

Posted (edited)

Hi! Thanks for reaching out, my jugs are indeed custom made, I tried adding {"name": "considerpetfood"} behaviour with PetAI however it did not work. My seraph kept on drinking the liquids :< I believe that drinking is at fault here, if there could be a way to for example block the player from drinking when holding ctrl that could potentially solve the issue, however im not sure where to begin witch such endeavor so i've been hoping for some possible solution using json

Edited by JeanPierre
×
×
  • 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.