Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] My TileEntities are not being registered properly & ConcurrentModification Exception


Cerandior
 Share

Recommended Posts

Their registry name is null. Considering the registry event is being called (I checked at the debugger), I am guessing I am doing the linking between the TileEntityType and the TileEntity wrong. I followed the docs tutorial on how to create tile entities but surely I must have messed up something.

 

The related classes:

Main Class:
https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/main/VanillaExtended.java
 

BlockList Class:

https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/blocks/BlockList.java

TileEntity Class (I am providing only one of them, same error with both):

https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/tileentities/CSTile.java

Edited by Cerandior
Link to comment
Share on other sites

You never assign the objects in your BlocksList class to anything.

 

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

14 hours ago, Draco18s said:

You never assign the objects in your BlocksList class to anything.

 

Sorry about that, I fixed it now.
However I am getting a concurrent modification exception right now (unrelated to the original problem, I thought it was at first). I don't think I am removing or adding anything to the list while iterating through it, I am modifying some of its elements however. Can I not do this?

 

Spoiler

---- Minecraft Crash Report ----
// Oh - I know what I did wrong!

Time: 2/9/20 11:58 AM
Description: Unexpected error

java.util.ConcurrentModificationException: null
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) ~[?:1.8.0_181] {}
    at java.util.ArrayList$Itr.next(ArrayList.java:859) ~[?:1.8.0_181] {}
    at teabx.vanillaextended.tileentities.TPTile.updateStorageBlock(TPTile.java:27) ~[classes/:?] {re:classloading}
    at teabx.vanillaextended.blocks.CollectiveStorage.onBlockPlacedBy(CollectiveStorage.java:38) ~[classes/:?] {re:classloading}
    at net.minecraft.item.BlockItem.tryPlace(BlockItem.java:69) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
    at net.minecraft.item.BlockItem.onItemUse(BlockItem.java:42) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
    at net.minecraft.item.ItemStack.lambda$onItemUse$0(ItemStack.java:169) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:184) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:169) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
    at net.minecraft.client.multiplayer.PlayerController.func_217292_a(PlayerController.java:310) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1286) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:1544) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1377) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:904) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:384) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:128) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181] {}
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-4.1.0.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-4.1.0.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-4.1.0.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-4.1.0.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-4.1.0.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}


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

-- Head --
Thread: Client thread
Stacktrace:
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
    at java.util.ArrayList$Itr.next(ArrayList.java:859)
    at teabx.vanillaextended.tileentities.TPTile.updateStorageBlock(TPTile.java:27)
    at teabx.vanillaextended.blocks.CollectiveStorage.onBlockPlacedBy(CollectiveStorage.java:38)
    at net.minecraft.item.BlockItem.tryPlace(BlockItem.java:69)
    at net.minecraft.item.BlockItem.onItemUse(BlockItem.java:42)
    at net.minecraft.item.ItemStack.lambda$onItemUse$0(ItemStack.java:169)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:184)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:169)
    at net.minecraft.client.multiplayer.PlayerController.func_217292_a(PlayerController.java:310)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1286)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:1544)

-- Affected level --
Details:
    All players: 1 total; [ClientPlayerEntity['Dev'/149, l='MpServer', x=-4.39, y=72.79, z=348.25]]
    Chunk stats: Client Chunk Cache: 289, 139
    Level dimension: DimensionType{minecraft:overworld}
    Level name: MpServer
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: {}
    Level spawn location: World: (96,64,217), Chunk: (at 0,4,9 in 6,13; contains blocks 96,0,208 to 111,255,223), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 5841 game time, 5841 day time
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Server brand: forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.world.ClientWorld.fillCrashReport(ClientWorld.java:425)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:1824)
    at net.minecraft.client.Minecraft.run(Minecraft.java:405)
    at net.minecraft.client.main.Main.main(Main.java:128)
    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:498)
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)

-- System Details --
Details:
    Minecraft Version: 1.14.4
    Minecraft Version ID: 1.14.4
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_181, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 286427984 bytes (273 MB) / 1045430272 bytes (997 MB) up to 1778384896 bytes (1696 MB)
    CPUs: 4
    JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
    ModLauncher: 4.1.0+62+5bfa59b
    ModLauncher launch target: fmluserdevclient
    ModLauncher naming: mcp
    ModLauncher services: 
        /eventbus-1.0.0-service.jar eventbus PLUGINSERVICE 
        /forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE 
        /forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE 
        /accesstransformers-1.0.1-milestone.0.1+94458e7-shadowed.jar accesstransformer PLUGINSERVICE 
        /forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE 
        /forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE 
        /forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE 
    FML: 28.1
    Forge: net.minecraftforge:28.1.96
    FML Language Providers: 
        javafml@28.1
        minecraft@1
    Mod List: 
        client-extra.jar Minecraft {minecraft@1.14.4 DONE}
        main Vanilla Extended {vanillaextended@NONE DONE}
        forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar Forge {forge@28.1.96 DONE}
    Launched Version: MOD_DEV
    LWJGL: 3.2.2 build 10
    OpenGL: AMD Radeon HD 7560D GL version 4.5.13399 Compatibility Profile Context 15.201.1151.1008, ATI Technologies Inc.
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    CPU: 4x AMD A8-5600K APU with Radeon(tm) HD Graphics 

 

