Jump to content

[Solved] world.setBlockWithNotify() problem


Recommended Posts

Posted

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  :o 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.

Posted

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.

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



×
×
  • Create New...

Important Information

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