IndexOutOfBoundsException
noobanidus opened this issue ยท 7 comments
Reporting for a friend
As mentioned, this is the log containing the error: https://gist.github.com/duely/70c2ea46cc0806aac37af3087aae4c09
This is the modlist: https://gist.github.com/duely/c551fc4e6ad3904e8a64ccfe12bb6dcf
It appears to be attempting to inject items into the actual 45th slot (crafting grid of 9 plus player inventory of 36 meaning a total of 44 slots 0-indexed) implying that something is going beyond the bounds.
This happens when accessing the crafting interface.
The direct result of this is items appearing at random in the player inventory.
I know Arcane Archives suffered from this issues when an on-click event was transforming a single chest into a double-chest size but failing to cancel the on-click action, meaning there was a disparity between the client and the server about the actual size of the open container, and items ended up being placed in the armor slots, etc.
Thankyou Duely for explaining this better than I could. I am/was at a loss to explain what was happening. Strangely, creating a new world meant that this issue didn't replicate on the server.
I believe specifically this is when people are using the crafting interface. Unfortunately I'm passing this on second-hand and haven't seen the effect up-front, however the indication to me is that the container size on the client is, for some reason, smaller than the container size on the server, and the server is attempting to set the contents of something that does not exist.
This happened quite regularly with Arcane Archives' "chest upgrade" as the client container would be initialised to a single chest as the right-click action wasn't cancelled and it continued to create the gui/container, but then showed the correct container, but in the meantime the server had already tried to transmit the contents of the chest to the player and there was a mismatch in the sizes.
Unfortunately, the only thing that can add additional information (I've found) was a small mixin that modified ... setSlot to output the class name if the slot was greater than the total number of slots. As it's purely a client-side mod, I'll dig it up and see if I can supply it to @GentlemanGnu for further testing.
I unfortunately can't upload the mini-mixin mod I'm using, but I've provided it to @GentlemanGnu and hopefully that'll give us some more information to determine for certain if it's the Storage Network container that is causing the error, or something else.
I do see the issue in the log. I dont see a mention of simple storage mod ID or line of code in the error
What were you doing when this happened?
"It appears to be attempting " what is attempting? Are you pulling items out of the network?
"The direct result of this is items appearing at random in the player inventory." what does this mean and how does it happen?
Currently when my inventory is full, and i try to extract items out by shift clicing out, it just puts them on the ground. I dont know how to replicate this
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 45, Size: 45 at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_51] at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?] at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1088) [bib.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398) [bib.class:?] at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] Caused by: java.lang.IndexOutOfBoundsException: Index: 45, Size: 45 at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[?:1.8.0_51] at java.util.ArrayList.get(ArrayList.java:429) ~[?:1.8.0_51] at net.minecraft.inventory.Container.func_75139_a(Container.java:120) ~[afr.class:?] at net.minecraft.inventory.Container.func_190896_a(Container.java:527) ~[afr.class:?] at net.minecraft.client.network.NetHandlerPlayClient.func_147241_a(NetHandlerPlayClient.java:1191) ~[brz.class:?] at net.minecraft.network.play.server.SPacketWindowItems.func_148833_a(SourceFile:50) ~[is.class:?] at net.minecraft.network.play.server.SPacketWindowItems.func_148833_a(SourceFile:12) ~[is.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[hv$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_51] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_51] at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
Duely tells me this is the relevant line
[18:44:12] [Client thread/ERROR]: [ColdRock] Container with the class class mrriegel.storagenetwork.block.request.ContainerRequest tried to access slot 45 when only 45 slots are available.
We currently have a server where this glitch can be experienced first hand. It's whitelisted, and you'll need the entire pack in order to get online.
Whenever I try to craft in the storage request table, it shuffles around my inventory, and doesn't allow the craft to happen. I tried crafting polished andesite, but it doesn't show up in the results.
Re-entering the storage request table has the polished andesite waiting there in the first slot.
Just to clarify, Cold Rock is a short mod I wrote which bootstraps Sponge Mixins and then uses the following Mixin to provide information about what container it is that is about to cause an Index error:
@Mixin(Container.class)
@SuppressWarnings("unused")
public abstract class MixinContainer {
@Shadow
public List<Slot> inventorySlots;
@Inject(method = "getSlot", at = @At(value = "HEAD"))
private void getSlot(int slotId, CallbackInfoReturnable<Slot> callback) {
if (slotId >= this.inventorySlots.size()) {
ColdRock.LOG.error(String.format("[ColdRock] Container with the class %s tried to access slot %d when only %d slots are available.", this.getClass().toString(), slotId, this.inventorySlots.size()));
}
}
}```