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

Hey guys,

 

I'm having a problem with

for(int x = firstCorner[0]; x <= secondCorner[0]; x++){

            for(int y = firstCorner[1]; y <= secondCorner[1]; y++) {

                for(int z = firstCorner[2]; z <= secondCorner[2]; z++) {

                    //world.setBlock(x, y, z, blockID);

                    //world.setBlockWithNotify(x, y, z, blockID);

                    //world.setBlockAndMetadataWithNotify(x, y, z, blockID, 0);

                    world.setBlock(x, y, z, blockID)

                }

            }

}

 

It works just fine, but when ever the block gets updated like from water or placing a block above it, the block disappears.

It's just the same with the other methods which are commented out.

 

Does anyone have a idea where the problem is?

Sorry for my bad english...

you might want to make sure that this code is being run on the server side, because if it is running on the client side it will be a client only block, which is probably why it is disappearing when it gets updated

  • Author

Thanks for the answer!

 

But actually I have no clue how to do it. I have an item where I get two corners and then I wanna call the method above where i get the worldObj from EntityPlayer. Do I need an Entity or PacketHandling to send it to the server or what?

Sorry for my bad english...

You could either use packets, or in some cases you could make the calling code run server side when possible, but that is not always possible

Thanks for the answer!

 

But actually I have no clue how to do it. I have an item where I get two corners and then I wanna call the method above where i get the worldObj from EntityPlayer. Do I need an Entity or PacketHandling to send it to the server or what?

 

First rule of minecraft multiplayer modding: When in doubt, add an if(!world.isRemote) [And if you don't know what that means, I suggest you find the isRemote field in World.class]. 

 

Most methods in Block.class and Item.class get called both clientside and serverside, so packets shouldn't be necessary depending on how you arrived at the posted code, but beware of Item.class's onItemUseFirst method -- when it returns true clientside, it never gets called serverside.  I know how badly that tripped me up.

 

I also suggest you read the Forge Wiki's page on SMP coding guidelines -- its helpful, if somewhat terse.

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.