Пример #1
0
 public <BLOCK extends Block> BLOCK newBlock(
     String name, Class<BLOCK> cls, Class itemClass, String title) {
   try {
     int id = config.getBlock(name, 4095).getInt();
     Constructor<BLOCK> ctor = cls.getConstructor(int.class);
     BLOCK block = ctor.newInstance(id);
     String qualName = assetKey + ":" + name;
     block.setUnlocalizedName(qualName);
     // block.func_111022_d(qualName.toLowerCase()); // Set default icon name
     // block.func_111022_d(qualName); // Set default icon name
     block.setTextureName(qualName); // Set default icon name
     GameRegistry.registerBlock(block, itemClass);
     if (title != null) {
       LanguageRegistry.addName(block, title);
       if (clientSide) {
         // System.out.printf("%s: BaseMod.newBlock: %s: creative tab = %s\n",
         //	this, block.getUnlocalizedName(), block.getCreativeTabToDisplayOn());
         if (block.getCreativeTabToDisplayOn() == null && !title.startsWith("["))
           block.setCreativeTab(CreativeTabs.tabMisc);
       }
     }
     if (block instanceof IBlock) registeredBlocks.add((IBlock) block);
     return block;
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Пример #2
0
 public static Block addBlock(String name, Block block) {
   // System.out.printf("%s: Adding block %s id %s\n", modName, name,
   // block.blockID);
   block.setUnlocalizedName("gcewing." + idToName.get(block.blockID));
   GameRegistry.registerBlock(block);
   LanguageRegistry.addName(block, name);
   return block;
 }
Пример #3
0
  @Override
  public void registerBlocks() {
    GameRegistry.registerBlock(saltOre, "saltOre");
    GameRegistry.registerBlock(platinumOre, "platinumOre");
    GameRegistry.registerBlock(leadOre, "leadOre");
    GameRegistry.registerBlock(cinnabarOre, "cinnabarOre");
    GameRegistry.registerBlock(carobbiiteOre, "carobiiteOre");

    TickRegistry.registerScheduledTickHandler(new ScheduledTickHandler(), Side.SERVER);
    GameRegistry.registerTileEntity(TileLabBench.class, "LabBench");
  }
Пример #4
0
 public static void addSmeltingRecipe(Item product, int qty, Block input) {
   GameRegistry.addSmelting(input.blockID, new ItemStack(product, qty), 0);
 }
Пример #5
0
 public static void addShapelessRecipe(Item product, int qty, Object... params) {
   GameRegistry.addShapelessRecipe(new ItemStack(product, qty), params);
 }
Пример #6
0
 public static void addRecipe(Block product, int qty, Object... params) {
   GameRegistry.addRecipe(new ItemStack(product, qty), params);
 }
Пример #7
0
 void registerTileEntities() {
   GameRegistry.registerTileEntity(TEFloodlightBeam.class, "gcewing.FloodlightBeam");
 }
Пример #8
0
  @Handler
  public void preInit(FMLPreInitializationEvent event) {
    proxy.preInit();

    MinecraftForge.EVENT_BUS.register(new TinkerArmorEvents());
    FMLCommonHandler.instance().bus().register(new ArmorAbilities());

    TinkerArmor.dryingRack = new DryingRack().setBlockName("Armor.DryingRack");
    GameRegistry.registerBlock(TinkerArmor.dryingRack, "Armor.DryingRack");
    GameRegistry.registerTileEntity(DryingRackLogic.class, "Armor.DryingRack");
    TinkerArmor.diamondApple = new DiamondApple().setUnlocalizedName("tconstruct.apple.diamond");
    GameRegistry.registerItem(TinkerArmor.diamondApple, "diamondApple");
    boolean foodOverhaul = false;
    if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food")) {
      foodOverhaul = true;
    }

    TinkerArmor.jerky = new Jerky(foodOverhaul).setUnlocalizedName("tconstruct.jerky");
    GameRegistry.registerItem(TinkerArmor.jerky, "jerky");

    // Wearables
    // heavyHelmet = new TArmorBase(PHConstruct.heavyHelmet,
    // 0).setUnlocalizedName("tconstruct.HeavyHelmet");
    TinkerArmor.heartCanister = new HeartCanister().setUnlocalizedName("tconstruct.canister");
    // heavyBoots = new TArmorBase(PHConstruct.heavyBoots,
    // 3).setUnlocalizedName("tconstruct.HeavyBoots");
    // glove = new
    // Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
    TinkerArmor.knapsack = new Knapsack().setUnlocalizedName("tconstruct.storage");
    // GameRegistry.registerItem(TRepo.heavyHelmet, "heavyHelmet");
    GameRegistry.registerItem(TinkerArmor.heartCanister, "heartCanister");
    // GameRegistry.registerItem(TRepo.heavyBoots, "heavyBoots");
    // GameRegistry.registerItem(TRepo.glove, "glove");
    GameRegistry.registerItem(TinkerArmor.knapsack, "knapsack");

    LiquidCasting basinCasting = TConstruct.getBasinCasting();
    TinkerArmor.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] {1, 2, 2, 1}, 3);
    TinkerArmor.helmetWood =
        new ArmorBasic(TinkerArmor.materialWood, 0, "wood")
            .setUnlocalizedName("tconstruct.helmetWood");
    TinkerArmor.chestplateWood =
        new ArmorBasic(TinkerArmor.materialWood, 1, "wood")
            .setUnlocalizedName("tconstruct.chestplateWood");
    TinkerArmor.leggingsWood =
        new ArmorBasic(TinkerArmor.materialWood, 2, "wood")
            .setUnlocalizedName("tconstruct.leggingsWood");
    TinkerArmor.bootsWood =
        new ArmorBasic(TinkerArmor.materialWood, 3, "wood")
            .setUnlocalizedName("tconstruct.bootsWood");
    GameRegistry.registerItem(TinkerArmor.helmetWood, "helmetWood");
    GameRegistry.registerItem(TinkerArmor.chestplateWood, "chestplateWood");
    GameRegistry.registerItem(TinkerArmor.leggingsWood, "leggingsWood");
    GameRegistry.registerItem(TinkerArmor.bootsWood, "bootsWood");
    TConstructRegistry.addItemStackToDirectory(
        "diamondApple", new ItemStack(TinkerArmor.diamondApple, 1, 0));

    TConstructRegistry.addItemStackToDirectory(
        "canisterEmpty", new ItemStack(TinkerArmor.heartCanister, 1, 0));
    TConstructRegistry.addItemStackToDirectory(
        "miniRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 1));
    TConstructRegistry.addItemStackToDirectory(
        "canisterRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 2));

    travelGoggles =
        (TravelGear) new TravelGear(ArmorPart.Head).setUnlocalizedName("tconstruct.travelgoggles");
    travelVest =
        (TravelGear) new TravelGear(ArmorPart.Chest).setUnlocalizedName("tconstruct.travelvest");
    travelWings = (TravelGear) new TravelWings().setUnlocalizedName("tconstruct.travelwings");
    travelBoots =
        (TravelGear) new TravelGear(ArmorPart.Feet).setUnlocalizedName("tconstruct.travelboots");
    travelGlove = (AccessoryCore) new TravelGlove().setUnlocalizedName("tconstruct.travelgloves");
    travelBelt = (AccessoryCore) new TravelBelt().setUnlocalizedName("tconstruct.travelbelt");
    GameRegistry.registerItem(travelGoggles, "travelGoggles");
    GameRegistry.registerItem(travelVest, "travelVest");
    GameRegistry.registerItem(travelWings, "travelWings");
    GameRegistry.registerItem(travelBoots, "travelBoots");
    GameRegistry.registerItem(travelGlove, "travelGlove");
    GameRegistry.registerItem(travelBelt, "travelBelt");
  }
Пример #9
0
  private void craftingTableRecipes() {

    // Armor Recipes
    Object[] helm = new String[] {"www", "w w"};
    Object[] chest = new String[] {"w w", "www", "www"};
    Object[] pants = new String[] {"www", "w w", "w w"};
    Object[] shoes = new String[] {"w w", "w w"};
    GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.helmetWood, helm, 'w', "logWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.chestplateWood, chest, 'w', "logWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.leggingsWood, pants, 'w', "logWood"));
    GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.bootsWood, shoes, 'w', "logWood"));

    // Accessories
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
    // GameRegistry.addRecipe(new ShapedOreRecipe(new
    // ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#',
    // "ingotNaturalAluminum"));
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            new ItemStack(TinkerArmor.heartCanister, 1, 0),
            " # ",
            "#B#",
            " # ",
            '#',
            "ingotTin",
            'B',
            Items.bone));

    GameRegistry.addRecipe(
        new ItemStack(TinkerArmor.diamondApple),
        " d ",
        "d#d",
        " d ",
        'd',
        new ItemStack(Items.diamond),
        '#',
        new ItemStack(Items.apple));
    GameRegistry.addShapelessRecipe(
        new ItemStack(TinkerArmor.heartCanister, 1, 2),
        new ItemStack(TinkerArmor.diamondApple),
        new ItemStack(TinkerTools.materials, 1, 8),
        new ItemStack(TinkerArmor.heartCanister, 1, 0),
        new ItemStack(TinkerArmor.heartCanister, 1, 1));
    GameRegistry.addShapelessRecipe(
        new ItemStack(TinkerArmor.heartCanister, 1, 1),
        new ItemStack(TinkerArmor.heartCanister, 1, 3));
    GameRegistry.addShapelessRecipe(
        new ItemStack(TinkerArmor.heartCanister, 1, 4),
        new ItemStack(TinkerArmor.heartCanister, 1, 2),
        new ItemStack(TinkerArmor.heartCanister, 1, 3),
        new ItemStack(Items.golden_apple, 1, 1));
    // GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new
    // ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 4), new
    // ItemStack(heartCanister, 1, 5));

    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            new ItemStack(TinkerArmor.knapsack, 1, 0),
            "###",
            "rmr",
            "###",
            '#',
            new ItemStack(Items.leather),
            'r',
            new ItemStack(TinkerTools.toughRod, 1, 2),
            'm',
            "ingotGold"));
    ItemStack aluBrass = new ItemStack(TinkerTools.materials, 1, 14);
    GameRegistry.addRecipe(
        new ItemStack(TinkerArmor.knapsack, 1, 0),
        "###",
        "rmr",
        "###",
        '#',
        new ItemStack(Items.leather),
        'r',
        new ItemStack(TinkerTools.toughRod, 1, 2),
        'm',
        aluBrass);
    // Drying Rack Recipes
    GameRegistry.addRecipe(
        new ShapedOreRecipe(new ItemStack(TinkerArmor.dryingRack, 1, 0), "bbb", 'b', "slabWood"));

    // Temporary recipes
    ItemStack leather = new ItemStack(Items.leather);
    ItemStack glass = new ItemStack(Blocks.glass);
    ItemStack string = new ItemStack(Items.string);
    GameRegistry.addShapedRecipe(
        travelGoggles.getDefaultItem(),
        "# #",
        "q#q",
        "g g",
        '#',
        leather,
        'q',
        glass,
        'g',
        new ItemStack(Items.gold_ingot));
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            travelWings.getDefaultItem(),
            "g g",
            "i#i",
            "i i",
            '#',
            Items.ender_pearl,
            'g',
            Items.gold_ingot,
            'i',
            "ingotBronze"));
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            travelVest.getDefaultItem(),
            "#w#",
            "#i#",
            "#w#",
            '#',
            leather,
            'i',
            "ingotAluminum",
            'w',
            new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            travelBoots.getDefaultItem(),
            "#s#",
            "#i#",
            "#s#",
            '#',
            leather,
            's',
            string,
            'i',
            "ingotAluminum"));
    GameRegistry.addShapedRecipe(travelGlove.getDefaultItem(), "  #", "###", " ##", '#', leather);
    GameRegistry.addRecipe(
        new ShapedOreRecipe(
            travelBelt.getDefaultItem(),
            "###",
            "ici",
            "###",
            '#',
            leather,
            'c',
            new ItemStack(Blocks.chest),
            'i',
            "ingotAluminum"));
  }
Пример #10
0
 @Override
 public void registerItems() {
   GameRegistry.registerItem(CompoundMetaItem, CompoundMetaItem.getItemName());
   MinecraftForgeClient.registerItemRenderer(CompoundMetaItem.itemID, new ItemCompoundRenderer());
 }
Пример #11
0
 public void newSmeltingRecipe(Item product, int qty, Item input) {
   GameRegistry.addSmelting(input.itemID, new ItemStack(product, qty), 0);
 }
Пример #12
0
 public void newShapelessRecipe(ItemStack product, Object... params) {
   GameRegistry.addRecipe(new ShapelessOreRecipe(product, params));
 }