Jump to content

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


Recommended Posts

Posted (edited)

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
Posted

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.

Posted (edited)
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: 
        [email protected]
        minecraft@1
    Mod List: 
        client-extra.jar Minecraft {[email protected] DONE}
        main Vanilla Extended {vanillaextended@NONE DONE}
        forge-1.14.4-28.1.96_mapped_snapshot_20190719-1.14.3-recomp.jar Forge {[email protected] 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
Posted

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
Posted
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.

Posted

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).

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Also check the worldsave / serverconfig folder If there is no such file, make a test without this mod  
    • Hi, I've been having trouble trying to use forge as it shows a black screen when I open the game, but I can still interact with it and hear the music.  I've done all of the step by steps and most common fixes like updating drivers, keeping up to date with Java, deleting and reinstalling minecraft, restarting my computer MANY times, even smaller things like splash.properties (I didn't have that file so I added it and set it to false thinking it would do something, definitely not) and making sure to prioritize my rtx 3070 in the settings but with no luck. Minecraft works as intended when I uninstall forge and I also don't have any mods currently, it just gives me this issue when I install forge. I also increased the ram usage, made sure my hardware isn't full or anything, and even changed the resolution in hopes it would fix things. I checked my antivirus and firewall but that isn't the issue either. Trust me, I've done everything I can think of. For some reason the black screen does flicker a little into the main menu, but obviously unplayable. I couldn't even make my way to the settings with how little it flickered. I'm not sure if it flickered randomly or if it was because I was messing around moving and clicking a bunch, I didn't really test it that much.  
    • I've had a really weird issue recently,  I wanted to add the Depper and Darker mod on my dedicated server (MC 1.21 with Fabric 0.16.9, hosted on nitroserv.com) but whenever I do add the mod the sever stops doing anything after listing the mods, and I get no crash or error or anything, just a stuck server. Here's a normal log of the server booting up: https://pastebin.com/JipFF2Eh and here's the log of the server doing the weird thing: https://pastebin.com/W4JBh3eX I just don't understand it. I've tried removing other mods (somewhat randomly) but deeper and darker still breaks my server whenever I add it. NitroServ support staff is about as confused as I am and I've had no response from the Deeper and Darker support staff... Now I know this is the Forge support not the Fabric support but I'm just trying to know if anyone has any kind of idea to fix this (aside from not using the mod obviously) Also I still have a bunch of errors and warnings whenever the server does start properly, are there any of them I should be worried about?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.