[Bug] Magically unstable items sometimes cause crafting to fail
ItsFlux opened this issue ยท 1 comments
Observed behaviour
When repairing or Honing an item, said item has a chance to consume materials and levels and fail the attempt, due to exceeding magic capacity
Expected behaviour
The system to work how it does in 1.16, or at least, to not show a tooltip to the contrary
Steps to reproduce
- Place a modified item in the workbench
- apply lots of enchants
- attempt to hone or repair
- tooltip says the module has a chance of negative effect
- repair or hone fails based on the chance, wasting materials and/or exp levels
Crashlog
No response
Tetra version
4.5.0
mutil/mGui version
4.2.0
Forge version
1.18.1 - 39.0.64
Other mods
No response
Same issue.
java.lang.IllegalArgumentException: bound must be positive
at java.util.Random.nextInt(Random.java:322) ~[?:?]
at se.mickelus.tetra.items.modular.IModularItem.lambda$applyDestabilizationEffects$42(IModularItem.java:673) ~[tetra-1.18.1-4.6.0.jar%23121!/:?]
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.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[?:?]
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 se.mickelus.tetra.items.modular.IModularItem.applyDestabilizationEffects(IModularItem.java:663) ~[tetra-1.18.1-4.6.0.jar%23121!/:?]
at se.mickelus.tetra.items.modular.IModularItem.assemble(IModularItem.java:1032) ~[tetra-1.18.1-4.6.0.jar%23121!/:?]
at se.mickelus.tetra.blocks.workbench.WorkbenchTile.craft(WorkbenchTile.java:403) ~[tetra-1.18.1-4.6.0.jar%23121!/:?]
at se.mickelus.tetra.blocks.workbench.WorkbenchPacketCraft.handle(WorkbenchPacketCraft.java:23) ~[tetra-1.18.1-4.6.0.jar%23121!/:?]
at se.mickelus.mutil.network.PacketHandler.lambda$onMessage$2(PacketHandler.java:75) ~[mutil-1.18.1-4.4.0.jar%2395!/:4.4.0]
at net.minecraftforge.network.NetworkEvent$Context.enqueueWork(NetworkEvent.java:222) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at se.mickelus.mutil.network.PacketHandler.onMessage(PacketHandler.java:73) ~[mutil-1.18.1-4.4.0.jar%2395!/:4.4.0]
at net.minecraftforge.network.simple.IndexedMessageCodec.lambda$tryDecode$3(IndexedMessageCodec.java:128) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
at net.minecraftforge.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:128) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at net.minecraftforge.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:162) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at net.minecraftforge.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:82) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-5.0.3.jar%232!/:?]
at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-5.0.3.jar%232!/:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%232!/:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%232!/:?]
at net.minecraftforge.network.NetworkInstance.dispatch(NetworkInstance.java:82) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at net.minecraftforge.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:89) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at java.util.Optional.map(Optional.java:260) ~[?:?]
at net.minecraftforge.network.NetworkHooks.onCustomPayload(NetworkHooks.java:89) ~[forge-1.18.1-39.0.79-universal.jar%23130!/:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.m_7423_(ServerGamePacketListenerImpl.java:1416) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket.m_5797_(ServerboundCustomPayloadPacket.java:35) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket.m_5797_(ServerboundCustomPayloadPacket.java:8) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:21) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:151) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:765) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_6367_(MinecraftServer.java:161) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:125) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_129961_(MinecraftServer.java:748) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_7245_(MinecraftServer.java:742) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.util.thread.BlockableEventLoop.m_18701_(BlockableEventLoop.java:134) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_130012_(MinecraftServer.java:728) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:672) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258) ~[server-1.18.1-20211210.034407-srg.jar%23126!/:?]
at java.lang.Thread.run(Thread.java:833) [?:?]