Skip to content

Instantly share code, notes, and snippets.

@TehNut
Created April 25, 2016 23:13
Show Gist options
  • Save TehNut/a096ab00955d219e0a438fa06e6e17c5 to your computer and use it in GitHub Desktop.
Save TehNut/a096ab00955d219e0a438fa06e6e17c5 to your computer and use it in GitHub Desktop.
Forge 1.9 Registry examples
// Block
Block myBlock = new Block(Materials.ROCK);
GameRegistry.register(myBlock.setRegistryName("myBlock"));
// Block with inventory Item
Block myBlock = new Block(Materials.ROCK);
GameRegistry.register(myBlock.setRegistryName("myBlock"));
GameRegistry.register(new ItemBlock(myBlock).setRegistryName(myBlock.getRegistryName());
// Item
Item myItem = new Item();
GameRegistry.register(myItem.setRegistryName("myItem"));
// Potion
Potion myPotion = new Potion(false, 0);
GameRegistry.register(myPotion.setRegistryName("myPotion"));
// Enchantment
Enchantment myEnchant = new Enchantment(Enchantment.Rarity.COMMON, EnumEnchantmentType.ALL, new EntityEquipmentSlot[]{EntityEquipmentSlot.MAINHAND});
GameRegistry.register(myEnchant.setRegistryName("myEnchant"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment