Jump to content

Recommended Posts

Posted

Trying to make a liquid for the first time. Seems like no matter what I do it wants to crash ... hard. 

 

Here is my current code but has been changed multi times.

{
	code: "woodstain",
	class: "ItemLiquidPortion",
	matterState: "liquid",
	/*variantgroups: [
		{ code:"color", states: ["acacia-1", "acacia-2", "aged-1", "aged-2", "aged-3", "aged-4", "baldcypress-1", "baldcypress-2", "bamboo-side", "bamboosmooth", "bamboo-top",
        "birch-1", "birch-2", "ebony-1", "ebony-2", "kapok-1", "kapok-2", "kapok-3", "kapok-4", "larch-1", "larch-2", "larch-3", "larch-4", "lite-1", "lite-2", "maple-1",
        "maple-2", "maple-3", "maple-4", "new-1", "new-2", "new-3", "new-4", "new-5", "new-6", "new-7", "new-8", "new-9", "new-10", "new-11", "new-12",
        "oak-1", "oak-2", "oak-3", "oak-4", "old-1", "old-2", "old-3", "old-4", "old-5", "pine-1", "pine-2", "pine-3", "pine-4", "purpleheart-1", "purpleheart-2", "purpleheart-3", "purpleheart-4",
        "redwood-1", "redwood-2", "redwood-3", "redwood-4", "rottenebony-1", "rottenebony-2", "rottenebony-3", "rottenebony-4", "walnut-1", "walnut-2", "walnut-3", "walnut-4" ] }
	],*/
	variantgroups: [
		{ code:"color", states: ["acacia-1" ] }
	],
	attributes: {
		handbook: {
			ignoreCreativeInvStacks: true,
			groupBy: ["woodstain-*"]
		},
		waterTightContainerProps: {
			containable: true,
			isopaque: true,
			itemsPerLitre: 100,
			texture: { base: "stain/{color}" },
			allowSpill: true,
			whenSpilled: { 
				action: "DropContents",
				stack: { type: "item", code: "woodstain-{color}" } 
			}
		}
	},
	shape: { base: "game:item/liquid" },
	texture: { base: "stain/{color}" },
	creativeinventoryStacks: [ { tabs: ["general", "liquids"], stacks: [ { type: "block", code: "game:woodbucket", attributes: { ucontents: [ { type:"item", code: "woodstain-{color}", makefull: true } ] } } ] } ],
	maxstacksize: 5000,
	materialDensity: 200,
	guiTransform: {
		translation: { x: 0, y: 1, z: 0 },
		rotation: { x: 123, y: -33, z: -13 },
		origin: { x: 0.5, y: 0, z: 0.5 },
		scale: 1.4
	},
	fpHandTransform: {
		translation: { x: 0, y: 0, z: 0 },
		rotation: { x: 25, y: 157, z: -5 }
	},
	tpHandTransform: {
		translation: { x: -1.5, y: -1, z: -1.4 }
	}
}

 

Crash Log:

