Exemplo n.º 1
0
  private void addFruitTreesSequence(int i, int leavesTexture, int seedTexture, int subCount) {
    LeavesInfo leaves = leavesList.get(i);
    leaves.leavesBlock = new BlockFruitLeaves(leavesTexture, subCount);
    leaves.leavesBlock.serialNumber = i;
    leaves
        .leavesBlock
        .setBlockName("fruitLeaves" + i)
        .setCreativeTab(creativeTab)
        .setHardness(0.2F)
        .setLightOpacity(1)
        .setStepSound(Block.soundTypeGrass);
    RegistryUtils.registerBlock(leaves.leavesBlock);

    leaves.saplingBlock = new BlockFruitSapling(15, subCount);
    leaves.saplingBlock.serialNumber = i;
    String saplingBlockName = "fruitSapling" + i;
    leaves.saplingBlock.setBlockName(saplingBlockName).setCreativeTab(creativeTab);
    RegistryUtils.registerMultiBlock(
        leaves.saplingBlock,
        ItemBlockFruitSapling.class,
        constructSubNames(treeTypeNames, i, subCount));
    OreDictionary.registerOre("treeSapling", new ItemStack(leaves.saplingBlock, 1, ANY_DMG));
    if (otherMods.isMineFactoryReloadedDetected()) {
      FactoryRegistry.sendMessage("registerFertilizable", leaves.saplingBlock);
      FactoryRegistry.sendMessage("registerPlantable", leaves.saplingBlock);
    }

    leaves.seedsItem = new ItemFruitSeeds(leaves.saplingBlock, seedTexture, subCount);
    RegistryUtils.registerItem(leaves.seedsItem, "treeSeeds" + i);
    leaves.seedsItem.serialNumber = i;
    for (int j = 0; j < subCount; j++) {
      String combinedName = leaves.seedsItem.getUnlocalizedName() + "." + j + ".name";
      LanguageRegistry.instance().addStringLocalization(combinedName, seedsTitles[j + i * 4]);
    }
    if (otherMods.isMineFactoryReloadedDetected()) {
      FactoryRegistry.sendMessage("registerPlantable", leaves.seedsItem);
    }

    // bonemeal event
    MinecraftForge.EVENT_BUS.register(leaves.saplingBlock);
    if (i == 0) {
      leaves.seedsItem.setFirstInSequence();
    }

    if (ModuleManager.isModuleEnabled(technic)) {
      CompostRegister.addStack(leaves.leavesBlock, DEFAULT_BLOCK_COMPOSTING_VALUE);
      CompostRegister.addStack(leaves.saplingBlock, DEFAULT_FRUIT_COMPOSTING_VALUE);
    }
  }
Exemplo n.º 2
0
  private void constructItemsInBushInfo() {
    boolean first = true;
    for (EnumMap.Entry<BushType, BushInfo> entry : bushesList().entrySet()) {
      BushInfo info = entry.getValue();

      Item fruit = constructFruit(info.eatable, info.fruitTexture, info.getFruitLanguageName());
      fruit.setCreativeTab(creativeTab);
      info.itemFruit = fruit;
      if (BushType.isFruit(entry.getKey())) {
        registerFruitItem(fruit);
      }

      Item dropFromPlant = info.product == null ? info.itemFruit : info.product;
      BlockJaffaCrops crops = new BlockJaffaCrops(info.plantTexture, info.lastPhase, info.renderer);
      crops.setBlockName(info.getPlantLanguageName());
      RegistryUtils.registerBlockWithName(crops, info.name);
      info.block = crops;
      if (first) {
        first = false;
        MinecraftForge.EVENT_BUS.register(crops);
      }
      if (otherMods.isMineFactoryReloadedDetected()) {
        FactoryRegistry.sendMessage("registerHarvestable", crops);
        FactoryRegistry.sendMessage("registerFertilizable", crops);
      }
      if (ModuleManager.isModuleEnabled(technic)) {
        CompostRegister.addStack(dropFromPlant, DEFAULT_FRUIT_COMPOSTING_VALUE);
      }

      ItemJaffaSeeds seeds = new ItemJaffaSeeds(info.block, Blocks.farmland);
      RegistryUtils.registerItem(seeds, info.getSeedsLanguageName());
      seeds.setCustomIconIndex(info.seedsTexture);
      if (otherMods.isMineFactoryReloadedDetected()) {
        FactoryRegistry.sendMessage("registerPlantable", seeds);
      }

      info.itemSeeds = seeds;
      if (info.drop == DropsFromGrass) {
        seedsList.add(new ItemStack(seeds));
      }

      crops.setSeeds(seeds);
      crops.setProduct(dropFromPlant);
    }
  }
