예제 #1
0
파일: JaffasTrees.java 프로젝트: mnn/jaffas
  private void createItems() {
    addFruitTreesSequence(0, 0, 32, 4);
    addFruitTreesSequence(1, 4, 32 + 4, 4);
    addFruitTreesSequence(2, 8, 32 + 4, 1);

    for (int i = 1; i < JaffasTrees.leavesTypesCount + 1; i++) {
      seedsList.add(getTreeSeeds(i));
    }

    itemLemon = constructFruit(NotEatable, 68, "lemon");
    OreDictionary.registerOre(LEMON, itemLemon);
    registerFruitItem(itemLemon);

    itemOrange = constructFruit(EatableNormal, 69, "orange");
    OreDictionary.registerOre(ORANGE, itemOrange);
    registerFruitItem(itemOrange);

    itemPlum = constructFruit(EatableNormal, 70, "plum");
    registerFruitItem(itemPlum);

    itemCoconut = constructFruit(NotEatable, 71, "coconut");
    registerFruitItem(itemCoconut);

    itemBanana = constructFruit(EatableNormal, 72, "banana");
    registerFruitItem(itemBanana);

    registerFruitItem(Items.apple);

    if (ModuleManager.isModuleEnabled(technic)) {
      CompostRegister.addStack(itemLemon, DEFAULT_FRUIT_COMPOSTING_VALUE);
      CompostRegister.addStack(itemOrange, DEFAULT_FRUIT_COMPOSTING_VALUE);
      CompostRegister.addStack(itemPlum, DEFAULT_FRUIT_COMPOSTING_VALUE);
      CompostRegister.addStack(itemCoconut, DEFAULT_FRUIT_COMPOSTING_VALUE);
      CompostRegister.addStack(itemBanana, DEFAULT_FRUIT_COMPOSTING_VALUE);
    }

    constructItemsInBushInfo();

    blockFruitCollector = new BlockFruitCollector();
    GameRegistry.registerBlock(blockFruitCollector, "blockFruitCollector");
    JaffasRegistryHelper.registerTileEntity(TileFruitCollector.class, "fruitcollector");

    itemDebug = new ItemJaffaTreeDebugTool();
    itemDebug.setMaxStackSize(1).setUnlocalizedName("jaffaTreeDebug");
    RegistryUtils.registerItem(itemDebug);

    itemStick = new ItemTrees();
    itemStick.setUnlocalizedName("stickImpregnated");
    itemStick.setCustomIconIndex(160);
    RegistryUtils.registerItem(itemStick);

    itemRod = new ItemTrees();
    itemRod.setUnlocalizedName("rod").setMaxStackSize(1).setMaxDamage(64);
    itemRod.setCustomIconIndex(161);
    RegistryUtils.registerItem(itemRod);

    itemFruitPickerHead = new ItemTrees();
    itemFruitPickerHead.setUnlocalizedName("fruitPickerHead");
    itemFruitPickerHead.setCustomIconIndex(162);
    RegistryUtils.registerItem(itemFruitPickerHead);

    itemFruitPicker = new ItemTrees();
    itemFruitPicker.setUnlocalizedName("fruitPicker").setMaxStackSize(1).setMaxDamage(256);
    itemFruitPicker.setCustomIconIndex(163);
    RegistryUtils.registerItem(itemFruitPicker);

    itemUnknownSeeds = new ItemTrees();
    itemUnknownSeeds.setCustomIconIndex(34);
    itemUnknownSeeds.setInfo("Magnifier is needed for identification");
    RegistryUtils.registerItem(itemUnknownSeeds, "unknownSeeds");

    itemPlantingBagSmall = new ItemBagPlanting(164, 1);
    RegistryUtils.registerItem(itemPlantingBagSmall, "plantingBagSmall");
    itemPlantingBagMedium = new ItemBagPlanting(165, 2);
    RegistryUtils.registerItem(itemPlantingBagMedium, "plantingBagMedium");
    itemPlantingBagBig = new ItemBagPlanting(166, 3);
    RegistryUtils.registerItem(itemPlantingBagBig, "plantingBagBig");

    itemCollectingBag = new ItemBagCollecting(167);
    RegistryUtils.registerItem(itemCollectingBag, "collectingBag");
  }
예제 #2
0
파일: JaffasTrees.java 프로젝트: mnn/jaffas
  @Mod.EventHandler
  @Override
  public void preLoad(FMLPreInitializationEvent event) {
    super.preLoad(event);
    BushManager.populateBushInfo();

    try {
      config.load();

      dummyLeaves = new BlockFruitLeavesDummy();

      debug = config.get(Configuration.CATEGORY_GENERAL, "debug", false).getBoolean(false);
      bonemealingAllowed =
          config.get(Configuration.CATEGORY_GENERAL, "bonemeal", true).getBoolean(true);

      for (int i = 0; i < leavesBlocksAllocated; i++) {
        leavesList.add(new LeavesInfo(i));
      }

      ItemBagPlanting.blackList()
          .loadFromString(
              config
                  .get(
                      Configuration.CATEGORY_GENERAL,
                      "plantingBagBlackList",
                      "",
                      "Planting bag will ignore these items. Format of item (separated by ',' or ';'): <id>[:meta]")
                  .getString());
      ItemBagPlanting.blackList().printToLog(Log);
      TileFruitCollector.fruitCollectorRange =
          config.get(Configuration.CATEGORY_GENERAL, "fruitCollectorRange", 16).getInt();
    } catch (Exception e) {
      FMLLog.log(Level.FATAL, e, "Mod Jaffas (trees) can't read config file.");
    } finally {
      config.save();
    }

    if (!ModuleManager.isModuleEnabled(ModulesEnum.trees)) return;

    creativeTab = new JaffaCreativeTab("jaffas.trees");
    guiHandler = new GuiHandlerTrees();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);

    JaffasRegistryHelper.registerTileEntity(TileFruitLeaves.class, "fruitLeaves");
    JaffasRegistryHelper.registerTileEntity(TileJaffaCrops.class, "jaffaCrops");

    CompostRegister.init();
    createItems();

    MinecraftForge.addGrassSeed(new ItemStack(itemUnknownSeeds), SEEDS_WEIGHT);

    installRecipes();

    // texture stuff
    proxy.registerRenderThings();

    registerForestryStuff();

    creativeTab.setup(ItemManager.getItem(JaffaItem.oranges));
    LanguageRegistry.instance()
        .addStringLocalization("itemGroup.jaffas.trees", "en_US", "Jaffas and more! Trees");
  }