Jump to content

Recommended Posts

Posted (edited)

Hello! I made a custom dimension and i got strange problem. Whenever I add any structure to generate in my dimension minecraft gets strange server lags. I tried everything. Changing way of registering biome,dimension, moving custom structure from custom biome decorator to Generator Handler that implements IWorldGenerator and then registering it in main class. Nothing helped. These server lags lasts for about 1-2 minutes, and then everything is just fine. During the lag, I cannot break blocks, entites are lagged, etc. When I do not generate the structure, my dimension isn't laggy. My dimension is multi biome and the bug occurs no matter which forge version I use. I am working on minecraft 1.12. I can post the whole code on github if someone knows what can cause these lags. What can be wrong?

 

Generators are copied from vanilla (changed only blocks).

 

  Reveal hidden contents

 

  Reveal hidden contents

 

Edited by Krevik
Solved
Posted
  On 3/24/2018 at 3:28 PM, jabelar said:

You might be causing "cascading" during generation. This is where during the generation of a chunk you place a block (or call a function such as looking at neighbor blocks) that causes adjacent chunks to have to load and generate.  Learn more about it here: 

 

 

 

Expand  

I actually knew about this. Lags occure even if there's no word about cascading in console

Posted

Well, when it is lagging there is something happening that is taking the computer's processing time. There are really three common categories of lag that modders can create:

1) cascading as discussed

2) inefficient loops. Like if you're searching an area for something over and over again.

3) improper use of wait loops or other code that halts continued execution of the thread.

 

Are you making custom trees? What is your full code for generation?

 

Anyway, you just need to observe what is taking the time. You can do this by either setting breakpoints and using debug mode in Eclipse to figure out what is executing or you can add judicious console or logger print statements to trace the execution. By looking at the timestamps you can figure out what is taking the time and narrow it down. Like if you put a print statement at the beginning and end of your methods you can see how long each is taking, or maybe see that they are being called much more times than you expect.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
  On 3/24/2018 at 4:27 PM, jabelar said:

Well, when it is lagging there is something happening that is taking the computer's processing time. There are really three common categories of lag that modders can create:

1) cascading as discussed

2) inefficient loops. Like if you're searching an area for something over and over again.

3) improper use of wait loops or other code that halts continued execution of the thread.

 

Are you making custom trees? What is your full code for generation?

 

Anyway, you just need to observe what is taking the time. You can do this by either setting breakpoints and using debug mode in Eclipse to figure out what is executing or you can add judicious console or logger print statements to trace the execution. By looking at the timestamps you can figure out what is taking the time and narrow it down. Like if you put a print statement at the beginning and end of your methods you can see how long each is taking, or maybe see that they are being called much more times than you expect.

Expand  

Added code. Actually the problem is I tried a lot of structures e.g. some small constant structures like mushroom from blocks, and any of them cause these lags, even if (as I said) there is no word about cascading in console. Yea I am making custom trees but disabling them from generation doesn't help :/ Thanks will be trying with these print statements.

Posted (edited)

Do any of your blocks contain TileEntities?
Do any of your blocks do anything when placed?

 

and as Jabelar stated, you should try to see where everything is bottle-necking by comparing the before & after time of your methods/loops' executions.

 

Oh, and use bit-shifting instead of multiplying/dividing by 16.
By habit you'll likely (in the future) divide by 16 to get chunk-coordinate from a block coordinate. This will be incorrect for negative values, due to how integers are rounded down (-15/16 = -0.9375).

chunkX << 4 = blockX, blockX >> 4 = chunkX

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted
  On 3/25/2018 at 4:25 AM, Matryoshika said:

Do any of your blocks contain TileEntities?
Do any of your blocks do anything when placed?

 

and as Jabelar stated, you should try to see where everything is bottle-necking by comparing the before & after time of your methods/loops' executions.

 

Oh, and use bit-shifting instead of multiplying/dividing by 16.
By habit you'll likely (in the future) divide by 16 to get chunk-coordinate from a block coordinate. This will be incorrect for negative values, due to how integers are rounded down (-15/16 = 0.9375).

