Supplementaries

Supplementaries

82M Downloads

Adding compatibility for jars and Create filling/emptying

p3lim opened this issue ยท 0 comments

commented

I'd like to see native support for filling and emptying jars using Create.

As mentioned on Discord I already added potion support for this in my private modpack using KubeJS and its Create integration, the code for which follows:

const potions = [
	'minecraft:fire_resistance',
	'minecraft:long_fire_resistance',
	'minecraft:harming',
	'minecraft:strong_harming',
	'minecraft:healing',
	'minecraft:strong_healing',
	'minecraft:invisibility',
	'minecraft:long_invisibility',
	// and a whole lot more, just truncating it here
]

onEvent('recipes', event => {
	// add support for filling potions in Jars using Create
	for (let potion of potions){
		for (let mB = 1; mB <= 12; mB++){
			// both Create and Supplementaries uses NBT to distinguish potions
			let potionNBT = {
				Bottle: 'REGULAR',
				Potion: potion,
			}

			// create recipe for filling (arg1 = output, arg2 = input[])
			event.recipes.create.filling(Item.of('supplementaries:jar_full', {
				BlockEntityTag: {
					FluidHolder: {
						Fluid: 'minecraft:potion',
						Count: mB,
						NBT: potionNBT,
					}
				}
			}), [
				Fluid.of('create:potion', 250, potionNBT),
				mB === 0 ? 'supplementaries:jar' : Item.of('supplementaries:jar_full', {
					BlockEntityTag: {
						FluidHolder: {
							Fluid: 'minecraft:potion',
							Count: mB - 1,
							NBT: potionNBT,
						}
					}
				}),
			])

			// create recipe for emptying (arg1 = output[], arg2 = input)
			event.recipes.create.emptying([
				Fluid.of('create:potion', 250, potionNBT),
				mB === 0 ? 'supplementaries:jar' : Item.of('supplementaries:jar_full', {
					BlockEntityTag: {
						FluidHolder: {
							Fluid: 'minecraft:potion',
							Count: mB - 1,
							NBT: potionNBT,
						}
					}
				}),
			], Item.of('supplementaries:jar_full', {
				BlockEntityTag: {
					FluidHolder: {
						Fluid: 'minecraft:potion',
						Count: mB,
						NBT: potionNBT,
					}
				}
			}))
		}
	}
})