Java Code Examples for net.minecraftforge.fml.common.registry.GameRegistry#register()

The following examples show how to use net.minecraftforge.fml.common.registry.GameRegistry#register() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockSurgery.java    From Cyberware with MIT License 6 votes vote down vote up
public BlockSurgery()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "surgery";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

	ItemBlock ib = new ItemBlockCyberware(this);
	ib.setRegistryName(name);
	GameRegistry.register(ib);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);

	this.setCreativeTab(Cyberware.creativeTab);
	GameRegistry.registerTileEntity(TileEntitySurgery.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.blocks.add(this);
}
 
Example 2
Source File: BlockBeacon.java    From Cyberware with MIT License 6 votes vote down vote up
public BlockBeacon()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "beacon";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

	ItemBlock ib = new ItemBlockCyberware(this, "cyberware.tooltip.beacon");
	ib.setRegistryName(name);
	GameRegistry.register(ib);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);

	this.setCreativeTab(Cyberware.creativeTab);
	GameRegistry.registerTileEntity(TileEntityBeacon.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.blocks.add(this);
}
 
Example 3
Source File: BlockRegistry.java    From Logistics-Pipes-2 with MIT License 6 votes vote down vote up
/**
 * Registers all registered Blocks on Startup.
 * Call this in preInit on the Common Proxy
 */
public static void init() {
	//init Blocks
	registry.add(new BlockOreRutile());
	
	for(LPBlockBase block : registry) {

		//Register Block
		GameRegistry.register(block);
		//Register Item of Block
		GameRegistry.register(new ItemBlock(block), block.getRegistryName());
		//Register Ores
		if(!StringUtil.isNullOrWhitespace(block.getOreName()) && !StringUtil.isNullOrEmpty(block.getOreName()))
			OreDictionary.registerOre(block.getOreName(), block);
		
		if(block instanceof BlockOreRutile) {
			addConfiguredWorldgen(block.getDefaultState(), References.RN_ORE_RUTILE, Config.oreRutile);
		}
	}
}
 
Example 4
Source File: BlockComponentBox.java    From Cyberware with MIT License 6 votes vote down vote up
public BlockComponentBox()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "componentBox";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

	ib = new ItemComponentBox(this);
	ib.setRegistryName(name);
	GameRegistry.register(ib);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);

	this.setCreativeTab(Cyberware.creativeTab);
	GameRegistry.registerTileEntity(TileEntityComponentBox.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.items.add(ib);
	
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
 
Example 5
Source File: BlockBeaconLarge.java    From Cyberware with MIT License 6 votes vote down vote up
public BlockBeaconLarge()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "beaconLarge";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

	ItemBlock ib = new ItemBlockCyberware(this, "cyberware.tooltip.beaconLarge");
	ib.setRegistryName(name);
	GameRegistry.register(ib);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);

	this.setCreativeTab(Cyberware.creativeTab);
	GameRegistry.registerTileEntity(TileEntityBeaconLarge.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.blocks.add(this);
}
 
Example 6
Source File: ItemCyberwareBase.java    From Cyberware with MIT License 5 votes vote down vote up
public ItemCyberwareBase(String name, String... subnames)
{
	this.setRegistryName(name);
	GameRegistry.register(this);
	this.setUnlocalizedName(Cyberware.MODID + "." + name);
       
	this.setCreativeTab(Cyberware.creativeTab);
			
	this.subnames = subnames;

	this.setHasSubtypes(this.subnames.length > 0);
	this.setMaxDamage(0);

       CyberwareContent.items.add(this);
}
 
Example 7
Source File: BlockInfestedLeaves.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public BlockInfestedLeaves() {
	super();
	this.setUnlocalizedName("blockInfestedLeaves");
	this.setRegistryName("blockInfestedLeaves");
	GameRegistry.<Block>register(this);
	GameRegistry.register(new ItemBlock(this).setRegistryName("blockInfestedLeaves"));
	this.setDefaultState(
			this.blockState.getBaseState().withProperty(CHECK_DECAY, false).withProperty(DECAYABLE, false));
	this.leavesFancy = true;
}
 
Example 8
Source File: BlockBase.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public BlockBase(Material mat, String name)
{
    super(mat);
    setUnlocalizedName(name);
    setRegistryName(name);
    GameRegistry.register(this);
    GameRegistry.register(new ItemBlock(this).setRegistryName(name));
}
 
Example 9
Source File: TFC_Sounds.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
private static SoundEvent createSound(String s)
{
	ResourceLocation rl = new ResourceLocation(LOCATION + s);
	SoundEvent sound = new SoundEvent(rl);
	GameRegistry.register(sound, rl);
	return sound;
}
 
Example 10
Source File: CrookBase.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public CrookBase(String name, int maxUses)
{
	super(ToolMaterial.WOOD, Sets.newHashSet(new Block[]{}));
	
	this.setUnlocalizedName(name);
	this.setRegistryName(name);
	GameRegistry.<Item>register(this);
	this.setMaxDamage(maxUses);

}
 
Example 11
Source File: ItemDiamondApple.java    From Production-Line with MIT License 5 votes vote down vote up
public ItemDiamondApple() {
    super(1000, 10F, false);
    this.setUnlocalizedName(ProductionLine.MOD_ID + ".diamond_apple");
    this.setCreativeTab(ProductionLine.creativeTabPL);
    this.setHasSubtypes(true);
    this.setAlwaysEdible();
    GameRegistry.<Item>register(this, new ResourceLocation(ProductionLine.MOD_ID, "diamond_apple"));
}
 
