Skip to content

Instantly share code, notes, and snippets.

@JamiesWhiteShirt
Last active July 9, 2017 20:44
Show Gist options
  • Save JamiesWhiteShirt/f73557c0467b5ed2f6781b8c8ccaea23 to your computer and use it in GitHub Desktop.
Save JamiesWhiteShirt/f73557c0467b5ed2f6781b8c8ccaea23 to your computer and use it in GitHub Desktop.
@Override
public void registerModels() {
// ...
registerBlockModel(LWBlocks.SEALED_BARREL, "sealed_barrel");
// ...
}
private static void registerBlockModel(Block block, String name) {
registerItemModel(Item.getItemFromBlock(block), name);
}
private static void registerItemModel(Item item, String name) {
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(LeatherWorks.MODID, name), "inventory"));
}
// ...
public static final Block SEALED_BARREL = simply(new BlockEmpty(), "sealed_barrel").setCreativeTab(LeatherWorks.LeatherTab);
private static Block simply(Block block, String name) {
return block.setRegistryName(LeatherWorks.MODID, name).setUnlocalizedName(LeatherWorks.MODID + "." + name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment