TehStoneMan Posted July 16, 2018 Posted July 16, 2018 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. Quote My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
TehStoneMan Posted July 16, 2018 Author Posted July 16, 2018 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 ) ); } } Quote My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
TehStoneMan Posted July 17, 2018 Author Posted July 17, 2018 Moving the code to the ModelRegistryEvent fixed the problem. Thanks. Still getting used to how things work now in 1.12 Quote My mods: http://www.curse.com/mc-mods/minecraft/225548-greenscreen http://mods.curse.com/mc-mods/minecraft/238981-cash-craft
Recommended Posts
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.