Pam's HarvestCraft 2 - Crops

Pam's HarvestCraft 2 - Crops

17M Downloads

Index Out of Bounds Exception

TechniumUnlimited opened this issue ยท 3 comments

commented

Was about to post the same, problem happens when harvesting potatoes and you get a poisonous potato. If the right click event is sent with a fake player, it also causes a server crash.

[17:21:31] [Server thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: Index 1 out of bounds for length 1
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: pam.pamhc2crops.events.harvest.CropHarvest@159d7385 onCropHarvest(Lnet/minecraftforge/event/entity/player/PlayerInteractEvent$RightClickBlock;)V
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at pam.pamhc2crops.events.harvest.CropHarvest.onCropHarvest(CropHarvest.java:77)
	at net.minecraftforge.eventbus.ASMEventHandler_23_CropHarvest_onCropHarvest_RightClickBlock.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297)
	at net.minecraftforge.common.ForgeHooks.onRightClickBlock(ForgeHooks.java:778)
	at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:327)
	at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:917)
	at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:45)
	at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12)
	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19)
	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20)
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139)
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:755)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:156)
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109)
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:738)
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:732)
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:122)
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:718)
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:664)
	at net.minecraft.server.MinecraftServer.lambda$func_240784_a_$0(MinecraftServer.java:230)
	at java.base/java.lang.Thread.run(Thread.java:834)

[17:21:31] [Server thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Server
java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
	at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?] {}
	at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?] {}
	at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) ~[?:?] {}
	at java.util.Objects.checkIndex(Objects.java:372) ~[?:?] {}
	at java.util.ArrayList.get(ArrayList.java:458) ~[?:?] {}
	at pam.pamhc2crops.events.harvest.CropHarvest.onCropHarvest(CropHarvest.java:77) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_23_CropHarvest_onCropHarvest_RightClickBlock.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.3-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.3-service.jar:?] {}
	at net.minecraftforge.common.ForgeHooks.onRightClickBlock(ForgeHooks.java:778) ~[?:?] {re:classloading}
	at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:327) ~[?:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.processTryUseItemOnBlock(ServerPlayNetHandler.java:917) ~[?:?] {re:classloading}
	at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:45) ~[?:?] {re:classloading}
	at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.processPacket(CPlayerTryUseItemOnBlockPacket.java:12) ~[?:?] {re:classloading}
	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading}
	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[?:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:755) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:156) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:738) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:732) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:122) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:718) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:664) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.lambda$func_240784_a_$0(MinecraftServer.java:230) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:834) [?:?] {}
[17:21:33] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[17:21:33] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[New World]'/minecraft:overworld
[17:21:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[New World]'/minecraft:the_nether
[17:21:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[New World]'/minecraft:the_end
[17:21:34] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save New World
[17:21:34] [Server thread/DEBUG] [ne.mi.fm.FMLWorldPersistenceHook/WP]: ID Map collection complete New World

commented

Same error, gave this issue a +1. Stacktrace:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.rangeCheck(ArrayList.java:659) ~[?:1.8.0_275]
        at java.util.ArrayList.get(ArrayList.java:435) ~[?:1.8.0_275]
        at pam.pamhc2crops.events.harvest.CropHarvest.onCropHarvest(CropHarvest.java:73) ~[pamhc2crops:1.0.1]
        at net.minecraftforge.eventbus.ASMEventHandler_294_CropHarvest_onCropHarvest_RightClickBlock.invoke(.dynamic) ~[?:?]
        at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?]
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?]
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?]
        at net.minecraftforge.common.ForgeHooks.onRightClickBlock(ForgeHooks.java:803) ~[forge:?]
        at net.minecraft.server.management.PlayerInteractionManager.func_219441_a(PlayerInteractionManager.java:318) ~[?:?]
        at net.minecraft.network.play.ServerPlayNetHandler.func_184337_a(ServerPlayNetHandler.java:958) ~[?:?]
        at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.func_148833_a(SourceFile:36) ~[?:?]
        at net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket.func_148833_a(SourceFile:10) ~[?:?]
        at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21) ~[?:?]
        at net.minecraft.util.concurrent.TickDelayedTask.run(SourceFile:18) ~[?:?]
        at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213166_h(SourceFile:144) ~[?:?]
        at net.minecraft.util.concurrent.RecursiveEventLoop.func_213166_h(SourceFile:23) ~[?:?]
        at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:733) ~[?:?]
        at net.minecraft.server.MinecraftServer.func_213166_h(MinecraftServer.java:159) ~[?:?]
        at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213168_p(SourceFile:118) ~[?:?]
        at net.minecraft.server.MinecraftServer.func_213205_aW(MinecraftServer.java:716) ~[?:?]
        at net.minecraft.server.MinecraftServer.func_213168_p(MinecraftServer.java:710) ~[?:?]
        at net.minecraft.util.concurrent.ThreadTaskExecutor.func_213161_c(SourceFile:127) ~[?:?]
        at net.minecraft.server.MinecraftServer.func_213202_o(MinecraftServer.java:696) ~[?:?]
        at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:645) ~[?:?]
        at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:232) ~[?:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]

More context:
Forge 1.16.4-35.1.37 server version
pamhc2crops-1.16.3-1.0.1

Upon further inspection it looks to be a simple issue. On


it seems to remove a drop from a list, but tries to access it later on. the delete should happen after the world event and this issue should be fixed.

commented

Hopefully fixed in Fixed in 1.16.3-1.0.2