Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

  • Author

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.

  • Author

My mistake  :-[ :-[

 

The problem was  the "randomDisplayTick" method. I've changed by "onNeighborBlockChange" and works properly

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.