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

http://pastebin.com/jB1xJe1W is the code in question.

 

What I want to happen, is depending on the blocks rotation, it should place extra "gag blocks" to fill out some gaps. And, for meta 0, this works brilliantly:

51e7dfc78127d.jpg

 

However, when I try and place in another direction, I want the blocks to obviously be placed in the correct direction again. But, the extra blocks always go to the same place, like so:

51e7dff76a729.jpg

 

Probably some sort of really simple mistake, but can anyone point me in the right direction? Sorry for posting something so trivial, but noone on IRC could help :P

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

It appears to me that you are checking the block metadata as soon as it is placed, then setting the rotation from the players look vector. As the metadata is 0 when you place it, and you use the metadata from when it is placed, this will always be 0.

 

try this instead:

    @Override
    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemStack) {
        int meta = world.getBlockMetadata(x, y, z);
            int blockSet = meta / 4;
            int direction = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
            int newMeta = (blockSet * 4) + direction;
            world.setBlockMetadataWithNotify(x, y, z, newMeta, 0);
            if (newMeta == 0) {
                world.setBlock(x + 1, y, z, Roads.blockGag1.blockID);
                world.setBlock(x + 2, y, z, Roads.blockGag2.blockID);
                world.setBlock(x + 3, y, z, Roads.blockGag3.blockID);
        } else if (newMeta == 1) {
                world.setBlock(x - 1, y, z, Roads.blockGag1.blockID);
                world.setBlock(x - 2, y, z, Roads.blockGag2.blockID);
                world.setBlock(x - 3, y, z, Roads.blockGag3.blockID);
            } else if (newMeta == 2) {
                world.setBlock(x, y, z + 1, Roads.blockGag1.blockID);
                world.setBlock(x, y, z + 2, Roads.blockGag2.blockID);
                world.setBlock(x, y, z + 3, Roads.blockGag3.blockID);
            } else if (newMeta == 3) {
                world.setBlock(x, y, z - 1, Roads.blockGag1.blockID);
                world.setBlock(x, y, z - 2, Roads.blockGag2.blockID);
                world.setBlock(x, y, z - 3, Roads.blockGag3.blockID);
            }
    }

 

no promise but worth a shot.

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.