Skip to content

Instantly share code, notes, and snippets.

@LionZXY
Created July 7, 2015 08:15
Show Gist options
  • Save LionZXY/b6c517f1c108fcac3621 to your computer and use it in GitHub Desktop.
Save LionZXY/b6c517f1c108fcac3621 to your computer and use it in GitHub Desktop.
package ru.nord.common.lib.helpers;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;
import ru.nord.Nord;
public class RegisterHelper {
public static void registerSingleBlock(Block block, String name) {
registerSingleBlock(block, name, name);
}
public static void registerSingleBlock(Block block, String name, String model) {
GameRegistry.registerBlock(block, name);
Nord.proxy.registerBlockRender(block, 0, model);
}
public static void registerSingleItem(Item item, String name) {
registerSingleItem(item, name, name);
}
public static void registerSingleItem(Item item, String name, String model) {
GameRegistry.registerItem(item, name);
Nord.proxy.registerItemRender(item, 0, model);
}
public static void registerMetadataBlock(Block block, Class<? extends ItemBlock> itemBlock,
String name, String[] additionals) {
registerMetadataBlock(block, itemBlock, name, name, additionals);
}
public static void registerMetadataBlock(Block block, Class<? extends ItemBlock> itemBlock,
String name,int count) {
registerMetadataBlock(block, itemBlock, name, name,count);
}
public static void registerMetadataBlock(
Block block,
Class<? extends ItemBlock> itemBlock,
String name,
String model,
String[] additionals
) {
GameRegistry.registerBlock(block, itemBlock, name);
for (int i = 0; i < additionals.length; i++) {
Nord.proxy.registerBlockRender(block, i, model + "." + additionals[i]);
}
}
public static void registerMetadataItem(
Item itemVar,
String name,
String model,
String[] additionals
){
GameRegistry.registerItem(itemVar,name);
for (int i=0; i< additionals.length; i++){
System.out.println(itemVar);
System.out.println(i);
System.out.println(model+"."+additionals[i]);
System.out.println(additionals);
Nord.proxy.registerItemRender(itemVar,i,model+"."+additionals[i]);
}
}
public static void registerMetadataBlock(
Block block,
Class<? extends ItemBlock> itemBlock,
String name,
String model,
int count) {
GameRegistry.registerBlock(block, itemBlock, name);
for (int i = 0; i < count; i++) {
Nord.proxy.registerBlockRender(block, i, model);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment