Rhino

Rhino

34M Downloads

java.lang.IllegalArgumentException: forEach

aaronhowser1 opened this issue ยท 2 comments

commented

Crash report

It happens every time I look at Arcane Bee spawn eggs, with this KubeJS Script:
https://gist.github.com/c865f001628c5595acab465453b8697a
The relevant bit:

	let tooltipNBT = (itemNoNBT, itemWithNBT, theText) => {
		event.addAdvanced(itemNoNBT, (item, advanced, text) => {
			if (item.test(itemWithNBT)) {
				if (Array.isArray(theText)) {
					tooltip.forEach(function (line, index) {
						text.add(index+1, line)
					})
				} else {
					text.add(1, theText)
				}
			}
		})
	}

	let beeTooltip = (species, tooltip) => {
		let theItem = Item.of('productivebees:spawn_egg_configurable_bee', '{EntityTag:{type:"productivebees:'+species+'"}}')
		tooltipNBT('productivebees:spawn_egg_configurable_bee',theItem,tooltip)
	}

        beeTooltip('arcane',[Text.gray('Only obtainable in loot chests in the End')])
commented

tooltip is undefined

tooltip.forEach(function (line, index) {
						text.add(index+1, line)
					})

tooltip exists in the beeTooltip then passed to tooltipNBT but it's param is named theText meaning the correct code would be,

theText.forEach(function (line, index) {
						text.add(index+1, line)
					})
commented

I am a fool.