Example 12
Source File: ItemSwordCyberware.java    From Cyberware with MIT License 5 votes vote down vote up
public ItemSwordCyberware(String name, ToolMaterial material)
{
	super(material);
	
	this.setRegistryName(name);
	GameRegistry.register(this);
	this.setUnlocalizedName(Cyberware.MODID + "." + name);
       
	this.setCreativeTab(Cyberware.creativeTab);
			
       CyberwareContent.items.add(this);
}
 
Example 13
Source File: ItemNeuropozyne.java    From Cyberware with MIT License 5 votes vote down vote up
public ItemNeuropozyne(String name)
{
	this.setRegistryName(name);
	GameRegistry.register(this);
	this.setUnlocalizedName(Cyberware.MODID + "." + name);
	
	this.setCreativeTab(Cyberware.creativeTab);
			
	this.setMaxDamage(0);

	CyberwareContent.items.add(this);
}
 
Example 14
Source File: ItemOre.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public ItemOre(Ore ore) {
	super();

	this.ore = ore;
	registerIngot = ore.getResult() == null;
	setUnlocalizedName(ExNihiloAdscensio.MODID + ".ore."+ore.getName());
	setRegistryName("itemOre"+StringUtils.capitalize(ore.getName()));
	setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	setHasSubtypes(true);
	GameRegistry.<Item>register(this);
}
 
Example 15
Source File: BlockPL.java    From Production-Line with MIT License 5 votes vote down vote up
public BlockPL(Material material, String name) {
    super(material);
    this.setUnlocalizedName(MOD_ID + ".block." + name);
    this.setCreativeTab(creativeTabPL);
    this.internalName = name;
    // TODO register after construction
    GameRegistry.<Block>register(this, new ResourceLocation(MOD_ID, name));
    this.registerItemBlock();
    if (this instanceof IOrientableBlock) {
        this.setDefaultState(this.blockState.getBaseState().withProperty(PROPERTY_FACING, EnumFacing.NORTH));
    }
    PLConfig.gtiLogger.log(Level.INFO, name + ":" + Integer.toString(Block.getIdFromBlock(this)));
}
 
Example 16
Source File: BlockMisc.java    From Production-Line with MIT License 4 votes vote down vote up
@Override
protected void registerItemBlock() {
    GameRegistry.<Item>register(new ItemBlockPL(this), this.getRegistryName());
}
 
Example 17
Source File: ENEnchantments.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public static void init() {
    GameRegistry.register(efficiency);
    GameRegistry.register(fortune);
    GameRegistry.register(luckOfTheSea);
}
 
Example 18
Source File: ItemRegistry.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
/**
 * Initialize all Items for preInit
 * Call this in preInit on the Common Proxy
 */
public static void init(){
	//Init Items
	shard_rutile = new ShardRutile();
	ingot_titanium = new IngotTitanium();
	part_fpga = new PartFPGA();
	part_order = new PartOrderProc();
	part_sink = new PartSinkProc();
	part_extract = new PartExtractProc();
	part_provider = new PartProviderProc();
	module_base = new ItemModuleBase();
	module_order = new ItemModuleOrder();
	module_provide = new ItemModuleProvide();
	module_sink = new ItemModuleSink();
	module_sort = new ItemModuleSort();
	module_extract = new ItemModuleExtract();
	item_wrench = new ItemWrench();
	
	registry.add(shard_rutile);
	registry.add(ingot_titanium);
	registry.add(part_fpga);
	registry.add(part_order);
	registry.add(part_extract);
	registry.add(part_provider);
	registry.add(part_sink);
	registry.add(module_provide);
	registry.add(module_sink);
	registry.add(module_sort);
	registry.add(module_order);
	registry.add(module_extract);
	registry.add(item_wrench);
	
	
	//Register Items
	for(LPItemBase item : registry) {
		//Register Item
		GameRegistry.register(item);
		//Register Ordedict Names
		if(!StringUtil.isNullOrWhitespace(item.getOreName()) && !StringUtil.isNullOrEmpty(item.getOreName()))
			OreDictionary.registerOre(item.getOreName(), item);
	}
}
 
Example 19
Source File: BlockSurgeryTable.java    From Cyberware with MIT License 3 votes vote down vote up
public BlockSurgeryTable()
{
	
	String name = "surgeryTable";
	
	this.setRegistryName(name);
	GameRegistry.register(this);
	
	this.setUnlocalizedName(Cyberware.MODID + "." + name);

	GameRegistry.registerTileEntity(TileEntitySurgery.class, Cyberware.MODID + ":" + name);
	
	MinecraftForge.EVENT_BUS.register(this);
}
 
Example 20
Source File: BlockPL.java    From Production-Line with MIT License 2 votes vote down vote up
/**
 * Register item block.
 * Forge recommend register item block separately.
 * {@link GameRegistry#register(IForgeRegistryEntry, ResourceLocation)}
  */
protected void registerItemBlock() {
    GameRegistry.<Item>register(new ItemBlock(this), new ResourceLocation(MOD_ID, this.internalName));
}