PineReseen Posted February 23 Report Posted February 23 (edited) I'm trying to add a new reed for cold environments, and I'm stuck at the part were the reed root is supposed to spawn the correct reed. I don't see anything in the base game files regarding planting that would choose which root is for which reed, and I honestly don't know where to start. Does the game employ something like regex on codes to see which root corresponds to which reed or is it just hardcoded like that? Version is 1.21.6. Thanks! Edited February 23 by PineReseen Clarified version to comply with rules
Brady_The Posted February 23 Report Posted February 23 (edited) I believe the spawning of reeds is determined in assets\survival\worldgen\blockpatches\other.json. The whole plant is spawned (tallplant-coopersreed-land-normal-free) and on the right interaction is transformed into the root (tallplant-coopersreed-land-harvested-free) which then transforms into the whole plant again after a certain amount of time (reedpapyrus.json - transientPropsByType). That said, I am not a coder, so this is more of an educated guess. Edited February 23 by Brady_The 1
PineReseen Posted February 23 Author Report Posted February 23 14 minutes ago, Brady_The said: I believe the spawning of reeds is determined in assets\survival\worldgen\blockpatches\other.json. The whole plant is spawned (tallplant-coopersreed-land-normal-free) and on the right interaction is transformed into the root (tallplant-coopersreed-land-harvested-free) which then transforms into the whole plant again after a certain amount of time (reedpapyrus.json - transientPropsByType). That said, I am not a coder, so this is more of an educated guess. I think that's the mechanism for spawning in at initial world generation, I think I've managed to figure that out as of now, but the issue I'm having is that I have no idea how to implement the reed root item which should, upon planting, create it's corresponding reed, but I don't think the code for that is anywhere in the JSON files. For reference, here's my code for the item: Spoiler { code: "rushroot", class: "ItemCattailRoot", shape: { base: "item/resource/rush-root" }, texture: { base: "game:item/resource/reeds" }, creativeinventory: { "general": ["*"], "items": ["*"] }, maxstacksize: 64, materialDensity: 100, attributes: { plantContainable: { smallContainer: { shape: { base: "game:block/clay/flowerpot/tule" }, textures: { "north": { base: "block/plant/potted/rush" }, "south": { base: "block/plant/potted/rush" } } }, largeContainer: { shape: { base: "game:block/plant/reedpapyrus/tule" }, textures: { "leaves": { base: "block/plant/rush/rush" } } } } }, guiTransform: { translation: { x: 0, y: 0, z: 0 }, rotation: { x: -170, y: 143, z: 17 }, origin: { x: 0.65, y: 0.6, z: 0.5 }, scale: 1.7 }, fpHandTransform: { translation: { x: 0, y: -0.2, z: 0 }, rotation: { x: -45, y: 104, z: -33 }, scale: 1.2 }, tpHandTransform: { translation: { x: -1, y: -1.1, z: -1 }, rotation: { x: 7, y: 3, z: -88 }, scale: 0.48 }, groundTransform: { scale: 3.6 }, combustibleProps: { meltingPoint: 150, maxTemperature: 300, meltingDuration: 30, smeltingType: "cook", smeltedRatio: 1, smeltedStack: { type: "item", code: "vegetable-cookedcattailroot" }, requiresContainer: false } } The reed block should be "rushes-rush-{habitat}-{state}-{cover}" due to the "tallplant" code already being taken. The texture attributes are working fine, I have my own textures on the tule model. I have a suspicion that the planting action is handled by that ItemCattailRoot class thing, including what roots plant what reeds (currently upon planting my root it becomes cattails), and I can't really make code mods yet...
Solution Brady_The Posted February 23 Solution Report Posted February 23 (edited) 59 minutes ago, PineReseen said: but the issue I'm having is that I have no idea how to implement the reed root item which should Whoops, I completely misunderstood your problem. You seem to be right about your assumption regarding the planting being handled in ItemCattailRoot. https://github.com/anegostudios/vssurvivalmod/blob/2fdc2c37e5bbe1c92ce1314fe0b3e7c1576d42eb/Item/ItemCattailRoots.cs#L11 It should be fairly easy (well, at least I imagine it to be) to add your item via harmony patch, but for that you need at least some coding experience. Edited February 23 by Brady_The 1
PineReseen Posted February 23 Author Report Posted February 23 1 hour ago, Brady_The said: Whoops, I completely misunderstood your problem. You seem to be right about your assumption regarding the planting being handled in ItemCattailRoot. https://github.com/anegostudios/vssurvivalmod/blob/2fdc2c37e5bbe1c92ce1314fe0b3e7c1576d42eb/Item/ItemCattailRoots.cs#L11 It should be fairly easy (well, at least I imagine it to be) to add your item via harmony patch, but for that you need at least some coding experience. Well, that's a shame. Given my experience with installing windows programs on Linux, I don't think I'm gonna try installing Visual Studio, and besides the dotnet SDK doesn't seem to want to exist with 2 versions (or downgrade to 8.0) on my system for some reason, so I guess I'll have to wait for 1.22.x anyway...
Recommended Posts