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

I have the following problem. I want to set all the blocks from the coordinates of a specific Integer[] to id 0.

 

I'm doing this with this code:

 

for (Integer[] coord : this.coords.get(meta))
{
System.out.println((x + coord[0]) + " " + (y + coord[1]) + " " + (z + coord[2]) + " " + world.getBlockId(x + coord[0], y + coord[1], z + coord[2]));
world.setBlock((x + coord[0]), (y + coord[1]), (z + coord[2]), 0);
}

 

Th output is now

 

2013-03-23 14:47:19 [iNFO] [sTDOUT] -274 64 94 2676
2013-03-23 14:47:19 [iNFO] [sTDOUT] -275 63 94 0
2013-03-23 14:47:19 [iNFO] [sTDOUT] -275 64 94 0

 

Which means that the final two are probably already 0. But this is not the case, they are 2676 too.

Here comes the weird thing. If I do this:

 

for (Integer[] coord : this.coords.get(meta))
{
System.out.println((x + coord[0]) + " " + (y + coord[1]) + " " + (z + coord[2]) + " " + world.getBlockId(x + coord[0], y + coord[1], z + coord[2]));
}

 

it prints out this:

 

2013-03-23 14:51:38 [iNFO] [sTDOUT] -277 65 114 2676
2013-03-23 14:51:38 [iNFO] [sTDOUT] -278 64 114 2676
2013-03-23 14:51:38 [iNFO] [sTDOUT] -278 65 114 2676

 

Which means that the id is indeed 2676. Now what have I done wrong? When I run the code, the blocks are still there, except the one that was called first.

mca.png
  • Author

I did some testing, and i seems that with 3 different block IDs, it doesn't give the bug. This is weird...

mca.png

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.