Java Code Examples for net.minecraftforge.fml.common.registry.GameRegistry

The following examples show how to use net.minecraftforge.fml.common.registry.GameRegistry. These examples are extracted from open source projects. 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 Project: EmergingTechnology   Source File: CommonProxy.java    License: MIT License 6 votes vote down vote up
public void preInit(FMLPreInitializationEvent e) {
    RegistrationHandler.registerFluids();

    EmergingTechnologyConfig.preInit();
    ModLoader.preInit();

    GameRegistry.registerWorldGenerator(OreGenerator.instance, 10);
    MinecraftForge.EVENT_BUS.register(OreGenerator.instance);

    ModBulbProvider.preInit(e);
    ModMediumProvider.preInit(e);
    ModFluidProvider.preInit(e);
    ModTissueProvider.preInit(e);

    CraftTweakerHelper.preInit();

    PacketHandler.registerMessages(EmergingTechnology.MODID);
}
 
Example 2
public void initializeRegistry() {
    GTLog.logger.info("Initializing ore generation registry...");
    registerShapeGenerator("ellipsoid", EllipsoidGenerator::new);
    registerShapeGenerator("sphere", SphereGenerator::new);
    registerShapeGenerator("plate", PlateGenerator::new);
    registerShapeGenerator("single", SingleBlockGenerator::new);
    registerBlockFiller("simple", SimpleBlockFiller::new);
    registerBlockFiller("ignore_bedrock", () -> new BlacklistedBlockFiller(Lists.newArrayList(Blocks.BEDROCK.getDefaultState())));
    registerVeinPopulator("surface_rock", SurfaceRockPopulator::new);
    registerVeinPopulator("fluid_spring", FluidSpringPopulator::new);
    registerVeinPopulator("surface_block", SurfaceBlockPopulator::new);

    WorldGeneratorImpl worldGenerator = new WorldGeneratorImpl();
    GameRegistry.registerWorldGenerator(worldGenerator, 1);
    MinecraftForge.ORE_GEN_BUS.register(worldGenerator);
    try {
        reinitializeRegisteredVeins();
    } catch (IOException | RuntimeException exception) {
        GTLog.logger.fatal("Failed to initialize worldgen registry.", exception);
    }
}
 
Example 3
Source Project: YouTubeModdingTutorial   Source File: ModBlocks.java    License: MIT License 6 votes vote down vote up
public static void register(IForgeRegistry<Block> registry) {
    registry.register(new BlockFastFurnace());
    GameRegistry.registerTileEntity(TileFastFurnace.class, MyMod.MODID + "_fast_furnace");

    registry.register(new BlockGenerator());
    GameRegistry.registerTileEntity(TileGenerator.class, MyMod.MODID + "_generator");

    registry.register(new BlockPuzzle());
    GameRegistry.registerTileEntity(TilePuzzle.class, MyMod.MODID + "_puzzle");

    registry.register(new BlockTank());
    GameRegistry.registerTileEntity(TileTank.class, MyMod.MODID + "_tank");

    registry.register(new BlockFloader());
    GameRegistry.registerTileEntity(TileFloader.class, MyMod.MODID + "_floader");

    registry.register(new BlockSuperchest());
    GameRegistry.registerTileEntity(TileSuperchest.class, MyMod.MODID + "_superchest");

    registry.register(new BlockSuperchestPart());
    GameRegistry.registerTileEntity(TileSuperchestPart.class, MyMod.MODID + "_superchestpart");

    registry.register(new BlockFancyOre());
    registry.register(new BlockFload());
}
 
Example 4
private void registerNovaBlock(BlockFactory blockFactory) {
	FWBlock blockWrapper = new FWBlock(blockFactory);
	blockFactoryMap.put(blockFactory, blockWrapper);
	String blockId = blockFactory.getID();
	if (!blockId.contains(":"))
		blockId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + blockId;
	GameRegistry.registerBlock(blockWrapper, FWItemBlock.class, blockId);
	NovaMinecraft.proxy.postRegisterBlock(blockWrapper);

	if (blockWrapper.dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
		//Add into creative tab
		Category category = blockWrapper.dummy.components.get(Category.class);
		blockWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, blockWrapper));
	}

	Game.logger().info("Registered block: {}", blockFactory.getID());
}
 
