Jump to content

help with proper mod etiquette help!


Recommended Posts

I was messing around again and notice one of the main reasons my old mods stop working instantly and why the uploads seem to have issues.

though testing my mod on my end everything seems to work that's because I don't use proper mod etiquette.

I would add stuff to the game directly then use the mod loader to pack it up into a mod and realized once I go into the game directly and remove my changes the mod stops working despite following the instruction of where to put the zip produced by the mod tool.

lets take this simple bag that holds 9 items and is easy to craft and rather simple to get early on.

loading the zip the mod won't work. because of how it's written.

I didn't reference game: or clothbag: to direct where to get the files because when making the mod I made it directly in the game files itself.

I would like to understand proper modding etiquette to use game: and modid: to direct where to find the files.

here are the files that make up this mod.

folder

TestBagCloth>itemtypes>bag

{
    code: "clothbag",
    maxstacksize: 1,
    shape: { base: "item/bag/linensack" },
    behaviors: [{ name: "GroundStorable", properties: { layout: "SingleCenter", collisionBox: { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.375, z2: 0.75 }}}],
    textures: {
        "linen": { base: "item/bag/clothbag/linen" },
        "top": { base: "item/bag/clothbag/top" } 
    },
    storageFlags: 2,
    creativeinventory: { "general": ["*"], "items": ["*"] },
    guiTransform: {
        translation: { x: 0, y: 0, z: 0 },
        rotation: { x: -25, y: 23, z: 180 },
        origin: { x: 0.5299, y: 0.23, z: 0.5 },
        scale: 2.7,
        rotate: true
    },
    fpHandTransform: {
        translation: { x: 0, y: 0, z: 0.2 },
        rotation: { x: 47, y: -80, z: 33 },
        scale: 1.61
    },
    tpHandTransform: {
        translation: { x: -0.7, y: -0.5, z: -0.6 },
        rotation: { x: -4, y: 47, z: -17 },
        scale: 0.81
    },
    groundTransform: {
        translation: { x: 0, y: 0, z: 0 },
        rotation: { x: 180, y: 33, z: -180 },
        origin: { x: 0.5, y: 0, z: 0.5 },
        scale: 4
    },
    attributes: {
        backpack: {
            quantitySlots: 9
        }
    }
}

TestBagCloth>recipes>grid

{
    ingredientPattern: "T    L",
    ingredients: {
        "T": { type: "item", code: "flaxfibers" },
        "L": { type: "item", code: "cattailtops" }
    },
    width: 1,
    height: 2,
    output: { type: "item", code: "clothbag"  }
}

when making the code I made and tested it in

Roaming>Vintagestory>assets>survival>itemtypes>bag>clothbag

{
    code: "clothbag",
    maxstacksize: 1,
    shape: { base: "item/bag/linensack" },
    behaviors: [{ name: "GroundStorable", properties: { layout: "SingleCenter", collisionBox: { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.375, z2: 0.75 }}}],
    textures: {
        "linen": { base: "item/bag/clothbag/linen" },
        "top": { base: "item/bag/clothbag/top" } 
    },
    storageFlags: 2,
    creativeinventory: { "general": ["*"], "items": ["*"] },
    guiTransform: {
        translation: { x: 0, y: 0, z: 0 },
        rotation: { x: -25, y: 23, z: 180 },
        origin: { x: 0.5299, y: 0.23, z: 0.5 },
        scale: 2.7,
        rotate: true
    },
    fpHandTransform: {
        translation: { x: 0, y: 0, z: 0.2 },
        rotation: { x: 47, y: -80, z: 33 },
        scale: 1.61
    },
    tpHandTransform: {
        translation: { x: -0.7, y: -0.5, z: -0.6 },
        rotation: { x: -4, y: 47, z: -17 },
        scale: 0.81
    },
    groundTransform: {
        translation: { x: 0, y: 0, z: 0 },
        rotation: { x: 180, y: 33, z: -180 },
        origin: { x: 0.5, y: 0, z: 0.5 },
        scale: 4
    },
    attributes: {
        backpack: {
            quantitySlots: 9
        }
    }
}

Roaming>Vintagestory>assets>survival>recipes>grid>clothbag

{
    ingredientPattern: "T    L",
    ingredients: {
        "T": { type: "item", code: "flaxfibers" },
        "L": { type: "item", code: "cattailtops" }
    },
    width: 1,
    height: 2,
    output: { type: "item", code: "clothbag"  }
}

Roaming>Vintagestory>assets>survival>textures>item>bag>clothbag

custom images for top and bottom located here

 

with that I understand that is why the mod doesn't work when simply dropping the mod zip in the mod folder. 

I guess I'm trying to understand when/where to put a directory like game: or clothbag: respective to if the referenced file is an original game file or modded file

