Procedure Crash with slots

Published by Cyclip on
Status
Works as designed
Issue description

I tried making a chest/box thing so I created the block, and the procedure to open. When I tried it, the game stopped and didn't really crash but crashed.

Crash log thing:

---- Minecraft Crash Report ----
// Ouch. That hurt :(

Time: 6/3/18 8:36 PM
Description: Ticking player

java.lang.ArrayIndexOutOfBoundsException: 35
	at java.util.Arrays$ArrayList.get(Arrays.java:3841)
	at net.minecraft.util.NonNullList.get(NonNullList.java:51)
	at net.minecraft.tileentity.TileEntityLockableLoot.getStackInSlot(TileEntityLockableLoot.java:113)
	at net.minecraft.inventory.Slot.getStack(Slot.java:81)
	at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97)
	at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:365)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168)
	at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:870)
	at net.minecraft.world.World.updateEntity(World.java:2127)
	at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:671)
	at net.minecraft.world.World.updateEntities(World.java:1903)
	at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:642)
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:840)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
	at java.lang.Thread.run(Thread.java:748)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
	at java.util.Arrays$ArrayList.get(Arrays.java:3841)
	at net.minecraft.util.NonNullList.get(NonNullList.java:51)
	at net.minecraft.tileentity.TileEntityLockableLoot.getStackInSlot(TileEntityLockableLoot.java:113)
	at net.minecraft.inventory.Slot.getStack(Slot.java:81)
	at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97)
	at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:365)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168)
	at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:870)
	at net.minecraft.world.World.updateEntity(World.java:2127)

-- Player being ticked --
Details:
	Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
	Entity ID: 1173
	Entity Name: Player334
	Entity's Exact location: 263.97, 85.00, 206.34
	Entity's Block location: World: (263,85,206), Chunk: (at 7,5,14 in 16,12; contains blocks 256,0,192 to 271,255,207), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Entity's Momentum: 0.00, -0.08, 0.00
	Entity's Passengers: []
	Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
	at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:671)
	at net.minecraft.world.World.updateEntities(World.java:1903)
	at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:642)

-- Affected level --
Details:
	Level name: TW #3
	All players: 1 total; [EntityPlayerMP['Player334'/1173, l='TW #3', x=263.97, y=85.00, z=206.34]]
	Chunk stats: ServerChunkCache: 348 Drop: 0
	Level seed: -2822617044648506876
	Level generator: ID 00 - default, ver 1. Features enabled: true
	Level generator options: 
	Level spawn location: World: (255,64,227), Chunk: (at 15,4,3 in 15,14; contains blocks 240,0,224 to 255,255,239), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Level time: 517 game time, 517 day time
	Level dimension: 0
	Level storage version: 0x04ABD - Anvil
	Level weather: Rain time: 63352 (now: false), thunder time: 165471 (now: false)
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:840)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
	at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 8.1 (amd64) version 6.3
	Java Version: 1.8.0_152, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 375385840 bytes (357 MB) / 760217600 bytes (725 MB) up to 1415053312 bytes (1349 MB)
	JVM Flags: 0 total; 
	IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
	FML: MCP 9.42 Powered by Forge 14.23.2.2611 5 mods loaded, 5 mods active
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

	| State     | ID                 | Version      | Source                           | Signature |
	|:--------- |:------------------ |:------------ |:-------------------------------- |:--------- |
	| UCHIJAAAA | minecraft          | 1.12.2       | minecraft.jar                    | None      |
	| UCHIJAAAA | mcp                | 9.42         | minecraft.jar                    | None      |
	| UCHIJAAAA | FML                | 8.0.99.99    | forgeSrc-1.12.2-14.23.2.2611.jar | None      |
	| UCHIJAAAA | forge              | 14.23.2.2611 | forgeSrc-1.12.2-14.23.2.2611.jar | None      |
	| UCHIJAAAA | testenvironmentmod | 1.0          | modid-1.0.jar                    | None      |

	Loaded coremods (and transformers): 
	GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
	Profiler Position: N/A (disabled)
	Player Count: 1 / 8; [EntityPlayerMP['Player334'/1173, l='TW #3', x=263.97, y=85.00, z=206.34]]
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'fml,forge'

 

I attached the procedures too.

Issue comments

Thank you for your bug report!

The issue is not with the procedure, but the fact that you are somewhere referencing the slot with ID 35. Your block has 35 slots, that means that IDs go from 0 to 34. The simplest fix would be to increase the slot count on the block to 36, or find the reference to the slot with ID 35 and remove it.