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

    • I deleted delightful and all farmers delight addon (just in case) and still i have the error :'(, i need to check mod by mod?
    • I'm developing a Forge mod for Minecraft 1.16.5 to run on CatServer (version 1.16.5-1d8d6313, Forge 36.2.39). My mod needs to get the player's UUID from a ServerPlayerEntity object within a Forge ServerChatEvent handler. When I use serverPlayerEntity.getUUID(), my mod compiles fine, but I get a java.lang.NoSuchMethodError: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; at runtime. I cannot use serverPlayerEntity.getUniqueID() as it causes a compile error (cannot find symbol). Is there a known issue with this on CatServer, or a recommended way for a Forge mod to reliably get a player's UUID from ServerPlayerEntity in this environment? My goal is to pass this UUID to the LuckPerms API (which is running as a Bukkit plugin and successfully connected via ServicesManager). erorr ChatMod: FMLServerStartedEvent received. Attempting to initialize LuckPerms connection... [22:45:20] [Server thread/INFO]: ⚙️ Початок ініціалізації LuckPerms API через Bukkit Services Manager... [22:45:20] [Server thread/INFO]: ✅ Bukkit ServicesManager успішно отримано. [22:45:20] [Server thread/INFO]: ✅ Реєстрацію сервісу LuckPerms знайдено. [22:45:20] [Server thread/INFO]: ✅ API LuckPerms успішно отримано від Bukkit plugin! [22:45:20] [Server thread/INFO]: Використовується реалізація: me.lucko.luckperms.common.api.LuckPermsApiProvider [22:45:20] [Server thread/INFO]: ✅ LuckPerms API схоже що успішно ініціалізовано через Bukkit Services Manager. [22:45:24] [User Authenticator #1/INFO]: UUID of player Hiklee is 92cd7721-2652-3867-896b-2ceba5b99306 [22:45:25] [Server thread/INFO]: Using new advancement loading for net.minecraft.advancements.PlayerAdvancements@24cb7a68 [22:45:26] [Server thread/INFO]: Hiklee[/127.0.0.1:41122] logged in with entity id 210 at (92.23203876864889, 95.6183020148442, 68.24087802017877) [22:45:28] [Async Chat Thread - #0/INFO]: ✅ Скасовано стандартне відправлення чату! [22:45:28] [Async Chat Thread - #0/ERROR]: Exception caught during firing event: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; Index: 1 Listeners: 0: NORMAL 1: ASM: class com.example.chatmod.ChatEventHandler onPlayerChat(Lnet/minecraftforge/event/ServerChatEvent;)V java.lang.NoSuchMethodError: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; at com.example.chatmod.ChatPacketHandler.getPlayerPrefix(ChatPacketHandler.java:46) at com.example.chatmod.ChatEventHandler.onPlayerChat(ChatEventHandler.java:32) at net.minecraftforge.eventbus.ASMEventHandler_1_ChatEventHandler_onPlayerChat_ServerChatEvent.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:303) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) at net.minecraftforge.common.ForgeHooks.onServerChatEvent(ForgeHooks.java:493) at net.minecraft.network.play.ServerPlayNetHandler.chat(ServerPlayNetHandler.java:1717) at net.minecraft.network.play.ServerPlayNetHandler.func_244548_c(ServerPlayNetHandler.java:1666) at net.minecraft.network.play.ServerPlayNetHandler.func_147354_a(ServerPlayNetHandler.java:1605) at net.minecraft.network.play.client.CChatMessagePacket.lambda$handle$0(CChatMessagePacket.java:34) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750
    • Thank you so much for your help, I'll try it as soon as I can. I have a genuine question because I'm not familiar with the matter: Can a recipe error cause something as serious as the AMD error?
    • When i try to launch my modpack, the instance crashes and this is sent to the logs: Time: 2025-05-27 23:07:18 Description: Rendering overlay Below is the full log: https://mclo.gs/jP5G2EH
    • Make a test without delightful
  • Topics

×
×
  • Create New...

Important Information

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