Jump to content

Recommended Posts

Posted (edited)

I am currently trying somekind of connected textured with Blockstates, but it seems some parts of the Forge Blockstates are broken.

This is working and all variants (64) are displaying a cube with the same texture for each side.

I am using forge 13.20.0.2282

 

 

{
"forge_marker":1,
"defaults":
{
"model":"cube",
"textures":{
"down":"fp:blocks/d0000",
"up":"fp:blocks/d0000",
"north":"fp:blocks/d0000",
"south":"fp:blocks/d0000",
"west":"fp:blocks/d0000",
"east":"fp:blocks/d0000"
}
},
"variants":{
"down":{"true":{},"false":{}},
"up":{"true":{},"false":{}},
"north":{"true":{},"false":{}},
"south":{"true":{},"false":{}},
"west":{"true":{},"false":{}},
"east":{"true":{},"false":{}},



"inventory":[{}]
}
}

 

But if I add only one special variant everything breaks.

 

{
"forge_marker":1,
"defaults":
{
"model":"cube",
"textures":{
"down":"fp:blocks/d0000",
"up":"fp:blocks/d0000",
"north":"fp:blocks/d0000",
"south":"fp:blocks/d0000",
"west":"fp:blocks/d0000",
"east":"fp:blocks/d0000"
}
},
"variants":{
"down":{"true":{},"false":{}},
"up":{"true":{},"false":{}},
"north":{"true":{},"false":{}},
"south":{"true":{},"false":{}},
"west":{"true":{},"false":{}},
"east":{"true":{},"false":{}},

"down=true,east=false,north=false,south=false,up=false,west=false":{
"textures":{
"down":"fp:blocks/d0000",
"up":"fp:blocks/d0000",
"north":"fp:blocks/d0010",
"south":"fp:blocks/d0010",
"west":"fp:blocks/d0010",
"east":"fp:blocks/d0010"}
},

"inventory":[{}]
}
}

 

 

The Block class

public class BlockQuantanium extends Block
{
	public static final PropertyBool up = PropertyBool.create("up");
	public static final PropertyBool down = PropertyBool.create("down");
	public static final PropertyBool north = PropertyBool.create("north");
	public static final PropertyBool east = PropertyBool.create("east");
	public static final PropertyBool south = PropertyBool.create("south");
	public static final PropertyBool west = PropertyBool.create("west");
	
	public static final PropertyBool[] faces = new PropertyBool[]{down,up,north,south,west,east};

	public BlockQuantanium()
	{
		super(Material.ROCK);
		setCreativeTab(FPMain.tab_deco);
	}
	
	@Override
	protected BlockStateContainer createBlockState()
	{
		return new BlockStateContainer(this, faces);
	}
	
	@Override
	public int getMetaFromState(IBlockState state)
	{
		return 0;
	}
	
	@Override
	public IBlockState getStateFromMeta(int meta)
	{
		return super.getStateFromMeta(meta);
	}

	@Override
	public IBlockState getActualState(IBlockState state, IBlockAccess w, BlockPos pos)
	{
		for(int i=0;i<faces.length;i++)
		{
			state = state.withProperty(faces[i], w.getBlockState(pos.offset(EnumFacing.getFront(i))).getBlock() == this);
		}
		return state;
	}
}	

 

Edited by MCenderdragon

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

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.