12/1/2025 2:58:11 PM: Critical error occurred
Loaded Mods: mudmod@1.0.0, plantsexpandedmod@1.0.4, game@1.21.5, woodworking@1.0.0, creative@1.21.5, survival@1.21.5
System.Exception: Can't create itemstack without collectible!
   at Vintagestory.API.Common.ItemStack..ctor(CollectibleObject collectible, Int32 stacksize) in VintagestoryApi\Common\Collectible\ItemStack.cs:line 200
   at Vintagestory.GameContent.BlockContainer.CreateItemStackFromJson(ITreeAttribute stackAttr, IWorldAccessor world, String defaultDomain) in VSSurvivalMod\Block\BlockContainer.cs:line 107
   at Vintagestory.GameContent.BlockLiquidContainerBase.CreateItemStackFromJson(ITreeAttribute stackAttr, IWorldAccessor world, String domain) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 391
   at Vintagestory.GameContent.BlockContainer.ResolveUcontents(IWorldAccessor world, ItemStack itemstack) in VSSurvivalMod\Block\BlockContainer.cs:line 80
   at Vintagestory.GameContent.BlockContainer.GetContents(IWorldAccessor world, ItemStack itemstack) in VSSurvivalMod\Block\BlockContainer.cs:line 47
   at Vintagestory.GameContent.BlockLiquidContainerBase.GetContentInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 1082
   at Vintagestory.API.Common.Block.GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, Boolean withDebugInfo) in VintagestoryApi\Common\Collectible\Block\Block.cs:line 2301
   at Vintagestory.Common.CreativeTab.CreateSearchCache(IWorldAccessor world) in VintagestoryLib\Common\GameContent\Inventory\CreativeTab.cs:line 30
   at Vintagestory.Common.CreativeTabs.CreateSearchCache(IWorldAccessor world) in VintagestoryLib\Common\GameContent\Inventory\CreativeTabs.cs:line 50
   at Vintagestory.Client.NoObf.GuiDialogInventory.<OnOwnPlayerDataReceived>b__6_0() in VintagestoryLib\Client\Systems\Gui\Dialogs\GuiDialogInventory.cs:line 60
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
Game Version: v1.21.5 (Stable)
12/1/2025 3:10:36 PM: Critical error occurred
Loaded Mods: mudmod@1.0.0, plantsexpandedmod@1.0.4, game@1.21.5, woodworking@1.0.0, creative@1.21.5, survival@1.21.5
System.Exception: Can't create itemstack without collectible!
   at Vintagestory.API.Common.ItemStack..ctor(CollectibleObject collectible, Int32 stacksize) in VintagestoryApi\Common\Collectible\ItemStack.cs:line 200
   at Vintagestory.GameContent.BlockContainer.CreateItemStackFromJson(ITreeAttribute stackAttr, IWorldAccessor world, String defaultDomain) in VSSurvivalMod\Block\BlockContainer.cs:line 107
   at Vintagestory.GameContent.BlockLiquidContainerBase.CreateItemStackFromJson(ITreeAttribute stackAttr, IWorldAccessor world, String domain) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 391
   at Vintagestory.GameContent.BlockContainer.ResolveUcontents(IWorldAccessor world, ItemStack itemstack) in VSSurvivalMod\Block\BlockContainer.cs:line 80
   at Vintagestory.GameContent.BlockContainer.GetContents(IWorldAccessor world, ItemStack itemstack) in VSSurvivalMod\Block\BlockContainer.cs:line 47
   at Vintagestory.GameContent.BlockLiquidContainerBase.GetContent(ItemStack containerStack) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 367
   at Vintagestory.GameContent.BlockLiquidContainerBase.GetContentProps(ItemStack containerStack) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 261
   at Vintagestory.GameContent.BlockLiquidContainerBase.GetCurrentLitres(ItemStack containerStack) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 232
   at Vintagestory.GameContent.BlockLiquidContainerBase.GetContentInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 1082
   at Vintagestory.GameContent.BlockLiquidContainerBase.AddExtraHeldItemInfoPostMaterial(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world) in VSSurvivalMod\Systems\Liquid\BlockLiquidContainerBase.cs:line 1037
   at Vintagestory.API.Common.Block.GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, Boolean withDebugInfo) in VintagestoryApi\Common\Collectible\Block\Block.cs:line 2301
   at Vintagestory.GameContent.BlockContainer.GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, Boolean withDebugInfo) in VSSurvivalMod\Block\BlockContainer.cs:line 272
   at Vintagestory.Common.CreativeTab.CreateSearchCache(IWorldAccessor world) in VintagestoryLib\Common\GameContent\Inventory\CreativeTab.cs:line 30
   at Vintagestory.Common.CreativeTabs.CreateSearchCache(IWorldAccessor world) in VintagestoryLib\Common\GameContent\Inventory\CreativeTabs.cs:line 50
   at Vintagestory.Client.NoObf.GuiDialogInventory.<OnOwnPlayerDataReceived>b__6_0() in VintagestoryLib\Client\Systems\Gui\Dialogs\GuiDialogInventory.cs:line 60
   at Vintagestory.API.Common.TyronThreadPool.<>c__DisplayClass13_0.<QueueTask>b__0(Object a) in VintagestoryApi\Common\TyronThreadPool.cs:line 131
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

 

If I understand correctly there is a issue with inventory portion:

	creativeinventoryStacks: [ { tabs: ["general", "liquids"], stacks: [ { type: "block", code: "game:woodbucket", attributes: { ucontents: [ { type:"item", code: "woodstain-{color}", makefull: true } ] } } ] } ],

 

But still not fully grasping this issue. I made a sample item just changing the name and it still crashed using base game code. I've even tried using vanila textures for testing. Not sure why this is error on stacks. 

Posted (edited)

The ucontents item code might need the mod domain to properly function. That's the first thing I'd try.

Also, looking at your original variantgroups, it's very easy to simplify them:

variantgroups: [
		{ code: "color", states: [ "acacia", "aged", [...] ] }
		{ code: "intensity", states: [ "1", "2", "3", "4" ] }
	],

Edit: Looking at the variantgroups a bit closer this might not be as easy, considering that the combinations are a bit random. Still, technically doable with "skipVariants" or 

https://wiki.vintagestory.at/Modding:Registry_Object_JSON_Parsing#Enumerating_variants (which is somwhat more complicated).

 

Edited by Brady_The
Posted

@Brady_The

You was correct, something in there is the issue. I was able to get it working but I cant put it in a bucket because of that line of code 

 

new code:

{
	code: "woodstain",
	class: "ItemLiquidPortion",
	matterState: "liquid",
	variantgroups: [
		{ code:"color", states: ["acacia-1", "acacia-2", "aged-1", "aged-2", "aged-3", "aged-4", "baldcypress-1", "baldcypress-2", "bamboo-side", "bamboosmooth", "bamboo-top",
        "birch-1", "birch-2", "ebony-1", "ebony-2", "kapok-1", "kapok-2", "kapok-3", "kapok-4", "larch-1", "larch-2", "larch-3", "larch-4", "lite-1", "lite-2", "maple-1",
        "maple-2", "maple-3", "maple-4", "new-1", "new-2", "new-3", "new-4", "new-5", "new-6", "new-7", "new-8", "new-9", "new-10", "new-11", "new-12",
        "oak-1", "oak-2", "oak-3", "oak-4", "old-1", "old-2", "old-3", "old-4", "old-5", "pine-1", "pine-2", "pine-3", "pine-4", "purpleheart-1", "purpleheart-2", "purpleheart-3", "purpleheart-4",
        "redwood-1", "redwood-2", "redwood-3", "redwood-4", "rottenebony-1", "rottenebony-2", "rottenebony-3", "rottenebony-4", "walnut-1", "walnut-2", "walnut-3", "walnut-4" ] }
	],
	attributes: {
		handbook: {
			ignoreCreativeInvStacks: true,
			groupBy: ["woodstain-*"]
		},
		waterTightContainerProps: {
			containable: true,
			isopaque: true,
			itemsPerLitre: 100,
			texture: { base: "stain/{color}" },
			allowSpill: true,
			whenSpilled: { 
				action: "DropContents",
				stack: { type: "item", code: "woodstain-{color}" } 
			}
		}
	},
	shape: { base: "game:item/liquid" },
	texture: { base: "stain/{color}" },
	//creativeinventoryStacks: [ { tabs: ["general", "liquids"], stacks: [ { type: "block", code: "game:woodbucket", attributes: { ucontents: [ { type:"item", code: "woodstain-{color}", makefull: true } ] } } ] } ],
	creativeinventory: { "general": ["*"], "items": ["*"] },
	maxstacksize: 5000,
	materialDensity: 200,
	guiTransform: {
		translation: { x: 0, y: 1, z: 0 },
		rotation: { x: 123, y: -33, z: -13 },
		origin: { x: 0.5, y: 0, z: 0.5 },
		scale: 1.4
	},
	fpHandTransform: {
		translation: { x: 0, y: 0, z: 0 },
		rotation: { x: 25, y: 157, z: -5 }
	},
	tpHandTransform: {
		translation: { x: -1.5, y: -1, z: -1.4 }
	}
}

 