Exemplo n.º 3
0
  private void installRecipes() {
    addRecipe(
        new ShapelessOreRecipe(
            new ItemStack(getJaffaItem(JaffaItem.lemons)), LEMON, LEMON, LEMON, LEMON));

    addRecipe(
        new ShapelessOreRecipe(
            new ItemStack(getJaffaItem(JaffaItem.oranges)), ORANGE, ORANGE, ORANGE, ORANGE));

    GameRegistry.addShapelessRecipe(
        new ItemStack(getJaffaItem(JaffaItem.plums)),
        new ItemStack(JaffasTrees.itemPlum),
        new ItemStack(JaffasTrees.itemPlum),
        new ItemStack(JaffasTrees.itemPlum),
        new ItemStack(JaffasTrees.itemPlum));

    GameRegistry.addShapelessRecipe(
        new ItemStack(getJaffaItem(JaffaItem.strawberries)),
        new ItemStack(bushesList().get(BushType.Strawberry).itemFruit),
        new ItemStack(bushesList().get(BushType.Strawberry).itemFruit),
        new ItemStack(bushesList().get(BushType.Strawberry).itemFruit),
        new ItemStack(bushesList().get(BushType.Strawberry).itemFruit));
    GameRegistry.addShapelessRecipe(
        new ItemStack(getJaffaItem(JaffaItem.raspberries)),
        new ItemStack(bushesList().get(BushType.Raspberry).itemFruit),
        new ItemStack(bushesList().get(BushType.Raspberry).itemFruit),
        new ItemStack(bushesList().get(BushType.Raspberry).itemFruit),
        new ItemStack(bushesList().get(BushType.Raspberry).itemFruit));

    GameRegistry.addSmelting(
        bushesList().get(BushType.Coffee).itemFruit,
        new ItemStack(getJaffaItem(JaffaItem.coffeeRoasted)),
        0.5F);

    RecipesBoard.addRecipe(
        getFruitStack(BushType.Paprika), new ItemStack(getJaffaItem(JaffaItem.paprikaChopped)));
    RecipesBoard.addRecipe(
        getFruitStack(BushType.Tomato), new ItemStack(getJaffaItem(JaffaItem.tomatoChopped)));

    if (!ModuleManager.isModuleEnabled(technic)) {
      GameRegistry.addRecipe(
          new ItemStack(blockFruitCollector),
          "IDI",
          "DRD",
          "IGI",
          'I',
          new ItemStack(Blocks.iron_block),
          'D',
          new ItemStack(Items.diamond),
          'R',
          new ItemStack(Blocks.redstone_torch),
          'G',
          new ItemStack(Blocks.gold_block));
    }

    installTreeSeedsRecipes();
    BushManager.installSeedRecipes();

    Recipes.addShapelessOreRecipe(
        new ItemStack(itemStick, 4),
        Recipes.WOOD_STICK,
        Recipes.WOOD_STICK,
        Recipes.WOOD_STICK,
        Recipes.WOOD_STICK,
        Items.slime_ball);
    GameRegistry.addRecipe(
        new ItemStack(itemRod), " S ", "ISI", " S ", 'S', itemStick, 'I', Items.iron_ingot);
    GameRegistry.addRecipe(
        new ItemStack(itemFruitPickerHead),
        "III",
        "WWW",
        " W ",
        'I',
        Items.iron_ingot,
        'W',
        new ItemStack(Blocks.wool, 1, ANY_DMG));
    GameRegistry.addRecipe(
        new ItemStack(itemFruitPicker),
        "H ",
        " R",
        'H',
        new ItemStack(itemFruitPickerHead),
        'R',
        new ItemStack(itemRod));

    Recipes.addMalletShapedRecipe(
        new ItemStack(getJaffaItem(JaffaItem.coconutPowder)), new ItemStack(itemCoconut));

    GameRegistry.addShapelessRecipe(
        new ItemStack(getItem(JaffaItem.browniesPastry)),
        getFruitStack(BushType.Peanuts),
        new ItemStack(getItem(JaffaItem.pastrySweet)),
        new ItemStack(getItem(JaffaItem.chocolate)));

    RecipesBoard.addRecipe(
        JaffasTrees.getFruitStack(BushType.Onion), new ItemStack(getItem(JaffaItem.onionSliced)));
    GameRegistry.addShapelessRecipe(
        new ItemStack(getJaffaItem(JaffaItem.bottleKetchup)),
        Items.sugar,
        getJaffaItem(JaffaItem.bottleEmpty),
        getFruitStack(BushType.Tomato),
        getFruitStack(BushType.Tomato));
    GameRegistry.addShapelessRecipe(
        new ItemStack(getItem(JaffaItem.bottleMustard)),
        getItem(JaffaItem.bottleEmpty),
        getFruit(BushType.Mustard),
        getFruit(BushType.Mustard));

    addPieRecipe(
        getFruit(BushType.Strawberry),
        pieStrawberryRaw,
        TilePie.PieType.STRAWBERRY,
        true,
        getItem(jamStrawberry));
    addPieRecipe(
        getFruit(BushType.Raspberry),
        pieRaspberryRaw,
        TilePie.PieType.RASPBERRY,
        true,
        getItem(jamRaspberry));
    addPieRecipe(null, pieVanillaRaw, TilePie.PieType.VANILLA, true, getItem(jamV));
    addPieRecipe(itemPlum, piePlumRaw, TilePie.PieType.PLUM, true, getItem(jamP));

    // new juice recipes
    Juices$.MODULE$.addRecipes();

    GameRegistry.addShapelessRecipe(
        new ItemStack(getItem(peanutsSugar)), Items.sugar, getFruit(BushType.Peanuts));
    GameRegistry.addRecipe(
        new ItemStack(getItem(pepperStuffedRaw)),
        "M",
        "P",
        'M',
        getItem(mincedMeat),
        'P',
        getFruit(BushType.Paprika));

    // raw mutton
    // pea         -> raw lamb with peas => lamb with peas (in tin) | + plate -> lamb with peas
    // (plate) + tin
    // tin
    GameRegistry.addRecipe(
        getItemStack(lambWithPeasInTinRaw),
        " M ",
        "PPP",
        " T ",
        'M',
        getItem(muttonRaw),
        'P',
        getFruit(BushType.Pea),
        'T',
        getItem(cakeTin));
    GameRegistry.addSmelting(getItem(lambWithPeasInTinRaw), getItemStack(lambWithPeasInTin), 5f);
    GameRegistry.addShapelessRecipe(
        getItemStack(lambWithPeas, 3),
        getItemStack(lambWithPeasInTin),
        getItem(plate),
        getItem(plate),
        getItem(plate));
    PersistentItemsCraftingHandler.AddPersistentItemRetuningNonJaffaItem(
        lambWithPeasInTin, false, getItem(cakeTin));

    // beans
    // chopped tomatoes   ->  raw beans with tomato sauce => baked beans with tomato sauce
    // dish
    GameRegistry.addRecipe(
        getItemStack(beansWithTomatoRaw),
        "B",
        "T",
        "D",
        'B',
        getFruit(BushType.Bean),
        'T',
        getItem(tomatoChopped),
        'D',
        getItem(woodenBowl));
    GameRegistry.addSmelting(getItem(beansWithTomatoRaw), getItemStack(beansWithTomato), 3f);

    addRecipe(
        new ShapedOreRecipe(
            getItemStack(tinDuckOrangeRaw),
            "OSO",
            "ODO",
            " T ",
            'D',
            getItem(duckRaw),
            'O',
            ORANGE,
            'S',
            Items.sugar,
            'T',
            getItem(cakeTin)));

    GameRegistry.addSmelting(getItem(tinDuckOrangeRaw), getItemStack(tinDuckOrange), 5f);
    GameRegistry.addShapelessRecipe(
        getItemStack(plateDuckOrange, 3),
        getItemStack(tinDuckOrange),
        getItem(plate),
        getItem(plate),
        getItem(plate));
    PersistentItemsCraftingHandler.AddPersistentItemRetuningNonJaffaItem(
        tinDuckOrange, false, getItem(cakeTin));

    GameRegistry.addShapelessRecipe(
        getItemStack(bananaInChocolate, 2), itemBanana, getItem(chocolate), itemBanana);

    addRecipe(
        new ShapedOreRecipe(
            getItemStack(fruitSalad), "FFF", " B ", 'B', getItem(woodenBowl), 'F', FRUIT));
    addRecipe(
        new ShapedOreRecipe(
            getItemStack(fruitSalad, 3),
            "FFF",
            "FFF",
            "BBB",
            'B',
            getItem(woodenBowl),
            'F',
            FRUIT));

    Recipes.addSoupRecipes(getFruit(BushType.Pea), soupPeaRaw, soupPeaCooked, false);
    Recipes.addSoupRecipes(getFruit(BushType.Tomato), soupTomatoRaw, soupTomatoCooked, false);

    Recipes.addOreRecipe(
        new ItemStack(ContentHolder.blockCoconutLamp, 2),
        "S",
        "C",
        'S',
        Recipes.STRING,
        'C',
        itemCoconut);
  }
Exemplo n.º 4
0
  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");
  }
Exemplo n.º 5
0
  @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");
  }