Block Class:
https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/blocks/CollectiveStorage.java

 

Tile Class:
https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/tileentities/TPTile.java

Edited by Cerandior
Link to comment
Share on other sites

The problem is you execute the updateStorageBlock method recursively, which leads to the execution of the update method and there you add a new tile entity to your list you currently iterating over. This leads to the thrown ConcurrentModificationException because it's not allowed to modifie a list you currently iterating over. A simple fix would be copy the content of the list in a new list and iterate over this copy instead of the original one. But this fix only works if you not need the newly added tile entities.

  • Thanks 1
Link to comment
Share on other sites

52 minutes ago, korti11 said:

The problem is you execute the updateStorageBlock method recursively, which leads to the execution of the update method and there you add a new tile entity to your list you currently iterating over. This leads to the thrown ConcurrentModificationException because it's not allowed to modifie a list you currently iterating over. A simple fix would be copy the content of the list in a new list and iterate over this copy instead of the original one. But this fix only works if you not need the newly added tile entities.

That was the idea. Every time I right-clicked the master block (which is the CSTile), it would go through each of the connected parts and re-update the StorageBlock (An object that I am using to keep track of chests and storage block parts, such as CSTile and TPTile that are connected to this multi-block). I still don't think I am actually updating the original list. I am updating the list of an object that is stored in the original list. Does that still throw the Exception?

I am following another route now, if that works I'll post here the updated code in case someone else has a similar issue in the future.

Link to comment
Share on other sites

Alright, fixed it. You can find the updated classes below:

The Block Class:
https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/blocks/CollectiveStorage.java

The Tile Class:
https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/tileentities/TPTile.java

 

The StorageBlock Class:
https://github.com/Cerandior/VanillaExtended/blob/master/src/main/java/teabx/vanillaextended/blocks/StorageBlock.java

 

Ignore the printlns, I was checking a couple of things, didn't have time to cleanup right now.
Also the update() method at the StorageBlock is kind of stupid I know. I was having a problem with duplicates, and that's my fault for using an ArrayList. I should have used a HashSet since the beginning, since I don't really care about the order of the list elements. (You can use LinkedHashSet if you do care about that).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • net.minecraft.ResourceLocationException: Non [a-z0-9/._-] character in path of location: minecraft:textures/models/armor/gold_layer_١.png     at net.minecraft.resources.ResourceLocation.<init>(ResourceLocation.java:37) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading}     at net.minecraft.resources.ResourceLocation.<init>(ResourceLocation.java:42) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading}     at net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer.getArmorResource(HumanoidArmorLayer.java:146) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer.m_117118_(HumanoidArmorLayer.java:60) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer.m_6494_(HumanoidArmorLayer.java:36) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer.m_6494_(HumanoidArmorLayer.java:23) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.entity.LivingEntityRenderer.m_7392_(LivingEntityRenderer.java:126) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.entity.MobRenderer.m_7392_(SourceFile:45) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading}     at net.minecraft.client.renderer.entity.MobRenderer.m_7392_(SourceFile:18) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading}     at net.minecraft.client.renderer.entity.EntityRenderDispatcher.m_114384_(EntityRenderDispatcher.java:129) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.LevelRenderer.m_109517_(LevelRenderer.java:1280) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.LevelRenderer.m_109599_(LevelRenderer.java:1076) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.GameRenderer.m_109089_(GameRenderer.java:1050) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:830) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1039) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:659) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:186) ~[client-1.17.1-20210706.113038-srg.jar%2353!:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.17.1-37.0.126.jar%2322!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}   (This the crash report(
    • Also you should consider reading the README.txt file (there it explains how to set up the workspace and what to do on specific errors)
    • First you need to run "gradlew genEclipseRuns" / "gradlew genIntellijRuns" and then "gradlew eclipse" / "gradlew intellij". There isn't a setupdecompworkspace any more
    • Now I'm getting another error: C:\Users\<MyUserName> \Desktop\CLEAN_Phobos_1.9.0-BUILDABLE-SRC-main>gradlew setupdecompworkspace Starting a Gradle Daemon (subsequent builds will be faster) FAILURE: Build failed with an exception. * What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.9/userguide/gradle_daemon.html Please read the following process output to find out more: ----------------------- FAILURE: Build failed with an exception. * What went wrong: java.lang.ExceptionInInitializerError (no error message) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org
    • Thanks, everything seems to be working great now.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.