IndexOutOfBoundsException in InvSlot.put when ticking block entity
zz314657917 opened this issue · 5 comments
Description:
While playing the game, I encountered an IndexOutOfBoundsException error when a block entity was ticking. The error occurred in the InvSlot.put method, specifically at line 267 in the InvSlot class. The stack trace indicates that the issue is related to the InvSlotUpgrade component, which is trying to update an entity but fails due to an index out of bounds error.
Error Details:
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:659)
at java.util.ArrayList.set(ArrayList.java:450)
at com.denfop.invslot.InvSlot.put(InvSlot.java:267)
at com.denfop.invslot.InvSlotUpgrade.tickPullIn(InvSlotUpgrade.java:719)
at com.denfop.invslot.InvSlotUpgrade.tickNoMark(InvSlotUpgrade.java:409)
at com.denfop.componets.ComponentUpgradeSlots.updateEntityServer(ComponentUpgradeSlots.java:62)
at com.denfop.tiles.base.TileEntityBlock.updateEntityServer(TileEntityBlock.java:427)
at com.denfop.tiles.base.TileMultiMachine.updateEntityServer(TileMultiMachine.java:604)
at com.denfop.tiles.base.TileEntityBlock.TickCentral_TrueITickableUpdate(TileEntityBlock.java:404)
at com.github.terminatornl.tickcentral.api.TickHub.trueUpdate(TickHub.java:48)
at com.github.terminatornl.laggoggles.Main.redirectUpdate(Main.java:94)
at com.denfop.tiles.base.TileEntityBlock.func_73660_a(TileEntityBlock.java)
at net.minecraft.world.World.func_72939_s(World.java:2125)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:742)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:976)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:475)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:828)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:687)
at java.lang.Thread.run(Thread.java:750)
Steps to Reproduce:
Play the game and interact with a block entity that uses the InvSlotUpgrade component.
The error occurs during the ticking of the block entity.
Expected Behavior:
The block entity should update without any errors, and the game should continue running smoothly.
Actual Behavior:
The game crashes with an IndexOutOfBoundsException when the block entity tries to update.
Additional Information:
Time of Error: 3/12/25 5:03 PM
No Mixin Metadata is found in the Stacktrace.
Possible Cause:
The error seems to be caused by an attempt to access or modify an element in an ArrayList at an index that is out of bounds. This could be due to a mismatch between the expected size of the list and the actual size when the InvSlot.put method is called.
Request:
Could you please investigate this issue and provide a fix or workaround? Let me know if you need any additional information or logs to help diagnose the problem.
Thank you for your time and support!
Thank you for your response!
The crash occurred when I was using the Perfect Electric Furnace with multiple overclock upgrades. It seems that the combination of the Perfect Electric Furnace and a large number of overclock upgrades caused the IndexOutOfBoundsException in the InvSlot.put method.
Here’s a bit more detail about the setup:
I was using the Perfect Electric Furnace from Industrial Upgraded.
I had installed multiple overclock upgrades (likely more than the slot could handle, which might have triggered the issue).
The error occurred during the ticking of the block entity, specifically when the furnace was processing items with the overclock upgrades active.
Let me know if you need further details or if there’s any additional information I can provide to help debug this issue.
Thanks again for your help!
Hi,
Thank you for your previous response! I have another suggestion/request that I believe could improve the customization and flexibility of your mod, especially for server environments.
-
Pollution Switch in Config File:
Currently, the pollution mechanic is a fixed feature in the mod. While it adds an interesting layer of gameplay, it might introduce significant performance overhead in server environments, especially when multiple machines are running simultaneously. Could you consider adding an option to the config file to enable or disable pollution? This would allow server administrators to optimize performance by disabling pollution if needed, while still keeping it available for single-player or smaller servers. -
Configurable Overclock Power Consumption:
The overclock upgrades are a fantastic feature, but the power consumption ratio is currently hardcoded. Could you make this configurable as well? For example, allow players to set a custom power consumption ratio like 1:4, where for every 10% speed increase, the machine consumes an additional 40% power. This would give players and server admins more control over balancing performance and energy usage, especially in modpacks where energy generation and usage need to be carefully managed.
Why This Would Be Helpful:
Performance Optimization: Adding a pollution toggle could significantly reduce performance overhead on servers, making the mod more scalable for larger communities.
Flexibility: Players and server admins can adjust the mod to better fit their playstyle or server settings.
Balance: Customizable overclock power consumption would allow for more fine-tuned gameplay, especially in modpacks where energy balance is critical.
Accessibility: A pollution toggle would make the mod more accessible to players who prefer a pollution-free experience or need to prioritize performance.
Let me know what you think about these suggestions! If this is something you’d consider implementing, I’d be happy to help test or provide additional feedback.
Thank you for your hard work and for creating such an amazing mod!