How to assign "multipart" to a mod block?

Started by Ultimate Immersion on

Topic category: Help with modding (Java Edition)

Last seen on 14:56, 15. Jun 2023
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to assign "multipart" to a mod block?
Fri, 10/29/2021 - 14:32 (edited)

I've been trying to get this answer for so long now and no one seems to know how to help me out, which is really frustrating for something that's a common thing in vanilla Minecraft alone. I'd like to make a mod block that has a multipart blockstate, just like glass pane or fence in vanilla have, BUT with addition to make block rotate on placement as well based on your facing direction.

 

Is that possible and how can it be done?

 

Here's my blockstate snippet that I created for only one instance in multipart:

{
  "multipart": [
    {
      "when": {"north": "false", "south": "false", "east": "false", "west": "false", "facing": "north"},
      "apply":
           { "model": "mod:block/default" }
    },
    {
      "when": {"north": "false", "south": "false", "east": "false", "west": "false", "facing": "east"},
      "apply":
           { "model": "mod:block/default", "y": 90}
    },
    {
      "when": {"north": "false", "south": "false", "east": "false", "west": "false", "facing": "south"},
      "apply":
           { "model": "mod:block/default", "y": 180}
    },
    
    {
      "when": {"north": "false", "south": "false", "east": "false", "west": "false", "facing": "west"},
      "apply":
           { "model": "mod:block/default", "y": 270}
    }
	]
}

 

Edited by Ultimate Immersion on Fri, 10/29/2021 - 14:32
Without some custom code,…
Sun, 10/31/2021 - 08:59

Without some custom code, unfortunately, no. I would provide example code, but I did not deal with multipart blocks before, so I don't know how to do it yet at this point.

Last seen on 14:56, 15. Jun 2023
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know how good this…
Mon, 11/01/2021 - 09:08

I don't know how good this is but I got some of this custom code by someone

public static final BooleanProperty NORTH = SixWayBlock.NORTH;
public static final BooleanProperty EAST = SixWayBlock.EAST;
public static final BooleanProperty SOUTH = SixWayBlock.SOUTH;
public static final BooleanProperty WEST = SixWayBlock.WEST;

 

 

And in fillStateContainer to add this: 

builder.add(NORTH, EAST, WEST, SOUTH);
super.fillStateContainer(builderIn);

 

Yep but I would say this is…
Mon, 11/01/2021 - 09:28

Yep but I would say this is far from multipart blocks as AFAIK you need to register a custom multipart definition somehow

Last seen on 14:56, 15. Jun 2023
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I imagined this to be much…
Tue, 11/02/2021 - 08:14

I imagined this to be much easier than it is, since so many vanilla blocks use multipart. Would it be easier to make a procedure for example if a mod window frame block is placed by default it places block1, if another is placed on top of it it replaces them to top and bottom, if another is placed on that top and bottom remain and default is placed in the middle. Kinda like a pillar CTM only with models. How could I do that?

You could use on block right…
Tue, 11/02/2021 - 17:54

You could use on block right-clicked event and check for the face it was clicked on and depending on the face of the click and the item in hand, place a new part.

Or maybe the other way around, have an item part that places on the block depending on the block clicked and the face of the block.

Last seen on 14:56, 15. Jun 2023
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I didn't know this is even…
Tue, 11/02/2021 - 19:10

I didn't know this is even possible. I'll see what I can do tho since I'm not good at programing at all. Thanks.