@Override public void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition ) { ModelLoader.setCustomMeshDefinition( item, meshDefinition ); }
private static ResourceLocation registerIt(Item item, final ResourceLocation location) { // plop it in. // This here is needed for the model to be found ingame when the game looks for a model to render an Itemstack // we use an ItemMeshDefinition because it allows us to do it no matter what metadata we use ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { @Nonnull @Override public ModelResourceLocation getModelLocation(@Nonnull ItemStack stack) { return new ModelResourceLocation(location, VARIANT_INVENTORY); } }); // We have to readd the default variant if we have custom variants, since it wont be added otherwise and therefore not loaded ModelLoader.registerItemVariants(item, location); return location; }
@Override public void registerFluidModels(Fluid fluid) { if(fluid == null) { return; } Block block = fluid.getBlock(); if(block != null) { Item item = Item.getItemFromBlock(block); FluidStateMapper mapper = new FluidStateMapper(fluid); // item-model if(item != Items.AIR) { ModelLoader.registerItemVariants(item); ModelLoader.setCustomMeshDefinition(item, mapper); } // block-model ModelLoader.setCustomStateMapper(block, mapper); } }
@SideOnly(Side.CLIENT) @Override public void registerModels() { // Load and bake the 2D models ModelBakery.registerItemVariants(this, new ModelResourceLocation("botania:lexicon_default", "inventory"), new ModelResourceLocation("botania:lexicon_elven", "inventory")); ModelResourceLocation default3dPath = new ModelResourceLocation("botania:lexicon_3d_default", "inventory"); ModelResourceLocation elven3dPath = new ModelResourceLocation("botania:lexicon_3d_elven", "inventory"); // smart model will dispatch between 2d/3d appropriately, see LexiconModel ModelLoader.setCustomMeshDefinition(this, stack -> isElvenItem(stack) ? elven3dPath : default3dPath); }
ModelLoader.setCustomMeshDefinition(TinkerTools.pattern, new PatternMeshDefinition(patternLoc)); final ModelResourceLocation boltCoreGuiModelLocation = Util.getModelResource("parts/bolt_core_gui", ModelRegisterUtil.VARIANT_INVENTORY); ModelLoader.setCustomMeshDefinition(TinkerTools.boltCore, stack -> { if(stack == BoltCore.GUI_RENDER_ITEMSTACK) { return boltCoreGuiModelLocation;
@SideOnly(Side.CLIENT) @Override public void registerModels() { ModelBakery.registerItemVariants(this, new ModelResourceLocation("botania:desuGunClip", "inventory"), new ModelResourceLocation("botania:desuGun", "inventory"), new ModelResourceLocation("botania:manaGunClip", "inventory"), new ModelResourceLocation("botania:manaGun", "inventory")); ModelLoader.setCustomMeshDefinition(this, stack -> { if (hasClip(stack) && isSugoiKawaiiDesuNe(stack)) return new ModelResourceLocation("botania:desuGunClip", "inventory"); else if (isSugoiKawaiiDesuNe(stack)) return new ModelResourceLocation("botania:desuGun", "inventory"); else if(hasClip(stack)) return new ModelResourceLocation("botania:manaGunClip", "inventory"); else return new ModelResourceLocation("botania:manaGun", "inventory"); }); } }
@SideOnly(Side.CLIENT) public static void preInitClient() { ModelLoader.setCustomMeshDefinition(STRUCTURES, new BuildingDefinition(STRUCTURES)); ModelLoader.setCustomMeshDefinition(BLUEPRINTS, new MeshIdentical(BLUEPRINTS)); }
private static void bindBookModel() { List<ModelResourceLocation> models = new LinkedList<>(); BookRegistry.INSTANCE.books.values().forEach(b -> models.add(new ModelResourceLocation(b.model, "inventory"))); ModelBakery.registerItemVariants(book, models.toArray(new ModelResourceLocation[0])); ModelLoader.setCustomMeshDefinition(book, (stack) -> { Book book = ItemModBook.getBook(stack); if (book != null) return book.modelResourceLoc; return Book.DEFAULT_MODEL_RES; }); }
@Override @SideOnly(Side.CLIENT) public void preInitClient(FMLPreInitializationEvent event) { ModelHandler.registerModels(Items.SHIELD, LibMisc.PREFIX_MOD, new String[] { "shield_override" }, null, true); ModelLoader.setCustomMeshDefinition(Items.SHIELD, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { return new ModelResourceLocation("quark:shield_override", "inventory"); } }); }
@Override @SideOnly (Side.CLIENT) public void registerModels() { StateMapper mapper = new StateMapper(modName, "util", name); ModelBakery.registerItemVariants(this); ModelLoader.setCustomMeshDefinition(this, mapper); for (Map.Entry<Integer, ItemEntry> entry : itemMap.entrySet()) { ModelLoader.setCustomModelResourceLocation(this, entry.getKey(), new ModelResourceLocation(modName + ":" + "util", "type=" + entry.getValue().name)); } }
@Override @SideOnly (Side.CLIENT) public void registerModels() { StateMapper mapper = new StateMapper(modName, "util", name); ModelBakery.registerItemVariants(this); ModelLoader.setCustomMeshDefinition(this, mapper); for (Map.Entry<Integer, ItemEntry> entry : itemMap.entrySet()) { ModelLoader.setCustomModelResourceLocation(this, entry.getKey(), new ModelResourceLocation(modName + ":" + "util", "type=" + entry.getValue().name)); } }
ModelLoader.setCustomMeshDefinition(TinkerSmeltery.cast, new PatternMeshDefinition(castLoc)); CustomTextureCreator.castModelLocation = new ResourceLocation(clayCastLoc.getResourceDomain(), "item/" + clayCastLoc.getResourcePath()); ModelLoader.setCustomMeshDefinition(TinkerSmeltery.clayCast, new PatternMeshDefinition(clayCastLoc));
@Override @SideOnly (Side.CLIENT) public void registerModels() { StateMapper mapper = new StateMapper(modName, "util", name); ModelLoader.setCustomMeshDefinition(this, mapper); ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(modName + ":" + "util", "type=" + name)); }
/** * (Excerpted from Tinkers' Construct with permission, thanks guys!) */ private static void registerCustomFluidBlockRenderer(Fluid fluid){ Block block = fluid.getBlock(); Item item = Item.getItemFromBlock(block); FluidStateMapper mapper = new FluidStateMapper(fluid); ModelLoader.registerItemVariants(item); ModelLoader.setCustomMeshDefinition(item, mapper); ModelLoader.setCustomStateMapper(block, mapper); }
@Override @SideOnly (Side.CLIENT) public void registerModels() { ModelResourceLocation location = new ModelResourceLocation("thermalexpansion:frame", "frame"); ModelLoader.setCustomModelResourceLocation(this, 0, location); ModelLoader.setCustomMeshDefinition(this, (stack -> location)); ModelRegistryHelper.register(location, new CCBakeryModel()); }
@Override @SideOnly (Side.CLIENT) public void registerModels() { ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), "normal"); ModelLoader.setCustomModelResourceLocation(itemBlock, 0, location); // Suppresses model loading errors for #inventory. ModelLoader.setCustomMeshDefinition(itemBlock, (stack) -> location); ModelRegistryHelper.register(location, RenderStrongbox.INSTANCE); }
@Override @SideOnly(Side.CLIENT) public void registerModel(Item item) { ModelLoader.registerItemVariants(item, new ModelResourceLocation("extrabees:honey_crystal_full", "inventory"), new ModelResourceLocation("extrabees:honey_crystal_empty", "inventory"), new ModelResourceLocation("extrabees:honey_crystal", "inventory")); ModelLoader.setCustomMeshDefinition(item, new HoneyCrystalMeshDefinition()); }
@SideOnly(Side.CLIENT) @SuppressWarnings("deprecation") public static void preInitClient() { ModelLoader.setCustomMeshDefinition(SPAWNER_NPC, new MeshIdentical(SPAWNER_NPC)); registerNPCRendering(EntityNPCVillager.class); registerNPCRendering(EntityNPCBuilder.class); //TODO: Remove in 0.7+ registerNPCRendering(EntityNPCShopkeeper.class); registerNPCRendering(EntityNPCGoddess.class); registerNPCRendering(EntityNPCMiner.class); }
@Override public void registerFluidStateMapper(Block block, Fluids fluid) { final ModelResourceLocation fluidLocation = new ModelResourceLocation("forestry:blockforestryfluid", fluid.getTag()); StateMapperBase ignoreState = new FluidStateMapper(fluidLocation); ModelLoader.setCustomStateMapper(block, ignoreState); ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(block), new FluidItemMeshDefinition(fluidLocation)); ModelBakery.registerItemVariants(Item.getItemFromBlock(block), fluidLocation); }
public static <T extends Item & ISimpleStateItem> void setupItemRendering(ResourceLocation base, final T item) { final ResourceLocation id = item.getRegistryName(); final StateContainer stateContainer = item.getStateContainer(); for (State state : stateContainer.getAllStates()) { ModelResourceLocation modelLoc = new ModelResourceLocation(id, state.getVariant()); ModelBakery.registerItemVariants(item, modelLoc); } ModelLoader.setCustomMeshDefinition(item, stack -> { final State state = item.getState(stack); return new ModelResourceLocation(id, state.getVariant()); }); }