like would I do 

shape: { base: "game:/item/bag/linensack" },

instead of

shape: { base: "item/bag/linensack" },

and for texture would I use

textures: {

     "linen": { base: "clothbag:/item/bag/clothbag/linen" },

     "top": { base: "clothbag:/item/bag/clothbag/top" }

},

instead of

textures: {

     "linen": { base: "item/bag/clothbag/linen" },

     "top": { base: "item/bag/clothbag/top" }

},

and for recipe what would I do?

it works fine in the folder directly; Roaming>Vintagestory>assets>survival>recipes>grid>clothbag

{
    ingredientPattern: "T    L",
    ingredients: {
        "T": { type: "item", code: "flaxfibers" },
        "L": { type: "item", code: "cattailtops" }
    },
    width: 1,
    height: 2,
    output: { type: "item", code: "clothbag"  }
}

should it be....

{
    ingredientPattern: "T    L",
    ingredients: {
        "T": { type: "item", code: "game:/flaxfibers" },
        "L": { type: "item", code: "game:/cattailtops" }
    },
    width: 1,
    height: 2,
    output: { type: "item", code: "clothbag:/clothbag"  }
}

instead?

a long time back I read some post talking about this very thing but I didn't follow it because It seemed to work just fine the way I was doing it. that was until I tried uploading it and found out that using the mod program that finds the changes and puts them in it's own file for the mods folder didn't really have the same effect as the files themselves. 

I did a lot of different clay colors world generation new trees berry bushes crops feed and a number of other things all of which worked fine on my end when trying to play the game but it wasn't until I uploaded them I found out they didn't really work on their own as intended and if I went into the game and deleted the files I changed just what I added to them and put a generated zip in either mod folder it still wouldn't work and I didn't fully understand why at least it didn't fully sink in at the time.

so despite this being super long I wanted to make sure I gave plenty of information to hopefully get the best results in replies instead of a random generalization.

so if someone could point me to where this is explained I'd appreciate it. or you could just re explain it here but I think it would be easier if the old forum still exist that explains this in good detail I'd appreciate it.

for some reason the block tutorial just doesn't seem to give me the information I need as well as I'd hope.

I did follow it but it doesn't seem to work with what I'm doing and I know a good guide is already out there I just forgot where it's at and how to find it.

ClothBag.zip

Link to comment
Share on other sites

this is what I'm currently using but it only works when the items are put in the games survival folder in their respective folders the mod itself doesn't work an that's what I'm trying to get help with fixing and understanding. it will show the name and the icon in the mod list but the contents of the mod won't be in the game unless you copy the item recipe and texture and paste them in the respective folders in the survival folder of the game itself.

just double tested it. 

works perfectly fine when I copy past 

clothbag in Vintagestory>assets>survival>itemtypes>bag

clothbag in Vintagestory>assets>survival>recipes>grid

clothbag in Vintagestory>assets>survival>textures>item>bag>clothbag

respectively.  Simply copy and past the 2 json files 1 for the item itself and 1 for the recipe and 2 textures 1 for the linen/base and 1 for the top and it works even shows up in handbook crafting guide and everything.

 

clothbag9.zip

Edited by Sukotto82
verified it worked as is pasted in respective folders
Link to comment
Share on other sites

  • 2 weeks later...

Hey, the attached version should work for you.

Notice that:
- in your grid recipe, I prefixed the ingredients with game:    That's because those assets are in the game's domain, as opposed to items from your mod.
- in your clothbag item, I prefixed the shape with game: as well, for the same reason.  That asset (linensack) is in the game's files, not in your mod.  The textures on the other hand are in your mod, so they don't need a prefix, although you COULD prefix them with your modid if you like (see modinfo.json).  So this sort of thing is perfectly acceptable, and perhaps more readable
 

"textures": {
    "linen": { "base": "clothbag:item/bag/clothbag/linen" },
    "top": { "base": "clothbag:item/bag/clothbag/top" }
  },

Likewise in your grid recipe, you could prefix your mod's assets if you like...i.e.
 

"output": { "type": "item", "code": "clothbag:clothbag" }

-I changed up your modinfo.json slightly but I don't know if that was necessary.  Some of the things in that file are a little forgiving.
I moved your assets into a folder called assets.  This is mandatory.  Inside that folder, I renamed your clothbag9 folder to clothbag.  That folder must exist, and I always like to name it the same as my modid (although I've heard that isn't necessary).

Other than that - things got reformatted when I made those changes - the editor I was using is configured to automatically do that - apologies.

I tested the mod out and it all seems to work.
Cheers!

 

clothbag9.zip

  • Thanks 1
Link to comment
Share on other sites

 Share

×
×
  • 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.