Reformed Forestry!

* Updated for BC 6.0.x compatibility
* Re-implemented the Pipes plugin
* Converted to vanilla assets lang system
* Converted to standard gradle file structure
* General warnings cleanup
This commit is contained in:
Parker committed 2014-08-11 16:56:09 -04:00
1 parent 36248c02f1
commit 8f2d802f11
1602 files changed
+724 -736

No files matched your search

+89
View File
@@ -0,0 +1,89 @@
/*******************************************************************************
* 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.Random;
import net.minecraft.command.ICommand;
import net.minecraft.world.World;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.core.IPlugin;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.IPacketHandler;
import forestry.core.interfaces.IPickupHandler;
import forestry.core.interfaces.IResupplyHandler;
import forestry.core.interfaces.ISaveEventHandler;
public abstract class NativePlugin implements IPlugin {
@Override
public void preInit() {
registerItems();
}
@Override
public void doInit() {
registerBackpackItems();
registerCrates();
}
@Override
public void postInit() {
registerRecipes();
}
public boolean processIMCMessage(IMCMessage message) {
return false;
}
public IGuiHandler getGuiHandler() {
return null;
}
public ISaveEventHandler getSaveEventHandler() {
return null;
}
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
}
public IPacketHandler getPacketHandler() {
return null;
}
public IPickupHandler getPickupHandler() {
return null;
}
public IResupplyHandler getResupplyHandler() {
return null;
}
public ICommand[] getConsoleCommands() {
return null;
}
protected abstract void registerItems();
protected abstract void registerBackpackItems();
protected abstract void registerCrates();
protected abstract void registerRecipes();
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+162
View File
@@ -0,0 +1,162 @@
/*******************************************************************************
* 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.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import buildcraft.api.fuels.IronEngineCoolant;
import buildcraft.api.fuels.IronEngineFuel;
import buildcraft.api.gates.ActionManager;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.ITriggerProvider;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.recipes.BuildcraftRecipes;
import buildcraft.api.transport.IPipeTile;
import forestry.api.core.IPlugin;
import forestry.api.core.PluginInfo;
import forestry.core.GameMode;
import forestry.core.config.Config;
import forestry.core.config.Configuration;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryItem;
import forestry.core.config.Property;
import forestry.core.gadgets.TileForestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
@PluginInfo(pluginID = "BC6", name = "BuildCraft 6", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for BuildCraft 6.")
public class PluginBuildCraft implements IPlugin, ITriggerProvider {
public static PluginBuildCraft instance;
public static Configuration config;
// Ignore Buildcraft?
public static boolean ignore;
public static Item wrench;
public static Item stoneGear;
public static Item pipeWaterproof;
public PluginBuildCraft() {
if (PluginBuildCraft.instance == null)
PluginBuildCraft.instance = this;
}
/**
* @return true if BuildCraftCore is installed.
*/
@Override
public boolean isAvailable() {
return (Proxies.common.isModLoaded("BuildCraft|Core") && Proxies.common.isModLoaded("BuildCraft|Transport"));
}
@Override
public void doInit() {
config = Config.config;
Property buildcraftignore = config.get("buildcraft.ignore", Config.CATEGORY_COMMON, false);
buildcraftignore.Comment = "set to true to ignore buildcraft";
PluginBuildCraft.ignore = Boolean.parseBoolean(buildcraftignore.Value);
IronEngineCoolant.addCoolant(LiquidHelper.getLiquid(Defaults.LIQUID_ICE, 1).getFluid(), 10.0f);
addIronEngineFuel(LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1).getFluid(), 4,
Defaults.ENGINE_CYCLE_DURATION_ETHANOL * GameMode.getGameMode().getFloatSetting("fuel.ethanol.combustion"));
// Add recipe for ethanol
addRefineryRecipe(LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS, 4), null, LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1), 10, 1);
// Add custom trigger handler
ActionManager.registerTriggerProvider(this);
initStoneGear();
initWaterproof();
initLiquids();
}
@Override
public void postInit() {
}
private void initLiquids() {
LiquidHelper.injectWaxContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleOil.getItemStack(), ForestryItem.waxCapsule.getItemStack());
LiquidHelper.injectWaxContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.waxCapsuleFuel.getItemStack(), ForestryItem.waxCapsule.getItemStack());
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryOil.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
LiquidHelper.injectRefractoryContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.refractoryFuel.getItemStack(), ForestryItem.refractoryEmpty.getItemStack());
LiquidHelper.injectTinContainer(Defaults.LIQUID_OIL, Defaults.BUCKET_VOLUME, ForestryItem.canOil.getItemStack(), ForestryItem.canEmpty.getItemStack());
LiquidHelper.injectTinContainer(Defaults.LIQUID_FUEL, Defaults.BUCKET_VOLUME, ForestryItem.canFuel.getItemStack(), ForestryItem.canEmpty.getItemStack());
}
private void addIronEngineFuel(Fluid fuel, float powerPerCycle, float totalBurningTime) {
IronEngineFuel.addFuel(fuel, (int) powerPerCycle, (int) totalBurningTime);
}
private void addRefineryRecipe(FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy, int delay) {
BuildcraftRecipes.refinery.addRecipe(ingredient1, ingredient2, result, energy, delay);
}
private void initStoneGear() {
try {
stoneGear = (Item) Class.forName("buildcraft.BuildCraftCore").getField("stoneGearItem").get(null);
} catch (Exception ex) {
Proxies.log.fine("No BuildCraft stone gear found.");
return;
}
}
private void initWaterproof() {
try {
pipeWaterproof = (Item) Class.forName("buildcraft.BuildCraftTransport").getField("pipeWaterproof").get(null);
} catch (Exception ex) {
Proxies.log.fine("No BuildCraft pipe waterproof found.");
return;
}
Proxies.common.addRecipe(new ItemStack(pipeWaterproof), "#", '#', ForestryItem.beeswax);
}
public double invokeUseEnergyMethod(PowerHandler workProvider, float min, float max, boolean doUse) {
return workProvider.useEnergy(min, max, doUse);
}
public void invokeReceiveEnergyMethod(PowerHandler.Type type, PowerReceiver receiver, double extractedEnergy, ForgeDirection from) {
receiver.receiveEnergy(type, extractedEnergy, from);
}
// / ITRIGGERPROVIDER
@Override
public LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe) {
return null;
}
@Override
public LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile) {
if (tile instanceof TileForestry)
return ((TileForestry) tile).getCustomTriggers();
return null;
}
@Override
public void preInit() {
}
}
+500
View File
@@ -0,0 +1,500 @@
/*******************************************************************************
* 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.block.material.Material;
import net.minecraft.command.ICommand;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import forestry.api.circuits.ChipsetManager;
import forestry.api.core.PluginInfo;
import forestry.api.core.Tabs;
import forestry.api.genetics.AlleleManager;
import forestry.core.CommandForestry;
import forestry.core.CreativeTabForestry;
import forestry.core.GameMode;
import forestry.core.PickupHandlerCore;
import forestry.core.SaveEventHandlerCore;
import forestry.core.circuits.CircuitRegistry;
import forestry.core.circuits.ItemCircuitBoard;
import forestry.core.circuits.ItemSolderingIron;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.gadgets.BlockBase;
import forestry.core.gadgets.BlockResource;
import forestry.core.gadgets.BlockSoil;
import forestry.core.gadgets.BlockStainedGlass;
import forestry.core.gadgets.MachineDefinition;
import forestry.core.gadgets.TileAnalyzer;
import forestry.core.gadgets.TileEscritoire;
import forestry.core.genetics.Allele;
import forestry.core.genetics.AlleleRegistry;
import forestry.core.genetics.ClimateHelper;
import forestry.core.genetics.ItemResearchNote;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.IPickupHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.items.ItemArmorNaturalist;
import forestry.core.items.ItemAssemblyKit;
import forestry.core.items.ItemCrated;
import forestry.core.items.ItemForestry;
import forestry.core.items.ItemForestryBlock;
import forestry.core.items.ItemForestryPickaxe;
import forestry.core.items.ItemForestryShovel;
import forestry.core.items.ItemFruit;
import forestry.core.items.ItemLiquidContainer;
import forestry.core.items.ItemLiquidContainer.EnumContainerType;
import forestry.core.items.ItemMisc;
import forestry.core.items.ItemOverlay;
import forestry.core.items.ItemOverlay.OverlayInfo;
import forestry.core.items.ItemPipette;
import forestry.core.items.ItemScoop;
import forestry.core.items.ItemWrench;
import forestry.core.proxy.Proxies;
import forestry.core.utils.ForestryModEnvWarningCallable;
import forestry.core.utils.ShapedRecipeCustom;
@PluginInfo(pluginID = "Core", name = "Core", author = "SirSengir", url = Defaults.URL, description = "Core mechanics for Forestry. Required by all other plugins.")
public class PluginCore extends NativePlugin implements IFuelHandler {
public static MachineDefinition definitionAnalyzer;
public static MachineDefinition definitionEscritoire;
// ICrashCallable for highlighting certain mods during crashes.
public static ForestryModEnvWarningCallable crashCallable;
@Override
public void preInit() {
super.preInit();
ChipsetManager.solderManager = new ItemSolderingIron.SolderManager();
CircuitRegistry circuitRegistry = new CircuitRegistry();
ChipsetManager.circuitRegistry = circuitRegistry;
circuitRegistry.initialize();
AlleleRegistry alleleRegistry = new AlleleRegistry();
AlleleManager.alleleRegistry = alleleRegistry;
AlleleManager.climateHelper = new ClimateHelper();
alleleRegistry.initialize();
Allele.initialize();
ForestryBlock.core = new BlockBase(Material.iron, true);
ForestryBlock.core.setBlockName("for.core");
Proxies.common.registerBlock(ForestryBlock.core, ItemForestryBlock.class);
definitionAnalyzer = ForestryBlock.core.addDefinition(new MachineDefinition(Defaults.DEFINITION_ANALYZER_META, "forestry.Analyzer", TileAnalyzer.class,
PluginApiculture.proxy.getRendererAnalyzer(Defaults.TEXTURE_PATH_BLOCKS + "/analyzer_")));
definitionEscritoire = ForestryBlock.core.addDefinition(new MachineDefinition(Defaults.DEFINITION_ESCRITOIRE_META, "forestry.Escritoire", TileEscritoire.class,
Proxies.render.getRenderEscritoire()));
ForestryBlock.soil = new BlockSoil().setBlockName("soil");
Proxies.common.registerBlock(ForestryBlock.soil, ItemForestryBlock.class);
ForestryBlock.soil.setHarvestLevel("shovel", 0, 0);
ForestryBlock.soil.setHarvestLevel("shovel", 0, 1);
ForestryBlock.resources = new BlockResource().setBlockName("resources");
Proxies.common.registerBlock(ForestryBlock.resources, ItemForestryBlock.class);
ForestryBlock.resources.setHarvestLevel("pickaxe", 1, 0);
ForestryBlock.resources.setHarvestLevel("pickaxe", 1, 1);
ForestryBlock.resources.setHarvestLevel("pickaxe", 1, 2);
OreDictionary.registerOre("oreApatite", new ItemStack(ForestryBlock.resources, 1, 0));
OreDictionary.registerOre("oreCopper", new ItemStack(ForestryBlock.resources, 1, 1));
OreDictionary.registerOre("oreTin", new ItemStack(ForestryBlock.resources, 1, 2));
ForestryBlock.glass = new BlockStainedGlass().setBlockName("stained");
Proxies.common.registerBlock(ForestryBlock.glass, ItemForestryBlock.class);
/* SMELTING RECIPES */
FurnaceRecipes.smelting().func_151394_a(new ItemStack(ForestryBlock.resources, 1, 1), ForestryItem.ingotCopper.getItemStack(), 0.5f);
FurnaceRecipes.smelting().func_151394_a(new ItemStack(ForestryBlock.resources, 1, 2), ForestryItem.ingotTin.getItemStack(), 0.5f);
GameRegistry.registerFuelHandler(this);
}
@Override
public void doInit() {
super.doInit();
definitionAnalyzer.recipes = createAlyzerRecipes(ForestryBlock.core, Defaults.DEFINITION_ANALYZER_META);
definitionAnalyzer.register();
definitionEscritoire.register();
crashCallable = new ForestryModEnvWarningCallable();
RecipeSorter.register("forestry:shapedrecipecustom", ShapedRecipeCustom.class, RecipeSorter.Category.SHAPED, "before:minecraft:shaped");
}
@Override
public boolean isAvailable() {
return true;
}
@Override
public IGuiHandler getGuiHandler() {
return null;
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return new SaveEventHandlerCore();
}
@Override
protected void registerItems() {
// / FERTILIZERS
ForestryItem.fertilizerBio.registerItem((new ItemForestry()), "fertilizerBio");
ForestryItem.fertilizerCompound.registerItem((new ItemForestry()).setBonemeal(true), "fertilizerCompound");
// / GEMS
ForestryItem.apatite.registerItem((new ItemForestry()), "apatite");
OreDictionary.registerOre("gemApatite", ForestryItem.apatite.getItemStack());
ForestryItem.researchNote.registerItem(new ItemResearchNote(), "researchNote");
// / INGOTS
ForestryItem.ingotCopper.registerItem(new ItemForestry(), "ingotCopper");
ForestryItem.ingotTin.registerItem(new ItemForestry(), "ingotTin");
ForestryItem.ingotBronze.registerItem(new ItemForestry(), "ingotBronze");
OreDictionary.registerOre("ingotCopper", ForestryItem.ingotCopper.getItemStack());
OreDictionary.registerOre("ingotTin", ForestryItem.ingotTin.getItemStack());
OreDictionary.registerOre("ingotBronze", ForestryItem.ingotBronze.getItemStack());
// / TOOLS
ForestryItem.wrench.registerItem((new ItemWrench()), "wrench");
ForestryItem.pipette.registerItem(new ItemPipette(), "pipette");
ForestryItem.scoop.registerItem(new ItemScoop(), "scoop");
ForestryItem.scoop.item().setHarvestLevel("scoop", 3);
// / MACHINES
ForestryItem.sturdyCasing.registerItem((new ItemForestry()), "sturdyMachine");
ForestryItem.hardenedCasing.registerItem((new ItemForestry()), "hardenedMachine");
ForestryItem.impregnatedCasing.registerItem((new ItemForestry()), "impregnatedCasing");
ForestryItem.craftingMaterial.registerItem(new ItemMisc(), "craftingMaterial");
/* ARMOR */
ForestryItem.naturalistHat.registerItem(new ItemArmorNaturalist(0), "naturalistHelmet");
// / DISCONTINUED
// ForestryItem.vialEmpty = (new
// ItemForestry(Config.getOrCreateIntProperty("vialEmpty",
// Config.CATEGORY_ITEM, Defaults.ID_ITEM_VIAL_EMPTY)))
// .setItemName("vialEmpty").setIconIndex(10);
ForestryItem.vialCatalyst.registerItem((new ItemForestry()), "vialCatalyst");
// / PEAT PRODUCTION
ForestryItem.peat.registerItem((new ItemForestry()), "peat");
OreDictionary.registerOre("brickPeat", ForestryItem.peat.getItemStack());
ForestryItem.ash.registerItem((new ItemForestry()), "ash");
OreDictionary.registerOre("dustAsh", ForestryItem.ash.getItemStack());
Proxies.common.addSmelting(ForestryItem.peat.getItemStack(), ForestryItem.ash.getItemStack());
ForestryItem.bituminousPeat.registerItem(new ItemForestry(), "bituminousPeat");
// / GEARS
ForestryItem.gearBronze.registerItem((new ItemForestry()), "gearBronze");
OreDictionary.registerOre("gearBronze", ForestryItem.gearBronze.getItemStack());
ForestryItem.gearCopper.registerItem((new ItemForestry()), "gearCopper");
OreDictionary.registerOre("gearCopper", ForestryItem.gearCopper.getItemStack());
ForestryItem.gearTin.registerItem((new ItemForestry()), "gearTin");
OreDictionary.registerOre("gearTin", ForestryItem.gearTin.getItemStack());
// / CIRCUIT BOARDS
ForestryItem.circuitboards.registerItem(new ItemCircuitBoard(), "chipsets");
ForestryItem.solderingIron.registerItem(new ItemSolderingIron(), "solderingIron");
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");
// / CRATES AND CARTONS
ForestryItem.carton.registerItem((new ItemForestry()), "carton");
ForestryItem.crate.registerItem((new ItemForestry()), "crate");
// / CRAFTING CARPENTER
ForestryItem.stickImpregnated.registerItem((new ItemForestry()), "oakStick");
ForestryItem.woodPulp.registerItem((new ItemForestry()), "woodPulp");
OreDictionary.registerOre("pulpWood", ForestryItem.woodPulp.getItemStack());
// / RECLAMATION
ForestryItem.brokenBronzePickaxe.registerItem((new ItemForestry()), "brokenBronzePickaxe");
ForestryItem.brokenBronzeShovel.registerItem((new ItemForestry()), "brokenBronzeShovel");
// / TOOLS
ForestryItem.bronzePickaxe.registerItem(new ItemForestryPickaxe(ForestryItem.brokenBronzePickaxe.getItemStack()), "bronzePickaxe");
ForestryItem.bronzePickaxe.item().setHarvestLevel("pickaxe", 3);
MinecraftForge.EVENT_BUS.register(ForestryItem.bronzePickaxe.item());
ForestryItem.bronzeShovel.registerItem(new ItemForestryShovel(ForestryItem.brokenBronzeShovel.getItemStack()), "bronzeShovel");
ForestryItem.bronzeShovel.item().setHarvestLevel("shovel", 3);
MinecraftForge.EVENT_BUS.register(ForestryItem.bronzeShovel.item());
// / ASSEMBLY KITS
ForestryItem.kitShovel.registerItem(new ItemAssemblyKit(ForestryItem.bronzeShovel.getItemStack()), "kitShovel");
ForestryItem.kitPickaxe.registerItem(new ItemAssemblyKit(ForestryItem.bronzePickaxe.getItemStack()), "kitPickaxe");
// / MOISTENER RESOURCES
ForestryItem.mouldyWheat.registerItem((new ItemForestry()), "mouldyWheat");
ForestryItem.decayingWheat.registerItem((new ItemForestry()), "decayingWheat");
ForestryItem.mulch.registerItem((new ItemForestry()), "mulch");
// / RAINMAKER SUBSTRATES
ForestryItem.iodineCharge.registerItem((new ItemForestry()), "iodineCapsule");
ForestryItem.phosphor.registerItem((new ItemForestry()), "phosphor");
// / BEE RESOURCES
ForestryItem.beeswax.registerItem(new ItemForestry().setCreativeTab(Tabs.tabApiculture), "beeswax");
OreDictionary.registerOre("itemBeeswax", ForestryItem.beeswax.getItemStack());
ForestryItem.refractoryWax.registerItem(new ItemForestry(), "refractoryWax");
// FRUITS
ForestryItem.fruits.registerItem(new ItemFruit(), "fruits");
// / EMPTY LIQUID CONTAINERS
ForestryItem.waxCapsule.registerItem(new ItemLiquidContainer(EnumContainerType.CAPSULE, -1).setMaxStackSize(64), "waxCapsule");
ForestryItem.canEmpty.registerItem(new ItemLiquidContainer(EnumContainerType.CAN, -1).setMaxStackSize(64), "canEmpty");
ForestryItem.refractoryEmpty.registerItem(new ItemLiquidContainer(EnumContainerType.REFRACTORY, -1).setMaxStackSize(64), "refractoryEmpty");
// / BUCKETS
ForestryItem.bucketBiomass.registerItem(new ItemForestry().setContainerItem(Items.bucket).setMaxStackSize(1), "bucketBiomass");
ForestryItem.bucketBiofuel.registerItem(new ItemForestry().setContainerItem(Items.bucket).setMaxStackSize(1), "bucketBiofuel");
// / WAX CAPSULES
ForestryItem.waxCapsuleWater.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x2432ec)), "waxCapsuleWater");
ForestryItem.waxCapsuleBiomass.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x83d41c)), "waxCapsuleBiomass");
ForestryItem.waxCapsuleBiofuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xff7909)), "waxCapsuleBiofuel");
ForestryItem.waxCapsuleOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x404040)), "waxCapsuleOil");
ForestryItem.waxCapsuleFuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xffff00)), "waxCapsuleFuel");
ForestryItem.waxCapsuleSeedOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xffffa9)), "waxCapsuleSeedOil");
ForestryItem.waxCapsuleHoney.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xffda47)).setDrink(Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION), "waxCapsuleHoney");
ForestryItem.waxCapsuleJuice.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0x99d04e)).setDrink(Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION), "waxCapsuleJuice");
ForestryItem.waxCapsuleIce.registerItem((new ItemLiquidContainer(EnumContainerType.CAPSULE, 0xdcffff)), "waxCapsuleIce");
// / CANS
ForestryItem.canWater.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x2432ec)), "waterCan");
ForestryItem.canBiomass.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x83d41c)), "biomassCan");
ForestryItem.canBiofuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xff7909)), "biofuelCan");
ForestryItem.canOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x404040)), "canOil");
ForestryItem.canFuel.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xffff00)), "canFuel");
ForestryItem.canLava.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xfd461f)), "canLava");
ForestryItem.canSeedOil.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xffffa9)), "canSeedOil");
ForestryItem.canHoney.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xffda47)).setDrink(Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION), "canHoney");
ForestryItem.canJuice.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0x99d04e)).setDrink(Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION), "canJuice");
ForestryItem.canIce.registerItem((new ItemLiquidContainer(EnumContainerType.CAN, 0xdcffff)), "canIce");
// / REFRACTORY CAPSULES
ForestryItem.refractoryWater.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x2432ec)), "refractoryWater");
ForestryItem.refractoryBiomass.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x83d41c)), "refractoryBiomass");
ForestryItem.refractoryBiofuel.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xff7909)), "refractoryBiofuel");
ForestryItem.refractoryOil.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x404040)), "refractoryOil");
ForestryItem.refractoryFuel.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xffff00)), "refractoryFuel");
ForestryItem.refractoryLava.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xfd461f)), "refractoryLava");
ForestryItem.refractorySeedOil.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xffffa9)), "refractorySeedOil");
ForestryItem.refractoryHoney.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xffda47)).setDrink(Defaults.FOOD_HONEY_HEAL, Defaults.FOOD_HONEY_SATURATION), "refractoryHoney");
ForestryItem.refractoryJuice.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0x99d04e)).setDrink(Defaults.FOOD_JUICE_HEAL, Defaults.FOOD_JUICE_SATURATION), "refractoryJuice");
ForestryItem.refractoryIce.registerItem((new ItemLiquidContainer(EnumContainerType.REFRACTORY, 0xdcffff)), "refractoryIce");
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerCrates() {
// / CRATES
ForestryItem.cratedWood.registerItem(new ItemCrated(new ItemStack(Blocks.log)), "cratedWood");
ForestryItem.cratedCobblestone.registerItem(new ItemCrated(new ItemStack(Blocks.cobblestone)), "cratedCobblestone");
ForestryItem.cratedDirt.registerItem(new ItemCrated(new ItemStack(Blocks.dirt)), "cratedDirt");
ForestryItem.cratedStone.registerItem(new ItemCrated(new ItemStack(Blocks.stone)), "cratedStone");
ForestryItem.cratedBrick.registerItem(new ItemCrated(new ItemStack(Blocks.brick_block)), "cratedBrick");
ForestryItem.cratedCacti.registerItem(new ItemCrated(new ItemStack(Blocks.cactus)), "cratedCacti");
ForestryItem.cratedSand.registerItem(new ItemCrated(new ItemStack(Blocks.sand)), "cratedSand");
ForestryItem.cratedObsidian.registerItem(new ItemCrated(new ItemStack(Blocks.obsidian)), "cratedObsidian");
ForestryItem.cratedNetherrack.registerItem(new ItemCrated(new ItemStack(Blocks.netherrack)), "cratedNetherrack");
ForestryItem.cratedSoulsand.registerItem(new ItemCrated(new ItemStack(Blocks.soul_sand)), "cratedSoulsand");
ForestryItem.cratedSandstone.registerItem(new ItemCrated(new ItemStack(Blocks.sandstone)), "cratedSandstone");
ForestryItem.cratedBogearth.registerItem(new ItemCrated(new ItemStack(ForestryBlock.soil, 1, 1)), "cratedBogearth");
ForestryItem.cratedHumus.registerItem(new ItemCrated(new ItemStack(ForestryBlock.soil, 1, 0)), "cratedHumus");
ForestryItem.cratedNetherbrick.registerItem(new ItemCrated(new ItemStack(Blocks.nether_brick)), "cratedNetherbrick");
ForestryItem.cratedPeat.registerItem(new ItemCrated(ForestryItem.peat.getItemStack()), "cratedPeat");
ForestryItem.cratedApatite.registerItem(new ItemCrated(ForestryItem.apatite.getItemStack()), "cratedApatite");
ForestryItem.cratedFertilizer.registerItem(new ItemCrated(ForestryItem.fertilizerCompound.getItemStack()), "cratedFertilizer");
ForestryItem.cratedTin.registerItem(new ItemCrated(ForestryItem.ingotTin.getItemStack()), "cratedTin");
ForestryItem.cratedCopper.registerItem(new ItemCrated(ForestryItem.ingotCopper.getItemStack()), "cratedCopper");
ForestryItem.cratedBronze.registerItem(new ItemCrated(ForestryItem.ingotBronze.getItemStack()), "cratedBronze");
ForestryItem.cratedWheat.registerItem(new ItemCrated(new ItemStack(Items.wheat)), "cratedWheat");
ForestryItem.cratedMycelium.registerItem(new ItemCrated(new ItemStack(Blocks.mycelium)), "cratedMycelium");
ForestryItem.cratedMulch.registerItem(new ItemCrated(ForestryItem.mulch.getItemStack()), "cratedMulch");
ForestryItem.cratedSilver.registerItem(new ItemCrated(), "cratedSilver");
ForestryItem.cratedBrass.registerItem(new ItemCrated(), "cratedBrass");
ForestryItem.cratedNikolite.registerItem(new ItemCrated(), "cratedNikolite");
ForestryItem.cratedCookies.registerItem(new ItemCrated(new ItemStack(Items.cookie)), "cratedCookies");
ForestryItem.cratedRedstone.registerItem(new ItemCrated(new ItemStack(Items.redstone)), "cratedRedstone");
ForestryItem.cratedLapis.registerItem(new ItemCrated(new ItemStack(Items.dye, 1, 4)), "cratedLapis");
ForestryItem.cratedReeds.registerItem(new ItemCrated(new ItemStack(Items.reeds)), "cratedReeds");
ForestryItem.cratedClay.registerItem(new ItemCrated(new ItemStack(Items.clay_ball)), "cratedClay");
ForestryItem.cratedGlowstone.registerItem(new ItemCrated(new ItemStack(Items.glowstone_dust)), "cratedGlowstone");
ForestryItem.cratedApples.registerItem(new ItemCrated(new ItemStack(Items.apple)), "cratedApples");
ForestryItem.cratedNetherwart.registerItem(new ItemCrated(new ItemStack(Items.nether_wart)), "cratedNetherwart");
ForestryItem.cratedResin.registerItem(new ItemCrated(), "cratedResin");
ForestryItem.cratedRubber.registerItem(new ItemCrated(), "cratedRubber");
ForestryItem.cratedScrap.registerItem(new ItemCrated(), "cratedScrap");
ForestryItem.cratedUUM.registerItem(new ItemCrated(), "cratedUUM");
ForestryItem.cratedPhosphor.registerItem(new ItemCrated(ForestryItem.phosphor.getItemStack()), "cratedPhosphor");
ForestryItem.cratedAsh.registerItem(new ItemCrated(ForestryItem.ash.getItemStack()), "cratedAsh");
ForestryItem.cratedCharcoal.registerItem(new ItemCrated(new ItemStack(Items.coal, 1, 1)), "cratedCharcoal");
ForestryItem.cratedGravel.registerItem(new ItemCrated(new ItemStack(Blocks.gravel)), "cratedGravel");
ForestryItem.cratedCoal.registerItem(new ItemCrated(new ItemStack(Items.coal, 1, 0)), "cratedCoal");
ForestryItem.cratedSeeds.registerItem(new ItemCrated(new ItemStack(Items.wheat_seeds)), "cratedSeeds");
ForestryItem.cratedSaplings.registerItem(new ItemCrated(new ItemStack(Blocks.sapling)), "cratedSaplings");
}
@Override
protected void registerRecipes() {
/* BRONZE INGOTS */
if (Config.getCraftingBronzeEnabled()) {
Proxies.common.addShapelessRecipe(ForestryItem.ingotBronze.getItemStack(4), "ingotTin", "ingotCopper", "ingotCopper", "ingotCopper");
}
/* STURDY MACHINE */
Proxies.common.addRecipe(ForestryItem.sturdyCasing.getItemStack(), "###", "# #", "###", '#', "ingotBronze");
// / EMPTY CANS
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.can"), " # ", "# #", '#', "ingotTin");
// / GEARS
if (PluginBuildCraft.stoneGear != null) {
Proxies.common.addRecipe(ForestryItem.gearBronze.getItemStack(), " # ", "#Y#", " # ", '#', "ingotBronze", 'Y', PluginBuildCraft.stoneGear);
Proxies.common.addRecipe(ForestryItem.gearCopper.getItemStack(), " # ", "#Y#", " # ", '#', "ingotCopper", 'Y', PluginBuildCraft.stoneGear);
Proxies.common.addRecipe(ForestryItem.gearTin.getItemStack(), " # ", "#Y#", " # ", '#', "ingotTin", 'Y', PluginBuildCraft.stoneGear);
} else {
Proxies.common.addRecipe(ForestryItem.gearBronze.getItemStack(), " # ", "#X#", " # ", '#', "ingotBronze", 'X', "ingotCopper");
Proxies.common.addRecipe(ForestryItem.gearCopper.getItemStack(), " # ", "#X#", " # ", '#', "ingotCopper", 'X', "ingotCopper");
Proxies.common.addRecipe(ForestryItem.gearTin.getItemStack(), " # ", "#X#", " # ", '#', "ingotTin", 'X', "ingotCopper");
}
// / SURVIVALIST TOOLS
Proxies.common.addRecipe(ForestryItem.bronzePickaxe.getItemStack(), " X ", " X ", "###", '#', "ingotBronze", 'X', "stickWood");
Proxies.common.addRecipe(ForestryItem.bronzeShovel.getItemStack(), " X ", " X ", " # ", '#', "ingotBronze", 'X', "stickWood");
Proxies.common.addShapelessRecipe(ForestryItem.kitPickaxe.getItemStack(), ForestryItem.bronzePickaxe, ForestryItem.carton);
Proxies.common.addShapelessRecipe(ForestryItem.kitShovel.getItemStack(), ForestryItem.bronzeShovel, ForestryItem.carton);
/* NATURALIST'S ARMOR */
Proxies.common.addRecipe(ForestryItem.naturalistHat.getItemStack(), " X ", "Y Y", 'X', "ingotBronze", 'Y', Blocks.glass_pane);
// / WRENCH
Proxies.common.addRecipe(ForestryItem.wrench.getItemStack(), "# #", " # ", " # ", '#', "ingotBronze");
// Manure and Fertilizer
if (GameMode.getGameMode().getStackSetting("recipe.output.compost.wheat").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.compost.wheat"), " X ", "X#X", " X ", '#', Blocks.dirt, 'X', Items.wheat);
if (GameMode.getGameMode().getStackSetting("recipe.output.compost.ash").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.compost.ash"), " X ", "X#X", " X ", '#', Blocks.dirt, 'X', "dustAsh");
if (GameMode.getGameMode().getStackSetting("recipe.output.fertilizer.apatite").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.fertilizer.apatite"), " # ", " X ", " # ", '#', Blocks.sand, 'X', "gemApatite");
if (GameMode.getGameMode().getStackSetting("recipe.output.fertilizer.ash").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.fertilizer.ash"), "###", "#X#", "###", '#', "dustAsh", 'X', "gemApatite");
// Humus
if (GameMode.getGameMode().getStackSetting("recipe.output.humus.compost").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.humus.compost"), "###", "#X#", "###", '#', Blocks.dirt, 'X', ForestryItem.fertilizerBio);
if (GameMode.getGameMode().getStackSetting("recipe.output.humus.fertilizer").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.humus.fertilizer"), "###", "#X#", "###", '#', Blocks.dirt, 'X', ForestryItem.fertilizerCompound);
// Bog earth
if (GameMode.getGameMode().getStackSetting("recipe.output.bogearth.bucket").stackSize > 0)
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.bogearth.bucket"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', Items.water_bucket, 'Y', Blocks.sand);
if (GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can").stackSize > 0) {
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.canWater, 'Y', Blocks.sand);
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.waxCapsuleWater, 'Y', Blocks.sand);
Proxies.common.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', ForestryItem.refractoryWater, 'Y', Blocks.sand);
}
// Vials and catalyst
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3), "###", "YXY", '#', ForestryItem.waxCapsule.item(), 'X', Items.bone, 'Y', ForestryItem.fertilizerCompound);
Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3), "###", "YXY", '#', ForestryItem.canEmpty.item(), 'X', Items.bone, 'Y', ForestryItem.fertilizerCompound);
// Crafting Material
Proxies.common.addRecipe(new ItemStack(Items.string), "#", "#", "#", '#', ForestryItem.craftingMaterial.getItemStack(1, 2));
// / Pipette
Proxies.common.addRecipe(ForestryItem.pipette.getItemStack(), " #", " X ", "X ", 'X', Blocks.glass_pane, '#', new ItemStack(Blocks.wool, 1, Defaults.WILDCARD));
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
@Override
public IPickupHandler getPickupHandler() {
return new PickupHandlerCore();
}
@Override
public ICommand[] getConsoleCommands() {
return new ICommand[] { new CommandForestry() };
}
@Override
public int getBurnTime(ItemStack fuel) {
if (fuel != null && fuel.getItem() == ForestryItem.peat.item())
return 2000;
if (fuel != null && fuel.getItem() == ForestryItem.bituminousPeat.item())
return 4200;
return 0;
}
public IRecipe[] createAlyzerRecipes(Block block, int meta) {
ArrayList<IRecipe> recipes = new ArrayList<IRecipe>();
if (ForestryItem.beealyzer != null)
recipes.add(ShapedRecipeCustom.createShapedRecipe(new ItemStack(block, 1, meta), "XTX", " Y ", "X X", 'Y', ForestryItem.sturdyCasing, 'T', ForestryItem.beealyzer, 'X', "ingotBronze"));
if (ForestryItem.treealyzer != null)
recipes.add(ShapedRecipeCustom.createShapedRecipe(new ItemStack(block, 1, meta), "XTX", " Y ", "X X", 'Y', ForestryItem.sturdyCasing, 'T', ForestryItem.treealyzer, 'X', "ingotBronze"));
return recipes.toArray(new IRecipe[0]);
}
}
+95
View File
@@ -0,0 +1,95 @@
/*******************************************************************************
* 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.lang.reflect.Field;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.core.IPlugin;
import forestry.api.core.PluginInfo;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IMutation;
import forestry.apiculture.genetics.AlleleBeeSpecies;
import forestry.apiculture.genetics.BeeTemplates;
import forestry.apiculture.genetics.IJubilanceProvider;
import forestry.apiculture.genetics.JubilanceReqRes;
import forestry.apiculture.genetics.MutationEMC;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.genetics.Allele;
import forestry.core.proxy.Proxies;
@PluginInfo(pluginID = "EqEx2", name = "Equivalent Exchange 2", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for Equivalent Exchange 2. Enables the Omega branch of bees. Requires Apiculture to be enabled.")
public class PluginEE implements IPlugin {
public IMutation darkenedA;
public IMutation reddenedA;
public IMutation omegaA;
public ItemStack eeBlock1;
public ItemStack eeBlock2;
public Class<?> eeRelay2Class;
public Class<?> eeRelay3Class;
public Field eeRelay2EMCField;
public Field eeRelay3EMCField;
@Override
public boolean isAvailable() {
return Proxies.common.isModLoaded("mod_EE") && !Config.disableApiculture;
}
@Override
public void postInit() {
try {
eeBlock1 = new ItemStack((Block) Class.forName("ee.EEBlock").getField("eeStone").get(null), 1, 8);
eeBlock2 = new ItemStack((Block) Class.forName("ee.EEBlock").getField("eeStone").get(null), 1, 9);
eeRelay2Class = Class.forName("ee.TileRelay2");
eeRelay2EMCField = eeRelay2Class.getField("scaledEnergy");
eeRelay3Class = Class.forName("ee.TileRelay3");
eeRelay3EMCField = eeRelay3Class.getField("scaledEnergy");
} catch (Exception ex) {
Proxies.log.fine("Necessary block/classes from EE were not found");
return;
}
IJubilanceProvider jubilanceProviderDarkened = new JubilanceReqRes(eeBlock1);
IJubilanceProvider jubilanceProviderReddened = new JubilanceReqRes(eeBlock2);
((AlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele("forestry.speciesDarkened")).jubilanceProvider = jubilanceProviderDarkened;
((AlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele("forestry.speciesReddened")).jubilanceProvider = jubilanceProviderReddened;
((AlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele("forestry.speciesOmega")).jubilanceProvider = jubilanceProviderReddened;
darkenedA = new MutationEMC(Allele.speciesModest, Allele.speciesWintry, BeeTemplates.getDarkenedTemplate(), 100, eeBlock1, eeRelay2Class,
eeRelay2EMCField, 139264);
reddenedA = new MutationEMC(Allele.speciesDarkened, Allele.speciesTropical, BeeTemplates.getReddenedTemplate(), 100, eeBlock2, eeRelay3Class,
eeRelay3EMCField, 466944);
omegaA = new MutationEMC(Allele.speciesDarkened, Allele.speciesReddened, BeeTemplates.getOmegaTemplate(), 100, eeBlock2, eeRelay3Class,
eeRelay3EMCField, 933888).restrictBiomeType(BiomeDictionary.Type.NETHER).restrictBiomeType(BiomeDictionary.Type.SANDY);
}
@Override
public void preInit() {
}
@Override
public void doInit() {
}
}
+203
View File
@@ -0,0 +1,203 @@
/*******************************************************************************
* 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 net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.PluginInfo;
import forestry.api.fuels.GeneratorFuel;
import forestry.core.GameMode;
import forestry.core.circuits.Circuit;
import forestry.core.circuits.CircuitId;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.gadgets.BlockBase;
import forestry.core.gadgets.MachineDefinition;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.items.ItemForestryBlock;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.energy.GuiHandlerEnergy;
import forestry.energy.circuits.CircuitElectricBoost;
import forestry.energy.circuits.CircuitElectricChoke;
import forestry.energy.circuits.CircuitElectricEfficiency;
import forestry.energy.circuits.CircuitFireDampener;
import forestry.energy.gadgets.EngineBronze;
import forestry.energy.gadgets.EngineClockwork;
import forestry.energy.gadgets.EngineCopper;
import forestry.energy.gadgets.EngineDefinition;
import forestry.energy.gadgets.EngineTin;
import forestry.energy.gadgets.MachineGenerator;
import forestry.energy.proxy.ProxyEnergy;
@PluginInfo(pluginID = "Energy", name = "Energy", author = "SirSengir", url = Defaults.URL, description = "Adds several engines compatible with BuildCraft 3 as well as a generator for IC2.")
public class PluginEnergy extends NativePlugin {
@SidedProxy(clientSide = "forestry.energy.proxy.ClientProxyEnergy", serverSide = "forestry.energy.proxy.ProxyEnergy")
public static ProxyEnergy proxy;
public static MachineDefinition definitionEngineTin;
public static MachineDefinition definitionEngineCopper;
public static MachineDefinition definitionEngineBronze;
public static MachineDefinition definitionEngineClockwork;
public static MachineDefinition definitionGenerator;
@Override
public boolean isAvailable() {
return !Config.disableEnergy;
}
@Override
public void preInit() {
super.preInit();
ForestryBlock.engine = new BlockBase(Material.iron, true);
ForestryBlock.engine.setBlockName("for.engine");
Proxies.common.registerBlock(ForestryBlock.engine, ItemForestryBlock.class);
definitionEngineTin = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINETIN_META, "forestry.EngineTin", EngineTin.class,
PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_tin_"), ShapedRecipeCustom.createShapedRecipe(
new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINETIN_META),
"###",
" X ",
"YVY",
'#', "ingotTin",
'X', Blocks.glass,
'Y', "gearTin",
'V', Blocks.piston)));
definitionEngineCopper = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINECOPPER_META, "forestry.EngineCopper", EngineCopper.class,
PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_copper_"), ShapedRecipeCustom.createShapedRecipe(
new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINECOPPER_META),
"###",
" X ",
"YVY",
'#', "ingotCopper",
'X', Blocks.glass,
'Y', "gearCopper",
'V', Blocks.piston)));
definitionEngineBronze = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINEBRONZE_META, "forestry.EngineBronze", EngineBronze.class,
PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_bronze_"), ShapedRecipeCustom.createShapedRecipe(
new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINEBRONZE_META),
"###",
" X ",
"YVY",
'#', "ingotBronze",
'X', Blocks.glass,
'Y', "gearBronze",
'V', Blocks.piston)));
definitionGenerator = ForestryBlock.engine.addDefinition(new MachineDefinition(Defaults.DEFINITION_GENERATOR_META, "forestry.Generator", MachineGenerator.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/generator_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_GENERATOR_META),
"X#X",
"XYX",
"X#X",
'#', Blocks.glass,
'X', Items.gold_ingot,
'Y', ForestryItem.sturdyCasing)));
ShapedRecipeCustom clockworkRecipe = null;
if (GameMode.getGameMode().getBooleanSetting("energy.engine.clockwork")) {
clockworkRecipe = ShapedRecipeCustom.createShapedRecipe(
new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINECLOCKWORK_META),
"###",
" X ",
"ZVY",
'#', "plankWood",
'X', Blocks.glass,
'Y', Items.clock,
'Z', ForestryItem.gearCopper,
'V', Blocks.piston);
}
definitionEngineClockwork = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINECLOCKWORK_META, "forestry.EngineClockwork", EngineClockwork.class,
PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_clock_"), clockworkRecipe));
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_CHOKE_I, "forestry.energyChoke1");
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.FIRE_DAMPENER_I, "forestry.energyDampener1");
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_EFFICIENCY_I, "forestry.energyEfficiency1");
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_BOOST_I, "forestry.energyBoost1");
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_BOOST_II, "forestry.energyBoost2");
}
@Override
public void doInit() {
super.doInit();
definitionEngineTin.register();
definitionEngineCopper.register();
definitionEngineBronze.register();
definitionGenerator.register();
definitionEngineClockwork.register();
GeneratorFuel.fuels.put(LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1).getFluid().getID(), new GeneratorFuel(LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, 1),
(int) (32 * GameMode.getGameMode().getFloatSetting("fuel.ethanol.generator")), 4));
GeneratorFuel.fuels.put(LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS, 1).getFluid().getID(), new GeneratorFuel(LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS, 1),
(int) (8 * GameMode.getGameMode().getFloatSetting("fuel.biomass.generator")), 1));
Circuit.energyElectricChoke1 = new CircuitElectricChoke("energyChoke1");
Circuit.energyFireDampener1 = new CircuitFireDampener("energyDampener1");
Circuit.energyElectricEfficiency1 = new CircuitElectricEfficiency("energyEfficiency1");
Circuit.energyElectricBoost1 = new CircuitElectricBoost("energyBoost1", 2, 7, 2, "electric.boost.1", new String[] { "Increases output by 2 MJ/t",
"Increases intake by 7 EU/t" });
Circuit.energyElectricBoost2 = new CircuitElectricBoost("energyBoost2", 2, 15, 4, "electric.boost.2", new String[] { "Increases output by 4 MJ/t",
"Increases intake by 15 EU/t" });
}
@Override
protected void registerItems() {
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerRecipes() {
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout("forestry.engine.tin");
// / Solder Manager
ChipsetManager.solderManager.addRecipe(layout, ForestryItem.tubes.getItemStack(1, 0), Circuit.energyElectricChoke1);
ChipsetManager.solderManager.addRecipe(layout, ForestryItem.tubes.getItemStack(1, 1), Circuit.energyElectricBoost1);
ChipsetManager.solderManager.addRecipe(layout, ForestryItem.tubes.getItemStack(1, 2), Circuit.energyElectricBoost2);
ChipsetManager.solderManager.addRecipe(layout, ForestryItem.tubes.getItemStack(1, 3), Circuit.energyElectricEfficiency1);
}
@Override
protected void registerCrates() {
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerEnergy();
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
}
+478
View File
@@ -0,0 +1,478 @@
/*******************************************************************************
* 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.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.core.PluginInfo;
import forestry.api.recipes.ICraftingProvider;
import forestry.api.recipes.RecipeManagers;
import forestry.core.GameMode;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.gadgets.BlockBase;
import forestry.core.gadgets.MachineDefinition;
import forestry.core.gadgets.MachineNBTDefinition;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.items.ItemForestryBlock;
import forestry.core.items.ItemNBTTile;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import forestry.core.utils.RecipeUtil;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.factory.GuiHandlerFactory;
import forestry.factory.gadgets.MachineBottler;
import forestry.factory.gadgets.MachineCarpenter;
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
import forestry.factory.gadgets.MachineCentrifuge;
import forestry.factory.gadgets.MachineFabricator;
import forestry.factory.gadgets.MachineFermenter;
import forestry.factory.gadgets.MachineMoistener;
import forestry.factory.gadgets.MachineRaintank;
import forestry.factory.gadgets.MachineSqueezer;
import forestry.factory.gadgets.MachineStill;
import forestry.factory.gadgets.MillRainmaker;
import forestry.factory.gadgets.TileWorktable;
import forestry.factory.recipes.CraftGuideIntegration;
@PluginInfo(pluginID = "Factory", name = "Factory", author = "SirSengir", url = Defaults.URL, description = "Adds a wide variety of machines to craft, produce and process products.")
public class PluginFactory extends NativePlugin {
public static MachineDefinition definitionBottler;
public static MachineDefinition definitionCarpenter;
public static MachineDefinition definitionCentrifuge;
public static MachineDefinition definitionFermenter;
public static MachineDefinition definitionMoistener;
public static MachineDefinition definitionSqueezer;
public static MachineDefinition definitionStill;
public static MachineDefinition definitionRainmaker;
public static MachineDefinition definitionFabricator;
public static MachineDefinition definitionRaintank;
public static MachineDefinition definitionWorktable;
@Override
public boolean isAvailable() {
return !Config.disableFactory;
}
@Override
public void preInit() {
super.preInit();
RecipeManagers.craftingProviders = new ArrayList<ICraftingProvider>();
// Init bottler manager
RecipeManagers.craftingProviders.add(RecipeManagers.bottlerManager = new MachineBottler.RecipeManager());
// Init carpenter manager
RecipeManagers.craftingProviders.add(RecipeManagers.carpenterManager = new MachineCarpenter.RecipeManager());
// Init centrifuge manager
RecipeManagers.craftingProviders.add(RecipeManagers.centrifugeManager = new MachineCentrifuge.RecipeManager());
// Init fabricator manager
RecipeManagers.craftingProviders.add(RecipeManagers.fabricatorManager = new MachineFabricator.RecipeManager());
// Init fermenter manager
RecipeManagers.craftingProviders.add(RecipeManagers.fermenterManager = new MachineFermenter.RecipeManager());
// Init moistener manager
RecipeManagers.craftingProviders.add(RecipeManagers.moistenerManager = new MachineMoistener.RecipeManager());
// Init squeezer manager
RecipeManagers.craftingProviders.add(RecipeManagers.squeezerManager = new MachineSqueezer.RecipeManager());
// Init still manager
RecipeManagers.craftingProviders.add(RecipeManagers.stillManager = new MachineStill.RecipeManager());
ForestryBlock.factoryTESR = new BlockBase(Material.iron, true);
ForestryBlock.factoryTESR.setBlockName("for.factory");
Proxies.common.registerBlock(ForestryBlock.factoryTESR, ItemForestryBlock.class);
definitionBottler = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_BOTTLER_META, "forestry.Bottler", MachineBottler.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/bottler_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_BOTTLER_META),
"X#X",
"#Y#",
"X#X",
'#', Blocks.glass,
'X', ForestryItem.canEmpty,
'Y', ForestryItem.sturdyCasing)));
definitionCarpenter = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_CARPENTER_META, "forestry.Carpenter", MachineCarpenter.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/carpenter_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_CARPENTER_META),
"X#X",
"XYX",
"X#X",
'#', Blocks.glass,
'X', "ingotBronze",
'Y', ForestryItem.sturdyCasing)));
definitionCentrifuge = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_CENTRIFUGE_META, "forestry.Centrifuge", MachineCentrifuge.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/centrifuge_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_CENTRIFUGE_META),
"X#X",
"XYX",
"X#X",
'#', Blocks.glass,
'X', "ingotCopper",
'Y', ForestryItem.sturdyCasing.getItemStack())));
definitionFermenter = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_FERMENTER_META, "forestry.Fermenter", MachineFermenter.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/fermenter_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_FERMENTER_META),
"X#X",
"#Y#",
"X#X",
'#', Blocks.glass,
'X', "gearBronze",
'Y', ForestryItem.sturdyCasing)));
definitionMoistener = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_MOISTENER_META, "forestry.Moistener", MachineMoistener.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/moistener_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_MOISTENER_META),
"X#X",
"#Y#",
"X#X",
'#', Blocks.glass,
'X', "gearCopper",
'Y', ForestryItem.sturdyCasing)));
definitionSqueezer = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_SQUEEZER_META, "forestry.Squeezer", MachineSqueezer.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/squeezer_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_SQUEEZER_META),
"X#X",
"XYX",
"X#X",
'#', Blocks.glass,
'X', "ingotTin",
'Y', ForestryItem.sturdyCasing.getItemStack())));
definitionStill = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_STILL_META, "forestry.Still", MachineStill.class,
Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/still_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_STILL_META),
"X#X",
"#Y#",
"X#X",
'#', Blocks.glass,
'X', Items.redstone,
'Y', ForestryItem.sturdyCasing)));
definitionRainmaker = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_RAINMAKER_META, "forestry.Rainmaker", MillRainmaker.class,
Proxies.render.getRenderMill(Defaults.TEXTURE_PATH_BLOCKS + "/rainmaker_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_RAINMAKER_META),
"X#X",
"#Y#",
"X#X",
'#', Blocks.glass,
'X', "gearTin",
'Y', ForestryItem.hardenedCasing)));
ForestryBlock.factoryPlain = new BlockBase(Material.iron);
ForestryBlock.factoryPlain.setBlockName("for.factory2");
Proxies.common.registerBlock(ForestryBlock.factoryPlain, ItemNBTTile.class);
definitionFabricator = ForestryBlock.factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_FABRICATOR_META, "forestry.Fabricator", MachineFabricator.class,
ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryPlain,
1, Defaults.DEFINITION_FABRICATOR_META),
"X#X",
"#Y#",
"XZX",
'#', Blocks.glass,
'X', Items.gold_ingot,
'Y', ForestryItem.sturdyCasing,
'Z', Blocks.chest)).setFaces(0, 1, 2, 3, 4, 4));
definitionRaintank = ForestryBlock.factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_RAINTANK_META, "forestry.Raintank", MachineRaintank.class,
ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryPlain, 1, Defaults.DEFINITION_RAINTANK_META),
"X#X",
"XYX",
"X#X",
'#', Blocks.glass,
'X', Items.iron_ingot,
'Y', ForestryItem.sturdyCasing))
.setFaces(0, 1, 0, 0, 0, 0));
definitionWorktable = ForestryBlock.factoryPlain.addDefinition(new MachineNBTDefinition(Defaults.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class,
ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryPlain, 1, Defaults.DEFINITION_WORKTABLE_META),
"B",
"W",
"C",
'B', Items.book,
'W', Blocks.crafting_table,
'C', Blocks.chest)).setFaces(0, 1, 2, 3, 4, 4));
}
@Override
public void doInit() {
super.doInit();
definitionBottler.register();
definitionCarpenter.register();
definitionCentrifuge.register();
definitionFabricator.register();
definitionFermenter.register();
definitionMoistener.register();
definitionRaintank.register();
definitionSqueezer.register();
definitionStill.register();
definitionRainmaker.register();
definitionWorktable.register();
}
@Override
public void postInit() {
super.postInit();
if (Proxies.common.isModLoaded("craftguide"))
CraftGuideIntegration.register();
else
Proxies.log.info("Skipping CraftGuide integration.");
}
@Override
protected void registerItems() {
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerRecipes() {
// / FABRICATOR
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 0), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotCopper" });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 1), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotTin" });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 2), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotBronze" });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 3), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.iron_ingot });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 4), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.gold_ingot });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 5), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.diamond });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 6), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Blocks.obsidian });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 7), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.blaze_powder });
if (PluginIC2.rubber != null)
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 8),
new Object[] { " X ", "#X#", "XXX", '#', Items.redstone, 'X', PluginIC2.rubber });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 9), new Object[] {
" X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.emerald });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 10),
new Object[] { " X ", "#X#", "XXX", '#', Items.redstone, 'X', "gemApatite" });
RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 11),
new Object[] { " X ", "#X#", "XXX", '#', Items.redstone, 'X', new ItemStack(Items.dye, 1, 4) });
String[] dyes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime",
"dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" };
if (ForestryItem.propolis != null)
for (int i = 0; i < 16; i++) {
RecipeManagers.fabricatorManager.addRecipe(ForestryItem.waxCast.getItemStack(1, Defaults.WILDCARD), LiquidHelper.getLiquid(Defaults.LIQUID_GLASS,
Defaults.BUCKET_VOLUME), new ItemStack(ForestryBlock.glass, 1, 15 - i), new Object[] { "#", "X", '#', dyes[i],
'X', ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD) });
}
// / SQUEEZER
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.apple) }, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple")),
ForestryItem.mulch.getItemStack(), GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple"));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.wheat_seeds) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode
.getGameMode().getIntegerSetting("squeezer.liquid.seed")));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.pumpkin_seeds) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode
.getGameMode().getIntegerSetting("squeezer.liquid.seed")));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.melon_seeds) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode
.getGameMode().getIntegerSetting("squeezer.liquid.seed")));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone) },
LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 1600));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Blocks.cactus) }, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 500));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.snowball), ForestryItem.craftingMaterial.getItemStack(4, 5) },
LiquidHelper.getLiquid(Defaults.LIQUID_ICE, 4000));
// STILL
RecipeManagers.stillManager.addRecipe(Defaults.STILL_DESTILLATION_DURATION, LiquidHelper.getLiquid(Defaults.LIQUID_BIOMASS,
Defaults.STILL_DESTILLATION_INPUT), LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, Defaults.STILL_DESTILLATION_OUTPUT));
// MOISTENER
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Items.wheat_seeds), new ItemStack(Blocks.mycelium), 5000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone), 20000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stonebrick, 1, 1), 20000);
// FERMENTER
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 0), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 1), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 2), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.sapling, 1, 3), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.cactus), GameMode.getGameMode().getIntegerSetting("fermenter.yield.cactus"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Items.wheat), GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Items.reeds), GameMode.getGameMode().getIntegerSetting("fermenter.yield.cane"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.brown_mushroom), GameMode.getGameMode().getIntegerSetting("fermenter.yield.mushroom"), Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(new ItemStack(Blocks.red_mushroom), GameMode.getGameMode().getIntegerSetting("fermenter.yield.mushroom"), Defaults.LIQUID_BIOMASS);
// FABRICATOR
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.glass), LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 1000), 1000);
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.glass_pane), LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 375), 1000);
RecipeManagers.fabricatorManager.addSmelting(new ItemStack(Blocks.sand), LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 1000), 3000);
// / CARPENTER
RecipeManagers.carpenterManager.addRecipe(50, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 250), null, ForestryItem.impregnatedCasing.getItemStack(),
new Object[] { "###", "# #", "###", '#', "logWood" });
RecipeManagers.carpenterManager.addRecipe(50, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 500), null, new ItemStack(ForestryBlock.core, 1, Defaults.DEFINITION_ESCRITOIRE_META),
new Object[] { "# ", "###", "# #", '#', "plankWood" });
// RESOURCES
RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 100), null, ForestryItem.stickImpregnated.getItemStack(2),
new Object[] { "#", "#", '#', "logWood" });
RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, ForestryItem.woodPulp.getItemStack(4),
new Object[] { "#", '#', "logWood" });
RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, new ItemStack(Items.paper, 1), new Object[] { "#",
"#", '#', "pulpWood" });
RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, new ItemStack(ForestryBlock.soil, 9, 0),
new Object[] { "###", "#X#", "###", '#', Blocks.dirt, 'X', ForestryItem.mulch });
RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, new ItemStack(ForestryBlock.soil, 8, 1),
new Object[] { "#X#", "XYX", "#X#", '#', Blocks.dirt, 'X', Blocks.sand, 'Y',
ForestryItem.mulch });
RecipeManagers.carpenterManager.addRecipe(75, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 5000), null, ForestryItem.hardenedCasing.getItemStack(),
new Object[] { "# #", " Y ", "# #", '#', Items.diamond, 'Y', ForestryItem.sturdyCasing });
// / CHIPSETS
RecipeManagers.carpenterManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 0),
new Object[] { "R R", "R#R", "R R", '#', "ingotTin", 'R', Items.redstone });
RecipeManagers.carpenterManager.addRecipe(40, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 1),
new Object[] { "R#R", "R#R", "R#R", '#', "ingotBronze", 'R', Items.redstone });
RecipeManagers.carpenterManager.addRecipe(80, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 2),
new Object[] { "R#R", "R#R", "R#R", '#', Items.iron_ingot, 'R', Items.redstone });
RecipeManagers.carpenterManager.addRecipe(80, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 3),
new Object[] { "R#R", "R#R", "R#R", '#', Items.gold_ingot, 'R', Items.redstone });
RecipeManagers.carpenterManager.addRecipe(40, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.solderingIron.getItemStack(),
new Object[] { " # ", "# #", " B", '#', Items.iron_ingot, 'B', "ingotBronze" });
// ForestryCore.oreHandler.registerCarpenterRecipe(solderingIron);
// RAIN SUBSTRATES
RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.iodineCharge.getItemStack(),
new Object[] { "Z#Z", "#Y#", "X#X", '#', ForestryItem.pollen, 'X', Items.gunpowder,
'Y', ForestryItem.canEmpty, 'Z', ForestryItem.honeyDrop });
// ForestryCore.oreHandler.registerCarpenterRecipe(iodineCapsule);
RecipeManagers.carpenterManager.addRecipe(
5,
LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000),
null,
ForestryItem.craftingMaterial.getItemStack(1, 4),
new Object[] { "Z#Z", "#Y#", "X#X", '#', ForestryItem.royalJelly, 'X', Items.gunpowder,
'Y', ForestryItem.canEmpty, 'Z', ForestryItem.honeydew });
// ForestryCore.oreHandler.registerCarpenterRecipe(dissipationCharge);
// Ender pearl
RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), new Object[] { " # ", "###", " # ", '#',
ForestryItem.craftingMaterial.getItemStack(1, 1) });
// Woven Silk
RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 500), null, ForestryItem.craftingMaterial.getItemStack(1, 3),
new Object[] { "###", "###", "###", '#', ForestryItem.craftingMaterial.getItemStack(1, 2) });
// Boxes
RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.carton.getItemStack(2),
new Object[] { " # ", "# #", " # ", '#', "pulpWood" });
RecipeManagers.carpenterManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.crate.getItemStack(24),
new Object[] { " # ", "# #", " # ", '#', "logWood" });
// Assembly Kits
RecipeManagers.carpenterManager.addRecipe(20, null, ForestryItem.carton.getItemStack(), ForestryItem.kitPickaxe.getItemStack(), new Object[] {
"###",
" X ",
" X ",
'#', "ingotBronze",
'X', "stickWood" });
RecipeManagers.carpenterManager.addRecipe(20, null, ForestryItem.carton.getItemStack(), ForestryItem.kitShovel.getItemStack(),
new Object[] { " # ", " X ", " X ", '#', "ingotBronze", 'X', "stickWood" });
// Reclamation
RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(2, ForestryItem.ingotBronze.item().getMaxDamage()),
new Object[] { "#", '#', ForestryItem.brokenBronzePickaxe });
RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(), new Object[] { "#", '#', ForestryItem.brokenBronzeShovel });
// Crating and uncrating condensed
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedWood.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCobblestone.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedDirt.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedStone.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedBrick.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCacti.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSand.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedObsidian.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedNetherrack.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSoulsand.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSandstone.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedBogearth.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedHumus.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedNetherbrick.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPeat.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedApatite.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedFertilizer.getItemStack());
((RecipeManager) RecipeManagers.carpenterManager).addCrating("ingotTin", ForestryItem.ingotTin.getItemStack(), ForestryItem.cratedTin.getItemStack());
((RecipeManager) RecipeManagers.carpenterManager).addCrating("ingotCopper", ForestryItem.ingotCopper.getItemStack(), ForestryItem.cratedCopper.getItemStack());
((RecipeManager) RecipeManagers.carpenterManager).addCrating("ingotBronze", ForestryItem.ingotBronze.getItemStack(), ForestryItem.cratedBronze.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedWheat.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedMycelium.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedMulch.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCookies.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedHoneycombs.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedBeeswax.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPollen.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPropolis.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedHoneydew.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedRoyalJelly.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCocoaComb.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedRedstone.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedLapis.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedReeds.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedClay.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedGlowstone.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedApples.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedNetherwart.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSimmeringCombs.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedStringyCombs.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedFrozenCombs.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedDrippingCombs.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedRefractoryWax.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedPhosphor.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedAsh.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCharcoal.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedGravel.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedCoal.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSeeds.getItemStack());
RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedSaplings.getItemStack());
}
@Override
protected void registerCrates() {
// TODO Auto-generated method stub
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerFactory();
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
}
+162
View File
@@ -0,0 +1,162 @@
/*******************************************************************************
* 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.lang.reflect.Method;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.core.PluginInfo;
import forestry.api.farming.Farmables;
import forestry.core.config.Defaults;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.proxy.Proxies;
import forestry.farming.logic.FarmableFarmCraftory;
@PluginInfo(pluginID = "FarmCraftory", name = "FarmCraftory", author = "SirSengir", url = Defaults.URL, description = "Enables compatibility with FarmCraftory. Adds crops and vegetables to farms.")
public class PluginFarmCraftory extends NativePlugin {
public static Block blockSingle;
public static Block blockMulti;
public static Class<?> classSingle;
public static Class<?> classMulti;
public static Method methodGrowthSingle;
public static Method methodGrowthMulti;
public static HashMap<String, ItemStack> vegetableSeeds = new HashMap<String, ItemStack>();
public static final String[] seedIdentifiers = new String[] { "turnipSeedBag", "cabbageSeedBag", "onionSeedBag", "spinachSeedBag", "leekSeedBag",
"cucumberSeedBag", "tomatoSeedBag", "eggplantSeedBag", "greenPepperSeedBag", "yamSeedBag", "strawberrySeedBag", "pineappleSeedBag" };
public static HashMap<String, ItemStack> vegetableItems = new HashMap<String, ItemStack>();
public static final String[] vegetableIdentifiers = new String[] { "turnipItem", "cabbageItem", "onionItem", "spinachItem", "leekItem", "cucumberItem",
"tomatoItem", "eggplantItem", "greenPepperItem", "yamItem", "strawberryItem", "pineappleItem" };
public static HashMap<String, ItemStack> cerealSeeds = new HashMap<String, ItemStack>();
public static final String[] cseedIdentifiers = new String[] { "cornSeedBag" };
public static HashMap<String, ItemStack> cerealItems = new HashMap<String, ItemStack>();
public static final String[] cerealIdentifiers = new String[] { "cornItem" };
@Override
public boolean isAvailable() {
return Proxies.common.isModLoaded("FarmCraftory");
}
@Override
public void doInit() {
super.doInit();
try {
blockSingle = (Block) Class.forName("farmcraftory.FarmCraftory").getField("singleHarvest").get(null);
blockMulti = (Block) Class.forName("farmcraftory.FarmCraftory").getField("multiHarvest").get(null);
classSingle = Class.forName("farmcraftory.TileEntitySingleHarvest");
classMulti = Class.forName("farmcraftory.TileEntityMultiHarvest");
methodGrowthSingle = classSingle.getMethod("getGrowthStage");
methodGrowthMulti = classMulti.getMethod("getGrowthStage");
for (String str : seedIdentifiers)
try {
vegetableSeeds.put(str, new ItemStack((Item) Class.forName("farmcraftory.FarmCraftory").getField(str).get(null)));
} catch (Exception ex) {
Proxies.log.info("FarmCraftory item '%s' could not be integrated.", str);
Proxies.log.info(ex.getMessage());
}
for (String str : vegetableIdentifiers)
try {
vegetableItems.put(str, new ItemStack((Item) Class.forName("farmcraftory.FarmCraftory").getField(str).get(null)));
} catch (Exception ex) {
Proxies.log.info("FarmCraftory item '%s' could not be integrated.", str);
Proxies.log.info(ex.getMessage());
}
for (String str : cseedIdentifiers)
try {
cerealSeeds.put(str, new ItemStack((Item) Class.forName("farmcraftory.FarmCraftory").getField(str).get(null)));
} catch (Exception ex) {
Proxies.log.info("FarmCraftory item '%s' could not be integrated.", str);
Proxies.log.info(ex.getMessage());
}
for (String str : cerealIdentifiers)
try {
cerealItems.put(str, new ItemStack((Item) Class.forName("farmcraftory.FarmCraftory").getField(str).get(null)));
} catch (Exception ex) {
Proxies.log.info("FarmCraftory item '%s' could not be integrated.", str);
Proxies.log.info(ex.getMessage());
}
if (blockMulti != null && blockSingle != null) {
Farmables.farmables.get("farmWheat").add(new FarmableFarmCraftory(cerealSeeds.values(), cerealItems.values()));
Farmables.farmables.get("farmVegetables").add(new FarmableFarmCraftory(vegetableSeeds.values(), vegetableItems.values()));
}
} catch (Exception ex) {
Proxies.log.info("FarmCraftory plugin unexpectedly failed to load.");
Proxies.log.info(ex.getMessage());
}
}
public static int getGrowthStage(TileEntity tile) {
try {
if (classSingle.isInstance(tile))
return (Integer) methodGrowthSingle.invoke(tile);
else if (classMulti.isInstance(tile))
return (Integer) methodGrowthMulti.invoke(tile);
} catch (Exception ex) {
return 0;
}
return 0;
}
@Override
public IGuiHandler getGuiHandler() {
return null;
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
@Override
protected void registerItems() {
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerCrates() {
}
@Override
protected void registerRecipes() {
}
}
+360
View File
@@ -0,0 +1,360 @@
/*******************************************************************************
* 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.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraftforge.common.MinecraftForge;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.PluginInfo;
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;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.proxy.Proxies;
import forestry.core.triggers.Trigger;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.farming.EventHandlerFarming;
import forestry.farming.FarmHelper;
import forestry.farming.GuiHandlerFarming;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.gadgets.BlockFarm;
import forestry.farming.gadgets.BlockMushroom;
import forestry.farming.gadgets.TileControl;
import forestry.farming.gadgets.TileFarm.EnumFarmBlock;
import forestry.farming.gadgets.TileFarmPlain;
import forestry.farming.gadgets.TileGearbox;
import forestry.farming.gadgets.TileHatch;
import forestry.farming.gadgets.TileValve;
import forestry.farming.items.ItemFarmBlock;
import forestry.farming.logic.FarmLogicArboreal;
import forestry.farming.logic.FarmLogicCereal;
import forestry.farming.logic.FarmLogicCocoa;
import forestry.farming.logic.FarmLogicGourd;
import forestry.farming.logic.FarmLogicInfernal;
import forestry.farming.logic.FarmLogicOrchard;
import forestry.farming.logic.FarmLogicPeat;
import forestry.farming.logic.FarmLogicPoale;
import forestry.farming.logic.FarmLogicRubber;
import forestry.farming.logic.FarmLogicShroom;
import forestry.farming.logic.FarmLogicSucculent;
import forestry.farming.logic.FarmLogicVegetable;
import forestry.farming.logic.FarmableGE;
import forestry.farming.logic.FarmableGenericCrop;
import forestry.farming.logic.FarmableGenericSapling;
import forestry.farming.logic.FarmableGourd;
import forestry.farming.logic.FarmableStacked;
import forestry.farming.logic.FarmableVanillaSapling;
import forestry.farming.logic.FarmableVanillaShroom;
import forestry.farming.proxy.ProxyFarming;
import forestry.farming.triggers.TriggerLowFertilizer;
import forestry.farming.triggers.TriggerLowLiquid;
import forestry.farming.triggers.TriggerLowSoil;
@PluginInfo(pluginID = "Farming", name = "Farming", author = "SirSengir", url = Defaults.URL, description = "Adds automatic farms and harvesters for a wide variety of products.")
public class PluginFarming extends NativePlugin {
@SidedProxy(clientSide = "forestry.farming.proxy.ClientProxyFarming", serverSide = "forestry.farming.proxy.ProxyFarming")
public static ProxyFarming proxy;
public static int modelIdFarmBlock;
public static ItemStack farmFertilizer;
public static Trigger lowResourceLiquid50;
public static Trigger lowResourceLiquid25;
public static Trigger lowSoil128;
public static Trigger lowSoil64;
public static Trigger lowSoil32;
public static Trigger lowFertilizer50;
public static Trigger lowFertilizer25;
@Override
public boolean isAvailable() {
return !Config.disableFarming;
}
@Override
public void preInit() {
super.preInit();
Farmables.farmInterface = new FarmHelper();
ForestryBlock.mushroom = new BlockMushroom();
Farmables.farmables.put("farmArboreal", new ArrayList<IFarmable>());
Farmables.farmables.get("farmArboreal").add(new FarmableVanillaSapling());
Farmables.farmables.get("farmArboreal").add(new FarmableGE());
Farmables.farmables.put("farmShroom", new ArrayList<IFarmable>());
Farmables.farmables.get("farmShroom").add(new FarmableVanillaShroom(Blocks.brown_mushroom, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaShroom(Blocks.red_mushroom, 0));
Farmables.farmables.put("farmWheat", new ArrayList<IFarmable>());
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7));
Farmables.farmables.put("farmGourd", new ArrayList<IFarmable>());
Farmables.farmables.get("farmGourd").add(
new FarmableGourd(new ItemStack(Items.pumpkin_seeds), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.melon_seeds), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
Farmables.farmables.put("farmInfernal", new ArrayList<IFarmable>());
Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3));
Farmables.farmables.put("farmPoales", new ArrayList<IFarmable>());
Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3));
Farmables.farmables.put("farmSucculentes", new ArrayList<IFarmable>());
Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3));
Farmables.farmables.put("farmVegetables", new ArrayList<IFarmable>());
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7));
ForestryBlock.farm = new BlockFarm().setBlockName("ffarm");
Proxies.common.registerBlock(ForestryBlock.farm, ItemFarmBlock.class);
/*Item.itemsList[ForestryBlock.farm] = null;
Item.itemsList[ForestryBlock.farm] = (new ItemFarmBlock(ForestryBlock.farm - 256, "ffarm"));*/
ForestryBlock.farm.setHarvestLevel("pickaxe", 0);
proxy.initializeRendering();
// Triggers
lowResourceLiquid50 = new TriggerLowLiquid("lowLiquid.50", 0.5f);
lowResourceLiquid25 = new TriggerLowLiquid("lowLiquid.25", 0.25f);
lowSoil128 = new TriggerLowSoil(128);
lowSoil64 = new TriggerLowSoil(64);
lowSoil32 = new TriggerLowSoil(32);
lowFertilizer50 = new TriggerLowFertilizer("lowFertilizer.50", 0.5f);
lowFertilizer25 = new TriggerLowFertilizer("lowFertilizer.25", 0.25f);
// Layouts
ICircuitLayout layoutManaged = new CircuitLayout("farms.managed");
ChipsetManager.circuitRegistry.registerLayout(layoutManaged);
ICircuitLayout layoutManual = new CircuitLayout("farms.manual");
ChipsetManager.circuitRegistry.registerLayout(layoutManual);
}
@Override
public void doInit() {
super.doInit();
GameRegistry.registerTileEntity(TileFarmPlain.class, "forestry.Farm");
GameRegistry.registerTileEntity(TileGearbox.class, "forestry.FarmGearbox");
GameRegistry.registerTileEntity(TileHatch.class, "forestry.FarmHatch");
GameRegistry.registerTileEntity(TileValve.class, "forestry.FarmValve");
GameRegistry.registerTileEntity(TileControl.class, "forestry.FarmControl");
Circuit.farmArborealManaged = new CircuitFarmLogic("managedArboreal", FarmLogicArboreal.class, new String[] { "Arboreal Plants" });
Circuit.farmShroomManaged = new CircuitFarmLogic("managedShroom", FarmLogicShroom.class, new String[] { "Mushrooms" });
Circuit.farmPeatManaged = new CircuitFarmLogic("managedPeat", FarmLogicPeat.class, new String[] { "Peat Bog" });
Circuit.farmCerealManaged = new CircuitFarmLogic("managedCereal", FarmLogicCereal.class, new String[] { "Crops" });
Circuit.farmVegetableManaged = new CircuitFarmLogic("managedVegetable", FarmLogicVegetable.class, new String[] { "Vegetables" });
Circuit.farmInfernalManaged = new CircuitFarmLogic("managedInfernal", FarmLogicInfernal.class, new String[] { "Infernal Crops" });
Circuit.farmPeatManual = new CircuitFarmLogic("manualPeat", FarmLogicPeat.class, new String[] { "Peat Bog" }).setManual();
Circuit.farmShroomManual = new CircuitFarmLogic("manualShroom", FarmLogicShroom.class, new String[] { "Mushrooms" }).setManual();
Circuit.farmCerealManual = new CircuitFarmLogic("manualCereal", FarmLogicCereal.class, new String[] { "Crops" }).setManual();
Circuit.farmVegetableManual = new CircuitFarmLogic("manualVegetable", FarmLogicVegetable.class, new String[] { "Vegetables" }).setManual();
Circuit.farmSucculentManual = new CircuitFarmLogic("manualSucculent", FarmLogicSucculent.class, new String[] { "Succulents" }).setManual();
Circuit.farmPoalesManual = new CircuitFarmLogic("manualPoales", FarmLogicPoale.class, new String[] { "Reeds" }).setManual();
Circuit.farmGourdManual = new CircuitFarmLogic("manualGourd", FarmLogicGourd.class, new String[] { "Gourds" }).setManual();
Circuit.farmCocoaManual = new CircuitFarmLogic("manualCocoa", FarmLogicCocoa.class, new String[] { "Cocoa Plantation" }).setManual();
Circuit.farmOrchardManual = new CircuitFarmLogic("manualOrchard", FarmLogicOrchard.class, new String[] { "Orchard" });
Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", FarmLogicRubber.class, new String[] { "Rubber Plantation" });
MinecraftForge.EVENT_BUS.register(new EventHandlerFarming());
}
@Override
public void postInit() {
super.postInit();
farmFertilizer = ForestryItem.fertilizerCompound.getItemStack();
}
@Override
public boolean processIMCMessage(IMCMessage message) {
if (message.key.equals("add-farmable-sapling")) {
String[] tokens = message.getStringValue().split("@");
String errormsg = String.format("Received an invalid 'add-farmable-sapling' request '%s' from mod %s", message.getStringValue(),
message.getSender());
if (tokens.length != 2) {
Proxies.log.info(errormsg + ".");
return true;
}
if (!Farmables.farmables.containsKey(tokens[0])) {
Proxies.log.info("%s for non-existent farm %s.", errormsg, tokens[0]);
return true;
}
String[] items = tokens[1].split("[\\.]+");
if (items.length != 2 && items.length != 4) {
Proxies.log.info("%s for farm '%s': id definitions did not match.", errormsg, tokens[0]);
return true;
}
try {
Block sapling = GameData.getBlockRegistry().getRaw(items[0]);
if (sapling == null || sapling == Blocks.air) throw new RuntimeException("can't find block for "+items[0]);
if (items.length == 2) {
Farmables.farmables.get(tokens[0]).add(new FarmableGenericSapling(sapling, Integer.parseInt(items[1])));
} else {
Item windfall = GameData.getItemRegistry().getRaw(items[2]);
if (windfall == null) throw new RuntimeException("can't find item for "+items[2]);
Farmables.farmables.get(tokens[0]).add(
new FarmableGenericSapling(sapling, Integer.parseInt(items[1]),
new ItemStack(windfall, 1, Integer.parseInt(items[3]))));
}
} catch (Exception ex) {
Proxies.log.info("%s for farm '%s': ", errormsg, tokens[0], ex.getMessage());
}
return true;
} else if (message.key.equals("add-farmable-crop")) {
String[] tokens = message.getStringValue().split("@");
String errormsg = String.format("Received an invalid 'add-farmable-crop' request '%s' from mod %s", message.getStringValue(), message.getSender());
if (tokens.length != 2) {
Proxies.log.info(errormsg + ".");
return true;
}
if (!Farmables.farmables.containsKey(tokens[0])) {
Proxies.log.info("%s for non-existent farm %s.", errormsg, tokens[0]);
return true;
}
String[] items = tokens[1].split("[\\.]+");
if (items.length != 4) {
Proxies.log.info("%s for farm '%s': id definitions did not match.", errormsg, tokens[0]);
return true;
}
try {
Item seed = GameData.getItemRegistry().getRaw(items[0]);
if (seed == null) throw new RuntimeException("can't find item for "+items[0]);
Block crop = GameData.getBlockRegistry().getRaw(items[2]);
if (crop == null || crop == Blocks.air) throw new RuntimeException("can't find block for "+items[2]);
Farmables.farmables.get(tokens[0]).add(
new FarmableGenericCrop(new ItemStack(seed, 1, Integer.parseInt(items[1])),
crop,
Integer.parseInt(items[3])));
} catch (Exception ex) {
Proxies.log.info("%s for farm '%s': ", errormsg, tokens[0], ex.getMessage());
}
return true;
}
return false;
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerFarming();
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
@Override
protected void registerItems() {
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerCrates() {
}
@Override
protected void registerRecipes() {
ItemStack basic = new ItemStack(ForestryBlock.farm, 1, 0);
for (EnumFarmBlock block : EnumFarmBlock.values()) {
NBTTagCompound compound = new NBTTagCompound();
block.saveToCompound(compound);
basic.setTagCompound((NBTTagCompound) compound.copy());
ShapedRecipeCustom.buildRecipe(basic.copy(), "I#I", "WCW", '#', block.getCraftingIngredient(), 'W', "slabWood", 'C', ForestryItem.tubes.getItemStack(1, 1), 'I', "ingotCopper");
}
ItemStack gearbox = new ItemStack(ForestryBlock.farm, 1, 2);
ShapedRecipeCustom.buildRecipe(gearbox, " # ", "TTT", '#', basic, 'T', "gearTin").setPreserveNBT();
ItemStack hatch = new ItemStack(ForestryBlock.farm, 1, 3);
ShapedRecipeCustom.buildRecipe(hatch, " # ", "TDT", '#', basic, 'T', "gearTin", 'D', Blocks.trapdoor).setPreserveNBT();
ItemStack valve = new ItemStack(ForestryBlock.farm, 1, 4);
ShapedRecipeCustom.buildRecipe(valve, " # ", "XTX", '#', basic, 'T', "gearTin", 'X', Blocks.glass).setPreserveNBT();
ItemStack control = new ItemStack(ForestryBlock.farm, 1, 5);
ShapedRecipeCustom.buildRecipe(control, " # ", "XTX", '#', basic, 'T', ForestryItem.tubes.getItemStack(1, 4), 'X', Items.redstone).setPreserveNBT();
// Circuits
ICircuitLayout layoutManaged = ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed");
ICircuitLayout layoutManual = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual");
ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 0), Circuit.farmArborealManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 1), Circuit.farmPeatManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 2), Circuit.farmCerealManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 3), Circuit.farmVegetableManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 7), Circuit.farmInfernalManaged);
ChipsetManager.solderManager.addRecipe(layoutManaged, ForestryItem.tubes.getItemStack(1, 10), Circuit.farmShroomManaged);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 0), Circuit.farmOrchardManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 1), Circuit.farmPeatManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 2), Circuit.farmCerealManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 3), Circuit.farmVegetableManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 4), Circuit.farmSucculentManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 5), Circuit.farmPoalesManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 6), Circuit.farmGourdManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 10), Circuit.farmShroomManual);
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 11), Circuit.farmCocoaManual);
if (PluginIC2.resin != null && PluginIC2.rubberwood != null)
ChipsetManager.solderManager.addRecipe(layoutManual, ForestryItem.tubes.getItemStack(1, 8), Circuit.farmRubberManual);
}
}
+113
View File
@@ -0,0 +1,113 @@
/*******************************************************************************
* 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 net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.core.PluginInfo;
import forestry.api.food.BeverageManager;
import forestry.api.food.IBeverageEffect;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryItem;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.items.ItemForestryFood;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import forestry.food.BeverageEffect;
import forestry.food.GuiHandlerFood;
import forestry.food.items.ItemAmbrosia;
import forestry.food.items.ItemBeverage;
import forestry.food.items.ItemBeverage.BeverageInfo;
import forestry.food.items.ItemInfuser;
@PluginInfo(pluginID = "Food", name = "Food", author = "SirSengir", url = Defaults.URL, description = "Adds food.")
public class PluginFood extends NativePlugin {
@Override
public boolean isAvailable() {
return !Config.disableFood;
}
@Override
public void preInit() {
super.preInit();
// Init seasoner
BeverageManager.infuserManager = new ItemInfuser.MixtureManager();
BeverageManager.ingredientManager = new ItemInfuser.IngredientManager();
}
@Override
public void postInit() {
super.postInit();
ItemInfuser.initialize();
}
@Override
protected void registerItems() {
// / FOOD ITEMS
ForestryItem.honeyedSlice.registerItem(new ItemForestryFood(8, 0.6f), "honeyedSlice");
ForestryItem.beverage.registerItem(new ItemBeverage(
new BeverageInfo("meadShort", "glass", 0xec9a19, 0xffffff, 1, 0.2f, true),
new BeverageInfo("meadCurative", "glass", 0xc5feff, 0xffffff, 1, 0.2f, true)),
"shortMead");
ForestryItem.ambrosia.registerItem(new ItemAmbrosia().setIsDrink(), "ambrosia");
ForestryItem.honeyPot.registerItem(new ItemForestryFood(2, 0.2f).setIsDrink(), "honeyPot");
// / SEASONER
ForestryItem.infuser.registerItem(new ItemInfuser(), "infuser");
// Mead
ItemStack meadBottle = ForestryItem.beverage.getItemStack();
((ItemBeverage) ForestryItem.beverage.item()).beverages[0].saveEffects(meadBottle, new IBeverageEffect[] { BeverageEffect.weakAlcoholic });
LiquidHelper.getOrCreateLiquid(Defaults.LIQUID_MEAD);
LiquidHelper.injectLiquidContainer(Defaults.LIQUID_MEAD, Defaults.BUCKET_VOLUME, meadBottle, new ItemStack(Items.glass_bottle));
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerRecipes() {
// INFUSER
Proxies.common.addRecipe(ForestryItem.infuser.getItemStack(),
"X", "#", "X",
'#', Items.iron_ingot,
'X', "ingotBronze");
}
@Override
protected void registerCrates() {
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerFood();
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
}
+198
View File
@@ -0,0 +1,198 @@
/*******************************************************************************
* 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 net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.registry.GameData;
import ic2.api.item.IC2Items;
import forestry.api.core.IPlugin;
import forestry.api.core.PluginInfo;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.BackpackManager;
import forestry.core.GameMode;
import forestry.core.config.Config;
import forestry.core.config.Configuration;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryItem;
import forestry.core.items.ItemCrated;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import forestry.core.utils.RecipeUtil;
import forestry.core.utils.StackUtils;
import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.recipe.Recipes;
@PluginInfo(pluginID = "IC2", name = "IndustrialCraft2", author = "SirSengir", url = Defaults.URL, description = "Compatibility plugin for IC2.")
public class PluginIC2 implements IPlugin {
public static PluginIC2 instance;
public static Configuration config;
// Ignore IC2?
public static boolean ignore;
// IC2 stuff
public static ItemStack plantBall;
public static ItemStack compressedPlantBall;
public static ItemStack wrench;
public static ItemStack treetap;
public static ItemStack resin;
public static ItemStack rubbersapling;
public static ItemStack rubberwood;
public static ItemStack rubberleaves;
public static ItemStack fuelcanFilled;
public static ItemStack fuelcanEmpty;
public static ItemStack emptyCell;
public static ItemStack lavaCell;
public static ItemStack waterCell;
public static ItemStack rubber;
public static ItemStack scrap;
public static int fuelcanMeta;
public PluginIC2() {
if (PluginIC2.instance == null)
PluginIC2.instance = this;
}
@Override
public boolean isAvailable() {
return Proxies.common.isModLoaded("IC2");
}
@Override
public void doInit() {
config = Config.config;
if (!isAvailable()) return;
initLiquidContainers();
initRubberChain();
initFermentation();
initCrates();
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beeQueenGE.getItemStack()));
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beePrincessGE.getItemStack()));
// Remove some items from the recycler
registerBackpackItems();
if (rubbersapling != null && resin != null) {
String imc = String.format("farmArboreal@%s.%s.%s.%s",
GameData.getBlockRegistry().getNameForObject(StackUtils.getBlock(rubbersapling)),
rubbersapling.getItemDamage(),
GameData.getItemRegistry().getNameForObject(resin.getItem()),
resin.getItemDamage());
Proxies.log.finest("Sending IMC '%s'.", imc);
FMLInterModComms.sendMessage(Defaults.MOD, "add-farmable-sapling", imc);
}
}
private void initFermentation() {
plantBall = IC2Items.getItem("plantBall");
compressedPlantBall = IC2Items.getItem("compressedPlantBall");
if (plantBall == null || compressedPlantBall == null) {
Proxies.log.fine("No IC2 plantballs found.");
return;
}
// Add extra recipes
RecipeUtil.injectLeveledRecipe(plantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 4, Defaults.LIQUID_BIOMASS);
RecipeUtil.injectLeveledRecipe(compressedPlantBall, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat") * 5, Defaults.LIQUID_BIOMASS);
}
private void initLiquidContainers() {
emptyCell = IC2Items.getItem("cell");
lavaCell = IC2Items.getItem("lavaCell");
waterCell = IC2Items.getItem("waterCell");
if (emptyCell == null || lavaCell == null || waterCell == null) {
Proxies.log.fine("Any of the following IC2 items could not be found: empty cell, water cell, lava cell. Skipped adding IC2 liquid containers.");
return;
}
LiquidHelper.injectTinContainer(Defaults.LIQUID_LAVA, Defaults.BUCKET_VOLUME, lavaCell, emptyCell);
LiquidHelper.injectTinContainer(Defaults.LIQUID_WATER, Defaults.BUCKET_VOLUME, waterCell, emptyCell);
if (GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can").stackSize > 0)
Proxies.common
.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.bogearth.can"), "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waterCell, 'Y', Blocks.sand);
}
private void initRubberChain() {
treetap = IC2Items.getItem("treetap");
resin = IC2Items.getItem("resin");
rubberwood = IC2Items.getItem("rubberWood");
rubbersapling = IC2Items.getItem("rubberSapling");
rubberleaves = IC2Items.getItem("rubberLeaves");
fuelcanFilled = IC2Items.getItem("filledFuelCan");
fuelcanEmpty = IC2Items.getItem("fuelCan");
if (treetap == null || resin == null || rubberwood == null || rubbersapling == null || rubberleaves == null || fuelcanFilled == null
|| fuelcanEmpty == null) {
Proxies.log
.fine("Any of the following IC2 blocks and items could not be found: resin, rubber wood, saplings or leaves, filled fuel cans, empty fuel cans. Skipped adding rubber chain.");
return;
}
// Add extra recipes
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.propolis.getItemStack(), resin);
ItemStack fuelcanStack = new ItemStack(fuelcanFilled.getItem(), 1, 0);
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("value", 15288);
fuelcanStack.setTagCompound(compound);
RecipeManagers.bottlerManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_ETHANOL, Defaults.BOTTLER_FUELCAN_VOLUME), fuelcanEmpty, fuelcanStack);
RecipeUtil.injectLeveledRecipe(rubbersapling, GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS);
// Add backpack items
BackpackManager.backpackItems[2].add(rubbersapling);
BackpackManager.backpackItems[2].add(rubberleaves);
// Rubber wood is added via ore dictionary.
}
private void initCrates() {
resin = IC2Items.getItem("resin");
rubber = IC2Items.getItem("rubber");
scrap = IC2Items.getItem("scrap");
// Add crates for the IC2 items that exist.
if (resin != null) {
((ItemCrated) ForestryItem.cratedResin.item()).setContained(ForestryItem.cratedResin.getItemStack(), resin);
}
if (rubber != null) {
((ItemCrated) ForestryItem.cratedRubber.item()).setContained(ForestryItem.cratedRubber.getItemStack(), rubber);
}
if (scrap != null) {
((ItemCrated) ForestryItem.cratedScrap.item()).setContained(ForestryItem.cratedScrap.getItemStack(), scrap);
}
}
private void registerBackpackItems() {
if (BackpackManager.backpackItems == null)
return;
if (resin != null)
BackpackManager.definitions.get("forester").addValidItem(resin);
if (rubber != null)
BackpackManager.definitions.get("forester").addValidItem(rubber);
}
@Override
public void preInit() {
}
@Override
public void postInit() {
}
}
+329
View File
@@ -0,0 +1,329 @@
/*******************************************************************************
* 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.Locale;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.oredict.RecipeSorter;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.arboriculture.ITreeRoot;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.PluginInfo;
import forestry.api.core.Tabs;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IClassification;
import forestry.api.genetics.IClassification.EnumClassLevel;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IButterflyRoot;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Configuration;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.config.Property;
import forestry.core.gadgets.BlockBase;
import forestry.core.gadgets.MachineDefinition;
import forestry.core.genetics.Allele;
import forestry.core.genetics.Branch;
import forestry.core.items.ItemForestryBlock;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.core.utils.Utils;
import forestry.lepidopterology.ButterflySpawner;
import forestry.lepidopterology.GuiHandlerLepidopterology;
import forestry.lepidopterology.MatingRecipe;
import forestry.lepidopterology.entities.EntityButterfly;
import forestry.lepidopterology.gadgets.TileLepidopteristChest;
import forestry.lepidopterology.genetics.AlleleButterflySpecies;
import forestry.lepidopterology.genetics.AlleleEffectNone;
import forestry.lepidopterology.genetics.ButterflyHelper;
import forestry.lepidopterology.genetics.ButterflyTemplates;
import forestry.lepidopterology.items.ItemButterflyGE;
import forestry.lepidopterology.items.ItemFlutterlyzer;
import forestry.lepidopterology.proxy.ProxyLepidopterology;
@PluginInfo(pluginID = "Lepidopterology", name = "Lepidopterology", author = "SirSengir", url = Defaults.URL, description = "Butterflies. Shiny.")
public class PluginLepidopterology extends NativePlugin {
@SidedProxy(clientSide = "forestry.lepidopterology.proxy.ClientProxyLepidopterology", serverSide = "forestry.lepidopterology.proxy.ProxyLepidopterology")
public static ProxyLepidopterology proxy;
private static final String CONFIG_CATEGORY = "lepidopterology";
private Configuration config;
public static int spawnConstraint = 100;
public static int entityConstraint = 1000;
public static IClassification geometridae;
public static IClassification saturniidae;
public static IClassification pieridae;
public static IClassification nymphalidae;
public static IClassification lycaenidae;
public static IClassification papilionidae;
public static IClassification notchidae;
/**
* See {@link IButterflyRoot} for details.
*/
public static IButterflyRoot butterflyInterface;
public static MachineDefinition definitionChest;
@Override
public boolean isAvailable() {
return true;
}
@Override
public void preInit() {
super.preInit();
ForestryBlock.lepidopterology = new BlockBase(Material.iron);
ForestryBlock.lepidopterology.setBlockName("for.lepidopterology").setCreativeTab(Tabs.tabLepidopterology);
Proxies.common.registerBlock(ForestryBlock.lepidopterology, ItemForestryBlock.class);
definitionChest = ForestryBlock.lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class,
ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.lepidopterology, 1, Defaults.DEFINITION_LEPICHEST_META), new Object[] { " # ", "XYX", "XXX", '#', Blocks.glass, 'X',
ForestryItem.butterflyGE.getItemStack(1, Defaults.WILDCARD), 'Y', Blocks.chest }))
.setFaces(0, 1, 2, 3, 4, 4, 0, 7)));
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginLepidopterology.butterflyInterface = new ButterflyHelper());
createAlleles();
}
@Override
public void doInit() {
super.doInit();
config = new Configuration();
Property property = config.get("entities.spawn.limit", CONFIG_CATEGORY, spawnConstraint);
property.Comment = "determines the global butterfly entity count above which natural spawning of butterflies ceases.";
spawnConstraint = Integer.parseInt(property.Value);
property = config.get("entities.maximum.allowed", CONFIG_CATEGORY, entityConstraint);
property.Comment = "determines the global butterfly entity count above which butterflies will stay in item form and will not take flight anymore.";
entityConstraint = Integer.parseInt(property.Value);
config.save();
Utils.registerEntity(EntityButterfly.class, "butterflyGE", 0, 0x000000, 0xffffff, 50, 1, true);
proxy.initializeRendering();
registerTemplates();
definitionChest.register();
((ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees")).registerLeafTickHandler(new ButterflySpawner());
RecipeSorter.register("forestry:lepidopterologymating", MatingRecipe.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless");
}
@Override
protected void registerItems() {
ForestryItem.flutterlyzer.registerItem(new ItemFlutterlyzer(), "flutterlyzer");
ForestryItem.butterflyGE.registerItem(new ItemButterflyGE(EnumFlutterType.BUTTERFLY), "butterflyGE");
ForestryItem.serumGE.registerItem(new ItemButterflyGE(EnumFlutterType.SERUM), "serumGE");
ForestryItem.caterpillarGE.registerItem(new ItemButterflyGE(EnumFlutterType.CATERPILLAR), "caterpillarGE");
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerCrates() {
}
@SuppressWarnings("unchecked")
@Override
protected void registerRecipes() {
CraftingManager.getInstance().getRecipeList().add(new MatingRecipe());
RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.flutterlyzer.getItemStack(),
new Object[] { "X#X", "X#X", "RDR", Character.valueOf('#'), Blocks.glass_pane, Character.valueOf('X'), "ingotBronze", Character.valueOf('R'),
Items.redstone, Character.valueOf('D'), Items.diamond });
}
private void createAlleles() {
IClassification lepidoptera = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.ORDER, "lepidoptera", "Lepidoptera");
AlleleManager.alleleRegistry.getClassification("class.insecta").addMemberGroup(lepidoptera);
geometridae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "geometridae", "Geometridae");
lepidoptera.addMemberGroup(geometridae);
saturniidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "saturniidae", "Saturniidae");
lepidoptera.addMemberGroup(saturniidae);
pieridae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "pieridae", "Pieridae");
lepidoptera.addMemberGroup(pieridae);
nymphalidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "nymphalidae", "Nymphalidae");
lepidoptera.addMemberGroup(nymphalidae);
lycaenidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "lycaenidae", "Lycaenidae");
lepidoptera.addMemberGroup(lycaenidae);
papilionidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "papilionidae", "Papilionidae");
lepidoptera.addMemberGroup(papilionidae);
notchidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "notchidae", "Notchidae");
lepidoptera.addMemberGroup(notchidae);
/* GEOMETRIDAE */
IClassification opisthograptis = createButterflyBranch(geometridae, "Opisthograptis");
IClassification chiasmia = createButterflyBranch(geometridae, "Chiasmia");
Allele.mothBrimstone = new AlleleButterflySpecies("mothBrimstone", true, "Brimstone", opisthograptis, "luteolata", 0xffea40).setNocturnal(true).setRarity(1.0f);
Allele.mothLatticedHeath = new AlleleButterflySpecies("mothLatticedHeath", true, "Latticed Heath", chiasmia, "clathrata", 0xf2f0be).setNocturnal(true).setRarity(0.5f);
/* SATURNIIDAE */
IClassification attacus = createButterflyBranch(saturniidae, "Attacus");
Allele.mothAtlas = new AlleleButterflySpecies("mothAtlas", false, "Atlas", attacus, "atlas", 0xd96e3d).setNocturnal(true);
/* PIERIDAE */
IClassification pieris = createButterflyBranch(pieridae, "Pieris");
IClassification gonepteryx = createButterflyBranch(pieridae, "Gonepteryx");
IClassification anthocharis = createButterflyBranch(pieridae, "Anthocharis");
IClassification colias = createButterflyBranch(pieridae, "Colias");
IClassification pontia = createButterflyBranch(pieridae, "Pontia");
IClassification celastrina = createButterflyBranch(pieridae, "Celastrina");
Allele.lepiCabbageWhite = new AlleleButterflySpecies("lepiCabbageWhite", true, "Cabbage White", pieris, "rapae", 0xccffee).setRarity(1.0f);
Allele.lepiBrimstone = new AlleleButterflySpecies("lepiBrimstone", true, "Brimstone", gonepteryx, "rhamni", 0xf0ee38).setRarity(1.0f);
Allele.lepiAurora = new AlleleButterflySpecies("lepiAurora", true, "Orange Tip", anthocharis, "cardamines", 0xe34f05).setRarity(0.5f);
Allele.lepiPostillion = new AlleleButterflySpecies("lepiPostillion", true, "Postillion", colias, "croceus", 0xd77e04).setRarity(0.5f);
Allele.lepiPalaenoSulphur = new AlleleButterflySpecies("lepiPalaenoSulphur", true, "Palaeno Sulphur", colias, "palaeno", 0xf8fba3).setRarity(0.4f);
Allele.lepiReseda = new AlleleButterflySpecies("lepiReseda", true, "Reseda", pontia, "edusa", 0x747d48).setRarity(0.3f);
Allele.lepiSpringAzure = new AlleleButterflySpecies("lepiSpringAzure", true, "Spring Azure", celastrina, "argiolus", 0xb8cae2).setRarity(0.3f);
Allele.lepiGozoraAzure = new AlleleButterflySpecies("lepiGozoraAzure", true, "Gozora Azure", celastrina, "gozora", 0x6870e7).setRarity(0.2f);
/* PAPILIONIDAE */
IClassification papilio = createButterflyBranch(papilionidae, "Papilio");
IClassification protographium = createButterflyBranch(papilionidae, "Protographium");
Allele.lepiCitrusSwallow = new AlleleButterflySpecies("lepiCitrusSwallow", false, "Citrus Swallowtail", papilio, "demodocus", 0xeae389).setRarity(1.0f)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiEmeraldPeacock = new AlleleButterflySpecies("lepiEmeraldPeacock", true, "Emerald Peacock", papilio, "palinurus", 0x7cfe80)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiThoasSwallow = new AlleleButterflySpecies("lepiThoasSwallow", false, "Thoas Swallowtail", papilio, "thoas", 0xeac783).setRarity(0.2f)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiSpicebush = new AlleleButterflySpecies("lepiSpicebush", true, "Spicebush Swallowtail", papilio, "troilus", 0xeefeff).setRarity(0.5f);
Allele.lepiBlackSwallow = new AlleleButterflySpecies("lepiBlackSwallow", true, "Black Swallowtail", papilio, "polyxenes", 0xeac783).setRarity(1.0f);
Allele.lepiZebraSwallow = new AlleleButterflySpecies("lepiZebraSwallow", true, "Zebra Swallowtail", protographium, "marcellus", 0xeafeff).setRarity(0.5f);
Allele.lepiDianaFrit = new AlleleButterflySpecies("lepiDianaFrit", true, "Diana Fritillary", protographium, "diana", 0xffac05).setRarity(0.6f);
/* NYMPHALIDAE */
IClassification pararge = createButterflyBranch(nymphalidae, "Pararge");
IClassification polygonia = createButterflyBranch(nymphalidae, "Polygonia");
IClassification morpho = createButterflyBranch(nymphalidae, "Morpho");
IClassification greta = createButterflyBranch(nymphalidae, "Greta");
IClassification batesia = createButterflyBranch(nymphalidae, "Batesia");
IClassification myscelia = createButterflyBranch(nymphalidae, "Myscelia");
IClassification danaus = createButterflyBranch(nymphalidae, "Danaus");
IClassification bassarona = createButterflyBranch(nymphalidae, "Bassarona");
IClassification parantica = createButterflyBranch(nymphalidae, "Parantica");
IClassification heliconius = createButterflyBranch(nymphalidae, "Heliconius");
IClassification siproeta = createButterflyBranch(nymphalidae, "Siproeta");
IClassification cethosia = createButterflyBranch(nymphalidae, "Cethosia");
Allele.lepiGlasswing = new AlleleButterflySpecies("lepiGlasswing", true, "Glasswing", greta, "oto", 0x583732)
.setTemperature(EnumTemperature.WARM);
Allele.lepiSpeckledWood = new AlleleButterflySpecies("lepiSpeckledWood", true, "Speckled Wood", pararge, "aegeria", 0x947245).setRarity(1.0f);
Allele.lepiMadeiranSpeckledWood = new AlleleButterflySpecies("lepiMSpeckledWood", true, "Madeiran Speckled Wood", pararge, "xiphia", 0x402919).setRarity(0.5f);
Allele.lepiCanarySpeckledWood = new AlleleButterflySpecies("lepiCSpeckledWood", true, "Canary Speckled Wood", pararge, "xiphioides", 0x51372a).setRarity(0.5f);
Allele.lepiMenelausBlueMorpho = new AlleleButterflySpecies("lepiMBlueMorpho", true, "Menelaus Blue Morpho", morpho, "menelaus", 0x72e1fd).setRarity(0.5f)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiPeleidesBlueMorpho = new AlleleButterflySpecies("lepiPBlueMorpho", true, "Peleides Blue Morpho", morpho, "peleides", 0x6ecce8).setRarity(0.25f)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiRhetenorBlueMorpho = new AlleleButterflySpecies("lepiRBlueMorpho", true, "Rhetenor Blue Morpho", morpho, "rhetenor", 0x00bef8)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiComma = new AlleleButterflySpecies("lepiComma", true, "Comma", polygonia, "c-album", 0xf89505).setRarity(0.3f);
Allele.lepiBatesia = new AlleleButterflySpecies("lepiBatesia", true, "Painted Beauty", batesia, "hypochlora", 0xfe7763).setRarity(0.3f)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiBlueWing = new AlleleButterflySpecies("lepiBlueWing", true, "Blue Wing", myscelia, "ethusa", 0x3a93cc).setRarity(0.3f);
Allele.lepiMonarch = new AlleleButterflySpecies("lepiMonarch", true, "Monarch", danaus, "plexippus", 0xffa722).setRarity(0.2f);
Allele.lepiBlueDuke = new AlleleButterflySpecies("lepiBlueDuke", true, "Blue Duke", bassarona, "durga", 0x304240).setRarity(0.5f)
.setTemperature(EnumTemperature.COLD);
Allele.lepiGlassyTiger = new AlleleButterflySpecies("lepiGlassyTiger", true, "Glassy Tiger", parantica, "aglea", 0x5b3935).setRarity(0.3f);
Allele.lepiPostman = new AlleleButterflySpecies("lepiPostman", true, "Postman", heliconius, "melpmene", 0xf7302d).setRarity(0.3f);
Allele.lepiMalachite = new AlleleButterflySpecies("lepiMalachite", true, "Malachite", siproeta, "stelenes", 0xbdff53).setRarity(0.5f)
.setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP);
Allele.lepiLLacewing = new AlleleButterflySpecies("lepiLLacewing", true, "Leopard Lacewing", cethosia, "cyane", 0xfb8a06).setRarity(0.7f);
Allele.butterflyNone = new AlleleEffectNone("bfNone", false);
}
private void registerTemplates() {
butterflyInterface.registerTemplate(ButterflyTemplates.getBrimstoneMothTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getLatticedHeathTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getAtlasMothTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getCabbageWhiteTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getGlasswingTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getEmeraldPeacockTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getThoasSwallowTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getCitrusSwallowTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getBlackSwallowTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getZebraSwallowTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getDianaFritTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getSpeckledWoodTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getMadeiranSpeckledWoodTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getCanarySpeckledWoodTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getMenelausBlueMorphoTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getRhetenorBlueMorphoTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getPeleidesBlueMorphoTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getBrimstoneTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getAuroraTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getPostillionTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getPalaenoSulphurTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getResedaTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getSpringAzureTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getGozoraAzureTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getCommaTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getBatesiaTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getBlueWingTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getBlueDukeTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getGlassyTigerTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getMonarchTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getPostmanTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getSpicebushTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getMalachiteTemplate());
butterflyInterface.registerTemplate(ButterflyTemplates.getLeopardLacewingTemplate());
}
private IClassification createButterflyBranch(IClassification family, String scientific) {
IClassification branch = new Branch("moth." + scientific.toLowerCase(Locale.ENGLISH), scientific);
branch.setParent(family);
return branch;
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerLepidopterology();
}
}
+224
View File
@@ -0,0 +1,224 @@
/*******************************************************************************
* 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 net.minecraft.block.material.Material;
import net.minecraft.command.ICommand;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.core.PluginInfo;
import forestry.api.mail.EnumPostage;
import forestry.api.mail.PostManager;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.gadgets.BlockBase;
import forestry.core.gadgets.MachineDefinition;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.IPacketHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.items.ItemForestryBlock;
import forestry.core.proxy.Proxies;
import forestry.core.triggers.Trigger;
import forestry.core.utils.LiquidHelper;
import forestry.core.utils.ShapedRecipeCustom;
import forestry.mail.CommandMail;
import forestry.mail.EnumAddressee;
import forestry.mail.GuiHandlerMail;
import forestry.mail.PacketHandlerMail;
import forestry.mail.PostRegistry;
import forestry.mail.PostalCarrier;
import forestry.mail.SaveEventHandlerMail;
import forestry.mail.TickHandlerMailClient;
import forestry.mail.gadgets.MachineMailbox;
import forestry.mail.gadgets.MachinePhilatelist;
import forestry.mail.gadgets.MachineTrader;
import forestry.mail.items.ItemCatalogue;
import forestry.mail.items.ItemLetter;
import forestry.mail.items.ItemStamps;
import forestry.mail.items.ItemStamps.StampInfo;
import forestry.mail.proxy.ProxyMail;
import forestry.mail.triggers.TriggerBuffer;
import forestry.mail.triggers.TriggerHasMail;
import forestry.mail.triggers.TriggerLowInput;
import forestry.mail.triggers.TriggerLowPaper;
import forestry.mail.triggers.TriggerLowStamps;
@PluginInfo(pluginID = "Mail", name = "Mail", author = "SirSengir", url = Defaults.URL, description = "Adds Forestry's mail and trade system.")
public class PluginMail extends NativePlugin {
@SidedProxy(clientSide = "forestry.mail.proxy.ClientProxyMail", serverSide = "forestry.mail.proxy.ProxyMail")
public static ProxyMail proxy;
public static Trigger triggerHasMail;
public static Trigger lowPaper25;
public static Trigger lowPaper10;
public static Trigger lowPostage40;
public static Trigger lowPostage20;
public static Trigger lowInput25;
public static Trigger lowInput10;
public static Trigger highBuffer75;
public static Trigger highBuffer90;
public static MachineDefinition definitionMailbox;
public static MachineDefinition definitionTradestation;
public static MachineDefinition definitionPhilatelist;
public static StampInfo[] stampDefinitions;
@Override
public boolean isAvailable() {
return !Config.disableMail;
}
@Override
public void preInit() {
super.preInit();
new TickHandlerMailClient();
triggerHasMail = new TriggerHasMail();
lowPaper25 = new TriggerLowPaper("mail.lowPaper.25", 0.25f);
lowPaper10 = new TriggerLowPaper("mail.lowPaper.10", 0.1f);
lowPostage40 = new TriggerLowStamps("mail.lowStamps.40", 40);
lowPostage20 = new TriggerLowStamps("mail.lowStamps.20", 20);
lowInput25 = new TriggerLowInput("mail.lowInput.25", 0.25f);
lowInput10 = new TriggerLowInput("mail.lowInput.10", 0.1f);
highBuffer75 = new TriggerBuffer("mail.lowBuffer.75", 0.75f);
highBuffer90 = new TriggerBuffer("mail.lowBuffer.90", 0.90f);
ForestryBlock.mail = new BlockBase(Material.iron);
ForestryBlock.mail.setBlockName("for.mail");
Proxies.common.registerBlock(ForestryBlock.mail, ItemForestryBlock.class);
ShapedRecipeCustom recipe = ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.mail, 1, Defaults.DEFINITION_MAILBOX_META),
" # ", "#Y#", "XXX",
'#', "ingotTin",
'X', Blocks.chest,
'Y', ForestryItem.sturdyCasing);
definitionMailbox = ForestryBlock.mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_MAILBOX_META, "forestry.Mailbox", MachineMailbox.class, recipe).setFaces(0, 1, 2, 2, 2, 2, 0, 7));
recipe = ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.mail, 1, Defaults.DEFINITION_TRADESTATION_META),
"Z#Z", "#Y#", "XWX",
'#', ForestryItem.tubes.getItemStack(1, 2),
'X', Blocks.chest,
'Y', ForestryItem.sturdyCasing,
'Z', ForestryItem.tubes.getItemStack(1, 3),
'W', ForestryItem.circuitboards.getItemStack(1, 2));
definitionTradestation = ForestryBlock.mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_TRADESTATION_META, "forestry.Tradestation", MachineTrader.class, recipe).setFaces(0, 1, 2, 3, 4, 4, 0, 7));
definitionPhilatelist = ForestryBlock.mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_PHILATELIST_META, "forestry.Philatelist", MachinePhilatelist.class)
.setFaces(0, 1, 2, 3, 2, 2, 0, 7));
PostManager.postRegistry = new PostRegistry();
PostManager.postRegistry.registerCarrier(new PostalCarrier(EnumAddressee.PLAYER));
PostManager.postRegistry.registerCarrier(new PostalCarrier(EnumAddressee.TRADER));
}
@Override
public void doInit() {
super.doInit();
definitionMailbox.register();
definitionTradestation.register();
definitionPhilatelist.register();
}
@Override
public void postInit() {
super.postInit();
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerMail();
}
@Override
public IPacketHandler getPacketHandler() {
return new PacketHandlerMail();
}
@Override
protected void registerItems() {
stampDefinitions = new StampInfo[] {
new StampInfo("1n", EnumPostage.P_1, ForestryItem.apatite, 0x4a8ca7, 0xffffff), new StampInfo("2n", EnumPostage.P_2, "ingotCopper", 0xe8c814, 0xffffff),
new StampInfo("5n", EnumPostage.P_5, "ingotTin", 0x9c0707, 0xffffff), new StampInfo("10n", EnumPostage.P_10, Items.gold_ingot, 0x7bd1b8, 0xffffff),
new StampInfo("20n", EnumPostage.P_20, Items.diamond, 0xff9031, 0xfff7dd), new StampInfo("50n", EnumPostage.P_50, Items.emerald, 0x6431d7, 0xfff7dd),
new StampInfo("100n", EnumPostage.P_100, Items.nether_star, 0xd731ba, 0xfff7dd) }; //new StampInfo("200n", EnumPostage.P_200, Item.netherStar, 0xcd9831, 0xfff7dd)};
/* STAMPS */
ForestryItem.stamps.registerItem(new ItemStamps(stampDefinitions), "stamps");
/* LETTER */
ForestryItem.letters.registerItem(new ItemLetter(), "letters");
/* CATALOGUE */
ForestryItem.catalogue.registerItem(new ItemCatalogue(), "catalogue");
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerCrates() {
}
@Override
protected void registerRecipes() {
// Letters
Proxies.common.addShapelessRecipe(ForestryItem.letters.getItemStack(), Items.paper, ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD));
if (Config.craftingStampsEnabled) {
for (int i = 0; i < stampDefinitions.length; i++) {
if (Config.collectorStamps.contains(stampDefinitions[i].name))
continue;
Proxies.common.addRecipe(ForestryItem.stamps.getItemStack(9, i), new Object[] { "XXX", "###", "ZZZ", 'X',
stampDefinitions[i].getCraftingIngredient(), '#', Items.paper, 'Z', ForestryItem.honeyDrop });
RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 300), null, ForestryItem.stamps.getItemStack(9, i),
new Object[] { "XXX", "###", 'X', stampDefinitions[i].getCraftingIngredient(), '#', Items.paper });
}
}
// Recycling
Proxies.common.addRecipe(new ItemStack(Items.paper), new Object[] { "###", '#', ForestryItem.letters.getItemStack(1, Defaults.WILDCARD) });
// Carpenter
RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, ForestryItem.letters.getItemStack(), new Object[] { "###", "###", '#', ForestryItem.woodPulp });
Proxies.common.addShapelessRecipe(ForestryItem.catalogue.getItemStack(), new Object[] { ForestryItem.stamps.getItemStack(1, Defaults.WILDCARD), new ItemStack(Items.book) });
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return new SaveEventHandlerMail();
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return null;
}
@Override
public ICommand[] getConsoleCommands() {
return new ICommand[] { new CommandMail() };
}
}
+262
View File
@@ -0,0 +1,262 @@
/*******************************************************************************
* 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.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.core.IPlugin;
import forestry.core.ForestryCore;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.IPacketHandler;
import forestry.core.interfaces.IPickupHandler;
import forestry.core.interfaces.IResupplyHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.proxy.Proxies;
public class PluginManager {
/**
* You can use the API from your own mod or write a simple plugin mod using
* this plugin interface. Adding a plugin here will have Forestry call the
* registered object during ModsLoaded(). See {@link IPlugin} for further
* details.
*/
public static ArrayList<IPlugin> plugins = new ArrayList<IPlugin>();
public static ArrayList<IGuiHandler> guiHandlers = new ArrayList<IGuiHandler>();
public static ArrayList<IPacketHandler> packetHandlers = new ArrayList<IPacketHandler>();
public static ArrayList<IPickupHandler> pickupHandlers = new ArrayList<IPickupHandler>();
public static ArrayList<ISaveEventHandler> saveEventHandlers = new ArrayList<ISaveEventHandler>();
public static ArrayList<IResupplyHandler> resupplyHandlers = new ArrayList<IResupplyHandler>();
public static ArrayList<IOreDictionaryHandler> dictionaryHandlers = new ArrayList<IOreDictionaryHandler>();
public static void loadPlugins(File modLocation) {
loadIncludedPlugins(modLocation);
loadExternalPlugins(modLocation);
}
private static void loadIncludedPlugins(File modLocation) {
ClassLoader classLoader = ForestryCore.class.getClassLoader();
// Internal plugin when Forestry is a jar or zip
if (modLocation.isFile() && (modLocation.getName().endsWith(".jar") || modLocation.getName().endsWith(".zip")))
loadPluginsFromFile(modLocation, classLoader);
else if (modLocation.isDirectory())
loadPluginsFromBin(modLocation, classLoader);
}
private static void loadExternalPlugins(File modLocation) {
try {
File pluginDir = new File(Proxies.common.getForestryRoot() + "/mods");
ClassLoader classLoader = ForestryCore.class.getClassLoader();
// Abort if the plugin directory is not there.
if (!pluginDir.isDirectory())
return;
File[] fileList = pluginDir.listFiles();
if (fileList == null)
return;
for (File file : fileList) {
if (!file.isFile())
continue;
if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip"))
continue;
if (file.getName().equals(modLocation.getName()))
continue;
loadPluginsFromFile(file, classLoader);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static void loadPluginsFromFile(File file, ClassLoader classLoader) {
String pluginName;
try {
ZipEntry entry = null;
FileInputStream fileIO = new FileInputStream(file);
ZipInputStream zipIO = new ZipInputStream(fileIO);
while (true) {
entry = zipIO.getNextEntry();
if (entry == null) {
fileIO.close();
break;
}
String entryName = entry.getName();
File entryFile = new File(entryName);
pluginName = entryFile.getName();
if (!entry.isDirectory() && pluginName.startsWith("Plugin") && pluginName.endsWith(".class"))
PluginManager.addPlugin(classLoader, pluginName, entryFile.getPath().replace(File.separatorChar, '.'));
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
private static String parseClassName(String binpath) {
String[] tokens = binpath.split("[\\\\/]");
String packageName = "";
boolean inIdea = false;
for (int i = 0; i < tokens.length; i++) {
if (tokens[i] == null)
break;
if (tokens[i].equals("production"))
inIdea = true;
if (!tokens[i].equals("bin") && !inIdea)
continue;
// We are at bin, build the rest and return
for (int j = (inIdea ? i + 2 : i + 1); j < tokens.length; j++) {
if (packageName.length() > 0)
packageName += ".";
packageName += tokens[j];
}
break;
}
return packageName;
}
private static void loadPluginsFromBin(File bin, ClassLoader classLoader) {
File[] fileList = bin.listFiles();
// ensure consistent sorting across all platforms
Arrays.sort(fileList, new Comparator<File>() {
@Override
public int compare(File a, File b) {
return a.getName().toLowerCase().compareTo(b.getName().toLowerCase());
}
});
for (File file : fileList) {
String pluginName = file.getName();
if (file.isFile() && pluginName.startsWith("Plugin") && pluginName.endsWith(".class")) {
PluginManager.addPlugin(classLoader, pluginName, parseClassName(file.getPath()));
} else if (file.isDirectory()) {
loadPluginsFromBin(file, classLoader);
}
}
}
public static void addPlugin(ClassLoader classLoader, String pluginName, String packageName) {
if (pluginName.equals("PluginManager.class") || pluginName.equals("PluginInfo.class"))
return;
String pluginClassName = packageName.replace(".class", "").replace("minecraft.", "");
try {
Class<?> pluginClass = null;
try {
pluginClass = classLoader.loadClass(pluginClassName);
} catch (Throwable error) {
}
if (pluginClass == null) {
pluginClass = Class.forName(pluginClassName);
}
if (pluginClass != null) {
Class<?> clz = pluginClass;
boolean isPlugin = false;
do {
for (Class<?> i : clz.getInterfaces()) {
if (i == IPlugin.class) {
isPlugin = true;
break;
}
}
clz = clz.getSuperclass();
} while (clz != null && !isPlugin);
if (!isPlugin)
return;
IPlugin plugin = (IPlugin) pluginClass.newInstance();
if (plugin != null) {
Proxies.log.fine("Found plugin " + plugin.toString());
plugins.add(plugin);
if (plugin instanceof NativePlugin) {
NativePlugin nplugin = (NativePlugin) plugin;
IGuiHandler guiHandler = nplugin.getGuiHandler();
if (guiHandler != null)
guiHandlers.add(guiHandler);
IPacketHandler packetHandler = nplugin.getPacketHandler();
if (packetHandler != null)
packetHandlers.add(packetHandler);
IPickupHandler pickupHandler = nplugin.getPickupHandler();
if (pickupHandler != null)
pickupHandlers.add(pickupHandler);
ISaveEventHandler saveHandler = nplugin.getSaveEventHandler();
if (saveHandler != null)
saveEventHandlers.add(saveHandler);
IResupplyHandler resupplyHandler = nplugin.getResupplyHandler();
if (resupplyHandler != null)
resupplyHandlers.add(resupplyHandler);
IOreDictionaryHandler dictionaryHandler = nplugin.getDictionaryHandler();
if (dictionaryHandler != null)
dictionaryHandlers.add(dictionaryHandler);
}
if (plugin instanceof IFuelHandler)
GameRegistry.registerFuelHandler((IFuelHandler) plugin);
}
}
} catch (Throwable ex) {
// ex.printStackTrace();
}
}
}
+110
View File
@@ -0,0 +1,110 @@
/*******************************************************************************
* 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.event.FMLInterModComms;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.api.recipes.RecipeManagers;
import forestry.core.GameMode;
import forestry.core.config.Defaults;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
public class PluginNatura extends NativePlugin {
private static final String NATURA = "Natura";
public static Block logNatura;
public static Block logWillow;
public static Block leavesNatura;
public static Block saplingNatura;
@Override
public boolean isAvailable() {
return Proxies.common.isModLoaded(NATURA);
}
@Override
public void doInit() {
super.doInit();
logNatura = GameRegistry.findBlock(NATURA, "tree");
logWillow = GameRegistry.findBlock(NATURA, "willow");
leavesNatura = GameRegistry.findBlock(NATURA, "floraleaves");
saplingNatura = GameRegistry.findBlock(NATURA, "florasapling");
if(saplingNatura != null)
FMLInterModComms.sendMessage(Defaults.MOD, "add-farmable-sapling", String.format("farmArboreal@%s.-1", saplingNatura));
}
@Override protected void registerItems() {}
@Override protected void registerBackpackItems() {}
@Override protected void registerCrates() {}
@Override
protected void registerRecipes() {
ItemStack seedBarley = GameRegistry.findItemStack(NATURA, "seedBarley", 1);
ItemStack seedCotton = GameRegistry.findItemStack(NATURA, "seedCotton", 1);
ArrayList<ItemStack> seedList = new ArrayList<ItemStack>();
if (seedBarley != null)
seedList.add(seedBarley);
if (seedCotton != null)
seedList.add(seedCotton);
int amount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
for (int i = 0; i < seedList.size(); ++i) {
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { seedList.get(i) },
LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, amount));
}
ItemStack berryBlight = GameRegistry.findItemStack(NATURA, "berryBlight", 1);
ItemStack berryDusk = GameRegistry.findItemStack(NATURA, "berryDusk", 1);
ItemStack berrySky = GameRegistry.findItemStack(NATURA, "berrySting", 1);
ItemStack berrySting = GameRegistry.findItemStack(NATURA, "berrySting", 1);
ItemStack berryRasp = GameRegistry.findItemStack(NATURA, "berryRasp", 1);
ItemStack berryBlue = GameRegistry.findItemStack(NATURA, "berryBlue", 1);
ItemStack berryBlack = GameRegistry.findItemStack(NATURA, "berryBlack", 1);
ItemStack berryMalo = GameRegistry.findItemStack(NATURA, "berryMalo", 1);
ArrayList<ItemStack> berries = new ArrayList<ItemStack>();
if (berryBlight != null)
berries.add(berryBlight);
if (berryDusk != null)
berries.add(berryDusk);
if (berrySky != null)
berries.add(berrySky);
if (berrySting!= null)
berries.add(berrySting);
if (berryRasp != null)
berries.add(berryRasp);
if (berryBlue != null)
berries.add(berryBlue);
if (berryBlack != null)
berries.add(berryBlack);
if (berryMalo != null)
berries.add(berryMalo);
amount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") / 25;
amount = (amount > 1) ? amount : 1; // Produce at least 1 mb of juice.
for (int i = 0; i < berries.size(); ++i) {
RecipeManagers.squeezerManager.addRecipe(3, new ItemStack[] { berries.get(i) },
LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, amount));
}
}
}
+100
View File
@@ -0,0 +1,100 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.plugins;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IGuiHandler;
import forestry.api.core.PluginInfo;
import forestry.core.config.Configuration;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryItem;
import forestry.core.interfaces.IPacketHandler;
import forestry.core.proxy.Proxies;
import forestry.pipes.GuiHandlerPipes;
import forestry.pipes.network.PacketHandlerPipes;
import forestry.pipes.proxy.ProxyPipes;
@PluginInfo(pluginID = "Pipes", name = "Pipes", author = "SirSengir", url = Defaults.URL, description = "Adds the apiarist's pipe for beekeeping if apiculture is enabled and BuildCraft 6 is present.")
public class PluginPropolisPipe extends NativePlugin {
public static ProxyPipes proxy;
static String CONFIG_CATEGORY = "pipes";
public static Configuration config;
public static int propolisPipeItemId;
public static String textureBees = Defaults.TEXTURE_PATH_GUI + "/analyzer_icons.png";
/**
* Pipe used to sort bees from Forestry.
*/
public static Item pipeItemsPropolis;
@Override
public boolean isAvailable() {
return Proxies.common.isModLoaded("BuildCraft|Transport");
}
@Override
public void preInit() {
/*config = new Configuration();
propolisPipeItemId = Integer.parseInt(PluginPropolisPipe.config.get("propolisPipe", CONFIG_CATEGORY, 14000).Value);
config.save();*/
}
@Override
public void doInit() {
}
@Override
public void postInit() {
String proxyClass = "forestry.pipes.proxy.ProxyPipes";
if (FMLCommonHandler.instance().getSide().isClient())
proxyClass = "forestry.pipes.proxy.ClientProxyPipes";
proxy = (ProxyPipes) Proxies.common.instantiateIfModLoaded("BuildCraft|Transport", proxyClass);
if (proxy == null)
return;
proxy.initPropolisPipe();
proxy.registerCraftingPropolis(ForestryItem.propolis.getItemStack());
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerPipes();
}
@Override
public IPacketHandler getPacketHandler() {
return new PacketHandlerPipes();
}
@Override
protected void registerItems() {
}
@Override
protected void registerBackpackItems() {
}
@Override
protected void registerCrates() {
}
@Override
protected void registerRecipes() {
}
}
+605
View File
@@ -0,0 +1,605 @@
/*******************************************************************************
* 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.text.NumberFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBasePressurePlate;
import net.minecraft.block.BlockButton;
import net.minecraft.block.BlockChest;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockLever;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockMelon;
import net.minecraft.block.BlockPumpkin;
import net.minecraft.block.BlockRedstoneDiode;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.BlockTorch;
import net.minecraft.block.BlockTrapDoor;
import net.minecraft.block.BlockWall;
import net.minecraft.block.BlockWorkbench;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameData;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.IShearable;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.core.PluginInfo;
import forestry.api.core.Tabs;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.BackpackManager;
import forestry.api.storage.EnumBackpackType;
import forestry.api.storage.IBackpackDefinition;
import forestry.core.config.Config;
import forestry.core.config.Configuration;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.config.Property;
import forestry.core.interfaces.IOreDictionaryHandler;
import forestry.core.interfaces.IPickupHandler;
import forestry.core.interfaces.IResupplyHandler;
import forestry.core.interfaces.ISaveEventHandler;
import forestry.core.network.GuiId;
import forestry.core.proxy.Proxies;
import forestry.core.utils.LiquidHelper;
import forestry.storage.BackpackDefinition;
import forestry.storage.BackpackHelper;
import forestry.storage.GuiHandlerStorage;
import forestry.storage.PickupHandlerStorage;
import forestry.storage.ResupplyHandler;
import forestry.storage.items.ItemBackpack;
import forestry.storage.items.ItemNaturalistBackpack;
import forestry.storage.items.ItemNaturalistBackpack.BackpackDefinitionApiarist;
import forestry.storage.items.ItemNaturalistBackpack.BackpackDefinitionLepidopterist;
@PluginInfo(pluginID = "Storage", name = "Storage", author = "SirSengir", url = Defaults.URL, description = "Adds backpacks and crates.")
public class PluginStorage extends NativePlugin implements IOreDictionaryHandler {
private final ArrayList<ItemStack> minerItems = new ArrayList<ItemStack>();
private final ArrayList<ItemStack> diggerItems = new ArrayList<ItemStack>();
private final ArrayList<ItemStack> foresterItems = new ArrayList<ItemStack>();
private final ArrayList<ItemStack> hunterItems = new ArrayList<ItemStack>();
private final ArrayList<ItemStack> adventurerItems = new ArrayList<ItemStack>();
private final ArrayList<ItemStack> builderItems = new ArrayList<ItemStack>();
static String CONFIG_CATEGORY = "backpacks";
Configuration config;
@Override
public boolean isAvailable() {
return !Config.disableStorage;
}
@Override
public void preInit() {
BackpackManager.backpackInterface = new BackpackHelper();
super.preInit();
createBackpackArrays();
}
@Override
public void postInit() {
super.postInit();
scanForItems();
config = new Configuration();
Property backpackConf = config.get("backpacks.miner.items", CONFIG_CATEGORY, "");
backpackConf.Comment = "add additional blocks and items for the miner's backpack here in the format id:meta. separate blocks and items using ';'. wildcard for metadata: '*'";
parseBackpackItems("Miner's Backpack", backpackConf.Value, BackpackManager.definitions.get("miner"));
backpackConf = config.get("backpacks.digger.items", CONFIG_CATEGORY, "");
backpackConf.Comment = "add additional blocks and items for the digger's backpack here in the format id:meta. separate blocks and items using ';'. wildcard for metadata: '*'";
parseBackpackItems("Digger's Backpack", backpackConf.Value, BackpackManager.definitions.get("digger"));
backpackConf = config.get("backpacks.forester.items", CONFIG_CATEGORY, "");
backpackConf.Comment = "add additional blocks and items for the forester's backpack here in the format id:meta. separate blocks and items using ';'. wildcard for metadata: '*'";
parseBackpackItems("Forester's Backpack", backpackConf.Value, BackpackManager.definitions.get("forester"));
backpackConf = config.get("backpacks.hunter.items", CONFIG_CATEGORY, "");
backpackConf.Comment = "add additional blocks and items for the hunter's backpack here in the format id:meta. separate blocks and items using ';'. wildcard for metadata: '*'";
parseBackpackItems("Hunter's Backpack", backpackConf.Value, BackpackManager.definitions.get("hunter"));
backpackConf = config.get("backpacks.adventurer.items", CONFIG_CATEGORY, "");
backpackConf.Comment = "add blocks and items for the adventurer's backpack here in the format id:meta. separate blocks and items using ';'. wildcard for metadata: '*'";
parseBackpackItems("Adventurer's Backpack", backpackConf.Value, BackpackManager.definitions.get("adventurer"));
backpackConf = config.get("backpacks.builder.items", CONFIG_CATEGORY, "");
backpackConf.Comment = "add blocks and items for the builder's backpack here in the format id:meta. separate blocks and items using ';'. wildcard for metadata: '*'";
parseBackpackItems("Builder's Backpack", backpackConf.Value, BackpackManager.definitions.get("builder"));
config.save();
}
public static void addBackpackItem(String pack, ItemStack stack) {
if (stack == null)
return;
BackpackManager.definitions.get(pack).addValidItem(stack);
}
public static void addBackpackItem(String pack, Block block) {
BackpackManager.definitions.get(pack).addValidItem(new ItemStack(block, 1, Defaults.WILDCARD));
}
public static void addBackpackItem(String pack, Item item) {
BackpackManager.definitions.get(pack).addValidItem(new ItemStack(item, 1, Defaults.WILDCARD));
}
public static void scanForItems() {
for (Object id : Block.blockRegistry.getKeys()) {
try {
Block block = (Block) Block.blockRegistry.getObject(id);
if (block instanceof IPlantable ||
block instanceof IShearable ||
block instanceof BlockLog ||
block instanceof BlockMelon ||
block instanceof BlockPumpkin)
addBackpackItem("forester", block);
if (block instanceof BlockStairs || block.getRenderType() == 10 ||
block instanceof BlockFence || block.getRenderType() == 11 ||
block instanceof BlockFenceGate || block.getRenderType() == 21 ||
block instanceof BlockWall || block.getRenderType() == 32 ||
block instanceof BlockBasePressurePlate ||
block instanceof BlockLever ||
block instanceof BlockButton ||
block instanceof BlockTorch ||
block instanceof BlockRedstoneDiode ||
block instanceof BlockChest || block.getRenderType() == 22 ||
block instanceof BlockWorkbench ||
block instanceof BlockFurnace ||
block instanceof BlockLadder || block.getRenderType() == 8 ||
block instanceof BlockTrapDoor ||
block.getUnlocalizedName().contains("door"))
addBackpackItem("builder", block);
} catch (Throwable error) {
error.printStackTrace();
}
}
for (Object id : Item.itemRegistry.getKeys()) {
try {
Item item = (Item) Item.itemRegistry.getObject(id);
if (item instanceof IPlantable)
addBackpackItem("forester", item);
else if (item instanceof ItemFood)
addBackpackItem("hunter", item);
else if (item instanceof ItemDoor)
addBackpackItem("builder", item);
} catch (Throwable error) {
error.printStackTrace();
}
}
}
@Override
public boolean processIMCMessage(IMCMessage message) {
if (message.key.equals("add-backpack-items")) {
String[] tokens = message.getStringValue().split("@");
if (tokens.length != 2) {
Logger.getLogger("Forestry").log(Level.INFO,
String.format("Received an invalid 'add-backpack-items' request %s from mod %s", message.getStringValue(), message.getSender()));
return true;
}
if (!BackpackManager.definitions.containsKey(tokens[0])) {
Logger.getLogger("Forestry").log(
Level.INFO,
String.format("Received an invalid 'add-backpack-items' request %s from mod %s for non-existent backpack %s.",
message.getStringValue(), message.getSender(), tokens[0]));
return true;
}
parseBackpackItems(tokens[0] + "'s Backpack", tokens[1], BackpackManager.definitions.get(tokens[0]));
return true;
}
return false;
}
@Override
public IPickupHandler getPickupHandler() {
return new PickupHandlerStorage();
}
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerStorage();
}
@Override
public IResupplyHandler getResupplyHandler() {
return new ResupplyHandler();
}
@Override
protected void registerItems() {
// / BACKPACKS
ForestryItem.apiaristBackpack.registerItem(new ItemNaturalistBackpack(GuiId.ApiaristBackpackGUI.ordinal(), new BackpackDefinitionApiarist("apiarist", 0xc4923d)).setCreativeTab(Tabs.tabApiculture), "apiaristBag");
BackpackDefinition definition = (BackpackDefinition) ((ItemBackpack) ForestryItem.apiaristBackpack.item()).getDefinition();
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.lepidopteristBackpack.registerItem(new ItemNaturalistBackpack(GuiId.LepidopteristBackpackGUI.ordinal(), new BackpackDefinitionLepidopterist("lepidopterist", 0x995b31)).setCreativeTab(Tabs.tabLepidopterology), "lepidopteristBag");
definition = (BackpackDefinition) ((ItemBackpack) ForestryItem.lepidopteristBackpack.item()).getDefinition();
BackpackManager.definitions.put(definition.getKey(), definition);
definition = new BackpackDefinition("miner", 0x36187d).setValidItems(BackpackManager.backpackItems[0]);
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.minerBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "minerBag");
ForestryItem.minerBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "minerBagT2");
definition = new BackpackDefinition("digger", 0x363cc5).setValidItems(BackpackManager.backpackItems[1]);
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.diggerBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "diggerBag");
ForestryItem.diggerBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "diggerBagT2");
definition = new BackpackDefinition("forester", 0x347427)
.setValidItems(BackpackManager.backpackItems[2]);
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.foresterBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "foresterBag");
ForestryItem.foresterBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "foresterBagT2");
definition = new BackpackDefinition("hunter", 0x412215).setValidItems(BackpackManager.backpackItems[3]);
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.hunterBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "hunterBag");
ForestryItem.hunterBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "hunterBagT2");
definition = new BackpackDefinition("adventurer", 0x7fb8c2)
.setValidItems(BackpackManager.backpackItems[4]);
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.adventurerBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "adventurerBackpack");
ForestryItem.adventurerBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "adventurerBackpackT2");
definition = new BackpackDefinition("builder", 0xdd3a3a)
.setValidItems(BackpackManager.backpackItems[5]);
BackpackManager.definitions.put(definition.getKey(), definition);
ForestryItem.builderBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "builderBackpack");
ForestryItem.builderBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "builderBackpackT2");
}
@Override
protected void registerBackpackItems() {
// [0] Set valid items in miner's backpack
minerItems.add(new ItemStack(Blocks.obsidian));
minerItems.add(new ItemStack(Blocks.coal_ore));
minerItems.add(new ItemStack(Items.coal));
minerItems.add(new ItemStack(Blocks.diamond_ore));
minerItems.add(new ItemStack(Items.diamond));
minerItems.add(new ItemStack(Blocks.gold_ore));
minerItems.add(new ItemStack(Items.gold_ingot));
minerItems.add(new ItemStack(Blocks.iron_ore));
minerItems.add(new ItemStack(Items.iron_ingot));
minerItems.add(new ItemStack(Blocks.lapis_ore));
minerItems.add(new ItemStack(Blocks.redstone_ore));
minerItems.add(new ItemStack(Items.redstone));
minerItems.add(new ItemStack(Items.dye, 1, 4));
minerItems.add(new ItemStack(Items.glowstone_dust));
minerItems.add(new ItemStack(Items.emerald));
minerItems.add(new ItemStack(Blocks.diamond_block));
minerItems.add(new ItemStack(Blocks.emerald_block));
minerItems.add(new ItemStack(Blocks.gold_block));
minerItems.add(new ItemStack(Blocks.iron_block));
minerItems.add(new ItemStack(Blocks.lapis_block));
minerItems.add(ForestryItem.bronzePickaxe.getItemStack());
minerItems.add(ForestryItem.kitPickaxe.getItemStack());
minerItems.add(ForestryItem.brokenBronzePickaxe.getItemStack());
minerItems.add(new ItemStack(Items.quartz));
minerItems.add(new ItemStack(Blocks.emerald_ore));
minerItems.add(new ItemStack(Blocks.quartz_ore));
// [1] Set valid items in digger's backpack
diggerItems.add(new ItemStack(Blocks.dirt));
diggerItems.add(new ItemStack(Blocks.cobblestone));
diggerItems.add(new ItemStack(Blocks.sand));
diggerItems.add(new ItemStack(Blocks.sandstone));
diggerItems.add(new ItemStack(Blocks.gravel));
diggerItems.add(new ItemStack(Items.flint));
diggerItems.add(new ItemStack(Blocks.netherrack));
diggerItems.add(new ItemStack(Items.clay_ball));
diggerItems.add(new ItemStack(Blocks.soul_sand));
diggerItems.add(ForestryItem.bronzeShovel.getItemStack());
diggerItems.add(ForestryItem.kitShovel.getItemStack());
diggerItems.add(ForestryItem.brokenBronzeShovel.getItemStack());
// [2] Set valid items in forester's backpack
foresterItems.add(new ItemStack(Blocks.sapling, 1, Defaults.WILDCARD));
foresterItems.add(new ItemStack(Blocks.red_mushroom));
foresterItems.add(new ItemStack(Blocks.brown_mushroom));
foresterItems.add(new ItemStack(Blocks.log, 1, Defaults.WILDCARD));
foresterItems.add(new ItemStack(Items.wheat_seeds));
foresterItems.add(new ItemStack(Blocks.red_flower));
foresterItems.add(new ItemStack(Blocks.yellow_flower));
foresterItems.add(new ItemStack(Blocks.leaves, 1, Defaults.WILDCARD));
foresterItems.add(new ItemStack(Blocks.cactus));
foresterItems.add(new ItemStack(Blocks.tallgrass, 1, Defaults.WILDCARD));
foresterItems.add(new ItemStack(Blocks.vine));
foresterItems.add(new ItemStack(Blocks.pumpkin));
foresterItems.add(new ItemStack(Blocks.melon_block));
foresterItems.add(new ItemStack(Items.apple));
foresterItems.add(new ItemStack(Items.golden_apple));
foresterItems.add(new ItemStack(Items.nether_wart));
foresterItems.add(new ItemStack(Items.pumpkin_seeds));
foresterItems.add(new ItemStack(Items.melon_seeds));
foresterItems.add(new ItemStack(Items.wheat));
foresterItems.add(new ItemStack(ForestryBlock.saplingGE, 1));
// [3] Set valid items in hunter's backpack
hunterItems.add(new ItemStack(Items.feather));
hunterItems.add(new ItemStack(Items.gunpowder));
hunterItems.add(new ItemStack(Items.blaze_powder));
hunterItems.add(new ItemStack(Items.blaze_rod));
hunterItems.add(new ItemStack(Items.bone));
hunterItems.add(new ItemStack(Items.string));
hunterItems.add(new ItemStack(Items.rotten_flesh));
hunterItems.add(new ItemStack(Items.ghast_tear));
hunterItems.add(new ItemStack(Items.gold_nugget));
hunterItems.add(new ItemStack(Items.arrow));
hunterItems.add(new ItemStack(Items.porkchop));
hunterItems.add(new ItemStack(Items.cooked_porkchop));
hunterItems.add(new ItemStack(Items.beef));
hunterItems.add(new ItemStack(Items.cooked_beef));
hunterItems.add(new ItemStack(Items.chicken));
hunterItems.add(new ItemStack(Items.cooked_chicken));
hunterItems.add(new ItemStack(Items.leather));
hunterItems.add(new ItemStack(Items.egg));
hunterItems.add(new ItemStack(Items.ender_pearl));
hunterItems.add(new ItemStack(Items.spider_eye));
hunterItems.add(new ItemStack(Items.fermented_spider_eye));
hunterItems.add(new ItemStack(Items.slime_ball));
hunterItems.add(new ItemStack(Items.dye, 1, 0));
hunterItems.add(new ItemStack(Blocks.hay_block));
hunterItems.add(new ItemStack(Blocks.wool));
hunterItems.add(new ItemStack(Blocks.wool, 1, Defaults.WILDCARD));
hunterItems.add(new ItemStack(Items.ender_eye));
hunterItems.add(new ItemStack(Items.magma_cream));
hunterItems.add(new ItemStack(Items.speckled_melon));
hunterItems.add(new ItemStack(Items.fish));
hunterItems.add(new ItemStack(Items.cooked_fished));
hunterItems.add(new ItemStack(Items.lead));
hunterItems.add(new ItemStack(Items.fishing_rod));
hunterItems.add(new ItemStack(Items.name_tag));
hunterItems.add(new ItemStack(Items.saddle));
hunterItems.add(new ItemStack(Items.diamond_horse_armor));
hunterItems.add(new ItemStack(Items.golden_horse_armor));
hunterItems.add(new ItemStack(Items.iron_horse_armor));
// [4] Set valid items in adventurer's backpack
// [5] Set valid items in builder's backpack
builderItems.add(new ItemStack(Blocks.torch));
builderItems.add(new ItemStack(Blocks.redstone_torch));
builderItems.add(new ItemStack(Blocks.redstone_lamp));
builderItems.add(new ItemStack(ForestryBlock.candle));
builderItems.add(new ItemStack(ForestryBlock.stump));
builderItems.add(new ItemStack(Blocks.stonebrick, 1, Defaults.WILDCARD));
builderItems.add(new ItemStack(Blocks.sandstone, 1, 1));
builderItems.add(new ItemStack(Blocks.sandstone, 1, 2));
builderItems.add(new ItemStack(Blocks.stone));
builderItems.add(new ItemStack(Blocks.brick_block));
builderItems.add(new ItemStack(Blocks.planks, 1, Defaults.WILDCARD));
builderItems.add(new ItemStack(Blocks.hardened_clay, 1, Defaults.WILDCARD));
builderItems.add(new ItemStack(Blocks.nether_brick));
builderItems.add(new ItemStack(Blocks.nether_brick_fence));
builderItems.add(new ItemStack(Blocks.stone_stairs));
builderItems.add(new ItemStack(Blocks.oak_stairs));
builderItems.add(new ItemStack(Blocks.brick_stairs));
builderItems.add(new ItemStack(Blocks.nether_brick_stairs));
builderItems.add(new ItemStack(Blocks.stone_brick_stairs));
builderItems.add(new ItemStack(Blocks.glass));
builderItems.add(new ItemStack(Blocks.glass_pane));
builderItems.add(new ItemStack(Blocks.chest));
builderItems.add(new ItemStack(Blocks.crafting_table));
builderItems.add(new ItemStack(Blocks.furnace));
builderItems.add(new ItemStack(Blocks.lever));
builderItems.add(new ItemStack(Blocks.wooden_button));
builderItems.add(new ItemStack(Blocks.stone_button));
builderItems.add(new ItemStack(Blocks.dispenser));
builderItems.add(new ItemStack(Blocks.dropper));
builderItems.add(new ItemStack(Blocks.ladder));
builderItems.add(new ItemStack(Blocks.fence));
builderItems.add(new ItemStack(Blocks.fence_gate));
builderItems.add(new ItemStack(Blocks.iron_bars));
builderItems.add(new ItemStack(Blocks.stone_slab, 1, Defaults.WILDCARD));
builderItems.add(new ItemStack(Blocks.quartz_block, 1, Defaults.WILDCARD));
builderItems.add(new ItemStack(Blocks.quartz_stairs));
builderItems.add(new ItemStack(Blocks.sandstone_stairs));
builderItems.add(new ItemStack(Blocks.birch_stairs));
builderItems.add(new ItemStack(Blocks.spruce_stairs));
builderItems.add(new ItemStack(Blocks.jungle_stairs));
builderItems.add(new ItemStack(Blocks.cobblestone_wall, 1, Defaults.WILDCARD));
builderItems.add(new ItemStack(Items.iron_door));
builderItems.add(new ItemStack(Items.wooden_door));
builderItems.add(new ItemStack(Items.sign));
builderItems.add(new ItemStack(Items.repeater));
builderItems.add(new ItemStack(Items.comparator));
builderItems.add(new ItemStack(Items.item_frame));
}
@Override
protected void registerRecipes() {
// Apiarist's Backpack
Proxies.common.addRecipe(ForestryItem.apiaristBackpack.getItemStack(),
new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V',
"stickWood", 'Y', new ItemStack(ForestryBlock.apiculture, 1, Defaults.DEFINITION_APIARISTCHEST_META) });
// Lepidopterist's Backpack
Proxies.common.addRecipe(ForestryItem.lepidopteristBackpack.getItemStack(),
new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V',
"stickWood", 'Y', new ItemStack(ForestryBlock.lepidopterology, 1, Defaults.DEFINITION_LEPICHEST_META) });
// Miner's Backpack
Proxies.common.addRecipe(ForestryItem.minerBackpack.getItemStack(),
new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V',
Items.iron_ingot, 'Y', Blocks.chest });
// Digger's Backpack
Proxies.common.addRecipe(ForestryItem.diggerBackpack.getItemStack(),
new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V',
Blocks.stone, 'Y', Blocks.chest });
// Forester's Backpack
Proxies.common.addRecipe(ForestryItem.foresterBackpack.getItemStack(), new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool,
'X', Items.string, 'V', "logWood", 'Y', Blocks.chest });
// Hunter's Backpack
Proxies.common.addRecipe(ForestryItem.hunterBackpack.getItemStack(),
new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V',
Items.feather, 'Y', Blocks.chest });
// Adventurer's Backpack
Proxies.common.addRecipe(ForestryItem.adventurerBackpack.getItemStack(), new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool,
'X', Items.string, 'V', Items.bone, 'Y', Blocks.chest });
// Builder's Backpack
Proxies.common.addRecipe(ForestryItem.builderBackpack.getItemStack(), new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool,
'X', Items.string, 'V', Items.clay_ball, 'Y', Blocks.chest });
// / CARPENTER
// / BACKPACKS T2
RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.minerBackpackT2.getItemStack(),
new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W',
ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.minerBackpack });
RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.diggerBackpackT2.getItemStack(),
new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W',
ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.diggerBackpack });
RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.foresterBackpackT2.getItemStack(),
new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W',
ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.foresterBackpack });
RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.hunterBackpackT2.getItemStack(),
new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W',
ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.hunterBackpack });
RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.adventurerBackpackT2.getItemStack(),
new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W',
ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.adventurerBackpack });
RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.builderBackpackT2.getItemStack(),
new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W',
ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.builderBackpack });
}
@SuppressWarnings("unchecked")
private void createBackpackArrays() {
if (BackpackManager.backpackItems != null)
return;
BackpackManager.backpackItems = new ArrayList[6];
BackpackManager.backpackItems[0] = minerItems;
BackpackManager.backpackItems[1] = diggerItems;
BackpackManager.backpackItems[2] = foresterItems;
BackpackManager.backpackItems[3] = hunterItems;
BackpackManager.backpackItems[4] = adventurerItems;
BackpackManager.backpackItems[5] = builderItems;
}
@Override
protected void registerCrates() {
}
private static void parseBackpackItems(String backpackIdent, String list, IBackpackDefinition target) {
String[] parts = list.split("[;]+");
for (String part : parts) {
if (part.isEmpty())
continue;
String[] ident = part.split("[:]+");
if (ident.length != 2 && ident.length != 3) {
Proxies.log.warning("Failed to add block/item of (" + part + ") to "+backpackIdent+" since it isn't formatted properly. Suitable are <name>, <name>:<meta> or <name>:*, e.g. IC2:blockWall:*.");
continue;
}
String name = ident[0] + ":" + ident[1];
int meta;
if (ident.length == 2) {
meta = 0;
} else {
try {
meta = ident[2].equals("*") ? OreDictionary.WILDCARD_VALUE : NumberFormat.getIntegerInstance().parse(ident[2]).intValue();
} catch (ParseException e) {
Proxies.log.warning("Failed to add block/item of (" + part + ") to "+backpackIdent+" since its metadata isn't formatted properly. Suitable are integer values or *.");
continue;
}
}
Item item = GameData.getItemRegistry().getRaw(name);
if (item == null) {
Block block = GameData.getBlockRegistry().getRaw(name);
if (block == null || Item.getItemFromBlock(block) == null) {
Proxies.log.warning("Failed to add block/item of (" + part + ") to "+backpackIdent+" since it couldn't be found.");
continue;
}
item = Item.getItemFromBlock(block);
}
Proxies.log.finer("Adding block/item of (" + part + ") to "+backpackIdent+".");
target.addValidItem(new ItemStack(item, 1, meta));
}
}
@Override
public ISaveEventHandler getSaveEventHandler() {
return null;
}
@Override
public IOreDictionaryHandler getDictionaryHandler() {
return this;
}
@Override
public void onOreRegistration(String name, ItemStack ore) {
createBackpackArrays();
if (ore == null) {
Proxies.log.warning("An ore/item of type %s was registered with the Forge ore dictionary, however the passed itemstack is null. Someone broke it. :(", name);
return;
}
if (name.startsWith("ingot"))
minerItems.add(ore);
else if (name.startsWith("ore"))
minerItems.add(ore);
else if (name.startsWith("gem"))
minerItems.add(ore);
else if (name.startsWith("dust"))
minerItems.add(ore);
else if (name.startsWith("crystal"))
minerItems.add(ore);
else if (name.matches("dropUranium"))
minerItems.add(ore);
else if (name.equals("treeLeaves") || name.equals("treeSapling") || name.equals("logWood"))
foresterItems.add(ore);
else if (name.equals("stairWood") || name.equals("plankWood") || name.equals("slabWood"))
builderItems.add(ore);
else if (name.startsWith("wood"))
foresterItems.add(ore);
}
}