Skip to content

Instantly share code, notes, and snippets.

@sirsavary
Created March 4, 2016 22:55
Show Gist options
  • Select an option

  • Save sirsavary/9aab1ed04ff31fc6f274 to your computer and use it in GitHub Desktop.

Select an option

Save sirsavary/9aab1ed04ff31fc6f274 to your computer and use it in GitHub Desktop.
IRetexturableModel itemModel = (IRetexturableModel) ModelLoaderRegistry.getModel(new ResourceLocation("minecraft:builtin/generated"));
String itemName = "copper_axe";
IModel retexture = itemModel.retexture(ImmutableMap.of("layer0", ASSETS + "items/" + itemName));
TextureMap textures = Minecraft.getMinecraft().getTextureMapBlocks();
IFlexibleBakedModel bakedModel = retexture.bake(retexture.getDefaultState(), Attributes.DEFAULT_BAKED_FORMAT, (location) -> textures.getAtlasSprite(location.toString()));
event.modelRegistry.putObject(new ModelResourceLocation(MODID + ":" + itemName + "#normal"), bakedModel);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment