Jump to content

Recommended Posts

Posted

I'm writing a content mod that allows you to put fruit mash into a small trough for rabbit breeding.  It works, but the textures are completely wrong.   Here's the JSON code:

https://pastebin.com/6aqMKJEN

I've implemented blueberry, cranberry, redcurrant, and blackcurrant.  The problem is that all the fruit mash textures all look the same.  They look mangoish (orange), even though I specified the correct texture, i.e.

	{
		"side": "server",
		"op": "addmerge",
		"file": "game:blocktypes/wood/trough-small.json",
		"path": "/textures/contents-pressedmash-blueberry",
		"value": { "base": "block/wood/trough/large/fruitmash" }        
	},

and as you see, the blueberry mash does not look like blueberry.  Looks like pumpkin.

 

2025-03-17_17-06-01.thumb.png.a3ff095c51703ac9eb08d806471a5598.png

 

I haven't implemented mango or pineapple mash, so the texture is missing (white) as one would expect.

But I don't understand why my blueberry texture is wrong.  I basically copied what was already there in the big trough.

textures: {

		"contents-pressedmash-blueberry": { 
			base: "block/food/pie/fill-blueberry",
			overlays: ["block/wood/trough/large/shadow"]
		},

 

Posted
31 minutes ago, caffeine said:

I've implemented blueberry, cranberry, redcurrant, and blackcurrant.  The problem is that all the fruit mash textures all look the same.

They all look the same because you specified the exact same texture for all fruit mashes (block/wood/trough/large/fruitmash).

You might also have to specify the "textureCode" for each filling. I haven't messed around with the trough, so this is theoretical, but a "catch-all" wildcard-character could have unintended consequences.

  • Like 1
Posted

Thank you!  I got it working perfectly.   Solution is:

First, make all the pressed mashes available to be placed in a small trough.

{
	"side": "server",
	"op": "addmerge",
	"file": "game:blocktypes/wood/trough-small.json",
	"path": "/attributes/contentConfig/-",
	"value":
	{
		"code": "fruitmash",
		"content": { "type": "item", "code": "pressedmash-*" }, 
		"quantityPerFillLevel": 1,
		"maxFillLevels": 8,
		"shapesPerFillLevel":
		[
			"block/wood/trough/small/grainfill1", "block/wood/trough/small/grainfill1",
			"block/wood/trough/small/grainfill2", "block/wood/trough/small/grainfill2",
			"block/wood/trough/small/grainfill3", "block/wood/trough/small/grainfill3",
			"block/wood/trough/small/grainfill4", "block/wood/trough/small/grainfill4"
		],
		"textureCode": "*"
	}
}

The texture code is being left as a wildcard for the individual mashes.  I'm still pretty uncomfortable with this, but the closest analogy I can think of is the texture is being defined as a "virtual function", and we will override the virtual function with instantiated mashes, like this:

{
	"side": "server",
	"op": "addmerge",
	"file": "game:blocktypes/wood/trough-small.json",
	"path": "/textures/contents-pressedmash-blueberry",
	"value": { "base": "block/food/pie/fill-blueberry" }
}

The actual texture for the individual mashes is being taken from pie filling (I learned this from taking a peek at how the survival base mod defines it for the large trough).

And then, of course, chickens seem to have mashes included in their diet already, so I didn't have to patch that.

This was a very instructional exercise.  Now I need to pick a new problem to tackle.  Thank you!

 

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