Jump to content

Recommended Posts

Posted

IntCache is used in GenLayer and its subclasses to cache int arrays. It's reseted in the front of biome-related methods such as getBiomesForGeneration or getBiomeGenAt. Now here comes a problem:

 

GenLayer.getInt is called in both CLIENT and SERVER sides. It's ok using a dedicated server. However, in intergrated server, CLIENT and SERVER sides are in two thread. So they may call a biome method at same time. That means, IntCache might be reseted in CLIENT thread while SERVER thread is using it! If unlucky, game crashes.

 

I suffered from the crash for a long time but coundn't find the reason. I got it just now as I put a printing current thread statement in my GenLayer.getInts method. I found out that it was called in both CLIENT and SERVER threads. I realized what was responsible for these crashes. Now I put one crash report fragment here:

 

---- Minecraft Crash Report ----
// Oops.

Time: 15-4-4 10:05 PM
Description: Getting biome

java.lang.ArrayIndexOutOfBoundsException: 114
at me.herbix.taoland.world.gen.layer.GenLayerByProperty.getInts(GenLayerByProperty.java:65)
at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25)
at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25)
at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25)
at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25)
at net.minecraft.world.gen.layer.GenLayerSmooth.getInts(GenLayerSmooth.java:23)
at me.herbix.taoland.world.gen.layer.GenLayerRiverMix.getInts(GenLayerRiverMix.java:18)
at net.minecraft.world.gen.layer.GenLayerVoronoiZoom.getInts(GenLayerVoronoiZoom.java:25)
at net.minecraft.world.biome.WorldChunkManager.getBiomeGenAt(WorldChunkManager.java:199)
at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:106)
at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:37)
at net.minecraft.world.biome.BiomeCache.func_180284_a(BiomeCache.java:48)
at net.minecraft.world.biome.WorldChunkManager.func_180300_a(WorldChunkManager.java:75)
at net.minecraft.world.chunk.Chunk.getBiome(Chunk.java:1442)
at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:196)
at net.minecraft.world.WorldProvider.getBiomeGenForCoords(WorldProvider.java:429)
at net.minecraft.world.World.getBiomeGenForCoords(World.java:185)
at net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(ForgeHooksClient.java:388)
at net.minecraft.world.World.getSkyColorBody(World.java:1524)
at net.minecraft.world.WorldProvider.getSkyColor(WorldProvider.java:463)
at net.minecraft.world.World.getSkyColor(World.java:1511)
at net.minecraft.client.renderer.EntityRenderer.updateFogColor(EntityRenderer.java:1757)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1277)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107)
at net.minecraft.client.Minecraft.run(Minecraft.java:376)
at net.minecraft.client.main.Main.main(Main.java:117)
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:483)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)

 

Hmm.. IntCache shall not be access from CLIENT thread I thought, because generating biomes is a SERVER function. There must be some better way to implement ForgeHooksClient.getSkyBlendColour I suppose.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Posted

Oops. I found out that vanilla EntityRenderer.addRainParticles uses World.getBiomeGenForCoords as well.

But I still doubt whether this would cause crash.

 

Edit: More and more CLIENT side uses found. That's not a mistake of ForgeHooksClient.getSkyBlendColour.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Posted

Actually everything (even other mods) that get the biome for specific coords uses that method.

It seems like one of those examples where Mojang didn't see the necessity (probably unintentional) to make it safe for multithreading...

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

It seems like one of those examples where Mojang didn't see the necessity (probably unintentional) to make it safe for multithreading...

 

The strangest thing is that I didn't feel a vanilla crash caused by getInts. It only happens to my mod. I'm sure it's a multithreading problem, but not sure why crash occurs only in my mod.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

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

    • Hi, i'm really having problems trying to set the texture to my custom item. I thought i'm doing everything correctly, but all i see is the missing texture block for my item. I am trying this for over a week now and getting really frustrated. The only time i could make the texture work, was when i used an older Forge version (52.0.1) for Minecraft (1.21.4). Was there a fundamental change for textures and models somewhere between versions that i'm missing? I started with Forge 54.1.0 and had this problem, so in my frustration i tried many things: Upgrading to Forge 54.1.1, created multiple new projects, workspaces, redownloaded everything and setting things up multiple times, as it was suggested in an older thread. Therea are no errors in the console logs, but maybe i'm blind, so i pasted the console logs to pastebin anyway: https://pastebin.com/zAM8RiUN The only time i see an error is when i change the models JSON file to an incorrect JSON which makes sense and that suggests to me it is actually reading the JSON file.   I set the github repository to public, i would be so thankful if anyone could take a look and tell me what i did wrong: https://github.com/xLorkin/teleport_pug_forge   As a note: i'm pretty new to modding, this is my first mod ever. But i'm used to programming. I had some up and downs, but through reading the documentation, using google and experimenting, i could solve all other problems. I only started modding for Minecraft because my son is such a big fan and wanted this mod.
    • Please read the FAQ (link in orange bar at top of page), and post logs as described there.
    • Hello fellow Minecrafters! I recently returned to Minecraft and realized I needed a wiki that displays basic information easily and had great user navigation. That’s why I decided to build: MinecraftSearch — a site by a Minecraft fan, for Minecraft fans. Key Features So Far Straight-to-the-Point Info: No extra fluff; just the essentials on items, mobs, recipes, loot and more. Clean & Intuitive Layout: Easy navigation so you spend less time scrolling and more time playing. Optimized Search: Search for anything—items, mobs, blocks—and get results instantly. What I’m Thinking of Adding More data/information: Catch chances for fishing rod, traveling villager trades, biomes info and a lot more. The website is still under development and need a lot more data added. Community Contributions: Potential for user-uploaded tips for items/mobs/blocks in the future. Feature Requests Welcome: Your ideas could shape how the wiki evolves! You can see my roadmap at the About page https://minecraftsearch.com/about I’d love for you to check out MinecraftSearch and see if it helps you find the info you need faster. Feedback is crucial—I want to develop this further based on what the community needs most, so please let me know what you think. Thanks, and happy crafting!
    • Instructions on how to install newer Java can be found in the FAQ
    • That's just plain wrong... newer versions are much better optimised and start a lot faster than 1.8.9, both Forge and Minecraft itself. Comparing Fabric 1.21 with Forge 1.8 is like comparing apples and oranges... one's brand new and the other's over a decade old.
  • Topics

×
×
  • Create New...

Important Information

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