Example 5
Source Project: Cyberware   Source File: BlockBlueprintArchive.java    License: MIT License 6 votes vote down vote up
public BlockBlueprintArchive()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "blueprintArchive";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

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

	this.setCreativeTab(Cyberware.creativeTab);
	GameRegistry.registerTileEntity(TileEntityBlueprintArchive.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.blocks.add(this);
	
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
}
 
Example 6
Source Project: Cyberware   Source File: BlockBeaconLarge.java    License: 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 7
Source Project: Cyberware   Source File: BlockScanner.java    License: MIT License 6 votes vote down vote up
public BlockScanner()
{
	super(Material.IRON);
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "scanner";
	
	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(TileEntityScanner.class, Cyberware.MODID + ":" + name);
	
	CyberwareContent.blocks.add(this);
}
 
Example 8
Source Project: Cyberware   Source File: BlockBeacon.java    License: 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 9
Source Project: Cyberware   Source File: BlockSurgery.java    License: 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 10
Source Project: Production-Line   Source File: BlockMachine.java    License: MIT License 6 votes vote down vote up
public BlockMachine() {
    super(Material.IRON, "machine");
    this.setHardness(2.0F);
    this.setDefaultState(this.blockState.getBaseState().withProperty(PROPERTY_FACING, EnumFacing.NORTH)
            .withProperty(PROPERTY_ACTIVE, false));
    for (Type t : Type.values()) {
        GameRegistry.registerTileEntity(t.tileClass, t.getName());
    }

    PLBlocks.carbonizeFurnace = new ItemStack(this);
    PLBlocks.heatDryer = new ItemStack(this, 1, 1);
    PLBlocks.evsu = new ItemStack(this, 1, 2);
    PLBlocks.cseu = new ItemStack(this, 1, 3);
    PLBlocks.parallelSpaceSU = new ItemStack(this, 1, 4);
    PLBlocks.advSolar = new ItemStack(this, 1, 5);
    PLBlocks.fluidKineticGenerator = new ItemStack(this, 1, 6);
    PLBlocks.packager = new ItemStack(this, 1, 7);
}
 
Example 11
Source Project: Logistics-Pipes-2   Source File: PipeRegistry.java    License: MIT License 6 votes vote down vote up
public static void init() {
	network_core = new NetworkCore();
	pipe_basic = new PipeBasic();
	pipe_routed = new PipeRouted();
	pipe_blocking = new PipeBlocking();
	pipe_chassis_mki = new PipeChassisMkI();
	
	
	registry.add(network_core);
	registry.add(pipe_basic);
	registry.add(pipe_routed);
	registry.add(pipe_blocking);
	registry.add(pipe_chassis_mki);
	
	for(BlockGenericPipe pipe : registry) {
		GameRegistry.register(pipe);
		
		GameRegistry.register(new ItemBlock(pipe), pipe.getRegistryName());
	}
	
	
}
 
Example 12
Source Project: Signals   Source File: BlockTeleportRail.java    License: GNU General Public License v3.0 5 votes vote down vote up
public BlockTeleportRail(){
    super(false);
    setUnlocalizedName("teleport_rail");
    setCreativeTab(CreativeTabSignals.getInstance());
    ModBlocks.registerBlock(this);
    GameRegistry.registerTileEntity(TileEntityTeleportRail.class, "signals:teleport_rail");
}
 
Example 13
Source Project: TofuCraftReload   Source File: TofuMain.java    License: MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    proxy.preInit(event);

    logger = event.getModLog();

    TofuEntityRegister.entitySpawn();

    TofuCompat.preInit();

    GameRegistry.registerWorldGenerator(new TofuOreGenerator(), 0);

    MapGenStructureIO.registerStructure(MapGenTofuVillage.Start.class,"TofuVillage");
    StructureTofuVillagePieces.registerVillagePieces();
    MapGenStructureIO.registerStructure(StructureTofuMineshaftStart.class,"TofuMineshaft");
    StructureTofuMineshaftPieces.registerStructurePieces();
    MapGenStructureIO.registerStructure(MapGenTofuCastle.Start.class, "TofuCastle");
    TofuCastlePiece.registerTofuCastlePiece();

    NetworkRegistry.INSTANCE.registerGuiHandler(this, new TofuGuiHandler());


    zunda = new DamageSource("zunda") {
        @Override
        public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn) {
            String s = "death.attack.zunda";
            String s1 = s + ".player";

            return new TextComponentString(entityLivingBaseIn.getDisplayName().getFormattedText() + " ").appendSibling(new TextComponentTranslation(s1, new Object[]{entityLivingBaseIn.getDisplayName()}));
        }
    }.setDamageIsAbsolute();

    TOFU_DIMENSION = DimensionType.register("Tofu World", "_tofu", TofuConfig.dimensionID, WorldProviderTofu.class, false);
    DimensionManager.registerDimension(TofuConfig.dimensionID, TOFU_DIMENSION);

    TofuVillages.register();
}
 
