From e26fde5cc0f8e25b2d9782202a94fab103147af8 Mon Sep 17 00:00:00 2001 From: Nirek-K Date: Wed, 1 Apr 2015 00:55:14 -0500 Subject: [PATCH] Plant Mega Pack Stage 4 Add Forest and Plains plant types to bee plant/acceptable and Multifarm (Crop) Slight Refactor and Cleanup More minor Cleanup --- .../forestry/plugins/PluginPlantMegaPack.java | 88 +++++++++++++------ 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/src/main/java/forestry/plugins/PluginPlantMegaPack.java b/src/main/java/forestry/plugins/PluginPlantMegaPack.java index d18eabf53..086c93910 100644 --- a/src/main/java/forestry/plugins/PluginPlantMegaPack.java +++ b/src/main/java/forestry/plugins/PluginPlantMegaPack.java @@ -73,18 +73,17 @@ public class PluginPlantMegaPack extends ForestryPlugin { "Tomato" ); - ImmutableList desertPlant = ImmutableList.of( - "desertApachePlume", - "desertBrittlebush", - "desertBroadLeafGilia", - "desertBroomSnakeweed", - "desertKangarooPaw", - "desertOcotillo", - "desertPeninsulaOnion", - "desertSeepwood", - "desertWhiteSage" - - ); + ImmutableMap desertPlant = ImmutableMap.builder() + .put("desertApachePlume", 4) + .put("desertBrittlebush", 4) + .put("desertBroadLeafGilia", 4) + .put("desertBroomSnakeweed", 4) + .put("desertKangarooPaw", 4) + .put("desertOcotillo", 4) + .put("desertPeninsulaOnion", 4) + .put("desertSeepwood", 4) + .put("desertWhiteSage", 4) + .build(); ImmutableMap nonGrowingFlowers = ImmutableMap.builder() .put("flowerAchillea", 9) // number of flowers in the block, usually meta+1 @@ -145,6 +144,35 @@ public class PluginPlantMegaPack extends ForestryPlugin { .put("cactusSnowPole", 6) .put("cactusToothpick", 6) .build(); + ImmutableMap forestPlant = ImmutableMap.builder() + .put("forestArcticGentian", 1) + .put("forestAustralianBugle", 2) + .put("forestBroadleafMeadowsweet", 2) + .put("forestDeadnettle", 2) + .put("forestDeceivingTrillium", 2) + .put("forestFairySlipper", 2) + .put("forestHorseweed", 2) + .put("forestKneelingAngelica", 2) + //.put("forestLilyoftheValley", //poisonous + .put("forestNorthernPitcherPlant", 2) + .put("forestPinesap", 2) + .put("forestRedHelleborine", 2) + .put("forestSalal", 2) + .put("forestVanillaLeaf", 1) + .put("forestWesternWallflower", 2) + .put("forestWildColumbine", 2) + .put("forestWildMint", 2) + .put("forestWolfsFootClubmoss", 1) + .build(); + ImmutableMap plainsPlant = ImmutableMap.builder() + .put("plainsPrairieBrome", 6) //skips some metas + .put("plainsPrairieSage", 4) + .put("plainsReedCanaryGrass", 6) //skips some metas + .put("plainsShortrayFleabane", 4) + .put("plainsSmallPasqueFlower", 4) + .put("plainsSmoothAster", 4) + .put("plainsThreeFloweredAvens", 4) + .build(); ImmutableList waterPlant = ImmutableList.of( "waterKelpGiantGRN", @@ -177,15 +205,6 @@ public class PluginPlantMegaPack extends ForestryPlugin { } } - for (String dPlant : desertPlant) { - Block desertPlantBlock = GameRegistry.findBlock(PlantMP, dPlant); - ItemStack desertPlantStack = GameRegistry.findItemStack(PlantMP, dPlant, 1); - if (desertPlantBlock != null && desertPlantStack != null) { - FlowerManager.flowerRegistry.registerAcceptableFlower(desertPlantBlock, FlowerManager.FlowerTypeCacti); - Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(desertPlantStack, desertPlantBlock, 4)); - } - } - for (Map.Entry flower : nonGrowingFlowers.entrySet()) { Block flowerPlantBlock = GameRegistry.findBlock(PlantMP, flower.getKey()); if (flowerPlantBlock != null) { @@ -195,14 +214,11 @@ public class PluginPlantMegaPack extends ForestryPlugin { } } - for (Map.Entry cPlant : cactusPlant.entrySet()) { - Block cactusPlantBlock = GameRegistry.findBlock(PlantMP, cPlant.getKey()); - ItemStack cactusPlantStack = GameRegistry.findItemStack(PlantMP, cPlant.getKey(), 1); - if (cactusPlantBlock != null) { - FlowerManager.flowerRegistry.registerAcceptableFlower(cactusPlantBlock, FlowerManager.FlowerTypeCacti); - Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(cactusPlantStack, cactusPlantBlock, cPlant.getValue())); - } - } + addMetaFlower(cactusPlant, FlowerManager.FlowerTypeCacti, false); + addMetaFlower(desertPlant, FlowerManager.FlowerTypeCacti, false); + + addMetaFlower(forestPlant, FlowerManager.FlowerTypeVanilla, true); + addMetaFlower(plainsPlant, FlowerManager.FlowerTypeVanilla, true); for (String wPlant : waterPlant) { ItemStack waterPlantStack = GameRegistry.findItemStack(PlantMP, wPlant, 1); @@ -211,4 +227,18 @@ public class PluginPlantMegaPack extends ForestryPlugin { } } } + + private static void addMetaFlower(ImmutableMap flowerMap, String flowertype, boolean plantable) { + for (Map.Entry flower : flowerMap.entrySet()) { + Block flowerBlock = GameRegistry.findBlock(PlantMP, flower.getKey()); + ItemStack flowerStack = GameRegistry.findItemStack(PlantMP, flower.getKey(), 1); + FlowerManager.flowerRegistry.registerAcceptableFlower(flowerBlock, flowertype); + if (plantable && flowerBlock != null) { + FlowerManager.flowerRegistry.registerPlantableFlower(flowerBlock, 0, 0.75, flowertype); + } + if (flowerStack != null && flowerBlock != null) { + Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(flowerStack, flowerBlock, flower.getValue())); + } + } + } }