Jump to content

[1.8] Blockstate for object placed on any surface/side


zerofall

Recommended Posts

Have you tried looking at

BlockLever

? It uses its own enum to describe the possible facings and sets the facing from

Block#onBlockPlaced

when it's placed.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

You will need a way to rotate your block model.  Probably the easiest way is via the forge extensions to blockstate files.

 

However you do it, you'll then need to override your block's onBlockPlaced method and check the axis to return the appropriate block state.  It will need to have code that does something like this:

 

		switch (facing.getAxis()) {
		case X:
			return blockX.getStateFromMeta(meta);

		case Y:
			return blockY.getStateFromMeta(meta);

		case Z:
			return blockZ.getStateFromMeta(meta);

Link to comment
Share on other sites

Ya, but vanilla classes don't use the optimized JSON stuff that forge has set up right?

 

No, but you can use the vanilla lever's blockstates file as an example, just split the model and the rotation: define the model as either a default (single model) or based on the appropriate property (multiple models like the lever) and then define the rotation based on the

facing

property.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.