Jump to content

how to create a mod?


Sukotto82

Recommended Posts

I get how to install mods but if I wanted to create a mod for example I want to add an early game version of the saw.

I attempted to do this but found an issue where I would need to change the recipe for the saw to "material" instead of "metal' but I'm afraid this might cause some issues so I don't know if I can just add an extra line of code like i could for say 7 days to die or if I need to rename it entirely.

I essentially want to add an early game saw to the game flint and obsidian only.

adding 2 knapping recipes 1 for flint and 1 for stone (obsidian) a grid recipe using the flint/obsidian sawblade in crafting grid with stick to make the actual saw the knapping recipe would be a little weird as I'm trying to keep the same pattern as the smithing to some degree and smithing is 15 long as apposed to the only 10x10 grid for knapping so I did something like this

{
    ingredient: { type: "item", code: "stone-*", name: "rock", allowedVariants: ["obsidian", "flint"] },
    pattern: [[
        "__________",
        "___#______",
        "__##__#___",
        "___#__#___",
        "__##__##__",
        "___#__#___",
        "__##__##__",
        "___#__#___",
        "__##__##__",
        "__________"
    ]],
    name: "stone saw",
    output: { type: "item", code: "sawblade-{rock}", stacksize: 1  }
}

 

and something like 

[
  {
    "op": "add",
    "path": "/durabilitybytype/saw-flint",
    "value": 30,
    "file": "itemtypes/tool/saw.json"
  },
  {
    "op": "add",
    "path": "/durabilitybytype/saw-obsidian",
    "value": 50,
    "file": "itemtypes/tool/saw.json"
  }
]

then I get to this

{
    ingredientPattern: "T    S",
    ingredients: {
        "T": { type: "item", code: "sawblade-*", name: "metal"  },
        "S": { type: "item", code: "stick" }
    },
    width: 1,
    height: 2,
    output: { type: "item", code: "saw-{metal}", quantity: 1  }
}

and in order for it to work with the obsidian and flint variants I would need to change the "metal" and {metal} to "material" and {material}

I'm afraid however doing this might cause trouble in the vanilla recipe for the metal variations.

then of course there is the main file for the saw

{
    code: "saw",
    tool: "saw",
    attributes: {
        handbook: {
            groupBy: ["saw-*"]
        },
        toolrackTransform: {
            rotation: { y: 1, z: -1 },
            translation: { x: -0.35, y: 0.05 },
            scale: 1.25,
        }
    },
    variantgroups: [
        { code: "metal", states: ["copper", "tinbronze", "bismuthbronze", "blackbronze", "gold", "silver", "iron" ] },
    ],
    damagedby: ["blockbreaking", "attacking"],
    shape: { base: "item/tool/saw" },
    heldTpHitAnimation: "breaktool",
    textures: {
        "metal": { base: "block/metal/ingot/{metal}" },
        "wood": { base: "item/tool/material/wood" },
        "linen": { base: "item/tool/material/linen" }
    },
    tooltierbytype: {
        "*-stone": 1,
        "*-copper": 2,
        "*-gold": 2,
        "*-silver": 2,
        "*-bismuthbronze": 3,
        "*-tinbronze": 3,
        "*-blackbronze": 3,
        "*-iron": 4,
        "*-steel": 5,
    },
    miningspeedbytype: {
        "*-stone": {
            "wood": 3,
            "leaves": 1.6
        },
        "*-copper": {
            "wood": 4,
            "leaves": 2.4
        },
        "*-bismuthbronze": {
            "wood": 4.4,
            "leaves": 2.6
        },
        "*-tinbronze": {
            "wood": 4.6,
            "leaves": 3
        },
        "*-silver": {
            "wood": 4.6,
            "leaves": 3
        },
        "*-gold": {
            "wood": 4.6,
            "leaves": 3
        },
        "*-blackbronze": {
            "wood": 4.7,
            "leaves": 3.1
        },
        "*-iron": {
            "wood": 5,
            "leaves": 3.2
        },
        "*-steel": {
            "wood": 6,
            "leaves": 4
        },
    },
    durabilitybytype: {
        "saw-gold": 70,
        "saw-silver": 90,
        "saw-copper": 250,
        "saw-tinbronze": 400,
        "saw-bismuthbronze": 450,
        "saw-blackbronze": 500,
        "saw-iron": 900,
        "saw-steel": 1500
    },
    creativeinventory: { "general": ["*"], "items": ["*"], "tools": ["*"] },
    fpHandTransform: {
        translation: { x: 0.0468, y: 0, z: 0 },
        rotation: { x: -161, y: 20, z: 90 },
        scale: 2.5
    },
    guiTransform: {
        rotate: false,
        translation: { x: 1, y: 0, z: 0 },
        rotation: { x: -77, y: 47, z: -151 },
        origin: { x: 0.5, y: 0.5, z: 0.38 },
        scale: 1.9
    },
    groundTransform: {
        translation: { x: 0, y: 0, z: 0 },
        rotation: { x: 0, y: 0, z: 0 },
        origin: { x: 0.5, y: 0.45, z: 0.5 },
        scale: 3.6
    },
    tpHandTransform: {
        translation: { x: -0.65, y: -0.62, z: -0.45 },
        rotation: { x: 90, y: -174, z: 0 },
        scale: 1
    }
}

 

I figure I would need to change the 

variantgroups: [
        { code: "metal", states: ["copper", "tinbronze", "bismuthbronze", "blackbronze", "gold", "silver", "iron" ] },
    ],

portion to include "flint" and "obsidian" but they are not metals so I would need to replace metal here with material as well. then there is the texture

 textures: {
        "metal": { base: "block/metal/ingot/{metal}" },
        "wood": { base: "item/tool/material/wood" },
        "linen": { base: "item/tool/material/linen" }
    },

where I would need to add something to this to get the flint and obsidian texture. for the durability

durabilitybytype: {
        "saw-gold": 70,
        "saw-silver": 90,
        "saw-copper": 250,
        "saw-tinbronze": 400,
        "saw-bismuthbronze": 450,
        "saw-blackbronze": 500,
        "saw-iron": 900,
        "saw-steel": 1500
    },

I'd simply add "saw-obsidian":50, and "saw-flint":30, above the "saw-gold":70

but again making these changes as I don't really know what I'm doing I don't know if it would work and I don't know if it would cause problems with the vanilla saw "metal" references.

any help with this would be appreciated.

Edited by Sukotto82
Link to comment
Share on other sites

Unfortunately I can't really help with mods, but just wanted to pop in and suggest that if you guys aren't on discord, you might want to join up.  There's a couple modding channels, and generally just more people on discord.  You might get some help faster.  If nothing else, lots of people say our discord is the friendliest they've seen.

Link to comment
Share on other sites

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