Update for 1.11. Missing assets, unstable.

This commit is contained in:
mezz committed 2016-12-22 16:47:56 -08:00
1 parent 30d7365518
commit 9611ae08ae
1145 files changed
+15561 -18107

No files matched your search

@@ -1,24 +1,22 @@
package forestry.plugins;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import forestry.core.utils.Log;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
public class ForestryPluginUtil {
private ForestryPluginUtil() {
}
public static List<IForestryPlugin> getForestryPlugins(@Nonnull ASMDataTable asmDataTable) {
public static List<IForestryPlugin> getForestryPlugins(ASMDataTable asmDataTable) {
return getInstances(asmDataTable, ForestryPlugin.class, IForestryPlugin.class);
}
private static <T> List<T> getInstances(@Nonnull ASMDataTable asmDataTable, Class annotationClass, Class<T> instanceClass) {
private static <T> List<T> getInstances(ASMDataTable asmDataTable, Class annotationClass, Class<T> instanceClass) {
String annotationClassName = annotationClass.getCanonicalName();
Set<ASMDataTable.ASMData> asmDatas = asmDataTable.getAll(annotationClassName);
List<T> instances = new ArrayList<>();
@@ -1,23 +1,20 @@
package forestry.plugins;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;
import java.util.Set;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import forestry.core.IPickupHandler;
import forestry.core.IResupplyHandler;
import forestry.core.ISaveEventHandler;
import forestry.core.network.IPacketRegistry;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.event.FMLInterModComms;
public interface IForestryPlugin {
boolean isAvailable();
@@ -29,7 +26,6 @@ public interface IForestryPlugin {
/**
* See ForestryPlugin.pluginID()
*/
@Nonnull
Set<String> getDependencyUids();
void setupAPI();
@@ -10,11 +10,6 @@
******************************************************************************/
package forestry.plugins;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import javax.annotation.Nonnull;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
@@ -25,21 +20,9 @@ import java.util.Locale;
import java.util.Random;
import java.util.Set;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import forestry.Forestry;
import forestry.api.core.ForestryAPI;
import forestry.core.IPickupHandler;
@@ -49,6 +32,19 @@ import forestry.core.PluginCore;
import forestry.core.network.IPacketRegistry;
import forestry.core.utils.Log;
import forestry.core.utils.Translator;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class PluginManager {
@@ -73,7 +69,6 @@ public class PluginManager {
FINISHED
}
@Nonnull
public static final Set<IForestryPlugin> configDisabledPlugins = new HashSet<>();
public static Stage getStage() {
@@ -113,16 +108,16 @@ public class PluginManager {
}
}
private static IForestryPlugin getPluginCore(@Nonnull List<IForestryPlugin> forestryPlugins) {
private static IForestryPlugin getPluginCore(List<IForestryPlugin> forestryPlugins) {
for (IForestryPlugin plugin : forestryPlugins) {
if (plugin instanceof PluginCore) {
return plugin;
}
}
return null;
throw new IllegalStateException("Could not find core plugin");
}
private static void configurePlugins(@Nonnull List<IForestryPlugin> forestryPlugins) {
private static void configurePlugins(List<IForestryPlugin> forestryPlugins) {
Locale locale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
@@ -297,7 +292,7 @@ public class PluginManager {
}
}
@Nonnull
public static List<ItemStack> getHiddenItems() {
List<ItemStack> hiddenItems = new ArrayList<>();
for (IForestryPlugin plugin : loadedPlugins) {
@@ -306,7 +301,7 @@ public class PluginManager {
return hiddenItems;
}
@Nonnull
public static Set<String> getLootPoolNames() {
Set<String> lootPoolNames = new HashSet<>();
for (IForestryPlugin plugin : loadedPlugins) {
@@ -1,20 +1,20 @@
package forestry.plugins.compat;
import forestry.core.blocks.BlockBase;
import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
import forestry.energy.blocks.BlockEngine;
import forestry.energy.blocks.BlockTypeEngine;
public class BlockRegistryIC2 extends BlockRegistry {
public final BlockBase electricalEngine;
public final BlockEngine generator;
public BlockRegistryIC2() {
electricalEngine = new BlockEngine(BlockTypeEngine.ELECTRICAL);
registerBlock(electricalEngine, new ItemBlockForestry<>(electricalEngine), "engine_electrical");
generator = new BlockEngine(BlockTypeEngine.GENERATOR);
registerBlock(generator, new ItemBlockForestry<>(generator), "engine_generator");
}
}
//package forestry.plugins.compat;
//
//import forestry.core.blocks.BlockBase;
//import forestry.core.blocks.BlockRegistry;
//import forestry.core.items.ItemBlockForestry;
//import forestry.energy.blocks.BlockEngine;
//import forestry.energy.blocks.BlockTypeEngine;
//
//public class BlockRegistryIC2 extends BlockRegistry {
// public final BlockBase electricalEngine;
// public final BlockEngine generator;
//
// public BlockRegistryIC2() {
// electricalEngine = new BlockEngine(BlockTypeEngine.ELECTRICAL);
// registerBlock(electricalEngine, new ItemBlockForestry<>(electricalEngine), "engine_electrical");
//
// generator = new BlockEngine(BlockTypeEngine.GENERATOR);
// registerBlock(generator, new ItemBlockForestry<>(generator), "engine_generator");
// }
//}
@@ -1,8 +1,8 @@
package forestry.plugins.compat;
import javax.annotation.Nonnull;
import java.util.List;
import com.google.common.base.Preconditions;
import forestry.core.PluginCore;
import forestry.core.blocks.BlockRegistryCore;
import forestry.core.items.ItemRegistryCore;
@@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack;
@JEIPlugin
public class ForestryJeiPlugin extends BlankModPlugin {
@Override
public void register(@Nonnull IModRegistry registry) {
public void register(IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
IItemBlacklist itemBlacklist = jeiHelpers.getItemBlacklist();
List<ItemStack> hiddenItems = PluginManager.getHiddenItems();
@@ -27,6 +27,7 @@ public class ForestryJeiPlugin extends BlankModPlugin {
}
ItemRegistryCore items = PluginCore.items;
Preconditions.checkState(items != null);
JeiUtil.addDescription(registry,
items.solderingIron,
@@ -39,6 +40,8 @@ public class ForestryJeiPlugin extends BlankModPlugin {
);
BlockRegistryCore blocks = PluginCore.blocks;
Preconditions.checkState(blocks != null);
JeiUtil.addDescription(registry,
blocks.analyzer,
blocks.bogEarth,
@@ -1,6 +1,5 @@
package forestry.plugins.compat;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
@@ -59,8 +58,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
FluidStack seedFluid = Fluids.SEED_OIL.getFluid(amount);
for (Item seed : Arrays.asList(canolaSeed, flaxSeed, riceSeed, coffeeSeed)) {
if (seed != null) {
ItemStack[] resources = {new ItemStack(seed)};
RecipeManagers.squeezerManager.addRecipe(10, resources, seedFluid);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack(seed), seedFluid);
}
}
@@ -70,7 +68,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
Item misc = getItem("itemMisc");
if (misc != null) {
ItemStack canola = new ItemStack(misc, 1, 13);
RecipeManagers.squeezerManager.addRecipe(15, new ItemStack[]{canola}, new FluidStack(canolaOil, 80));
RecipeManagers.squeezerManager.addRecipe(15, canola, new FluidStack(canolaOil, 80));
}
//add canola oil fermenting in still
@@ -81,7 +79,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
}
}
private static void registerSeedPlant(@Nullable Item seedItem, @Nonnull String blockName) {
private static void registerSeedPlant(@Nullable Item seedItem, String blockName) {
if (seedItem != null) {
Block plantBlock = getBlock(blockName);
if (plantBlock != null) {
@@ -94,7 +92,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
}
@Nullable
private static Fluid getFluid(@Nonnull String fluidName) {
private static Fluid getFluid(String fluidName) {
Fluid fluid = FluidRegistry.getFluid(fluidName);
if (fluid == null) {
Log.error("Could not find fluid {}", fluidName);
@@ -103,7 +101,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
}
@Nullable
private static Block getBlock(@Nonnull String blockName) {
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(ACT_ADD, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
@@ -114,7 +112,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
}
@Nullable
private static Item getItem(@Nonnull String itemName) {
private static Item getItem(String itemName) {
ResourceLocation key = new ResourceLocation(ACT_ADD, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return ForgeRegistries.ITEMS.getValue(key);
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.plugins.compat;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -42,8 +43,11 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
private static final String BoP = "BiomesOPlenty";
@Nullable
private static Block saplings;
@Nullable
private static Block colorizedSaplings;
@Nullable
private static Item food;
private static int amount;
@@ -111,11 +115,11 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && boPTurnip != null) {
Item boPTurnipSeeds = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "turnipSeeds"));
ItemStack boPTurnipSeedStack = new ItemStack(boPTurnipSeeds, 1, 0);
if (boPTurnipSeeds != null) {
if (!boPTurnipSeedStack.isEmpty()) {
//TODO BoP for 1.9: Add farmable saplings
// Farmables.farmables.get("farmVegetables").add(new FarmableHandPlanted(boPTurnipSeedStack, boPTurnip, 7));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{boPTurnipSeedStack}, Fluids.SEED_OIL.getFluid(amount));
RecipeManagers.squeezerManager.addRecipe(10, boPTurnipSeedStack, Fluids.SEED_OIL.getFluid(amount));
}
}
@@ -127,11 +131,11 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
private static void addFermenterRecipes() {
int saplingYield = ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling");
if (saplings != Blocks.AIR) {
if (saplings != null && saplings != Blocks.AIR) {
RecipeUtil.addFermenterRecipes(new ItemStack(saplings, 1, OreDictionary.WILDCARD_VALUE), saplingYield, Fluids.BIOMASS);
}
if (colorizedSaplings != Blocks.AIR) {
if (colorizedSaplings != null && colorizedSaplings != Blocks.AIR) {
RecipeUtil.addFermenterRecipes(new ItemStack(colorizedSaplings, 1, OreDictionary.WILDCARD_VALUE), saplingYield, Fluids.BIOMASS);
}
}
@@ -141,16 +145,16 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
Item pinecone = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "pinecone"));
if (pinecone != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(pinecone)}, Fluids.SEED_OIL.getFluid(3 * amount));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack(pinecone), Fluids.SEED_OIL.getFluid(3 * amount));
}
if (food != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(food)}, Fluids.JUICE.getFluid(50), mulch, 5);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack(food), Fluids.JUICE.getFluid(50), mulch, 5);
}
Item persimmon = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BoP, "persimmon"));
if (persimmon != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(persimmon)}, Fluids.JUICE.getFluid(200), mulch, 20);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack(persimmon), Fluids.JUICE.getFluid(200), mulch, 20);
}
}
@@ -232,8 +236,8 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BoP, blockName));
if (block != null) {
Item item = Item.getItemFromBlock(block);
if (item != null) {
ItemStack blockStack = new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE);
ItemStack blockStack = new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE);
if (!blockStack.isEmpty()) {
BackpackManager.backpackInterface.addItemToForestryBackpack(backpackUid, blockStack);
} else {
Log.warning("Could not find an item for block: {}", blockName);
@@ -13,7 +13,8 @@ package forestry.plugins.compat;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import forestry.core.PluginCore;
import forestry.core.config.Constants;
@@ -42,7 +43,7 @@ public class PluginBuildCraftTransport extends BlankForestryPlugin {
@Override
public void registerRecipes() {
Item beeswax = PluginCore.items.beeswax;
Item pipeWaterproof = GameRegistry.findItem(BCT, "pipeWaterproof");
Item pipeWaterproof = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BCT, "pipeWaterproof"));
if (pipeWaterproof != null) {
RecipeUtil.addShapelessRecipe(new ItemStack(pipeWaterproof), beeswax);
} else {
@@ -17,7 +17,7 @@ import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.core.PluginCore;
import forestry.core.circuits.Circuit;
import forestry.core.circuits.Circuits;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.items.EnumElectronTube;
@@ -33,6 +33,7 @@ import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -62,7 +63,7 @@ public class PluginExtraUtilities extends BlankForestryPlugin {
Item enderLillyItem = Item.getItemFromBlock(enderLillyBlock);
if (enderLillyBlock == Blocks.AIR) {
Log.error("Could not find ender lilly block.");
} else if (enderLillyItem == null) {
} else if (enderLillyItem == Items.AIR) {
Log.error("Could not find ender lilly item.");
} else {
IProperty<Integer> growthProperty = BlockUtil.getProperty(enderLillyBlock, "growth", Integer.class);
@@ -72,7 +73,7 @@ public class PluginExtraUtilities extends BlankForestryPlugin {
int harvestAge = Collections.max(growthProperty.getAllowedValues());
int replantAge = enderLillyBlock.getDefaultState().getValue(growthProperty);
Farmables.farmables.put("farmEnder", new FarmableAgingCrop(new ItemStack(enderLillyItem), enderLillyBlock, growthProperty, harvestAge, replantAge));
Circuit.farmEnderManaged = new CircuitFarmLogic("managedEnder", new FarmLogicEnder());
Circuits.farmEnderManaged = new CircuitFarmLogic("managedEnder", new FarmLogicEnder());
}
}
}
@@ -81,9 +82,9 @@ public class PluginExtraUtilities extends BlankForestryPlugin {
@Override
public void registerRecipes() {
super.registerRecipes();
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && Circuit.farmEnderManaged != null) {
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && Circuits.farmEnderManaged != null) {
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
ChipsetManager.solderManager.addRecipe(layoutManaged, PluginCore.items.tubes.get(EnumElectronTube.ENDER, 1), Circuit.farmEnderManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, PluginCore.items.tubes.get(EnumElectronTube.ENDER, 1), Circuits.farmEnderManaged);
}
}
}
@@ -10,20 +10,11 @@
******************************************************************************/
package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import static forestry.core.PluginCore.items;
import com.google.common.collect.ImmutableList;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.api.fuels.FuelManager;
@@ -38,8 +29,12 @@ import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import static forestry.core.PluginCore.items;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
@ForestryPlugin(pluginID = ForestryPluginUids.HARVESTCRAFT, name = "HarvestCraft", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.harvestcraft.description")
public class PluginHarvestCraft extends BlankForestryPlugin {
@@ -55,17 +50,19 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
public String getFailMessage() {
return "HarvestCraft not found";
}
@Nullable
private static ItemStack getItemStack(@Nonnull String itemName) {
private static ItemStack getItemStack(String itemName) {
ResourceLocation key = new ResourceLocation(HC, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return new ItemStack(ForgeRegistries.ITEMS.getValue(key),1);
return new ItemStack(ForgeRegistries.ITEMS.getValue(key), 1);
} else {
return null;
}
}
private static Block getBlock(@Nonnull String blockName) {
@Nullable
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(HC, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
@@ -73,7 +70,8 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
return null;
}
}
@Override
@Override
public void registerRecipes() {
ImmutableList<String> berries = ImmutableList.of(
@@ -216,17 +214,17 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
int wheatamount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
PropertyInteger plantAGE = PropertyInteger.create("age", 0, 3);
PropertyInteger fruitAGE = PropertyInteger.create("age", 0, 2);
juiceAmount = Math.max(juiceAmount, 1); // Produce at least 1 mb of juice.
for (String berryName : berries) {
ItemStack berry = getItemStack(berryName + "Item");
ItemStack berrySeed = getItemStack( berryName + "seedItem");
ItemStack berrySeed = getItemStack(berryName + "seedItem");
Block berryBlock = getBlock("pam" + berryName + "Crop");
if (berry != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{berry}, Fluids.JUICE.getFluid(juiceAmount));
RecipeManagers.squeezerManager.addRecipe(10, berry, Fluids.JUICE.getFluid(juiceAmount));
}
if (berrySeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{berrySeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, berrySeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && berrySeed != null && berryBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(berrySeed, berryBlock, plantAGE, 3));
@@ -241,14 +239,14 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
ItemStack fruitSeed = getItemStack(fruitName + "seedItem");
Block fruitBlock = getBlock("pam" + fruitName + "Crop");
if (fruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{fruit}, Fluids.JUICE.getFluid(juiceAmount));
RecipeManagers.squeezerManager.addRecipe(10, fruit, Fluids.JUICE.getFluid(juiceAmount));
}
if (fruitSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{fruitSeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, fruitSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && fruitSeed != null && fruitBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(fruitSeed, fruitBlock,plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(fruitSeed,fruitBlock,plantAGE, 3, 0));
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(fruitSeed, fruitBlock, plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(fruitSeed, fruitBlock, plantAGE, 3, 0));
}
plants.add(fruitName);
}
@@ -260,14 +258,14 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
ItemStack vegetableSeed = getItemStack(vegetableName + "seedItem");
Block vegetableBlock = getBlock("pam" + vegetableName + "Crop");
if (vegetable != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{vegetable}, Fluids.JUICE.getFluid(juiceAmount));
RecipeManagers.squeezerManager.addRecipe(10, vegetable, Fluids.JUICE.getFluid(juiceAmount));
}
if (vegetableSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{vegetableSeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, vegetableSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && vegetableSeed != null && vegetableBlock != null) {
Farmables.farmables.get("farmVegetables").add(new FarmableAgingCrop(vegetableSeed, vegetableBlock,plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(vegetableSeed, vegetableBlock,plantAGE, 3, 0));
Farmables.farmables.get("farmVegetables").add(new FarmableAgingCrop(vegetableSeed, vegetableBlock, plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(vegetableSeed, vegetableBlock, plantAGE, 3, 0));
}
plants.add(vegetableName);
}
@@ -281,12 +279,12 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
FuelManager.moistenerResource.put(grain, new MoistenerFuel(grain, items.mouldyWheat.getItemStack(), 0, 300));
}
if (grainSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{grainSeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, grainSeed, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.moistenerManager.addRecipe(grainSeed, new ItemStack(Blocks.MYCELIUM), 5000);
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && grainSeed != null && grainBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(grainSeed, grainBlock,plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(grainSeed,grainBlock,plantAGE, 3, 0));
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(grainSeed, grainBlock, plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(grainSeed, grainBlock, plantAGE, 3, 0));
}
plants.add(grainName);
}
@@ -295,10 +293,10 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
ItemStack treeFruit = getItemStack(treeFruitName + "Item");
Block treeFruitBlock = getBlock("pam" + (Character.toUpperCase(treeFruitName.charAt(0)) + treeFruitName.substring(1)));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && treeFruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(null, treeFruitBlock, fruitAGE, 2, 0));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(ItemStack.EMPTY, treeFruitBlock, fruitAGE, 2, 0));
}
if (treeFruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{treeFruit}, Fluids.JUICE.getFluid(juiceAmount));
RecipeManagers.squeezerManager.addRecipe(10, treeFruit, Fluids.JUICE.getFluid(juiceAmount));
}
plants.add(treeFruitName);
}
@@ -306,7 +304,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
for (String treeName : trees) {
Block fruitBlock = getBlock("pam" + (Character.toUpperCase(treeName.charAt(0)) + treeName.substring(1)));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && fruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(null, fruitBlock, fruitAGE, 2, 0));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(ItemStack.EMPTY, fruitBlock, fruitAGE, 2, 0));
}
plants.add(treeName);
}
@@ -314,7 +312,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
for (String treeName : treesSpecial) {
Block fruitBlock = getBlock("pam" + (Character.toUpperCase(treeName.charAt(0)) + treeName.substring(1)));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && fruitBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(null, fruitBlock, fruitAGE, 2, 0));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(ItemStack.EMPTY, fruitBlock, fruitAGE, 2, 0));
}
}
@@ -322,7 +320,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
ItemStack genericCropSeed = getItemStack(cropName + "seedItem");
Block genericCropBlock = getBlock("pam" + cropName + "Crop");
if (genericCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{genericCropSeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, genericCropSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && genericCropSeed != null && genericCropBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(genericCropSeed, genericCropBlock, plantAGE, 3));
@@ -334,11 +332,11 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
Block mustardCropBlock = getBlock("pam" + "mustardseeds" + "Crop");
ItemStack mustardFruit = getItemStack("mustard" + "seedsItem");
if (mustardCropSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{mustardCropSeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, mustardCropSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && mustardCropSeed != null && mustardCropBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(mustardCropSeed, mustardCropBlock, plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(mustardCropSeed,mustardCropBlock, plantAGE, 3, 0));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(mustardCropSeed, mustardCropBlock, plantAGE, 3, 0));
}
if (mustardFruit != null) {
RecipeUtil.addFermenterRecipes(mustardFruit, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
@@ -356,31 +354,31 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
ItemStack cropnutSeed = getItemStack(cropnutName + "seedItem");
Block cropnutBlock = getBlock("pam" + cropnutName + "Crop");
if (cropnutSeed != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{cropnutSeed}, Fluids.SEED_OIL.getFluid(seedamount));
RecipeManagers.squeezerManager.addRecipe(10, cropnutSeed, Fluids.SEED_OIL.getFluid(seedamount));
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && cropnutSeed != null && cropnutBlock != null) {
Farmables.farmables.get("farmWheat").add(new FarmableAgingCrop(cropnutSeed, cropnutBlock, plantAGE, 3));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(cropnutSeed,cropnutBlock, plantAGE, 3, 0));
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(cropnutSeed, cropnutBlock, plantAGE, 3, 0));
}
if (cropnut != null) {
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{cropnut}, Fluids.SEED_OIL.getFluid(12 * seedamount));
RecipeManagers.squeezerManager.addRecipe(20, cropnut, Fluids.SEED_OIL.getFluid(12 * seedamount));
}
}
for (String nutName : nuts) {
ItemStack nut = getItemStack(nutName + "Item");
Block nutBlock = getBlock("pam" + (Character.toUpperCase(nutName.charAt(0)) + nutName.substring(1)));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)&& nutBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(null, nutBlock, fruitAGE, 2, 0));
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING) && nutBlock != null) {
Farmables.farmables.get("farmOrchard").add(new FarmableAgingCrop(ItemStack.EMPTY, nutBlock, fruitAGE, 2, 0));
}
if (nut != null) {
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{nut}, Fluids.SEED_OIL.getFluid(15 * seedamount));
RecipeManagers.squeezerManager.addRecipe(20, nut, Fluids.SEED_OIL.getFluid(15 * seedamount));
}
}
ItemStack hcHoneyItem = getItemStack("honeyItem");
if (hcHoneyItem != null) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{hcHoneyItem}, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
}
ItemStack hcBeeswaxItem = getItemStack("beeswaxItem");
@@ -1,314 +1,314 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.plugins.compat;
import javax.annotation.Nonnull;
import java.util.Set;
import com.google.common.collect.ImmutableMap;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.api.fuels.EngineBronzeFuel;
import forestry.api.fuels.FuelManager;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.BackpackManager;
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.items.EnumPropolis;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.PluginCore;
import forestry.core.blocks.BlockBogEarth;
import forestry.core.circuits.Circuit;
import forestry.core.circuits.CircuitLayout;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.items.EnumElectronTube;
import forestry.core.items.ItemRegistryCore;
import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.energy.PluginEnergy;
import forestry.energy.blocks.BlockRegistryEnergy;
import forestry.energy.circuits.CircuitElectricBoost;
import forestry.energy.circuits.CircuitElectricChoke;
import forestry.energy.circuits.CircuitElectricEfficiency;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicRubber;
import forestry.farming.logic.FarmableBasicIC2Crop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import ic2.api.item.IC2Items;
import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.recipe.Recipes;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.event.FMLInterModComms;
@ForestryPlugin(pluginID = ForestryPluginUids.INDUSTRIALCRAFT2, name = "IndustrialCraft2", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.ic2.description")
public class PluginIC2 extends BlankForestryPlugin {
public static final String modId = "IC2";
public static PluginIC2 instance;
private static ItemStack rubberSapling;
private static ItemStack rubber;
public static ItemStack rubberWood;
public static ItemStack resin;
public BlockRegistryIC2 blocks;
public PluginIC2() {
if (PluginIC2.instance == null) {
PluginIC2.instance = this;
}
}
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(PluginIC2.modId);
}
@Override
public String getFailMessage() {
return "IndustrialCraft2 not found";
}
@Nonnull
@Override
public Set<String> getDependencyUids() {
Set<String> dependencyUids = super.getDependencyUids();
dependencyUids.add(ForestryPluginUids.FARMING);
dependencyUids.add(ForestryPluginUids.FACTORY);
return dependencyUids;
}
@Override
@Optional.Method(modid = PluginIC2.modId)
public void preInit() {
super.preInit();
// rubber chain
rubberWood = IC2Items.getItem("rubber_wood");
resin = IC2Items.getItem("misc_resource", "resin");
rubberSapling = IC2Items.getItem("sapling");
rubber = IC2Items.getItem("crafting", "rubber");
Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", new FarmLogicRubber());
ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin", CircuitSocketType.ELECTRIC_ENGINE);
ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
Farmables.fertilizers.put(IC2Items.getItem("crop_res", "fertilizer"), 250);
}
@Override
@Optional.Method(modid = PluginIC2.modId)
public void doInit() {
super.doInit();
// Remove some items from the recycler
if (Recipes.recyclerBlacklist != null) {
ItemRegistryApiculture beeItems = PluginApiculture.items;
if (beeItems != null) {
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(new ItemStack(beeItems.beeQueenGE)));
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(new ItemStack(beeItems.beePrincessGE)));
}
} else {
Log.error("IC2 Recipes.recyclerBlacklist not found.");
}
Circuit.energyElectricChoke1 = new CircuitElectricChoke("electric.choke.1");
Circuit.energyElectricEfficiency1 = new CircuitElectricEfficiency("electric.efficiency.1");
Circuit.energyElectricBoost1 = new CircuitElectricBoost("electric.boost.1", 7, 20);
Circuit.energyElectricBoost2 = new CircuitElectricBoost("electric.boost.2", 15, 40);
blocks.electricalEngine.init();
blocks.generator.init();
}
@Override
public void postInit() {
super.postInit();
if (BackpackManager.backpackInterface == null) {
return;
}
if (resin != null) {
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, resin);
}
if (rubber != null) {
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubber);
}
if (rubberSapling != null) {
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubberSapling);
}
ItemStack rubberLeaves = IC2Items.getItem("leaves");
if (rubberLeaves != null) {
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubberLeaves);
}
}
@Override
public void registerCrates() {
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
if (crateRegistry == null) {
return;
}
if (resin != null) {
crateRegistry.registerCrate(resin);
}
if (rubber != null) {
crateRegistry.registerCrate(rubber);
}
ItemStack scrap = IC2Items.getItem("crafting", "scrap");
if (scrap != null) {
crateRegistry.registerCrate(scrap);
}
ItemStack uuMatter = IC2Items.getItem("misc_resource", "matter");
if (uuMatter != null) {
crateRegistry.registerCrate(uuMatter);
}
ItemStack silver = IC2Items.getItem("ingot", "silver");
if (silver != null) {
crateRegistry.registerCrate(silver);
}
ItemStack brass = IC2Items.getItem("ingot", "bronze");
if (brass != null) {
crateRegistry.registerCrate(brass);
}
}
@Override
@Optional.Method(modid = PluginIC2.modId)
public void registerRecipes() {
ItemRegistryCore coreItems = PluginCore.items;
if (rubber != null) {
for (Object rubberOreDict : RecipeUtil.getOreDictRecipeEquivalents(rubber)) {
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), coreItems.tubes.get(EnumElectronTube.RUBBER, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', rubberOreDict});
}
}
ItemStack plantBall = IC2Items.getItem("crafting", "plant_ball");
if (plantBall != null) {
RecipeUtil.addFermenterRecipes(plantBall, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
}
ItemStack bioChaff = IC2Items.getItem("crafting", "bio_chaff");
if (bioChaff != null) {
RecipeUtil.addFermenterRecipes(bioChaff, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
}
ItemRegistryApiculture beeItems = PluginApiculture.items;
if (beeItems != null) {
if (resin != null) {
RecipeManagers.centrifugeManager.addRecipe(20, beeItems.propolis.get(EnumPropolis.NORMAL, 1), ImmutableMap.of(resin, 1.0f));
} else {
Log.info("Missing IC2 resin, skipping centrifuge recipe for propolis to resin.");
}
}
if (rubberSapling != null) {
RecipeUtil.addFermenterRecipes(rubberSapling, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
} else {
Log.info("Missing IC2 rubber sapling, skipping fermenter recipe for converting rubber sapling to biomass.");
}
if (rubberSapling != null && resin != null) {
String saplingName = ItemStackUtil.getBlockNameFromRegistryAsSting(ItemStackUtil.getBlock(rubberSapling));
String resinName = ItemStackUtil.getItemNameFromRegistryAsString(resin.getItem());
String imc = String.format("farmArboreal@%s.%s.%s.%s",
saplingName, rubberSapling.getItemDamage(),
resinName, resin.getItemDamage());
Log.trace("Sending IMC '%s'.", imc);
FMLInterModComms.sendMessage(Constants.MOD_ID, "add-farmable-sapling", imc);
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ENERGY)) {
Fluid biogas = FluidRegistry.getFluid("ic2biogas");
if (biogas != null) {
int burnDuration = Math.round(Constants.ENGINE_CYCLE_DURATION_BIOMASS * ForestryAPI.activeMode.getFloatSetting("fuel.biomass.biogas"));
EngineBronzeFuel bronzeFuel = new EngineBronzeFuel(Fluids.BIOMASS.getFluid(), Constants.ENGINE_FUEL_VALUE_BIOMASS, burnDuration, 1);
FuelManager.bronzeEngineFuel.put(biogas, bronzeFuel);
}
}
ItemStack waterCell = IC2Items.getItem("fluid_cell", "water");
if (waterCell != null) {
int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can");
if (bogEarthOutputCan > 0) {
ItemStack bogEarthCan = PluginCore.blocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, bogEarthOutputCan);
RecipeUtil.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waterCell, 'Y', "sand");
}
}
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout("forestry.engine.tin");
// / Solder Manager
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.COPPER, 1), Circuit.energyElectricChoke1);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.TIN, 1), Circuit.energyElectricBoost1);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuit.energyElectricBoost2);
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.IRON, 1), Circuit.energyElectricEfficiency1);
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
if (resin != null && rubberWood != null) {
ICircuitLayout layoutManual = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual");
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.RUBBER, 1), Circuit.farmRubberManual);
}
Farmables.farmables.get("farmOrchard").add(new FarmableBasicIC2Crop());
}
BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
if (energyBlocks != null) {
RecipeUtil.addRecipe(blocks.generator,
"X#X",
"XYX",
"X#X",
'#', "blockGlass",
'X', "ingotGold",
'Y', coreItems.sturdyCasing);
RecipeUtil.addRecipe(blocks.electricalEngine,
"###",
" X ",
"YVY",
'#', "ingotTin",
'X', "blockGlass",
'Y', "gearTin",
'V', Blocks.PISTON);
}
}
@Override
public void registerItemsAndBlocks() {
super.registerItemsAndBlocks();
blocks = new BlockRegistryIC2();
}
}
///*******************************************************************************
// * Copyright (c) 2011-2014 SirSengir.
// * All rights reserved. This program and the accompanying materials
// * are made available under the terms of the GNU Lesser Public License v3
// * which accompanies this distribution, and is available at
// * http://www.gnu.org/licenses/lgpl-3.0.txt
// *
// * Various Contributors including, but not limited to:
// * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
// ******************************************************************************/
//package forestry.plugins.compat;
//
//import javax.annotation.Nonnull;
//import java.util.Set;
//
//import com.google.common.collect.ImmutableMap;
//import forestry.api.circuits.ChipsetManager;
//import forestry.api.circuits.CircuitSocketType;
//import forestry.api.circuits.ICircuitLayout;
//import forestry.api.core.ForestryAPI;
//import forestry.api.farming.Farmables;
//import forestry.api.fuels.EngineBronzeFuel;
//import forestry.api.fuels.FuelManager;
//import forestry.api.recipes.RecipeManagers;
//import forestry.api.storage.BackpackManager;
//import forestry.api.storage.ICrateRegistry;
//import forestry.api.storage.StorageManager;
//import forestry.apiculture.PluginApiculture;
//import forestry.apiculture.items.EnumPropolis;
//import forestry.apiculture.items.ItemRegistryApiculture;
//import forestry.core.PluginCore;
//import forestry.core.blocks.BlockBogEarth;
//import forestry.core.circuits.Circuit;
//import forestry.core.circuits.CircuitLayout;
//import forestry.core.config.Constants;
//import forestry.core.fluids.Fluids;
//import forestry.core.items.EnumElectronTube;
//import forestry.core.items.ItemRegistryCore;
//import forestry.core.recipes.RecipeUtil;
//import forestry.core.utils.ItemStackUtil;
//import forestry.core.utils.Log;
//import forestry.core.utils.ModUtil;
//import forestry.energy.PluginEnergy;
//import forestry.energy.blocks.BlockRegistryEnergy;
//import forestry.energy.circuits.CircuitElectricBoost;
//import forestry.energy.circuits.CircuitElectricChoke;
//import forestry.energy.circuits.CircuitElectricEfficiency;
//import forestry.farming.circuits.CircuitFarmLogic;
//import forestry.farming.logic.FarmLogicRubber;
//import forestry.farming.logic.FarmableBasicIC2Crop;
//import forestry.plugins.BlankForestryPlugin;
//import forestry.plugins.ForestryPlugin;
//import forestry.plugins.ForestryPluginUids;
//import ic2.api.item.IC2Items;
//import ic2.api.recipe.RecipeInputItemStack;
//import ic2.api.recipe.Recipes;
//import net.minecraft.init.Blocks;
//import net.minecraft.item.ItemStack;
//import net.minecraftforge.fluids.Fluid;
//import net.minecraftforge.fluids.FluidRegistry;
//import net.minecraftforge.fml.common.Optional;
//import net.minecraftforge.fml.common.event.FMLInterModComms;
//
//@ForestryPlugin(pluginID = ForestryPluginUids.INDUSTRIALCRAFT2, name = "IndustrialCraft2", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.ic2.description")
//public class PluginIC2 extends BlankForestryPlugin {
// public static final String modId = "IC2";
// public static PluginIC2 instance;
//
// private static ItemStack rubberSapling;
// private static ItemStack rubber;
// public static ItemStack rubberWood;
// public static ItemStack resin;
//
// public BlockRegistryIC2 blocks;
//
// public PluginIC2() {
// if (PluginIC2.instance == null) {
// PluginIC2.instance = this;
// }
// }
//
// @Override
// public boolean isAvailable() {
// return ModUtil.isModLoaded(PluginIC2.modId);
// }
//
// @Override
// public String getFailMessage() {
// return "IndustrialCraft2 not found";
// }
//
// @Nonnull
// @Override
// public Set<String> getDependencyUids() {
// Set<String> dependencyUids = super.getDependencyUids();
// dependencyUids.add(ForestryPluginUids.FARMING);
// dependencyUids.add(ForestryPluginUids.FACTORY);
// return dependencyUids;
// }
//
// @Override
// @Optional.Method(modid = PluginIC2.modId)
// public void preInit() {
// super.preInit();
//
// // rubber chain
// rubberWood = IC2Items.getItem("rubber_wood");
// resin = IC2Items.getItem("misc_resource", "resin");
// rubberSapling = IC2Items.getItem("sapling");
// rubber = IC2Items.getItem("crafting", "rubber");
//
// Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", new FarmLogicRubber());
//
// ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin", CircuitSocketType.ELECTRIC_ENGINE);
// ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
//
// Farmables.fertilizers.put(IC2Items.getItem("crop_res", "fertilizer"), 250);
// }
//
// @Override
// @Optional.Method(modid = PluginIC2.modId)
// public void doInit() {
// super.doInit();
//
// // Remove some items from the recycler
// if (Recipes.recyclerBlacklist != null) {
// ItemRegistryApiculture beeItems = PluginApiculture.items;
// if (beeItems != null) {
// Recipes.recyclerBlacklist.add(new RecipeInputItemStack(new ItemStack(beeItems.beeQueenGE)));
// Recipes.recyclerBlacklist.add(new RecipeInputItemStack(new ItemStack(beeItems.beePrincessGE)));
// }
// } else {
// Log.error("IC2 Recipes.recyclerBlacklist not found.");
// }
//
// Circuit.energyElectricChoke1 = new CircuitElectricChoke("electric.choke.1");
// Circuit.energyElectricEfficiency1 = new CircuitElectricEfficiency("electric.efficiency.1");
// Circuit.energyElectricBoost1 = new CircuitElectricBoost("electric.boost.1", 7, 20);
// Circuit.energyElectricBoost2 = new CircuitElectricBoost("electric.boost.2", 15, 40);
//
// blocks.electricalEngine.init();
// blocks.generator.init();
// }
//
// @Override
// public void postInit() {
// super.postInit();
//
// if (BackpackManager.backpackInterface == null) {
// return;
// }
//
// if (resin != null) {
// BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, resin);
// }
// if (rubber != null) {
// BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubber);
// }
// if (rubberSapling != null) {
// BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubberSapling);
// }
// ItemStack rubberLeaves = IC2Items.getItem("leaves");
// if (rubberLeaves != null) {
// BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubberLeaves);
// }
// }
//
// @Override
// public void registerCrates() {
// ICrateRegistry crateRegistry = StorageManager.crateRegistry;
// if (crateRegistry == null) {
// return;
// }
//
// if (resin != null) {
// crateRegistry.registerCrate(resin);
// }
//
// if (rubber != null) {
// crateRegistry.registerCrate(rubber);
// }
//
// ItemStack scrap = IC2Items.getItem("crafting", "scrap");
// if (scrap != null) {
// crateRegistry.registerCrate(scrap);
// }
//
// ItemStack uuMatter = IC2Items.getItem("misc_resource", "matter");
// if (uuMatter != null) {
// crateRegistry.registerCrate(uuMatter);
// }
//
// ItemStack silver = IC2Items.getItem("ingot", "silver");
// if (silver != null) {
// crateRegistry.registerCrate(silver);
// }
//
// ItemStack brass = IC2Items.getItem("ingot", "bronze");
// if (brass != null) {
// crateRegistry.registerCrate(brass);
// }
// }
//
// @Override
// @Optional.Method(modid = PluginIC2.modId)
// public void registerRecipes() {
// ItemRegistryCore coreItems = PluginCore.items;
//
// if (rubber != null) {
// for (Object rubberOreDict : RecipeUtil.getOreDictRecipeEquivalents(rubber)) {
// RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), coreItems.tubes.get(EnumElectronTube.RUBBER, 4),
// new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', rubberOreDict});
// }
// }
//
// ItemStack plantBall = IC2Items.getItem("crafting", "plant_ball");
// if (plantBall != null) {
// RecipeUtil.addFermenterRecipes(plantBall, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
// }
//
// ItemStack bioChaff = IC2Items.getItem("crafting", "bio_chaff");
// if (bioChaff != null) {
// RecipeUtil.addFermenterRecipes(bioChaff, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat") * 9, Fluids.BIOMASS);
// }
//
// ItemRegistryApiculture beeItems = PluginApiculture.items;
// if (beeItems != null) {
// if (resin != null) {
// RecipeManagers.centrifugeManager.addRecipe(20, beeItems.propolis.get(EnumPropolis.NORMAL, 1), ImmutableMap.of(resin, 1.0f));
// } else {
// Log.info("Missing IC2 resin, skipping centrifuge recipe for propolis to resin.");
// }
// }
//
// if (rubberSapling != null) {
// RecipeUtil.addFermenterRecipes(rubberSapling, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
// } else {
// Log.info("Missing IC2 rubber sapling, skipping fermenter recipe for converting rubber sapling to biomass.");
// }
//
// if (rubberSapling != null && resin != null) {
// String saplingName = ItemStackUtil.getBlockNameFromRegistryAsSting(ItemStackUtil.getBlock(rubberSapling));
// String resinName = ItemStackUtil.getItemNameFromRegistryAsString(resin.getItem());
// String imc = String.format("farmArboreal@%s.%s.%s.%s",
// saplingName, rubberSapling.getItemDamage(),
// resinName, resin.getItemDamage());
// Log.trace("Sending IMC '%s'.", imc);
// FMLInterModComms.sendMessage(Constants.MOD_ID, "add-farmable-sapling", imc);
// }
//
//
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ENERGY)) {
// Fluid biogas = FluidRegistry.getFluid("ic2biogas");
// if (biogas != null) {
// int burnDuration = Math.round(Constants.ENGINE_CYCLE_DURATION_BIOMASS * ForestryAPI.activeMode.getFloatSetting("fuel.biomass.biogas"));
// EngineBronzeFuel bronzeFuel = new EngineBronzeFuel(Fluids.BIOMASS.getFluid(), Constants.ENGINE_FUEL_VALUE_BIOMASS, burnDuration, 1);
// FuelManager.bronzeEngineFuel.put(biogas, bronzeFuel);
// }
// }
//
// ItemStack waterCell = IC2Items.getItem("fluid_cell", "water");
// if (waterCell != null) {
// int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can");
// if (bogEarthOutputCan > 0) {
// ItemStack bogEarthCan = PluginCore.blocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, bogEarthOutputCan);
// RecipeUtil.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waterCell, 'Y', "sand");
// }
// }
//
// ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout("forestry.engine.tin");
//
// // / Solder Manager
// ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.COPPER, 1), Circuit.energyElectricChoke1);
// ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.TIN, 1), Circuit.energyElectricBoost1);
// ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.BRONZE, 1), Circuit.energyElectricBoost2);
// ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.IRON, 1), Circuit.energyElectricEfficiency1);
//
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
// if (resin != null && rubberWood != null) {
// ICircuitLayout layoutManual = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual");
// ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.RUBBER, 1), Circuit.farmRubberManual);
// }
//
// Farmables.farmables.get("farmOrchard").add(new FarmableBasicIC2Crop());
// }
//
//
// BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
// if (energyBlocks != null) {
// RecipeUtil.addRecipe(blocks.generator,
// "X#X",
// "XYX",
// "X#X",
// '#', "blockGlass",
// 'X', "ingotGold",
// 'Y', coreItems.sturdyCasing);
//
// RecipeUtil.addRecipe(blocks.electricalEngine,
// "###",
// " X ",
// "YVY",
// '#', "ingotTin",
// 'X', "blockGlass",
// 'Y', "gearTin",
// 'V', Blocks.PISTON);
// }
// }
//
// @Override
// public void registerItemsAndBlocks() {
// super.registerItemsAndBlocks();
// blocks = new BlockRegistryIC2();
// }
//}
@@ -1,5 +1,7 @@
package forestry.plugins.compat;
import javax.annotation.Nullable;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.api.farming.ICrop;
@@ -15,15 +17,13 @@ import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ForestryPlugin(pluginID = ForestryPluginUids.IMMERSIVE_ENGINEERING, name = "ImmersiveEngineering", author = "marcin212", url = Constants.URL, unlocalizedDescription = "for.plugin.immersiveengineering.description")
public class PluginImmersiveEngineering extends BlankForestryPlugin {
private static final String IE = "immersiveengineering";
@@ -43,9 +43,9 @@ public class PluginImmersiveEngineering extends BlankForestryPlugin {
ItemStack hempSeed = getItemStack("seed");
Block hempCrop = getBlock("hemp");
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
IProperty age = hempCrop.getBlockState().getProperties().stream().filter(p -> p.getName().equals("type")).findAny().get();
IProperty age = hempCrop.getBlockState().getProperties().stream().filter(p -> p.getName().equals("type")).findAny().orElseGet(null);
if (hempSeed != null && hempCrop != null && age != null) {
if (hempSeed != null && hempCrop != Blocks.AIR && age != null) {
IBlockState planted = hempCrop.getDefaultState().withProperty(age, (Comparable) age.parseValue("bottom0").get());
IBlockState mature = hempCrop.getDefaultState().withProperty(age, (Comparable) age.parseValue("top0").get());
Farmables.farmables.get("farmWheat").add(new FarmableBase(hempSeed, planted, mature, false) {
@@ -59,11 +59,12 @@ public class PluginImmersiveEngineering extends BlankForestryPlugin {
}
});
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{hempSeed}, Fluids.SEED_OIL.getFluid(seedAmount));
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
}
}
private static Block getBlock(@Nonnull String blockName) {
@Nullable
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(IE, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
@@ -73,7 +74,7 @@ public class PluginImmersiveEngineering extends BlankForestryPlugin {
}
@Nullable
private static ItemStack getItemStack(@Nonnull String itemName, int meta) {
private static ItemStack getItemStack(String itemName, int meta) {
ResourceLocation key = new ResourceLocation(IE, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return new ItemStack(ForgeRegistries.ITEMS.getValue(key), 1, meta);
@@ -83,7 +84,7 @@ public class PluginImmersiveEngineering extends BlankForestryPlugin {
}
@Nullable
private static ItemStack getItemStack(@Nonnull String itemName) {
private static ItemStack getItemStack(String itemName) {
return getItemStack(itemName, 0);
}
}
@@ -10,18 +10,10 @@
******************************************************************************/
package forestry.plugins.compat;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.core.ForestryAPI;
import forestry.api.fuels.FuelManager;
import forestry.api.fuels.MoistenerFuel;
@@ -37,18 +29,31 @@ import forestry.core.utils.ModUtil;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
@ForestryPlugin(pluginID = ForestryPluginUids.NATURA, name = "Natura", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.natura.description")
public class PluginNatura extends BlankForestryPlugin {
private static final String NATURA = "Natura";
@Nullable
private static Block logNatura;
@Nullable
private static Block logWillow;
@Nullable
private static Block leavesNatura;
@Nullable
private static Block saplingNatura;
@Nullable
private static Block saplingNaturaRare;
private static ItemStack berryBlight;
private static ItemStack berryDusk;
private static ItemStack berrySky;
@@ -73,11 +78,11 @@ public class PluginNatura extends BlankForestryPlugin {
public void preInit() {
super.preInit();
logNatura = GameRegistry.findBlock(NATURA, "tree");
logWillow = GameRegistry.findBlock(NATURA, "willow");
leavesNatura = GameRegistry.findBlock(NATURA, "floraleaves");
saplingNatura = GameRegistry.findBlock(NATURA, "florasapling");
saplingNaturaRare = GameRegistry.findBlock(NATURA, "Rare Sapling");
logNatura = getBlock("tree");
logWillow = getBlock("willow");
leavesNatura = getBlock("floraleaves");
saplingNatura = getBlock("florasapling");
saplingNaturaRare = getBlock("Rare Sapling");
ArrayList<String> saplingItemKeys = new ArrayList<>();
@@ -89,28 +94,24 @@ public class PluginNatura extends BlankForestryPlugin {
}
for (String key : saplingItemKeys) {
Item saplingItem = GameRegistry.findItem(NATURA, key);
ItemStack saplingWild = getItemStack(key, OreDictionary.WILDCARD_VALUE);
if (!saplingWild.isEmpty()) {
RecipeUtil.addFermenterRecipes(saplingWild, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
ItemStack saplingWild = new ItemStack(saplingItem, 1, OreDictionary.WILDCARD_VALUE);
RecipeUtil.addFermenterRecipes(saplingWild, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
String saplingName = ItemStackUtil.getItemNameFromRegistryAsString(saplingItem);
FMLInterModComms.sendMessage(Constants.MOD_ID, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
String saplingName = ItemStackUtil.getItemNameFromRegistryAsString(saplingWild.getItem());
FMLInterModComms.sendMessage(Constants.MOD_ID, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingName));
}
}
Item netherBerry = GameRegistry.findItem(NATURA, "berry.nether");
Item berry = GameRegistry.findItem(NATURA, "berry");
Item barley = GameRegistry.findItem(NATURA, "barleyFood");
berryBlight = new ItemStack(netherBerry, 1, 0);
berryDusk = new ItemStack(netherBerry, 1, 1);
berrySky = new ItemStack(netherBerry, 1, 2);
berrySting = new ItemStack(netherBerry, 1, 3);
berryRasp = new ItemStack(berry, 1, 0);
berryBlue = new ItemStack(berry, 1, 1);
berryBlack = new ItemStack(berry, 1, 2);
berryMalo = new ItemStack(berry, 1, 3);
itemBarley = new ItemStack(barley);
berryBlight = getItemStack("berry.nether", 0);
berryDusk = getItemStack("berry.nether", 1);
berrySky = getItemStack("berry.nether", 2);
berrySting = getItemStack("berry.nether", 3);
berryRasp = getItemStack("berry", 0);
berryBlue = getItemStack("berry", 1);
berryBlack = getItemStack("berry", 2);
berryMalo = getItemStack("berry", 3);
itemBarley = getItemStack("barleyFood", 0);
}
@Override
@@ -119,31 +120,31 @@ public class PluginNatura extends BlankForestryPlugin {
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
if (berryBlight != null) {
if (!berryBlight.isEmpty()) {
crateRegistry.registerCrate(berryBlight);
}
if (berryDusk != null) {
if (!berryDusk.isEmpty()) {
crateRegistry.registerCrate(berryDusk);
}
if (berrySky != null) {
if (!berrySky.isEmpty()) {
crateRegistry.registerCrate(berrySky);
}
if (berrySting != null) {
if (!berrySting.isEmpty()) {
crateRegistry.registerCrate(berrySting);
}
if (berryRasp != null) {
if (!berryRasp.isEmpty()) {
crateRegistry.registerCrate(berryRasp);
}
if (berryBlue != null) {
if (!berryBlue.isEmpty()) {
crateRegistry.registerCrate(berryBlue);
}
if (berryBlack != null) {
if (!berryBlack.isEmpty()) {
crateRegistry.registerCrate(berryBlack);
}
if (berryMalo != null) {
if (!berryMalo.isEmpty()) {
crateRegistry.registerCrate(berryMalo);
}
if (itemBarley != null) {
if (!itemBarley.isEmpty()) {
crateRegistry.registerCrate(itemBarley);
}
if (saplingNatura != null) {
@@ -164,11 +165,11 @@ public class PluginNatura extends BlankForestryPlugin {
crateRegistry.registerCrate(new ItemStack(saplingNaturaRare, 1, 3));
crateRegistry.registerCrate(new ItemStack(saplingNaturaRare, 1, 4));
}
Item potashApple = GameRegistry.findItem(NATURA, "Natura.netherfood");
if (potashApple != null) {
crateRegistry.registerCrate(new ItemStack(potashApple, 1, 0));
ItemStack potashApple = getItemStack("Natura.netherfood", 0);
if (!potashApple.isEmpty()) {
crateRegistry.registerCrate(potashApple);
}
Item glowShroom = GameRegistry.findItem(NATURA, "Glowshroom");
Item glowShroom = getItem("Glowshroom");
if (glowShroom != null) {
crateRegistry.registerCrate(new ItemStack(glowShroom, 1, 0));
crateRegistry.registerCrate(new ItemStack(glowShroom, 1, 1));
@@ -179,22 +180,25 @@ public class PluginNatura extends BlankForestryPlugin {
crateRegistry.registerCrate(new ItemStack(logNatura, 1, 1));
crateRegistry.registerCrate(new ItemStack(logNatura, 1, 2));
crateRegistry.registerCrate(new ItemStack(logNatura, 1, 3));
}
if (logWillow != null) {
crateRegistry.registerCrate(new ItemStack(logWillow, 1, 0));
}
Item bloodWood = GameRegistry.findItem(NATURA, "bloodwood");
Item bloodWood = getItem("bloodwood");
if (bloodWood != null) {
crateRegistry.registerCrate(new ItemStack(bloodWood, 1, 0));
}
Item darkTree = GameRegistry.findItem(NATURA, "Dark Tree");
Item darkTree = getItem("Dark Tree");
if (darkTree != null) {
crateRegistry.registerCrate(new ItemStack(darkTree, 1, 0));
crateRegistry.registerCrate(new ItemStack(darkTree, 1, 1));
}
Item heatSand = GameRegistry.findItem(NATURA, "heatsand");
Item heatSand = getItem("heatsand");
if (heatSand != null) {
crateRegistry.registerCrate(new ItemStack(heatSand, 1, 0));
}
Item taintedSoil = GameRegistry.findItem(NATURA, "soil.tainted");
Item taintedSoil = getItem("soil.tainted");
if (taintedSoil != null) {
crateRegistry.registerCrate(new ItemStack(taintedSoil, 1, 0));
}
@@ -202,71 +206,74 @@ public class PluginNatura extends BlankForestryPlugin {
@Override
public void registerRecipes() {
Item seed = GameRegistry.findItem(NATURA, "barley.seed");
ItemStack seedBarley = new ItemStack(seed, 1, 0);
ItemStack seedCotton = new ItemStack(seed, 1, 1);
ArrayList<ItemStack> seedList = new ArrayList<>();
if (seedBarley != null) {
seedList.add(seedBarley);
RecipeManagers.moistenerManager.addRecipe(seedBarley, new ItemStack(Blocks.MYCELIUM), 5000);
}
if (seedCotton != null) {
seedList.add(seedCotton);
}
int amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
for (ItemStack aSeedList : seedList) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{aSeedList}, Fluids.SEED_OIL.getFluid(amount));
Item seed = getItem("barley.seed");
if (seed != null) {
ItemStack seedBarley = new ItemStack(seed, 1, 0);
ItemStack seedCotton = new ItemStack(seed, 1, 1);
ArrayList<ItemStack> seedList = new ArrayList<>();
if (!seedBarley.isEmpty()) {
seedList.add(seedBarley);
RecipeManagers.moistenerManager.addRecipe(seedBarley, new ItemStack(Blocks.MYCELIUM), 5000);
}
if (!seedCotton.isEmpty()) {
seedList.add(seedCotton);
}
for (ItemStack aSeedList : seedList) {
RecipeManagers.squeezerManager.addRecipe(10, aSeedList, Fluids.SEED_OIL.getFluid(amount));
}
}
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
Block cropBlock = GameRegistry.findBlock(NATURA, "N Crops");
Block cropBlock = getBlock("N Crops");
//TODO: Natura for 1.9
// Farmables.farmables.get("farmWheat").add(new FarmableHandPlanted(seedBarley, cropBlock, 3));
// Farmables.farmables.get("farmWheat").add(new FarmableHandPlanted(seedCotton, cropBlock, 8));
}
List<ItemStack> berries = new ArrayList<>();
if (berryBlight != null) {
if (!berryBlight.isEmpty()) {
berries.add(berryBlight);
}
if (berryDusk != null) {
if (!berryDusk.isEmpty()) {
berries.add(berryDusk);
}
if (berrySky != null) {
if (!berrySky.isEmpty()) {
berries.add(berrySky);
}
if (berrySting != null) {
if (!berrySting.isEmpty()) {
berries.add(berrySting);
}
if (berryRasp != null) {
if (!berryRasp.isEmpty()) {
berries.add(berryRasp);
}
if (berryBlue != null) {
if (!berryBlue.isEmpty()) {
berries.add(berryBlue);
}
if (berryBlack != null) {
if (!berryBlack.isEmpty()) {
berries.add(berryBlack);
}
if (berryMalo != null) {
if (!berryMalo.isEmpty()) {
berries.add(berryMalo);
}
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 2;
amount = Math.max(amount, 1); // Produce at least 1 mb of juice.
ItemStack netherFood = new ItemStack(GameRegistry.findItem(NATURA, "Natura.netherfood"), 1, 0);
ItemStack netherFood = getItemStack("Natura.netherfood", 0);
ItemStack mulch = PluginCore.items.mulch.getItemStack();
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{netherFood}, Fluids.JUICE.getFluid(amount), mulch, ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple"));
RecipeManagers.squeezerManager.addRecipe(10, netherFood, Fluids.JUICE.getFluid(amount), mulch, ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple"));
amount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
amount = Math.max(amount, 1); // Produce at least 1 mb of juice.
for (ItemStack berry : berries) {
RecipeManagers.squeezerManager.addRecipe(3, new ItemStack[]{berry}, Fluids.JUICE.getFluid(amount));
RecipeManagers.squeezerManager.addRecipe(3, berry, Fluids.JUICE.getFluid(amount));
}
if (itemBarley != null) {
if (!itemBarley.isEmpty()) {
RecipeUtil.addFermenterRecipes(itemBarley, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
if (compostWheatAmount > 0) {
@@ -277,4 +284,32 @@ public class PluginNatura extends BlankForestryPlugin {
}
}
@Nullable
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(NATURA, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
} else {
return null;
}
}
@Nullable
private static Item getItem(String itemName) {
ResourceLocation key = new ResourceLocation(NATURA, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return ForgeRegistries.ITEMS.getValue(key);
} else {
return null;
}
}
private static ItemStack getItemStack(String itemName, int meta) {
ResourceLocation key = new ResourceLocation(NATURA, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return new ItemStack(ForgeRegistries.ITEMS.getValue(key), 1, meta);
} else {
return ItemStack.EMPTY;
}
}
}
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@FieldsAreNonnullByDefault
@MethodsReturnNonnullByDefault
package forestry.plugins.compat;
import javax.annotation.ParametersAreNonnullByDefault;
import forestry.core.utils.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@FieldsAreNonnullByDefault
@MethodsReturnNonnullByDefault
package forestry.plugins;
import javax.annotation.ParametersAreNonnullByDefault;
import forestry.core.utils.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;