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.12.2 How to make a block face a certain direction based on how you place it

Featured Replies

Posted

Hello, I have been searching everywhere for info on how to do this, I've tried several things similar to this in my blocks blockstate json

 
 
 
Spoiler

{
    "variants": {
        "facing=north": { "model": "modid:model" },
        "facing=south": { "model": "modid:model", "y": 180 },
        "facing=west":  { "model": "modid:model", "y": 270 },
        "facing=east":  { "model": "modid:model", "y": 90 }
    }
}

 

Several posts have suggested looking at the Minecraft source code but I really have only had one idea on how to do that, it being that "It's a library in eclipse". I've tried my best looking for it but can't find it.

Another thing I've tried is adding this override to my block's code:

 
 
 
Spoiler

	@Override
	public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
			float hitZ, int meta, EntityLivingBase placer, EnumHand hand) 
	{
		return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, placer.getHorizontalFacing());
	}

 

But could not get FACING to work. I later found this when trying to fix the facing issue:

 
 
 
Spoiler

protected BlockState createBlockState()
{
	return new BlockState(this, new IProperty[]{FACING});
}

 

But none of this has worked, so I've come here to ask for help.

1 hour ago, 8-Bit KitKat said:

Several posts have suggested looking at the Minecraft source code but I really have only had one idea on how to do that, it being that "It's a library in eclipse". I've tried my best looking for it but can't find it.

Controlling how blocks face are configured in blockstates and model [JSON] files,

In the Eclipse "Package Explorer" view, look for Referenced Libraries -> Forge Src 1.12 ... -> assets.minecraft.blockstates --> 'birch_log.json' for an Example (Birch Logs)

The models listed can be found in assets.minecraft.models.block

 

The base Class for logs is in net.minecraft.block.BlockLog . which you can probably use natively or extend to get the effect you are after.

 

Basic concepts are covered here: https://mcforge.readthedocs.io/en/latest/blocks/states/ 

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.