Fochis Posted September 1, 2012 Share Posted September 1, 2012 Hi. I don't speak english and it's very hard for me explain my problem properly, sorry. I have a problem with this code: public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { if(!(par1World.isRemote)) { if(hayLava(par1World,par2,par3,par4)) //Determine if lava touch my block { par1World.setBlockWithNotify(par2, par3, par4, Nemod.reforzado2.blockID); } } } In game, the block never change to "Nemod.reforzado2.blockId". If I remove the "if(!par1World.isRemote)" line, the block appears to change, but not properly. If I look the block in McEdit, the block has the old ID, but in game showme the new block There seems to be two worlds in the same game, the server world and the client world, but why i can change any block in the "server world"? I tried multiple ways to do it, but I not found any solution. Can you help me? Tell me if you need more information or screenshots. Thank's in advance and sorry for my bad english. Quote Link to comment Share on other sites More sharing options...
Fochis Posted September 2, 2012 Author Share Posted September 2, 2012 I've been reading SMP Coding Guidelines and I found what's the problem: Blocks setting/breaking No. You do not have to change anything to have a Block-changing mod work on server, you do not have to think about distinguishing client/server, the clientside "Block ID at World XYZ" is synchronized every couple seconds, and a clientside World.setBlock wont do anything on a server. ( It will only make your client already presume the new Block, which means you will have no glitch until the server sends you the new data ) I imagine that the change in the block have to do on the server side, but I do not know how to do this. My mod is a very simple mod that works only in single player but with the changes in the 1.3.2 version, single and multiplayer modes seems to be the same. My block work's as the grass block, but I don't find the way to do it. Quote Link to comment Share on other sites More sharing options...
Fochis Posted September 2, 2012 Author Share Posted September 2, 2012 My mistake :-[ The problem was the "randomDisplayTick" method. I've changed by "onNeighborBlockChange" and works properly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.