portablejim / BetterBuildersWands

17 stars 21 forks source link

[1.12.2] Wand lacks inventory index safety #104

Closed Vectrobe closed 5 years ago

Vectrobe commented 5 years ago

Seems to attempt to load an index out of range in some cases, causing it to crash on accessing some inventories;


java.lang.ArrayIndexOutOfBoundsException: 45
    at cofh.core.gui.container.InventoryContainerItemWrapper.func_70301_a(InventoryContainerItemWrapper.java:142)
    at net.minecraftforge.items.wrapper.InvWrapper.getStackInSlot(InvWrapper.java:68)
    at portablejim.bbw.containers.handlers.HandlerCapability.countItems(HandlerCapability.java:28)
    at portablejim.bbw.containers.ContainerManager.countItems(ContainerManager.java:55)
    at portablejim.bbw.shims.BasicPlayerShim.countItems(BasicPlayerShim.java:69)
    at portablejim.bbw.core.WandWorker.getProperItemStack(WandWorker.java:81)
    at portablejim.bbw.core.BlockEvents.blockHighlightEvent(BlockEvents.java:53)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1836_BlockEvents_blockHighlightEvent_DrawBlockHighlightEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
    at net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(ForgeHooksClient.java:191)
    at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1361)
    at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1259)
    at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1062)
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1119)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398)
    at net.minecraft.client.main.Main.main(SourceFile:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)```
Vectrobe commented 5 years ago

tell a lie actually, this may be on cofh's side after all...

msgerbs commented 5 years ago

Have you posted this to COFH yet? Not sure which mod is the true cause but it's really annoying.

Vectrobe commented 5 years ago

hum, not sure if I got back to this one. I did look at the code on both sides, but couldn't find anything inherently wrong, so I can only assume that something is going horribly wrong with the satchel's internal container...

Could simply be that the satchel isn't re-sized correctly when enchanted, however COFH in their wisdom have locked all the repos so I cant actually check back on them...

KingLemming commented 5 years ago

The true cause of this is whatever mod forcibly adds capabilities to Satchels, because Satchels do not have capabilities. This is a very intentional design decision meant to prevent nonsense like this from happening in the first place.

So, unless this mod forces capabilities onto Satchels (I do not believe it does), it's a third party mod altogether.

Also, @Paul17041993 - the repos are not locked. The feedback repo has been closed down for now because frankly, bugs for 1.12 have been resolved. 99% of everything I get now is tech support issues. However, you can still go look at code to your heart's content.

Vectrobe commented 5 years ago

You locked the issues for all mods, which is exactly what I wanted to check through

Vectrobe commented 5 years ago

Alright, can confirm this issue is fixed in CommonCapabilities; https://github.com/CyclopsMC/CommonCapabilities/issues/20