Example 14
Source Project: BaseMetals   Source File: Blocks.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
private static BlockDoor createDoor(MetalMaterial metal){
	String name = metal.getName()+"_door";
	BlockDoor block = new BlockMetalDoor(metal);
	block.setRegistryName(BaseMetals.MODID, name);
	block.setUnlocalizedName(BaseMetals.MODID+"."+name);
	GameRegistry.register(block);
	
	ItemBlock itemBlock = new ItemBlock(block);
	itemBlock.setRegistryName(BaseMetals.MODID, name);
	GameRegistry.register(itemBlock);
	
	allBlocks.put(metal.getName()+"_door", block);
	return block;
}
 
Example 15
Source Project: TFC2   Source File: RegistryItemQueue.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void registerItems()
{
	Entry e; 
	while (!listItem.isEmpty())
	{
		e = listItem.pop();
		GameRegistry.register(e.item);

		if(TFC.proxy.isClientSide())
			registerEntry(e);
	}

}
 
Example 16
Source Project: TFC2   Source File: TFCBlocks.java    License: GNU General Public License v3.0 5 votes vote down vote up
private static Block register(Block b, Class<? extends ItemBlock> i)
{
	try 
	{
		GameRegistry.register(b);
		ItemBlock ib = i.getDeclaredConstructor(Block.class).newInstance(b);
		GameRegistry.register(ib, b.getRegistryName());
	} 
	catch (Exception e) 
	{
		e.printStackTrace();
	}
	return b;
}
 
Example 17
@Override
public void onPreInit(FMLPreInitializationEvent e)
{
	GameRegistry.registerTileEntity(TileEntityGnomeCache.class, new ResourceLocation(CommunityGlobals.MOD_ID, "te_gnomecache"));

	if (e.getSide().isClient())
	{
		RenderingRegistry.registerEntityRenderingHandler(EntityGnomeWood.class, RenderGnomeWood::new);
	}
}
 
Example 18
Source Project: BaseMetals   Source File: Recipes.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void initVanillaRecipes(){
	OreDictionary.registerOre("barsIron", Blocks.IRON_BARS);
	OreDictionary.registerOre("bars", Blocks.IRON_BARS);
	OreDictionary.registerOre("doorIron", Items.IRON_DOOR);
	OreDictionary.registerOre("door", Items.IRON_DOOR);
	OreDictionary.registerOre("doorWood", Items.OAK_DOOR);
	OreDictionary.registerOre("doorWood", Items.JUNGLE_DOOR);
	OreDictionary.registerOre("doorWood", Items.SPRUCE_DOOR);
	OreDictionary.registerOre("doorWood", Items.DARK_OAK_DOOR);
	OreDictionary.registerOre("doorWood", Items.BIRCH_DOOR);
	OreDictionary.registerOre("doorWood", Items.ACACIA_DOOR);
	OreDictionary.registerOre("door", Items.OAK_DOOR);
	OreDictionary.registerOre("door", Items.JUNGLE_DOOR);
	OreDictionary.registerOre("door", Items.SPRUCE_DOOR);
	OreDictionary.registerOre("door", Items.DARK_OAK_DOOR);
	OreDictionary.registerOre("door", Items.BIRCH_DOOR);
	OreDictionary.registerOre("door", Items.ACACIA_DOOR);
	
	CrusherRecipeRegistry.addNewCrusherRecipe("oreIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,2));
	CrusherRecipeRegistry.addNewCrusherRecipe("blockIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,9));
	CrusherRecipeRegistry.addNewCrusherRecipe("ingotIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,1));
	CrusherRecipeRegistry.addNewCrusherRecipe("oreGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,2));
	CrusherRecipeRegistry.addNewCrusherRecipe("blockGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,9));
	CrusherRecipeRegistry.addNewCrusherRecipe("ingotGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,1));
	GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(cyano.basemetals.init.Items.iron_nugget,9), new ItemStack(Items.IRON_INGOT)));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.IRON_INGOT), "xxx","xxx","xxx",'x',cyano.basemetals.init.Items.iron_nugget));
	GameRegistry.addSmelting(cyano.basemetals.init.Items.iron_powder, new ItemStack(Items.IRON_INGOT), 0f);
	GameRegistry.addSmelting(cyano.basemetals.init.Items.gold_powder, new ItemStack(Items.GOLD_INGOT), 0f);
	CrusherRecipeRegistry.addNewCrusherRecipe("oreCoal", new ItemStack(cyano.basemetals.init.Items.carbon_powder,2));
	CrusherRecipeRegistry.addNewCrusherRecipe("blockCoal", new ItemStack(cyano.basemetals.init.Items.carbon_powder,9));
	CrusherRecipeRegistry.addNewCrusherRecipe(new ItemStack(Items.COAL,1,0), new ItemStack(cyano.basemetals.init.Items.carbon_powder,1));
	CrusherRecipeRegistry.addNewCrusherRecipe(new ItemStack(Items.COAL,1,1), new ItemStack(cyano.basemetals.init.Items.carbon_powder,1));
	GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.COAL_BLOCK), "xxx","xxx","xxx",'x',cyano.basemetals.init.Items.carbon_powder));
}
 
