Skip to content

BlockEdible

MCE626 edited this page May 25, 2019 · 2 revisions

BlockEdible is a block that you can eat, nine times. Usually made of a food, it gives you a set hunger and saturation value for every bite you take. The parameters are the same as BlockBase, but it adds a hunger amount and saturation at the end.

Examples

public static final Block PORK_BLOCK = new BlockEdible("pork_block", Material.CLAY, BLOCKS, ModItems.ITEMS, 3, 0.3f).setCreativeTab(LittleUtilities.lu).setHardness(0.8f);

The first 3 is an integer and will give you 3 hunger points, which is 1 1/2 hunger added, the same as one raw pork chop. The number after that, 0.3f, is the saturation amount. This is also the same as one raw pork chop.

Similar to EdibleBlock the mod handles modeling and stuff, but you'll need to still do the blockstate files for your blocks.

{
	"forge_marker": 1,
	"variants": {
		"inventory": [{}],
		"amount": {
			"0": {"model": "xenlib:usable_block_0", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"1": {"model": "xenlib:usable_block_1", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"2": {"model": "xenlib:usable_block_2", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"3": {"model": "xenlib:usable_block_3", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"4": {"model": "xenlib:usable_block_4", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"5": {"model": "xenlib:usable_block_5", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"6": {"model": "xenlib:usable_block_6", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"7": {"model": "xenlib:usable_block_7", "textures": { "all": "littleutilities:blocks/apple_block"}},
			"8": {"model": "xenlib:usable_block_8", "textures": { "all": "littleutilities:blocks/apple_block"}}
		}
	}
}

Whether your block is an edible or usable block, they both use the usable block model file from XenLib. If you're block isn't a full block, but still needs the decreasing size from the top, you'll need to add your own model files. I'll link to the PufferfishBlock model files from LittleUtilities.

References