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

So i've got these blocks that also have metadata, but y question is "How do i get these blocks to rotate like logs do when you place them?"

 

 

Reveal hidden contents

 

This goes in your block class

 

public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
{
	int rotation = MathHelper
			.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3;
	world.setBlockMetadata(i, j, k, rotation - 1);
}

you may have to toy with the world.setBlockMetaData(i,j, rotation *1*); but it might work straight off haven't tested this.

How are you storing your logs meta data for rotations

 

for example

the vanilla oak log facing straight up is meta 0

its rotated north/south is meta 4

and rotated east/west is meta 8

  • Author

 

Reveal hidden contents

 

 

here is my revised code but i have 16 blocks and have only 4 working

  On 3/12/2013 at 5:56 PM, AzureusNation123 said:

can anyone help please

 

you still haven't explained how you are working out what direction the block will be facing with the meta data.

 

are you doing the same as vanilla? meta data n = face up, n + 4 = face north/south n + 8 = face west/east?

  • Author

ive got my code its here take a look:

 

 

Reveal hidden contents

 

  On 3/12/2013 at 6:02 PM, AzureusNation123 said:

ive got my code its here take a look:

 

 

Reveal hidden contents

 

 

Please take the time to read what I said so I can help. I am NOT a mind reader, all I can see in your code is blocks with meta data just like most other blocks have

  • Author

ive add in comments to explain my code but its not the rotation any more its adding more than 4 blocks to rotate otherwise they go like in the picture a few posts above

 

and yes im using the vinilla way

 

 

Reveal hidden contents

 

  • Author

Still Unsolved all i want to know is how to add 16 blocks so they can rotate like wood blocks, i already have 4 done but it doesn't let me go over that or they go strange

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.