Example 19
public static Block getBlockByName(String name) {
    ResourceLocation blockName = new ResourceLocation(name);
    Block block = GameRegistry.findRegistry(Block.class).getValue(blockName);
    if (block == null)
        throw new IllegalArgumentException("Block with identifier " + blockName + " not found!");
    return block;
}
 
Example 20
Source Project: GT-Classic   Source File: GTRecipe.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void initProcessing() {
	GameRegistry.addSmelting(GTMaterialGen.get(GTBlocks.oreSheldonite, 1), (GTMaterialGen.getIngot(GTMaterial.Platinum, 1)), 0.1F);
	maceratorUtil("oreBauxite", 1, GTMaterialGen.getDust(GTMaterial.Bauxite, 4));
	maceratorUtil("oreIridium", 1, GTMaterialGen.getDust(GTMaterial.Iridium, 2));
	TileEntityMacerator.addRecipe(GTMaterialGen.getIc2(Ic2Items.iridiumOre, 1), GTMaterialGen.getDust(GTMaterial.Iridium, 1));
	TileEntityMacerator.addRecipe("stoneMarble", 1, GTMaterialGen.getDust(GTMaterial.Calcite, 1));
	TileEntityMacerator.addRecipe("stoneLimestone", 1, GTMaterialGen.getDust(GTMaterial.Calcite, 1));
	TileEntityMacerator.addRecipe("stoneBasalt", 1, GTMaterialGen.getDust(GTMaterial.Basalt, 1));
	TileEntityMacerator.addRecipe(GTMaterialGen.get(Items.FLINT, 1), GTMaterialGen.getDust(GTMaterial.Flint, 1));
	TileEntityMacerator.addRecipe("enderpearl", 1, GTMaterialGen.getDust(GTMaterial.EnderPearl, 1));
	TileEntityMacerator.addRecipe(GTMaterialGen.get(Items.ENDER_EYE, 1), GTMaterialGen.getDust(GTMaterial.EnderEye, 2));
	TileEntityMacerator.addRecipe("gemEmerald", 1, GTMaterialGen.getDust(GTMaterial.Emerald, 1));
	TileEntityMacerator.addRecipe("logWood", 1, GTMaterialGen.getDust(GTMaterial.Wood, 6));
	TileEntityMacerator.addRecipe(GTMaterialGen.get(GTBlocks.oreChid), (GTMaterialGen.getDust(GTMaterial.BrownDye, 1)));
	TileEntityExtractor.addRecipe("oreRuby", 1, GTMaterialGen.getGem(GTMaterial.Ruby, 3), 0.1F);
	TileEntityExtractor.addRecipe("oreSapphire", 1, GTMaterialGen.getGem(GTMaterial.Sapphire, 3), 0.1F);
	TileEntityExtractor.addRecipe(GTMaterialGen.get(GTBlocks.brittleCharcoal), new ItemStack(Items.COAL, 3, 1), 0.1F);
	TileEntityCompressor.addRecipe("dustEmerald", 1, GTMaterialGen.get(Items.EMERALD, 1));
	TileEntityCompressor.addRecipe("dustCarbon", 8, GTMaterialGen.getIc2(Ic2Items.carbonFiber, 1));
	TileEntityCompressor.addRecipe("dustUranium", 1, GTMaterialGen.getIc2(Ic2Items.uraniumIngot, 1), 0.3F);
	TileEntityCompressor.addRecipe("dustThorium", 1, GTMaterialGen.getIngot(GTMaterial.Thorium, 1));
	ClassicRecipes.fluidGenerator.addEntry(GTMaterialGen.getFluid(GTMaterial.Sodium), 3800, 8);
	ClassicRecipes.fluidGenerator.addEntry(GTMaterialGen.getFluid(GTMaterial.Methane), 3000, 16);
	ClassicRecipes.fluidGenerator.addEntry(GTMaterialGen.getFluid(GTMaterial.Fuel), 4000, 30);
	GTTileTypeFilter.addOreDictFilter("dust", "dustTiny", "dustSmall", "ingot", "ingotHot", "nugget", "plate", "stick", "rod", "gear", "gem", "block", "ore", "crushed", "crushedPurified", "stone", "log", "plank", "treeSapling", "treeLeaves", "dye", "record", "crop", "machine", "circuit", "item");
	if (GTConfig.modcompat.extraTypeFilters != null && GTConfig.modcompat.extraTypeFilters.length > 0
			&& GTConfig.modcompat.extraTypeFilters.length < 64) {
		GTTileTypeFilter.addOreDictFilter(GTConfig.modcompat.extraTypeFilters);
	}
	if (GTConfig.general.addHydrogenAsLiquidFuel) {
		ClassicRecipes.fluidGenerator.addEntry(GTMaterialGen.getFluid(GTMaterial.Hydrogen), 950, 16);
	}
	ItemStack fullCan = GTMaterialGen.get(GTItems.sprayCan);
	NBTTagCompound nbt = StackUtil.getNbtData(fullCan);
	nbt.setInteger("color", 15);
	ClassicRecipes.canningMachine.registerCannerItem(GTMaterialGen.get(GTItems.sprayCanEmpty), new RecipeInputItemStack(GTMaterialGen.getTube(GTMaterial.MagicDye, 1)), fullCan);
}
 
