Skip to content

Instantly share code, notes, and snippets.

@Dockter
Created September 19, 2017 04:29
Show Gist options
  • Save Dockter/896ee9b95e9187497f53ca07e6e18ea6 to your computer and use it in GitHub Desktop.
Save Dockter/896ee9b95e9187497f53ca07e6e18ea6 to your computer and use it in GitHub Desktop.
public <BLOCK extends Block> BLOCK addBlock(BLOCK block, String name, Class itemClass) {
String qualName = assetKey + ":" + name;
block.setUnlocalizedName(qualName);
System.out.println("QualName: " + qualName);
// block.setBlockTextureName(qualName);
System.out.printf("BaseMod.addBlock: name '%s' qualName '%s' %s\n", name, qualName, block);
block.setRegistryName(assetKey, name);
ForgeRegistries.BLOCKS.register(block);
final Item item = new ItemBlock(block).setRegistryName(block.getRegistryName());
ForgeRegistries.ITEMS.register(item);
if (creativeTab != null) {
block.setCreativeTab(creativeTab);
}
if (block instanceof BaseBlock)
((BaseBlock)block).mod = this;
registeredBlocks.add(block);
System.out.println("SGCraft: registering block: " + assetKey + ":" + name);
return block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment