Jump to content

Block disappears after block update


Panderoli

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.