Example 21
private void registerNOVAItem(ItemFactory itemFactory) {
	if (map.containsKey(itemFactory)) {
		// just a safeguard - don't map stuff twice
		return;
	}

	net.minecraft.item.Item itemWrapper;

	Item dummy = itemFactory.build();
	if (dummy instanceof ItemBlock) {
		BlockFactory blockFactory = ((ItemBlock) dummy).blockFactory;
		net.minecraft.block.Block mcBlock = BlockConverter.instance().toNative(blockFactory);
		itemWrapper = net.minecraft.item.Item.getItemFromBlock(mcBlock);
		if (itemWrapper == null) {
			throw new InitializationException("ItemConverter: Missing block: " + itemFactory.getID());
		}
	} else {
		itemWrapper = new FWItem(itemFactory);
	}

	MinecraftItemMapping minecraftItemMapping = new MinecraftItemMapping(itemWrapper, 0);
	map.put(itemFactory, minecraftItemMapping);

	// Don't register ItemBlocks twice
	if (!(dummy instanceof ItemBlock)) {
		NovaMinecraft.proxy.registerItem((FWItem) itemWrapper);
		String itemId = itemFactory.getID();
		if (!itemId.contains(":"))
			itemId = NovaLauncher.instance().flatMap(NovaLauncher::getCurrentMod).map(Mod::id).orElse("nova") + ':' + itemId;
		GameRegistry.registerItem(itemWrapper, itemId);

		if (dummy.components.has(Category.class) && FMLCommonHandler.instance().getSide().isClient()) {
			//Add into creative tab
			Category category = dummy.components.get(Category.class);
			itemWrapper.setCreativeTab(CategoryConverter.instance().toNative(category, itemWrapper));
		}

		Game.logger().info("Registered item: {}", itemFactory.getID());
	}
}
 