chunkX << 4 = blockX, blockX >> 4 = chunkX

Expand  

Yes some of my blocks do something and they"re "ticking" but even if they"re disabled from generation lags occure. Also these blocks start ticking after these lags end. Yes I have some tileEntities but they"re not generated, they"re available only from crafting table. Thanks will remember about shifting! :D

Posted (edited)

Checked with these print Statements and it seems that structures are not causing these lags. Every structure is generated very fast and finished also. Lags occure even if no structure is actually being generated.  So It seems that generators are correct, but there's problem with something "higher".

Edited by Krevik
Forgot about sth
Posted (edited)

Found a solution. I was just using setBlockState method instead of 

setBlockAndNotifyAdequately

Even if no generate method was called there were lags (Idk why) but now the lags are gone

Edited by Krevik
forgot about State

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

    • Ignore shrimple, it doesn't work with Oculus. Also, enableShaders was alr true when it said that towards the end of the log. If you could also figure out why my tags are messed up that'd be cool too, but that's a later issue. https://drive.google.com/drive/folders/1ovEKDZECUCl7zZxGfpyQcS4s5PZPQyfa?usp=drive_link
    • accidental duplicate mesage cuz lag
    • https://gnomebot.dev/paste/231527759279685634/1372324909073563730/1372324908629102716 https://gnomebot.dev/paste/231527759279685634/1372320454861262908/1372320454299090996 seems like theres a registry sync error, not sure what that means though, however in an old pack i played on, i actually had a registry sync error happen whenever the world tried too save and it would suddenly stop loading chunks, is there a mod fix for this or some way too bypass registry syncing? is this a server problem? i have no issues with the pack on pc, only on my server.
    • i think the problem is the player animator library but i need it for one of my main mods is there any way i can fix this? The game crashed: rendering overlay Error: java.lang.IllegalArgumentException: Failed to create player model for default heres the crash report: https://pastebin.com/U5Wp8ysb
    • I have been an enthusiastic investor in crypt0currencies for several years, and my digital assets have been integral to my financial strategy. A few months ago, I encountered a distressing predicament when I lost access to my primary cryptocurrency walleet after clicking on an airdrop link that inadvertently connected to my walleet. The dread of potentially losing all my hard-earned funds was overwhelming, leaving me uncertain about where to seek assistance. In my pursuit of solutions, I stumbled upon ChainDigger Retrievers. From our initial consultation to the triumphant recovery of my assets, the team exhibited exceptional expertise. They provided comprehensive explanations of the recovery process, ensuring I was informed at every stage and offering reassurance during this tumultuous time. Their approach was not only meticulous but also compassionate, which significantly alleviated my anxiety. ChainDigger Retrievers unwavering commitment to resolving my issue was evident throughout the process. Leveraging their profound understanding of crypt0currency technology and digital forensics, they initiated an exhaustive investigation to trace the transactions linked to my compromised wallet. Their meticulous analysis and relentless determination were apparent as they left no stone unturned in their quest to recover my funds. After several days of diligent investigation, the team successfully recovered everything I had lost. They uncovered that the link I had clicked contained malware, which scammeers had used to infiltrate my walleet. This revelation was both alarming and enlightening, underscoring the inherent risks associated with crypt0currency transactions when proper precautions are not taken.Thanks to ChainDigger Retrievers, I not only regained everything but also acquired invaluable knowledge about safeguarding my investments. Their expertise and steadfast support transformed a daunting situation into a manageable one, and I am profoundly grateful for their assistance. I can now continue my investment journey with renewed confidence, knowing that I have a trustworthy ally in ChainDigger Retrievers. Their client satisfaction is truly commendable, and I wholeheartedly recommend their services to anyone facing similar challenges in the crypt0currency realm. With their help, I was able to turn a distressing time into a positive outcome, and I will forever be grateful for their support.  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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