Posted June 16, 201312 yr At first I was thinking that's maybe beacuse Server is running in the background, or maybe it's just bug, but now it started to bother me. I am using this code: @Override public void onBlockDestroyedByPlayer(World par1World, int x, int y, int z, int m) { Random generator = new Random(); int X = generator.nextInt(10000) + 1; System.out.println(X); } It gives me 2x random numbers every time I destroy block - WHY?! And will it cause problems on MP? Note that no matter if I use Random or not, all the System.out will run twice. 1.7.10 is no longer supported by forge, you are on your own.
June 16, 201312 yr Yes it's because of the server and client threads. If you only want it called on one side use an if statement, with world.isRemote which returns true on the client and false on the server. This shouldn't cause a problem, normally you want to do things on both, but sometimes you will only want t do it on the server, and very very rarely you may want to do something only on the client (although i'm not sure why) github
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.