Example 22
Source Project: Signals   Source File: BlockBase.java    License: GNU General Public License v3.0 5 votes vote down vote up
public BlockBase(Class<? extends TileEntity> tileClass, String name){
    super(Material.ROCK);
    setUnlocalizedName(name);
    this.tileClass = tileClass;
    GameRegistry.registerTileEntity(tileClass, name);
    setCreativeTab(CreativeTabSignals.getInstance());
    ModBlocks.registerBlock(this);
    setHardness(1);
}
 
Example 23
Source Project: ToroQuest   Source File: BlockToroSpawner.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void initBlock(final RegistryEvent.Register<Block> event) {
	GameRegistry.registerTileEntity(TileEntityToroSpawner.class, NAME);
	INSTANCE = (BlockToroSpawner) new BlockToroSpawner().setUnlocalizedName(NAME);
	INSTANCE.setRegistryName(REGISTRY_NAME);
	event.getRegistry().register(INSTANCE);
	ITEM_INSTANCE = Item.REGISTRY.getObject(new ResourceLocation(ToroQuest.MODID, NAME));
}
 
Example 24
Source Project: Cyberware   Source File: ItemCyberwareBase.java    License: 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 25
Source Project: Cyberware   Source File: ItemBlueprint.java    License: MIT License 5 votes vote down vote up
public ItemBlueprint(String name)
{
	this.setRegistryName(name);
	GameRegistry.register(this);
	this.setUnlocalizedName(Cyberware.MODID + "." + name);
	
	this.setCreativeTab(Cyberware.creativeTab);
			
	this.setHasSubtypes(true);
	this.setMaxStackSize(1);

	CyberwareContent.items.add(this);
}
 
Example 26
Source Project: Cyberware   Source File: ItemNeuropozyne.java    License: 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 27
Source Project: Cyberware   Source File: ItemSwordCyberware.java    License: 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 28
Source Project: Cyberware   Source File: BlockBeaconPost.java    License: MIT License 5 votes vote down vote up
public BlockBeaconPost()
{
	super(Material.IRON);
	
	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "radioPost";
	
	this.setRegistryName(name);
	GameRegistry.register(this);
	

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

	this.setCreativeTab(Cyberware.creativeTab);
	
	CyberwareContent.blocks.add(this);
	
	GameRegistry.registerTileEntity(TileEntityBeaconPost.class, Cyberware.MODID + ":" + name);
	GameRegistry.registerTileEntity(TileEntityBeaconPostMaster.class, Cyberware.MODID + ":" + name + "_master");

	this.setDefaultState(this.blockState.getBaseState()
			.withProperty(TRANSFORMED, 0)
			.withProperty(NORTH, Boolean.valueOf(false))
			.withProperty(EAST, Boolean.valueOf(false))
			.withProperty(SOUTH, Boolean.valueOf(false))
			.withProperty(WEST, Boolean.valueOf(false)));
}
 
Example 29
Source Project: NOVA-Core   Source File: CommonProxy.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void preInit(FMLPreInitializationEvent evt) {
	GameRegistry.registerTileEntity(FWTile.class, "novaTile");
	GameRegistry.registerTileEntity(FWTileUpdater.class, "novaTileUpdater");
	int globalUniqueEntityId = EntityRegistry.findGlobalUniqueEntityId();
	EntityRegistry.registerGlobalEntityID(FWEntity.class, "novaEntity", globalUniqueEntityId);
	EntityRegistry.registerModEntity(FWEntity.class, "novaEntity", globalUniqueEntityId, NovaMinecraft.instance, 64, 20, true);
}
 
Example 30
Source Project: Cyberware   Source File: BlockEngineeringTable.java    License: MIT License 5 votes vote down vote up
public BlockEngineeringTable()
{
	super(Material.IRON);
	this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(HALF, EnumEngineeringHalf.LOWER));

	setHardness(5.0F);
	setResistance(10.0F);
	setSoundType(SoundType.METAL);
	
	String name = "engineeringTable";
	
	this.setRegistryName(name);
	GameRegistry.register(this);

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

	ib.setCreativeTab(Cyberware.creativeTab);
	
	GameRegistry.registerTileEntity(TileEntityEngineeringTable.class, Cyberware.MODID + ":" + name);
	GameRegistry.registerTileEntity(TileEntityEngineeringDummy.class, Cyberware.MODID + ":" + name + "Dummy");

	CyberwareContent.items.add(ib);
}