Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

(1.12.2) Random Block Rotations


Recommended Posts

So I've added an ore to my mod with a custom model. And when I put them side by side, it's pretty plain. Can anybody teach me how to add random block rotations so It's not always the same pattern? 

 

copper_ore.json

{
	"credit": "Made with Blockbench",
	"textures": {
		"1": "imam:blocks/stone",
		"2": "imam:blocks/copper",
		"particle": "imam:blocks/copper"
	},
	"elements": [
		{
			"from": [0, 0, 0],
			"to": [16, 16, 16],
			"faces": {
				"north": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"east": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"south": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
			}
		},
		{
			"from": [12, 3, -3],
			"to": [17, 9, 4],
			"rotation": {"angle": 45, "axis": "x", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 5, 6], "texture": "#2"},
				"east": {"uv": [0, 0, 7, 6], "texture": "#2"},
				"south": {"uv": [0, 0, 5, 6], "texture": "#2"},
				"west": {"uv": [0, 0, 7, 6], "texture": "#2"},
				"up": {"uv": [0, 0, 5, 7], "texture": "#2"},
				"down": {"uv": [0, 0, 5, 7], "texture": "#2"}
			}
		},
		{
			"from": [6, 1.5, 14.5],
			"to": [11, 8.5, 20.5],
			"rotation": {"angle": -22.5, "axis": "x", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 5, 7], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 7, 6], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 5, 7], "texture": "#2"},
				"west": {"uv": [0, 0, 7, 6], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 5, 6], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 5, 6], "texture": "#2"}
			}
		},
		{
			"from": [-2, 1.5, 2.5],
			"to": [3, 8.5, 8.5],
			"rotation": {"angle": -22.5, "axis": "x", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 5, 7], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 7, 6], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 5, 7], "texture": "#2"},
				"west": {"uv": [0, 0, 7, 6], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 5, 6], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 5, 6], "texture": "#2"}
			}
		},
		{
			"from": [18, 12, 7],
			"to": [25, 18, 14],
			"rotation": {"angle": 45, "axis": "z", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 7, 6], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 7, 6], "rotation": 180, "texture": "#2"},
				"south": {"uv": [0, 0, 7, 6], "rotation": 180, "texture": "#2"},
				"west": {"uv": [0, 0, 7, 6], "rotation": 180, "texture": "#2"},
				"up": {"uv": [0, 0, 7, 7], "texture": "#2"},
				"down": {"uv": [0, 0, 7, 7], "texture": "#2"}
			}
		},
		{
			"from": [3, 7.5, 1.5],
			"to": [10, 16.5, 8.5],
			"rotation": {"angle": -22.5, "axis": "x", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 7, 9], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 9, 7], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 7, 9], "texture": "#2"},
				"west": {"uv": [0, 0, 9, 7], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 7, 7], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 7, 7], "texture": "#2"}
			}
		},
		{
			"from": [7, 4.5, 9.5],
			"to": [13, 13.5, 16.5],
			"rotation": {"angle": 22.5, "axis": "y", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 6, 9], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 9, 7], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 6, 9], "texture": "#2"},
				"west": {"uv": [0, 0, 9, 7], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 6, 7], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 6, 7], "texture": "#2"}
			}
		},
		{
			"from": [0, 11.5, 9.5],
			"to": [6, 17.5, 16.5],
			"rotation": {"angle": 22.5, "axis": "z", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 6, 6], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 6, 7], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 6, 6], "texture": "#2"},
				"west": {"uv": [0, 0, 6, 7], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 6, 7], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 6, 7], "texture": "#2"}
			}
		},
		{
			"from": [1, 0.5, 6.5],
			"to": [7, 6.5, 13.5],
			"rotation": {"angle": 22.5, "axis": "z", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 6, 6], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 6, 7], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 6, 6], "texture": "#2"},
				"west": {"uv": [0, 0, 6, 7], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 6, 7], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 6, 7], "texture": "#2"}
			}
		},
		{
			"from": [10, -6.5, -1.5],
			"to": [16, 0.5, 4.5],
			"rotation": {"angle": -22.5, "axis": "z", "origin": [15.5, 3, 0.5]},
			"faces": {
				"north": {"uv": [0, 0, 6, 7], "rotation": 180, "texture": "#2"},
				"east": {"uv": [0, 0, 7, 6], "rotation": 270, "texture": "#2"},
				"south": {"uv": [0, 0, 6, 7], "texture": "#2"},
				"west": {"uv": [0, 0, 7, 6], "rotation": 90, "texture": "#2"},
				"up": {"uv": [0, 0, 6, 6], "rotation": 180, "texture": "#2"},
				"down": {"uv": [0, 0, 6, 6], "texture": "#2"}
			}
		}
	]
}

 

Link to post
Share on other sites

In your blockstate json add a couple of "normal" variants with different rotations. For example:
 

{
  "forge_marker": 1,
  "defaults": {
    "model": "modid:modblock"
  },
  "variants": {
    "normal": [
      {
        "model": "modid:modblock"
      },
      {
        "model": "modid:modblock",
        "y": 90
      },
      {
        "model": "modid:modblock",
        "y": 180
      },
      {
        "model": "modid:modblock",
        "y": 270
      }
    ],
    "inventory": [{
      "transform": "forge:default-block"
    }]
  }
}

 

Link to post
Share on other sites
1 hour ago, ZigTheHedge said:

In your blockstate json add a couple of "normal" variants with different rotations. For example:
 


{
  "forge_marker": 1,
  "defaults": {
    "model": "modid:modblock"
  },
  "variants": {
    "normal": [
      {
        "model": "modid:modblock"
      },
      {
        "model": "modid:modblock",
        "y": 90
      },
      {
        "model": "modid:modblock",
        "y": 180
      },
      {
        "model": "modid:modblock",
        "y": 270
      }
    ],
    "inventory": [{
      "transform": "forge:default-block"
    }]
  }
}

 

so will the code look like this?

Spoiler

{
  "forge_marker": 1,
  "defaults": {
    "model": "imam:copper_ore"
  },
  "variants": {
    "normal": [
      {
        "model": "imam:copper_ore"
      },
      {
        "model": "imam:copper_ore",
        "y": 90
      },
      {
        "model": "imam:copper_ore",
        "y": 180
      },
      {
        "model": "imam:copper_ore",
        "y": 270
      }
    ],
     "inventory": [{
      "transform": "forge:default-block"
    }]
  }
}

 

Link to post
Share on other sites

By the way, Minecraft vanilla doesn't apply the random rotation thing to ores. You're free to do whatever you want, but I am one of those sorts of people who look at vanilla and tries to match style and ethos. So if vanilla doesn't apply random rotations to ores, then my ores won't have random rotation either. This the closest I've come to having a non-square model, and even then its based on the math behind water, soo...

 

(By the way, don't forget to add your ore blocks and items to the tag system)

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
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.

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



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.