There is something about this line of code is does not like:

//creativeinventoryStacks: [ { tabs: ["general", "liquids"], stacks: [ { type: "block", code: "game:woodbucket", attributes: { ucontents: [ { type:"item", code: "woodstain-{color}", makefull: true } ] } } ] } ],

I'm still not sure how to fix it or what it wants. But i'll keep testing. Thanks for helping. This is my first liquid. 

Posted
18 minutes ago, Micah Holmes said:

@Brady_The

You was correct, something in there is the issue. I was able to get it working but I cant put it in a bucket because of that line of code 

 

new code:

 

There is something about this line of code is does not like:

//creativeinventoryStacks: [ { tabs: ["general", "liquids"], stacks: [ { type: "block", code: "game:woodbucket", attributes: { ucontents: [ { type:"item", code: "woodstain-{color}", makefull: true } ] } } ] } ],

I'm still not sure how to fix it or what it wants. But i'll keep testing. Thanks for helping. This is my first liquid. 

Did you try this?

14 hours ago, Brady_The said:

The ucontents item code might need the mod domain to properly function. That's the first thing I'd try.

https://cdn.imgchest.com/files/2a94cf031637.png

Posted

@Brady_The

That worked!!! Here is my new code:

{
	code: "woodworking:woodstain",
	class: "ItemLiquidPortion",
	matterState: "liquid",
	variantgroups: [
		{ code:"color", states: ["acacia-1", "acacia-2", "aged-1", "aged-2", "aged-3", "aged-4", "baldcypress-1", "baldcypress-2", "bamboo-side", "bamboosmooth", "bamboo-top",
        "birch-1", "birch-2", "ebony-1", "ebony-2", "kapok-1", "kapok-2", "kapok-3", "kapok-4", "larch-1", "larch-2", "larch-3", "larch-4", "lite-1", "lite-2", "maple-1",
        "maple-2", "maple-3", "maple-4", "new-1", "new-2", "new-3", "new-4", "new-5", "new-6", "new-7", "new-8", "new-9", "new-10", "new-11", "new-12",
        "oak-1", "oak-2", "oak-3", "oak-4", "old-1", "old-2", "old-3", "old-4", "old-5", "pine-1", "pine-2", "pine-3", "pine-4", "purpleheart-1", "purpleheart-2", "purpleheart-3", "purpleheart-4",
        "redwood-1", "redwood-2", "redwood-3", "redwood-4", "rottenebony-1", "rottenebony-2", "rottenebony-3", "rottenebony-4", "walnut-1", "walnut-2", "walnut-3", "walnut-4" ] }
	],
	attributes: {
		handbook: {
			ignoreCreativeInvStacks: true,
			groupBy: ["woodstain-*"]
		},
		waterTightContainerProps: {
			containable: true,
			isopaque: true,
			itemsPerLitre: 100,
			texture: { base: "stain/{color}" },
			allowSpill: true,
			whenSpilled: { 
				action: "DropContents",
				stack: { type: "item", code: "woodworking:woodstain-{color}" } 
			}
		}
	},
	shape: { base: "game:item/liquid" },
	texture: { base: "stain/{color}" },
	creativeinventoryStacks: [ { tabs: ["general", "liquids"], stacks: [ { type: "block", code: "game:woodbucket", attributes: { ucontents: [ { type:"item", code: "woodworking:woodstain-{color}", makefull: true } ] } } ] } ],
	maxstacksize: 5000,
	materialDensity: 200,
	guiTransform: {
		translation: { x: 0, y: 1, z: 0 },
		rotation: { x: 123, y: -33, z: -13 },
		origin: { x: 0.5, y: 0, z: 0.5 },
		scale: 1.4
	},
	fpHandTransform: {
		translation: { x: 0, y: 0, z: 0 },
		rotation: { x: 25, y: 157, z: -5 }
	},
	tpHandTransform: {
		translation: { x: -1.5, y: -1, z: -1.4 }
	}
}

 

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