@SideOnly(Side.CLIENT) public static void registerItemRenders() { rmm(skeleton_maker); rmm(baby_skeleton_maker); rmm(overlords_seal); rmm(overlords_stamp); rmm(squad_editor); rmm(sans_mask); rmm(skinsuit); rmm(skinsuit_mummy); rmm(warrior_spawner); rmm(baby_spawner); rmm(converted_spawner); rmm(milk_bottle); rmm(keychain); rmm(keychain_occupied); rmm(crown); rmm(rallying_horn); IStateMapper skeleton_maker_mapper = new StateMap.Builder().ignore(BlockSkeletonMaker.TRIGGERED).build(); ModelLoader.setCustomStateMapper(skeleton_maker, skeleton_maker_mapper); ModelLoader.setCustomStateMapper(baby_skeleton_maker, skeleton_maker_mapper); }
@Override public void registerNonRenderingProperties(Block block) { if (block instanceof IHSHBlock) { IHSHBlock hshBlock = (IHSHBlock)block; IProperty[] nonRenderingProperties = hshBlock.getNonRenderingProperties(); if (nonRenderingProperties != null) { // use a custom state mapper which will ignore the properties specified in the block as being non-rendering IStateMapper custom_mapper = (new StateMap.Builder()).ignore(nonRenderingProperties).build(); ModelLoader.setCustomStateMapper(block, custom_mapper); } } }
/** * Internal, do not use. */ public static void onRegisterAllBlocks(BlockModelShapes shapes) { for (Entry<RegistryDelegate<Block>, IStateMapper> e : customStateMappers.entrySet()) { shapes.registerBlockWithStateMapper(e.getKey().get(), e.getValue()); } }
@SideOnly(Side.CLIENT) public void initModel(){ IStateMapper stateMapper = new StateMap.Builder().build(); ModelLoader.setCustomStateMapper(this, stateMapper); for(WoodType type : WoodType.values()){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), type.getMeta(), new ModelResourceLocation(getRegistryName()+"_"+type.getName(), "inventory")); } }
@Override @SideOnly(Side.CLIENT) public void initModel() { IStateMapper stateMapper = new StateMap.Builder().ignore(new IProperty[] {BlockDoor.POWERED}).build(); ModelLoader.setCustomStateMapper(this, stateMapper); ModBlocks.initBasicModel(this); }
@SideOnly(Side.CLIENT) public void initModel(){ IStateMapper stateMapper = new StateMap.Builder().build(); ModelLoader.setCustomStateMapper(this, stateMapper); for(FancyLadderType2 type : FancyLadderType2.values()){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), type.getMeta(), new ModelResourceLocation(getRegistryName()+"_"+type.getName(), "inventory")); } }
@SideOnly(Side.CLIENT) public void initModel(){ IStateMapper stateMapper = new StateMap.Builder().build(); ModelLoader.setCustomStateMapper(this, stateMapper); for(FancyLadderType type : FancyLadderType.values()){ ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), type.getMeta(), new ModelResourceLocation(getRegistryName()+"_"+type.getName(), "inventory")); } }
public static void registerBlockRenderer(Block block, IStateMapper mapper, int... metadata) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher() .getModelManager().getBlockModelShapes() .registerBlockWithStateMapper(block, mapper); }
/** * Always returns the same base texture, since ISmartModel will handle the actual render state */ @Override @SideOnly(Side.CLIENT) public IStateMapper getCustomStateMap() { return new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return ModelDungeonBlock.resource; } }; }
@Override @SideOnly(Side.CLIENT) public IStateMapper getCustomStateMap() { // can't use this because meta 8 needs to be remapped to 7: // return (new StateMap.Builder()).addPropertiesToIgnore(UNLOCKED).build(); return new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { String resource = getUnlocalizedName(); resource = resource.substring(resource.lastIndexOf(".") + 1) + "#" + PENDANTS.getName() + "="; int pendants = ((Boolean) state.getValue(UNLOCKED)).booleanValue() ? ALL_PENDANTS : ((Integer) state.getValue(PENDANTS)).intValue(); return new ModelResourceLocation(ModInfo.ID + ":" + resource + pendants); } }; }
@Override @SideOnly(Side.CLIENT) public IStateMapper getCustomStateMap() { return new StateMapperBase() { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return new ModelResourceLocation(ModInfo.ID + ":chest_invisible"); } }; }
public void registerBlockWithStateMapper(Block assoc, IStateMapper stateMapper) { this.blockStateMapper.registerBlockStateMapper(assoc, stateMapper); }
/** * Adds a custom IBlockState -> model variant logic. */ public static void setCustomStateMapper(Block block, IStateMapper mapper) { customStateMappers.put(block.delegate, mapper); }
private static void registerBlockStateMapper(Block block, IStateMapper mapper) { ModelLoader.setCustomStateMapper(block, mapper); }
@Override @SideOnly(Side.CLIENT) public IStateMapper getCustomStateMap() { return (new StateMap.Builder()).ignore(VARIANT).build(); }
@Override @SideOnly(Side.CLIENT) public IStateMapper getCustomStateMap() { return (new StateMap.Builder()).ignore(EXPLODE).build(); }
@Override @SideOnly(Side.CLIENT) public IStateMapper getCustomStateMap() { return (new StateMap.Builder()).ignore(UNBREAKABLE).build(); }
/** * Return the {@link IStateMapper IStateMapper} to use for {@link net.minecraftforge.client.model.ModelLoader#setCustomStateMapper ModelLoader.setCustomStateMapper} */ @SideOnly(Side.CLIENT) IStateMapper getCustomStateMap();
/** * Registers a mapper for the given block that takes a given BlockState and gives back a prebaked model. * * @param block Block for rendering * @param mapper IStateMapper to provide the models */ public static void registerBlockModelMapper(Block block, IStateMapper mapper) { Minecraft.getMinecraft().modelManager.getBlockModelShapes().registerBlockWithStateMapper(block, mapper); }
/** * Remaps the models from an already registered block onto the given one. * * @param original Original block * @param block Block to assign the models to */ public static void swapoutBlockModels(Block original, Block block) { BlockModelShapes mapper = Minecraft.getMinecraft().modelManager.getBlockModelShapes(); mapper.getBlockStateMapper().registerBlockStateMapper(block, (IStateMapper)mapper.getBlockStateMapper().blockStateMap.get(original)); mapper.reloadModels(); }