diff --git a/lang b/lang index 8bd772eb2..ba83a26c9 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 8bd772eb208af109520a56b60762f25889f2ed0d +Subproject commit ba83a26c9ca5e4594b4daac0519c5535b5b025fc diff --git a/src/main/java/forestry/core/circuits/Circuit.java b/src/main/java/forestry/core/circuits/Circuit.java index 52b3ecee0..1433eeb6f 100755 --- a/src/main/java/forestry/core/circuits/Circuit.java +++ b/src/main/java/forestry/core/circuits/Circuit.java @@ -97,4 +97,5 @@ public abstract class Circuit implements ICircuit { public static ICircuit farmOrchardManual; public static ICircuit farmRubberManual; + public static ICircuit farmEnderManaged; } diff --git a/src/main/java/forestry/core/config/Config.java b/src/main/java/forestry/core/config/Config.java index a9f9f5586..bdeb94462 100755 --- a/src/main/java/forestry/core/config/Config.java +++ b/src/main/java/forestry/core/config/Config.java @@ -80,6 +80,7 @@ public class Config { public static final ArrayList collectorStamps = new ArrayList(); public static boolean squareFarms = false; + public static boolean ExUtilEnderLily = true; // Mail public static boolean mailAlertEnabled = true; @@ -109,6 +110,10 @@ public class Config { return generateBeehivesRate; } + public static boolean isExUtilEnderLilyEnabled() { + return ExUtilEnderLily; + } + public static void load() { setDebugMode(); @@ -237,6 +242,10 @@ public class Config { property.comment = "set to true to have farms use a square layout instead of a diamond one."; Config.squareFarms = Boolean.parseBoolean(property.value); + Property supportEnderlily = config.get("tweaks.farms.exutilenderlily", CATEGORY_COMMON, true); + supportEnderlily.comment = "set to false to disable multifarm support for ExtraUtilities Ender-lily seeds."; + ExUtilEnderLily = Boolean.parseBoolean(supportEnderlily.value); + property = config.get("structures.schemata.disabled", CATEGORY_COMMON, ""); property.comment = "add schemata keys to disable them. current keys: alveary3x3;farm3x3;farm3x4;farm3x5;farm4x4;farm5x5"; disabledStructures.addAll(Arrays.asList(parseStructureKeys(property.value))); diff --git a/src/main/java/forestry/core/items/ItemOverlay.java b/src/main/java/forestry/core/items/ItemOverlay.java index a73fe1975..7f3c6b5a9 100755 --- a/src/main/java/forestry/core/items/ItemOverlay.java +++ b/src/main/java/forestry/core/items/ItemOverlay.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.core.items; +import java.awt.Color; import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; @@ -34,6 +35,10 @@ public class ItemOverlay extends ItemForestry { public final int secondaryColor; public boolean isSecret = false; + public OverlayInfo(String name, Color primaryColor, Color secondaryColor) { + this(name, primaryColor.getRGB(), secondaryColor.getRGB()); + } + public OverlayInfo(String name, int primaryColor, int secondaryColor) { this.name = name; this.primaryColor = primaryColor; diff --git a/src/main/java/forestry/farming/logic/FarmLogicEnder.java b/src/main/java/forestry/farming/logic/FarmLogicEnder.java new file mode 100644 index 000000000..b6e656274 --- /dev/null +++ b/src/main/java/forestry/farming/logic/FarmLogicEnder.java @@ -0,0 +1,123 @@ +/******************************************************************************* + * 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.farming.logic; + +import java.util.Collection; +import java.util.Stack; + +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import net.minecraftforge.common.util.ForgeDirection; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import forestry.api.farming.Farmables; +import forestry.api.farming.ICrop; +import forestry.api.farming.IFarmHousing; +import forestry.api.farming.IFarmable; +import forestry.core.utils.Utils; +import forestry.core.vect.Vect; +import forestry.core.vect.VectUtil; + +public class FarmLogicEnder extends FarmLogicHomogeneous { + + public FarmLogicEnder(IFarmHousing housing) { + super(housing, + new ItemStack[]{new ItemStack(Blocks.end_stone)}, + new ItemStack(Blocks.end_stone), + Farmables.farmables.get("farmEnder").toArray(new IFarmable[0])); + + } + + @Override + public String getName() { + return "Managed Ender Farm"; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon() { + return Items.ender_eye.getIconFromDamage(0); + } + + @Override + public int getFertilizerConsumption() { + return 20; + } + + @Override + public int getWaterConsumption(float hydrationModifier) { + return 0; + } + + @Override + public Collection collect() { + return null; + } + + @Override + public Collection harvest(int x, int y, int z, ForgeDirection direction, int extent) { + World world = getWorld(); + + Stack crops = new Stack(); + for (int i = 0; i < extent; i++) { + Vect position = translateWithOffset(x, y + 1, z, direction, i); + for (IFarmable farmable : germlings) { + ICrop crop = farmable.getCropAt(world, position.x, position.y, position.z); + if (crop != null) { + crops.push(crop); + } + } + + } + return crops; + + } + + @Override + protected boolean maintainGermlings(int x, int y, int z, ForgeDirection direction, int extent) { + World world = getWorld(); + + for (int i = 0; i < extent; i++) { + Vect position = translateWithOffset(x, y, z, direction, i); + if (!VectUtil.isAirBlock(world, position) && !Utils.isReplaceableBlock(world, position.x, position.y, position.z)) { + continue; + } + + ItemStack below = VectUtil.getAsItemStack(world, position.add(0, -1, 0)); + if (!isAcceptedGround(below)) { + continue; + } + + return trySetCrop(position); + } + + return false; + } + + private boolean trySetCrop(Vect position) { + World world = getWorld(); + + for (IFarmable candidate : germlings) { + if (housing.plantGermling(candidate, world, position.x, position.y, position.z)) { + return true; + } + } + + return false; + } + +} diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java old mode 100755 new mode 100644 index 33b76cd26..8b52e5f23 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.plugins; +import java.awt.Color; import java.util.ArrayList; import net.minecraft.block.material.Material; @@ -210,12 +211,25 @@ public class PluginCore extends ForestryPlugin { // / CIRCUIT BOARDS ForestryItem.circuitboards.registerItem(new ItemCircuitBoard(), "chipsets"); ForestryItem.solderingIron.registerItem(new ItemSolderingIron(), "solderingIron"); + + Color tubeCoverNormal = Color.WHITE; + Color tubeCoverGold = new Color(0xFFF87E); + Color tubeCoverEnder = new Color(0x255661); + ForestryItem.tubes.registerItem(new ItemOverlay(CreativeTabForestry.tabForestry, - new OverlayInfo("ex-0", 0xffffff, 0xe3b78e), new OverlayInfo("ex-1", 0xffffff, 0xe1eef4), - new OverlayInfo("ex-2", 0xffffff, 0xddc276), new OverlayInfo("ex-3", 0xffffff, 0xd8d8d8), new OverlayInfo("ex-4", 0xffffff, 0xffff8b), - new OverlayInfo("ex-5", 0xffffff, 0x7bd1b8), new OverlayInfo("ex-6", 0xffffff, 0x866bc0), new OverlayInfo("ex-7", 0xfff87e, 0xd96600), - new OverlayInfo("ex-8", 0xffffff, 0x444444), new OverlayInfo("ex-9", 0xffffff, 0xbfffdd), new OverlayInfo("ex-10", 0xffffff, 0x68ccee), - new OverlayInfo("ex-11", 0xffffff, 0x1c57c6)), "thermionicTubes"); + new OverlayInfo("ex-0", tubeCoverNormal, new Color(0xe3b78e)), + new OverlayInfo("ex-1", tubeCoverNormal, new Color(0xE6F8FF)), + new OverlayInfo("ex-2", tubeCoverNormal, new Color(0xddc276)), + new OverlayInfo("ex-3", tubeCoverNormal, new Color(0xCCCCCC)), + new OverlayInfo("ex-4", tubeCoverNormal, new Color(0xffff8b)), + new OverlayInfo("ex-5", tubeCoverNormal, new Color(0x8CF5E3)), + new OverlayInfo("ex-6", tubeCoverNormal, new Color(0x866bc0)), + new OverlayInfo("ex-7", tubeCoverGold, new Color(0xd96600)), + new OverlayInfo("ex-8", tubeCoverNormal, new Color(0x444444)), + new OverlayInfo("ex-9", tubeCoverNormal, new Color(0x00CC41)), + new OverlayInfo("ex-10", tubeCoverNormal, new Color(0x579CD9)), + new OverlayInfo("ex-11", tubeCoverNormal, new Color(0x1c57c6)), + new OverlayInfo("ex-12", tubeCoverEnder, new Color(0x33adad))), "thermionicTubes"); // / CARTONS ForestryItem.carton.registerItem((new ItemForestry()), "carton"); diff --git a/src/main/java/forestry/plugins/PluginExtraUtilities.java b/src/main/java/forestry/plugins/PluginExtraUtilities.java new file mode 100644 index 000000000..bafa4b671 --- /dev/null +++ b/src/main/java/forestry/plugins/PluginExtraUtilities.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +import cpw.mods.fml.common.registry.GameRegistry; + +import forestry.api.farming.Farmables; +import forestry.api.farming.IFarmable; +import forestry.core.circuits.Circuit; +import forestry.core.config.Config; +import forestry.core.config.Defaults; +import forestry.core.proxy.Proxies; +import forestry.farming.circuits.CircuitFarmLogic; +import forestry.farming.logic.FarmLogicEnder; +import forestry.farming.logic.FarmableGenericCrop; + +@Plugin(pluginID = "ExtraUtilities", name = "ExtraUtilities", author = "Nirek", url = Defaults.URL, unlocalizedDescription = "for.plugin.extrautilities.description") +public class PluginExtraUtilities extends ForestryPlugin { + + private static final String ExU = "ExtraUtilities"; + + public static Block ExUEnderLilly; + + @Override + public boolean isAvailable() { + return Proxies.common.isModLoaded(ExU); + } + + @Override + public String getFailMessage() { + return "ExtraUtilities not found"; + } + + @Override + public void doInit() { + super.doInit(); + + ExUEnderLilly = GameRegistry.findBlock(ExU, "plant/ender_lilly"); + Farmables.farmables.put("farmEnder", new ArrayList()); + if (Config.isExUtilEnderLilyEnabled()) { + Circuit.farmEnderManaged = new CircuitFarmLogic("managedEnder", FarmLogicEnder.class); + Farmables.farmables.get("farmEnder").add(new FarmableGenericCrop(new ItemStack(ExUEnderLilly, 1, 0), ExUEnderLilly, 7)); + } + } +} diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index e6ed64c14..d31eff4d9 100644 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -270,6 +270,8 @@ public class PluginFactory extends ForestryPlugin { new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', "gemApatite"}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), ForestryItem.tubes.getItemStack(4, 11), new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', new ItemStack(Items.dye, 1, 4)}); + RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), ForestryItem.tubes.getItemStack(4, 12), + new Object[]{" X ", "#X#", "XXX", '#', new ItemStack(Items.ender_eye, 1, 0), 'X', new ItemStack(Blocks.end_stone, 1, 0)}); String[] dyes = {"dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite"}; diff --git a/src/main/java/forestry/plugins/PluginFarming.java b/src/main/java/forestry/plugins/PluginFarming.java old mode 100755 new mode 100644 index 62702dcf3..22844b8d5 --- a/src/main/java/forestry/plugins/PluginFarming.java +++ b/src/main/java/forestry/plugins/PluginFarming.java @@ -33,6 +33,7 @@ import forestry.api.farming.Farmables; import forestry.api.farming.IFarmable; import forestry.core.circuits.Circuit; import forestry.core.circuits.CircuitLayout; +import forestry.core.config.Config; import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; @@ -341,5 +342,9 @@ public class PluginFarming extends ForestryPlugin { if (PluginIC2.resin != null && PluginIC2.rubberwood != null) { ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 8), Circuit.farmRubberManual); } + + if (PluginExtraUtilities.ExUEnderLilly != null && Config.isExUtilEnderLilyEnabled()) { + ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 12), Circuit.farmEnderManaged); + } } } diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index c9bb8afde..d1bd7dc7c 100755 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -84,6 +84,7 @@ public class PluginManager { BUILDCRAFT_STATEMENTS(new PluginBuildCraftStatements()), BUILDCRAFT_TRANSPORT(new PluginBuildCraftTransport()), PROPOLIS_PIPE(new PluginPropolisPipe()), + EXTRAUTILITIES(new PluginExtraUtilities()), EQUIVELENT_EXCHANGE(new PluginEE()), FARM_CRAFTORY(new PluginFarmCraftory()), INDUSTRIALCRAFT(new PluginIC2()),