According to your testing, does the issue occur with ONLY Portal Gun mod and Immersive Portals mod and Farbic API?
Yes
Describe the issue
when registering the creative inventory tab, if maxEnergy = 0 then the item is duplicated, which crashes
the crash at startup only occurs due to CC:Tweaked, however entering the creative mode inventory crashes without any additional mods as far as I know
java.lang.IllegalStateException: Accidentally adding the same item stack twice [Portal Gun] to a Creative Mode Tab: Portal Gun at net.minecraft.class_1761$class_7703.method_45417(class_1761.java:252) ~[client-intermediary.jar:?] at net.minecraft.class_1761$class_7704.method_45420(class_1761.java:278) ~[client-intermediary.jar:?] at portalgun.PortalGunMod.lambda$static$1(PortalGunMod.java:74) ~[portalgun-6.2.0-mc1.20.4-fabric.jar:?] at net.minecraft.class_1761.method_47306(class_1761.java:101) ~[client-intermediary.jar:?] at net.minecraft.class_7706.method_47338(class_7706.java:2131) ~[client-intermediary.jar:?] at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?] at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?] at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?] at net.minecraft.class_7706.method_47337(class_7706.java:2131) ~[client-intermediary.jar:?] at net.minecraft.class_7706.method_47330(class_7706.java:2142) ~[client-intermediary.jar:?] at dan200.computercraft.shared.CommonHooks.onServerStarted(CommonHooks.java:69) ~[cc-tweaked-1.20.4-fabric-1.109.5.jar:?] at net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents.lambda$static$2(ServerLifecycleEvents.java:49) ~[fabric-lifecycle-events-v1-2.3.0+a67ffb5d4f-df781ed0de5bc62e.jar:?] at net.minecraft.server.MinecraftServer.handler$bei000$fabric-lifecycle-events-v1$afterSetupServer(MinecraftServer.java:2914) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:654) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) ~[client-intermediary.jar:?] at java.lang.Thread.run(Thread.java:833) ~[?:?]
Post the log here
too long for github, will post somehow if necessary, but a simple check for maxEnergy should sufice:
replace:
entries.accept(new PortalGunItem.ItemInfo(
BlockList.createDefault(), maxEnergy, maxEnergy
).toStack());
with:
if(maxEnegy!=0) {
entries.accept(new PortalGunItem.ItemInfo(
BlockList.createDefault(), maxEnergy, maxEnergy
).toStack());
}
According to your testing, does the issue occur with ONLY Portal Gun mod and Immersive Portals mod and Farbic API?
Yes
Describe the issue
when registering the creative inventory tab, if maxEnergy = 0 then the item is duplicated, which crashes
the crash at startup only occurs due to CC:Tweaked, however entering the creative mode inventory crashes without any additional mods as far as I know
java.lang.IllegalStateException: Accidentally adding the same item stack twice [Portal Gun] to a Creative Mode Tab: Portal Gun at net.minecraft.class_1761$class_7703.method_45417(class_1761.java:252) ~[client-intermediary.jar:?] at net.minecraft.class_1761$class_7704.method_45420(class_1761.java:278) ~[client-intermediary.jar:?] at portalgun.PortalGunMod.lambda$static$1(PortalGunMod.java:74) ~[portalgun-6.2.0-mc1.20.4-fabric.jar:?] at net.minecraft.class_1761.method_47306(class_1761.java:101) ~[client-intermediary.jar:?] at net.minecraft.class_7706.method_47338(class_7706.java:2131) ~[client-intermediary.jar:?] at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?] at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?] at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?] at net.minecraft.class_7706.method_47337(class_7706.java:2131) ~[client-intermediary.jar:?] at net.minecraft.class_7706.method_47330(class_7706.java:2142) ~[client-intermediary.jar:?] at dan200.computercraft.shared.CommonHooks.onServerStarted(CommonHooks.java:69) ~[cc-tweaked-1.20.4-fabric-1.109.5.jar:?] at net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents.lambda$static$2(ServerLifecycleEvents.java:49) ~[fabric-lifecycle-events-v1-2.3.0+a67ffb5d4f-df781ed0de5bc62e.jar:?] at net.minecraft.server.MinecraftServer.handler$bei000$fabric-lifecycle-events-v1$afterSetupServer(MinecraftServer.java:2914) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:654) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) ~[client-intermediary.jar:?] at java.lang.Thread.run(Thread.java:833) ~[?:?]
Post the log here