Posted May 20, 20169 yr Hello. I have an entity that i noticed lags the server, resulting in entities semi-teleporting around, and overall server lag. After commenting out all of my entity's AI, it ran like normal. However after undoing that it lags as expected. Could this be because the class is to large? Here is my class, by the way: https://github.com/Alex-the-666/Ice_and_Fire/blob/77547cdff9fe98fe619ce48e21ef2c98ff048597/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDragonBase.java
May 20, 20169 yr Could this be because the class is to large? The "commented out" code you were talking about is EXACTLY the code that is commented out in file you linked? If yes - could you narrow it down? If no - could you please mark lines which are the ones that change game experience (lag)? Also - how many such entities are in world when lag occurs (with AI code)? Is this actually server lag (meaning - have you checked with cmd /tps ?) or maybe some rendering (I don't think so, but still). Without looking too much at code (too long really) I can guess that your entity, by using dragon's AI (I assume that is vanilla AI, because if not, you would include it, and I can't get on IDE now), is doing some bat-shit crazy processing, especially ridiculus when having shitload of dragons where they shouldn't be. (This is only guess, provide more info). 1.7.10 is no longer supported by forge, you are on your own.
May 20, 20169 yr Author I said "class too large" meaning there might have been too much logic that could be triggered by the AI, but i don't think that would fit on Subject. The currently commented out code hasn't been tested. I just mean the current code does the server lag, which is server lag, as logic is slowed down, mobs move extremely jittery, etc.
May 21, 20169 yr You should sample your mod to determine what's using so much CPU time/memory. 1. The JDK comes with the java profiler VisualVM; it's located in <jdkname>/bin, look for jvisualvm.exe or type "jvisualvm.exe" into a run window and press enter. 2. Launch your mod, then go into VisualVM and find the VM called GradleStart under local, right-click it and select Open. 3. Go into the Sampler tab, check the box labeled Settings and set the packages you wish to profile/not profile. 4. Press the CPU or Memory button to start sampling.
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.