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.

Trouble with block that can face multiple directions.

Featured Replies

Posted

I get this error:

 

[m[33m[15:56:03] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'kenmod:blockstates/oak_log_wall_type_0.json' missing model for variant: 'kenmod:oak_log_wall_type_0#facing=east'
[m[33m[15:56:03] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'kenmod:blockstates/oak_log_wall_type_0.json' missing model for variant: 'kenmod:oak_log_wall_type_0#facing=north'
[m[33m[15:56:03] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'kenmod:blockstates/oak_log_wall_type_0.json' missing model for variant: 'kenmod:oak_log_wall_type_0#facing=south'
[m[33m[15:56:03] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'kenmod:blockstates/oak_log_wall_type_0.json' missing model for variant: 'kenmod:oak_log_wall_type_0#facing=west'
[m[33m[15:56:03] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'kenmod:blockstates/oak_log_wall_type_0.json' in resourcepack: 'Mod Resources': com.google.gson.stream.MalformedJsonException: Expected name at line 7 column 7 path $.variants.

 

And here is what the blockstate file looks like:

 

{
	"variants": {
        	"facing=north": { "model": "kenmod:block/oak_log_wall_type_0" },
        	"facing=south": { "model": "kenmod:block/oak_log_wall_type_0", "y": 180 },
        	"facing=west":  { "model": "kenmod:block/oak_log_wall_type_0", "y": 270 },
        	"facing=east":  { "model": "kenmod:block/oak_log_wall_type_0", "y": 90 }
    	}
}

 

Here is the log wall block class:

 

package com.kenneths_mod.objects.blocks.walls;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.util.Direction;
import net.minecraft.util.Rotation;

public class LogWallType0 extends Block {
	
	public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;
	
	public LogWallType0(Properties properties) {
		super(properties);
		this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH));
	}
	
	@Override
	public BlockState getStateForPlacement(BlockItemUseContext context) {
		return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
	}
	@Override
	public BlockState rotate(BlockState state, Rotation rot) {
		return state.with(FACING, rot.rotate(state.get(FACING)));
	}
	@Override
	protected void fillStateContainer(Builder<Block, BlockState> builder) {
		builder.add(FACING);
	}
}

 

And here is what it looks like when registered:

 

BlockList.oak_log_wall_type_0 = new LogWallType0(Block.Properties.create(Material.WOOD).hardnessAndResistance(3.0F).sound(SoundType.WOOD).harvestTool(ToolType.AXE)).setRegistryName(location("oak_log_wall_type_0"))

 

Here is the model file:

 

{
	"credit": "Made with Blockbench",
	"textures": {
		"0": "block/oak_log",
		"1": "block/oak_log_top",
		"2": "block/oak_planks",
		"particle": "block/oak_log"
	},
	"elements": [
		{
			"from": [0, 12, 5],
			"to": [16, 13, 11],
			"faces": {
				"north": {"uv": [0, 0, 16, 1], "texture": "#2"},
				"east": {"uv": [0, 0, 6, 1], "texture": "#2"},
				"south": {"uv": [0, 0, 16, 1], "texture": "#2"},
				"west": {"uv": [0, 0, 6, 1], "texture": "#2"},
				"up": {"uv": [0, 0, 16, 6], "texture": "#2"},
				"down": {"uv": [0, 0, 16, 6], "texture": "#2"}
			}
		},
		{
			"from": [0, 4, 5],
			"to": [16, 5, 11],
			"faces": {
				"north": {"uv": [0, 0, 16, 1], "texture": "#2"},
				"east": {"uv": [0, 0, 6, 1], "texture": "#2"},
				"south": {"uv": [0, 0, 16, 1], "texture": "#2"},
				"west": {"uv": [0, 0, 6, 1], "texture": "#2"},
				"up": {"uv": [0, 0, 16, 6], "texture": "#2"},
				"down": {"uv": [0, 0, 16, 6], "texture": "#2"}
			}
		},
		{
			"from": [0, 5, 4],
			"to": [16, 12, 12],
			"faces": {
				"north": {"uv": [0, 0, 7, 16], "rotation": 90, "texture": "#0"},
				"east": {"uv": [4, 5, 12, 12], "texture": "#1"},
				"south": {"uv": [0, 0, 7, 16], "rotation": 90, "texture": "#0"},
				"west": {"uv": [4, 5, 12, 12], "texture": "#1"},
				"up": {"uv": [0, 0, 8, 16], "rotation": 90, "texture": "#0"},
				"down": {"uv": [0, 0, 8, 16], "rotation": 90, "texture": "#0"}
			}
		},
		{
			"from": [0, 13, 4],
			"to": [16, 17, 12],
			"faces": {
				"north": {"uv": [0, 0, 4, 16], "rotation": 90, "texture": "#0"},
				"east": {"uv": [4, 8, 12, 12], "texture": "#1"},
				"south": {"uv": [0, 0, 4, 16], "rotation": 90, "texture": "#0"},
				"west": {"uv": [4, 8, 12, 12], "texture": "#1"},
				"up": {"uv": [0, 0, 8, 16], "rotation": 90, "texture": "#0"},
				"down": {"uv": [0, 0, 8, 16], "rotation": 90, "texture": "#0"}
			}
		},
		{
			"from": [0, 0, 4],
			"to": [16, 4, 12],
			"faces": {
				"north": {"uv": [0, 0, 4, 16], "rotation": 90, "texture": "#0"},
				"east": {"uv": [4, 4, 12, 8], "texture": "#1"},
				"south": {"uv": [0, 0, 4, 16], "rotation": 90, "texture": "#0"},
				"west": {"uv": [4, 4, 12, 8], "texture": "#1"},
				"up": {"uv": [0, 0, 8, 16], "rotation": 90, "texture": "#0"},
				"down": {"uv": [0, 0, 8, 16], "rotation": 90, "texture": "#0"}
			}
		}
	]
}

 

Can anyone explain to me where I went wrong?

Edited by Kenneth201998

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.