Fabric-Generator-MCreator
Fabric-Generator-MCreator copied to clipboard
Crash when using a random number generator for a variable
Issue tracker rule checks (please read carefully)
- [X] I have checked that my problem is not already reported
- [X] I have checked that my problem is not covered on Knowledge Base or on MCreator's Wiki
- [X] I have checked that my written content does not violate the publishing guidelines
Issue description
I created a block that is placed above a jukebox: It has 12 inventory slots that Discs are placed into. The only trigger I have set is for when redstone is detected OFF as I read that the jukebox creates a redstone signal when it's playing. The code first checks below it to make sure it's a jukebox. It is then supposed to generate a random integer and save it to a variable. That variable is used to select a slot from my box and send it to the jukebox as well as take the item in slot 0 from the jukebox and send it to my block. It loads up fine in the game but crashes as soon as the first disc ends playing. I initially manually place the disc into the jukebox as i don't want to mess with the triggering until I isolate what the problem is with the random number.
General Information on what you have done to fix it: I need the random number so it can select a random disc from the block I created.. so I'm at a loss. I can't find a workaround for the random number.
How to reproduce this issue?
play a disc, when the disc ends the game crashes
Operating system
Windows
Details
Mcreator Version: 2023.4 Minecraft Version: 1.20.1
Example workspace
No response
Logs
---- Minecraft Crash Report ---- // Shall we play a game?
Time: 2024-04-10 20:13:37 Description: Ticking block entity
java.lang.ClassCastException: class net.minecraft.world.level.block.entity.JukeboxBlockEntity cannot be cast to class net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity (net.minecraft.world.level.block.entity.JukeboxBlockEntity and net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity are in unnamed module of loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @3d99d22e) at net.mcreator.jukeboxcarousel.procedures.JukeboxCheckProcedure$2.getItemStack(JukeboxCheckProcedure.java:38) at net.mcreator.jukeboxcarousel.procedures.JukeboxCheckProcedure.execute(JukeboxCheckProcedure.java:41) at net.mcreator.jukeboxcarousel.block.CarouselBlock.neighborChanged(CarouselBlock.java:88) at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.neighborChanged(BlockBehaviour.java:1081) at net.minecraft.world.level.redstone.CollectingNeighborUpdater$MultiNeighborUpdate.runNext(CollectingNeighborUpdater.java:132) at net.minecraft.world.level.redstone.CollectingNeighborUpdater.runUpdates(CollectingNeighborUpdater.java:78) at net.minecraft.world.level.redstone.CollectingNeighborUpdater.addAndRun(CollectingNeighborUpdater.java:65) at net.minecraft.world.level.redstone.CollectingNeighborUpdater.updateNeighborsAtExceptFromFacing(CollectingNeighborUpdater.java:47) at net.minecraft.server.level.ServerLevel.updateNeighborsAt(ServerLevel.java:1018) at net.minecraft.world.level.block.entity.JukeboxBlockEntity.stopPlaying(JukeboxBlockEntity.java:94) at net.minecraft.world.level.block.entity.JukeboxBlockEntity.tick(JukeboxBlockEntity.java:103) at net.minecraft.world.level.block.entity.JukeboxBlockEntity.playRecordTick(JukeboxBlockEntity.java:198) at net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity.tick(LevelChunk.java:662) at net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper.tick(LevelChunk.java:716) at net.minecraft.world.level.Level.tickBlockEntities(Level.java:470) at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:390) at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:897) at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:824) at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:105) at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:671) at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) at java.base/java.lang.Thread.run(Thread.java:840)
A detailed walkthrough of the error, its code path and all known details is as follows:
-- Head -- Thread: Server thread Stacktrace: at net.mcreator.jukeboxcarousel.procedures.JukeboxCheckProcedure$2.getItemStack(JukeboxCheckProcedure.java:38) at net.mcreator.jukeboxcarousel.procedures.JukeboxCheckProcedure.execute(JukeboxCheckProcedure.java:41) at net.mcreator.jukeboxcarousel.block.CarouselBlock.neighborChanged(CarouselBlock.java:88) at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.neighborChanged(BlockBehaviour.java:1081) at net.minecraft.world.level.redstone.CollectingNeighborUpdater$MultiNeighborUpdate.runNext(CollectingNeighborUpdater.java:132) at net.minecraft.world.level.redstone.CollectingNeighborUpdater.runUpdates(CollectingNeighborUpdater.java:78) at net.minecraft.world.level.redstone.CollectingNeighborUpdater.addAndRun(CollectingNeighborUpdater.java:65) at net.minecraft.world.level.redstone.CollectingNeighborUpdater.updateNeighborsAtExceptFromFacing(CollectingNeighborUpdater.java:47) at net.minecraft.server.level.ServerLevel.updateNeighborsAt(ServerLevel.java:1018) at net.minecraft.world.level.block.entity.JukeboxBlockEntity.stopPlaying(JukeboxBlockEntity.java:94) at net.minecraft.world.level.block.entity.JukeboxBlockEntity.tick(JukeboxBlockEntity.java:103) at net.minecraft.world.level.block.entity.JukeboxBlockEntity.playRecordTick(JukeboxBlockEntity.java:198) at net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity.tick(LevelChunk.java:662) at net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper.tick(LevelChunk.java:716) at net.minecraft.world.level.Level.tickBlockEntities(Level.java:470) at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:390)
-- Block entity being ticked -- Details: Name: minecraft:jukebox // net.minecraft.world.level.block.entity.JukeboxBlockEntity Block: Block{minecraft:jukebox}[has_record=true] Block location: World: (-21,63,-44), Section: (at 11,15,4 in -2,3,-3; chunk contains blocks -32,-64,-48 to -17,319,-33), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,-64,-512 to -1,319,-1) Block: Block{minecraft:jukebox}[has_record=true] Block location: World: (-21,63,-44), Section: (at 11,15,4 in -2,3,-3; chunk contains blocks -32,-64,-48 to -17,319,-33), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,-64,-512 to -1,319,-1) Stacktrace: at net.minecraft.world.level.chunk.LevelChunk$BoundTickingBlockEntity.tick(LevelChunk.java:662) at net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper.tick(LevelChunk.java:716) at net.minecraft.world.level.Level.tickBlockEntities(Level.java:470) at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:390) at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:897) at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:824) at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:105) at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:671) at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) at java.base/java.lang.Thread.run(Thread.java:840)
-- Affected level -- Details: All players: 1 total; [ServerPlayer['Player565'/175, l='ServerLevel[New World]', x=-22.22, y=63.00, z=-42.40]] Chunk stats: 3249 Level dimension: minecraft:overworld Level spawn location: World: (-32,63,-32), Section: (at 0,15,0 in -2,3,-2; chunk contains blocks -32,-64,-32 to -17,319,-17), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,-64,-512 to -1,319,-1) Level time: 22866 game time, 22866 day time Level name: New World Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Level weather: Rain time: 52615 (now: false), thunder time: 108701 (now: false) Known server brands: fabric Removed feature flags: Level was modded: true Level storage version: 0x04ABD - Anvil Stacktrace: at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:897) at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:824) at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:105) at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:671) at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) at java.base/java.lang.Thread.run(Thread.java:840)
-- System Details -- Details: Minecraft Version: 1.20.1 Minecraft Version ID: 1.20.1 Operating System: Windows 11 (amd64) version 10.0 Java Version: 17.0.9, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 1001832824 bytes (955 MiB) / 1832910848 bytes (1748 MiB) up to 8547991552 bytes (8152 MiB) CPUs: 24 Processor Vendor: GenuineIntel Processor Name: 13th Gen Intel(R) Core(TM) i7-13700F Identifier: Intel64 Family 6 Model 183 Stepping 1 Microarchitecture: unknown Frequency (GHz): 2.11 Number of physical packages: 1 Number of physical CPUs: 16 Number of logical CPUs: 24 Graphics card #0 name: NVIDIA GeForce RTX 4070 Ti Graphics card #0 vendor: NVIDIA (0x10de) Graphics card #0 VRAM (MB): 4095.00 Graphics card #0 deviceId: 0x2782 Graphics card #0 versionInfo: DriverVersion=31.0.15.5161 Memory slot #0 capacity (MB): 16384.00 Memory slot #0 clockSpeed (GHz): 5.60 Memory slot #0 type: Unknown Memory slot #1 capacity (MB): 16384.00 Memory slot #1 clockSpeed (GHz): 5.60 Memory slot #1 type: Unknown Virtual memory max (MB): 65374.43 Virtual memory used (MB): 28716.63 Swap memory total (MB): 32768.00 Swap memory used (MB): 70.18 JVM Flags: 0 total; Fabric Mods: fabric-api: Fabric API 0.83.1+1.20.1 fabric-api-base: Fabric API Base 0.4.29+b04edc7a77 fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.34+4d8536c977 fabric-biome-api-v1: Fabric Biome API (v1) 13.0.10+b3afc78b77 fabric-block-api-v1: Fabric Block API (v1) 1.0.9+e022e5d177 fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.39+b3afc78b77 fabric-client-tags-api-v1: Fabric Client Tags 1.0.20+b3afc78b77 fabric-command-api-v2: Fabric Command API (v2) 2.2.11+b3afc78b77 fabric-content-registries-v0: Fabric Content Registries (v0) 4.0.7+b3afc78b77 fabric-convention-tags-v1: Fabric Convention Tags 1.5.3+b3afc78b77 fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.18+aeb40ebe77 fabric-data-generation-api-v1: Fabric Data Generation API (v1) 12.1.11+b3afc78b77 fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.51+b3afc78b77 fabric-entity-events-v1: Fabric Entity Events (v1) 1.5.21+b3afc78b77 fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.6.0+b3afc78b77 fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.38+b04edc7a77 fabric-gametest-api-v1: Fabric Game Test API (v1) 1.2.10+b3afc78b77 fabric-item-api-v1: Fabric Item API (v1) 2.1.26+b3afc78b77 fabric-item-group-api-v1: Fabric Item Group API (v1) 4.0.7+b3afc78b77 fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.36+fb8d95da77 fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.2.20+b3afc78b77 fabric-loot-api-v2: Fabric Loot API (v2) 1.1.37+b3afc78b77 fabric-message-api-v1: Fabric Message API (v1) 5.1.6+b3afc78b77 fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.47+b3afc78b77 fabric-models-v0: Fabric Models (v0) 0.3.35+b3afc78b77 fabric-networking-api-v1: Fabric Networking API (v1) 1.3.8+b3afc78b77 fabric-object-builder-api-v1: Fabric Object Builder API (v1) 11.0.6+b3afc78b77 fabric-particles-v1: Fabric Particles (v1) 1.0.28+b3afc78b77 fabric-recipe-api-v1: Fabric Recipe API (v1) 1.0.18+b3afc78b77 fabric-registry-sync-v0: Fabric Registry Sync (v0) 2.2.6+b3afc78b77 fabric-renderer-api-v1: Fabric Renderer API (v1) 3.0.1+b3afc78b77 fabric-renderer-indigo: Fabric Renderer - Indigo 1.3.1+b3afc78b77 fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.33+b3afc78b77 fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.0.26+b3afc78b77 fabric-rendering-v1: Fabric Rendering (v1) 3.0.6+b3afc78b77 fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.3.5+ea08f9d877 fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.11.7+f7923f6d77 fabric-screen-api-v1: Fabric Screen API (v1) 2.0.6+b3afc78b77 fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.27+b3afc78b77 fabric-sound-api-v1: Fabric Sound API (v1) 1.0.12+b3afc78b77 fabric-transfer-api-v1: Fabric Transfer API (v1) 3.2.2+b3afc78b77 fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 4.2.0+b3afc78b77 fabricloader: Fabric Loader 0.14.21 java: OpenJDK 64-Bit Server VM 17 jukebox_carousel: jukebox_carousel 1.0.0 minecraft: Minecraft 1.20.1 Server Running: true Player Count: 1 / 8; [ServerPlayer['Player565'/175, l='ServerLevel[New World]', x=-22.22, y=63.00, z=-42.40]] Data Packs: vanilla, fabric Enabled Feature Flags: minecraft:vanilla World Generation: Stable Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fabric'; Server brand changed to 'fabric' Launched Version: Fabric