Пример #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);
    }
  }
Пример #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);
    }
  }
Пример #3
0
  private ItemJaffaBase constructFruit(EatableType type, int textureOffset, String name) {
    ItemJaffaBase res;
    if (type == NotEatable) {
      res = new ItemJaffaBerry();
    } else if (type == EatableNormal) {
      res = (ItemJaffaBase) (new ItemJaffaBerryEatable()).Setup(2, 0.2f);
    } else {
      throw new RuntimeException("unknown eatable type");
    }

    res.setUnlocalizedName(name);
    RegistryUtils.registerItem(res, name);

    res.setCustomIconIndex(textureOffset);
    return res;
  }
Пример #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");
  }