Make neoforge creative tab checker happy

This commit is contained in:
DBotThePony 2024-08-28 00:31:57 +07:00
parent 85e477f386
commit fa5b6c2840
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -77,14 +77,16 @@ private fun CreativeModeTab.Output.all(values: Map<DyeColor?, Item>) {
}
private fun CreativeModeTab.Output.energized(value: Item) {
accept(value)
val empty = ItemStack(value, 1)
accept(empty)
val stack = ItemStack(value, 1)
val energy = stack.matteryEnergy ?: throw IllegalArgumentException("${value.registryName} does not implement mattery energy capability")
val full = empty.copy()
val energy = full.matteryEnergy ?: throw IllegalArgumentException("${value.registryName} does not implement mattery energy capability")
energy.fillBattery()
if (ItemStack(value, 1).matteryEnergy!!.batteryLevel != energy.batteryLevel)
accept(stack)
// FIXME
if (ItemStack(value, 1).matteryEnergy!!.batteryLevel != energy.batteryLevel && !ItemStack.isSameItemSameComponents(empty, full))
accept(full)
}
private fun CreativeModeTab.Output.energized(values: Iterable<Item>) {
@ -94,15 +96,17 @@ private fun CreativeModeTab.Output.energized(values: Iterable<Item>) {
}
private fun CreativeModeTab.Output.mattery(value: Item) {
accept(value)
val empty = ItemStack(value, 1)
accept(empty)
val stack = ItemStack(value, 1)
val matter = stack.getCapability(MatteryCapability.MATTER_ITEM) ?: throw IllegalArgumentException("${value.registryName} does not implement matter capability")
val full = empty.copy()
val matter = full.getCapability(MatteryCapability.MATTER_ITEM) ?: throw IllegalArgumentException("${value.registryName} does not implement matter capability")
matter.fillMatter()
if (ItemStack(value, 1).getCapability(MatteryCapability.MATTER_ITEM)!!.storedMatter != matter.storedMatter)
accept(stack)
// FIXME
if (ItemStack(value, 1).getCapability(MatteryCapability.MATTER_ITEM)!!.storedMatter != matter.storedMatter && !ItemStack.isSameItemSameComponents(empty, full))
accept(full)
}
private fun CreativeModeTab.Output.mattery(values: Iterable<Item>) {