Пример #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);
    }
  }