use of forestry.farming.logic.farmables.FarmableVanillaMushroom in project ForestryMC by ForestryMC.
the class ModuleFarming method preInit.
@Override
public void preInit() {
ItemRegistryCore coreItems = ModuleCore.getItems();
BlockRegistryFarming blocks = getBlocks();
MinecraftForge.EVENT_BUS.register(this);
IFarmRegistry registry = ForestryAPI.farmRegistry;
registry.registerFarmables("farmArboreal", new FarmableVanillaSapling());
if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.ARBORICULTURE))) {
registry.registerFarmables("farmArboreal", new FarmableGE());
}
registry.registerFarmables("farmCrops", new FarmableAgingCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.WHEAT, BlockCrops.AGE, 7, 0), new FarmableAgingCrop(new ItemStack(Items.POTATO), Blocks.POTATOES, BlockCrops.AGE, 7, 0), new FarmableAgingCrop(new ItemStack(Items.CARROT), Blocks.CARROTS, BlockCrops.AGE, 7, 0), new FarmableAgingCrop(new ItemStack(Items.BEETROOT_SEEDS), Blocks.BEETROOTS, BlockBeetroot.BEETROOT_AGE, 3, 0));
IBlockState plantedBrownMushroom = blocks.mushroom.getDefaultState().withProperty(BlockMushroom.VARIANT, BlockMushroom.MushroomType.BROWN);
registry.registerFarmables("farmShroom", new FarmableVanillaMushroom(new ItemStack(Blocks.BROWN_MUSHROOM), plantedBrownMushroom, Blocks.BROWN_MUSHROOM_BLOCK));
IBlockState plantedRedMushroom = blocks.mushroom.getDefaultState().withProperty(BlockMushroom.VARIANT, BlockMushroom.MushroomType.RED);
registry.registerFarmables("farmShroom", new FarmableVanillaMushroom(new ItemStack(Blocks.RED_MUSHROOM), plantedRedMushroom, Blocks.RED_MUSHROOM_BLOCK));
registry.registerFarmables("farmGourd", new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), Blocks.PUMPKIN_STEM, Blocks.PUMPKIN));
registry.registerFarmables("farmGourd", new FarmableGourd(new ItemStack(Items.MELON_SEEDS), Blocks.MELON_STEM, Blocks.MELON_BLOCK));
registry.registerFarmables("farmInfernal", new FarmableAgingCrop(new ItemStack(Items.NETHER_WART), Blocks.NETHER_WART, BlockNetherWart.AGE, 3));
registry.registerFarmables("farmPoales", new FarmableStacked(new ItemStack(Items.REEDS), Blocks.REEDS, 3));
registry.registerFarmables("farmSucculentes", new FarmableStacked(new ItemStack(Blocks.CACTUS), Blocks.CACTUS, 3));
registry.registerFarmables("farmEnder", FarmableChorus.INSTANCE);
// Forestry fertilizer
registry.registerFertilizer(new ItemStack(coreItems.fertilizerCompound, 1, OreDictionary.WILDCARD_VALUE), 500);
proxy.initializeModels();
// Layouts
ICircuitLayout layoutManaged = new CircuitLayout("farms.managed", CircuitSocketType.FARM);
ChipsetManager.circuitRegistry.registerLayout(layoutManaged);
ICircuitLayout layoutManual = new CircuitLayout("farms.manual", CircuitSocketType.FARM);
ChipsetManager.circuitRegistry.registerLayout(layoutManual);
}
use of forestry.farming.logic.farmables.FarmableVanillaMushroom in project ForestryMC by ForestryMC.
the class PluginNatura method registerItems.
@SubscribeEvent
public void registerItems(RegistryEvent<Item> itemRegistryEvent) {
final ItemStack potashApple = findPotashAppleInRegistry();
boolean hasMushroom = blueLargeGlowshroomBlock != null && greenLargeGlowshroomBlock != null && purpleLargeGlowshroomBlock != null;
ForgeRegistries.ITEMS.forEach(item -> {
final ResourceLocation registryName = item.getRegistryName();
if (registryName == null || !registryName.getResourceDomain().equals(MOD_ID)) {
return;
}
final String itemName = registryName.getResourcePath();
if (itemName.matches("^.*_sapling\\d?$")) {
consumeSubItems(item, "saplings", saplings);
RecipeUtil.addFermenterRecipes(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
ItemStack[] windfall = new ItemStack[] {};
// add potash apple as windfall for darkwood (nether_sapling:2)
if (itemName.endsWith("nether_sapling")) {
windfall = new ItemStack[] { potashApple };
}
FarmRegistry.getInstance().registerFarmables("farmArboreal", new FarmableSapling(new ItemStack(item), windfall));
return;
}
if (hasMushroom && itemName.matches("^.*nether_glowshroom\\d?$")) {
complexConsumeSubItems(item, "shrooms", subItem -> {
shrooms.add(subItem);
// find large shroom block that matches subItem
final Block largeShroomBlock;
if (subItem.getMetadata() == blueLargeGlowshroomBlock.damageDropped(blueLargeGlowshroomBlock.getDefaultState())) {
largeShroomBlock = blueLargeGlowshroomBlock;
} else if (subItem.getMetadata() == greenLargeGlowshroomBlock.damageDropped(greenLargeGlowshroomBlock.getDefaultState())) {
largeShroomBlock = greenLargeGlowshroomBlock;
} else {
largeShroomBlock = purpleLargeGlowshroomBlock;
}
// block representing planted glowshroom
final Block smallShroomBlock = Block.getBlockFromItem(subItem.getItem());
FarmRegistry.getInstance().registerFarmables("farmShroom", new FarmableVanillaMushroom(subItem, smallShroomBlock.getStateFromMeta(subItem.getMetadata()), largeShroomBlock));
});
return;
}
if (itemName.matches("^edibles|.*fruit_item|soups$")) {
complexConsumeSubItems(item, "edibles", subitem -> {
final String subItemName = subitem.getUnlocalizedName();
if (subItemName.matches("^.*berry$")) {
berries.add(subitem);
return;
}
if (subItemName.matches("^.*(fruit_item|apple)$")) {
fruits.add(subitem);
return;
}
if (subItemName.matches("^.*stew$")) {
soups.add(subitem);
return;
}
edibles.add(subitem);
});
}
if (itemName.matches("^.*_seeds$")) {
consumeSubItems(item, "seeds", seeds);
return;
}
if (itemName.matches("^.*_logs\\d?$")) {
consumeSubItems(item, "logs", logs);
return;
}
if (itemName.matches("^.*_crop\\d?$")) {
consumeSubItems(item, "cropBlocks", cropBlocks);
return;
}
if (itemName.matches("^materials$")) {
complexConsumeSubItems(item, "materials", subitem -> {
final String subItemName = subitem.getUnlocalizedName();
if (subItemName.matches("^.*(barley|cotton)$")) {
crops.add(subitem);
return;
}
materials.add(subitem);
});
}
});
}
Aggregations