Posted June 17, 201213 yr hi, so i need to make minecraft wait before running code, all the methods that i have tried cause unbelievable amounts of lag, so im just wondering what other ways i have of doing it, i want something like the BC quarry building
June 17, 201213 yr http://lmgtfy.com/?q=java+threads I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 17, 201213 yr Author i still cant get one to work without Producing MASSIVE lag heres my code example public static Runnable r1 = new Runnable() { public void run() { try { while (true) { System.out.println("Hello, world!"); Thread.sleep(5); } } catch (InterruptedException iex) {} } }; public static Thread t1 = new Thread(r1); public static void creation(World world, int depth, int height, int width, int x, int y, int z, Block block){ for (int x1 = 0; x1 < depth; x1++) { for (int y1 = 0; y1 < height; y1++) { for (int z1 = 0; z1 < width; z1++) { // Floor world.setBlockWithNotify(x + x1, y, z + z1, block.blockID); t1.start(); } } } } im probably making such a noobish mistake, for which i apologise in advanced
June 18, 201213 yr try a tick counting function to will only do a task every so many ticks to reduce lag. There are 20 ticks on average in a second and a tick is every single world update. http://i577.photobucket.com/albums/ss215/bobstrong/ModBannerMed.png[/img]
June 18, 201213 yr Author Can you give me a little example of how to do that? like what class i can look at to figure it out?
June 18, 201213 yr Can you give me a little example of how to do that? like what class i can look at to figure it out? private int ticks = 0; onUpdate() { if(ticks % 20 == 0) { System.out.println("one second!"); } ticks ++; } http://calclavia.com/uploads/banner.png[/img]
June 18, 201213 yr Author so i guess that method will overwrite another method? what class is the first method in it thats true.
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.