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.

[1.7.10] How to have the front texture of a block face player when placed

Featured Replies

Posted

Hello, I was wondering how do I get the front texture of a multi-textured block to face the player when the block is placed, similar to when a furnace is placed. Any help would be awesome.

The chest uses ForgeDirection some how, but I have no idea how (I've never done anything like this). Try to look at the vanilla code.

  • Author

@RYxINATORx314 I'll try that, but where do I find the furnace or oak tree classes? Sorry for asking, I haven't made a mod since 1.4.6 or 1.4.7..  :-\ Nvm, I got it..

 

@Awesome_Spider Thanks, I'll play around with ForgeDirection and see if I can get something working(or broken)

Hi

 

For clues look at BlockFurnace.onBlockPlacedBy.  It uses metadata to specify the four directions the furnace can face.

For more background information, see the Block topics on this link:

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

 

  public void onBlockPlacedBy(World world, int wx, int wy, int wz, EntityLivingBase entityLivingBase, ItemStack itemStack)
  {
    int l = MathHelper.floor_double((double) (entityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; // which compass point is the player facing?

    if (l == 0)
    {
      world.setBlockMetadataWithNotify(wx, wy, wz, 2, 2);
    }

    if (l == 1)
    {
      world.setBlockMetadataWithNotify(wx, wy, wz, 5, 2);
    }

    if (l == 2)
    {
      world.setBlockMetadataWithNotify(wx, wy, wz, 3, 2);
    }

    if (l == 3)
    {
      world.setBlockMetadataWithNotify(wx, wy, wz, 4, 2);
    }

    if (itemStack.hasDisplayName())
    {
      ((TileEntityFurnace)world.getTileEntity(wx, wy, wz)).func_145951_a(itemStack.getDisplayName());
    }
  }

 

-TGG

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.