Jump to content

Recommended Posts

Posted

Hello. I am having a problem with a custom state map for a set of blocks.

 

I set up three blocks using the same custom state map, but only the first block appears, the other two are missing model blocks.

 

Even if I reorder the blocks in the code, it is still only the first block that has the custom state map applied appears.

 

For example, if I have

 

MyStateMap stateMap = new MyStateMap();
ModelLoader.setCustomStateMapper( block1, stateMap );
ModelLoader.setCustomStateMapper( block2, stateMap );
ModelLoader.setCustomStateMapper( block3, stateMap );

 

then block1 appears as the proper model, but block2 and block3 are missing models.

 

If I move block1 to the bottom, block2 appears normal, but block1 and block3 are missing models.

 

This did seem to work in previous Minecraft versions.

Posted

The code above is located in my ClientProxy preInit().

 

Here is my state mapper

public class SizeStateMap extends StateMapperBase
{
	@Override
	protected ModelResourceLocation getModelResourceLocation( IBlockState state )
	{
		String size = state.getValue( BlockLockable.CONNECTED ) ? "_large" : "_small";
		String name = Block.REGISTRY.getNameForObject( state.getBlock() ).toString() + size;
		Map < IProperty<?>, Comparable<? >> map = Maps. < IProperty<?>, Comparable<? >> newLinkedHashMap(state.getProperties());
		map.remove( BlockHorizontal.FACING );
		map.remove( BlockLockable.CONNECTED );
		if( map.containsKey( BlockDoor.HINGE ))
		{
			name += "_" + state.getValue( BlockDoor.HINGE ).getName();
			map.remove( BlockDoor.HINGE );
		}
		return new ModelResourceLocation( new ResourceLocation( name ), getPropertyString( map ) );
	}
}

 

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.