2014-05-02 21:31:20 +02:00
|
|
|
/*******************************************************************************
|
2014-08-07 08:29:25 +02:00
|
|
|
* 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
|
2014-08-07 02:56:58 -07:00
|
|
|
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
2015-01-26 22:26:21 -08:00
|
|
|
*
|
2014-08-07 08:29:25 +02:00
|
|
|
* Various Contributors including, but not limited to:
|
|
|
|
|
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
2014-05-02 21:31:20 +02:00
|
|
|
******************************************************************************/
|
|
|
|
|
package forestry.plugins;
|
|
|
|
|
|
2015-01-01 19:39:36 -08:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.util.WeightedRandomChestContent;
|
|
|
|
|
|
|
|
|
|
import net.minecraftforge.common.ChestGenHooks;
|
|
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
|
|
|
|
|
2014-09-20 22:43:13 -07:00
|
|
|
import cpw.mods.fml.common.IFuelHandler;
|
2014-05-02 21:31:20 +02:00
|
|
|
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 cpw.mods.fml.common.registry.VillagerRegistry;
|
2015-01-01 19:39:36 -08:00
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
import forestry.api.arboriculture.EnumFruitFamily;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.api.arboriculture.EnumGermlingType;
|
2015-09-27 19:35:46 -07:00
|
|
|
import forestry.api.arboriculture.EnumWoodType;
|
2015-08-01 00:14:16 -07:00
|
|
|
import forestry.api.arboriculture.TreeManager;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.api.core.Tabs;
|
|
|
|
|
import forestry.api.genetics.AlleleManager;
|
|
|
|
|
import forestry.api.recipes.RecipeManagers;
|
2015-01-29 10:40:24 -06:00
|
|
|
import forestry.api.storage.ICrateRegistry;
|
|
|
|
|
import forestry.api.storage.StorageManager;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.arboriculture.FruitProviderNone;
|
|
|
|
|
import forestry.arboriculture.FruitProviderPod;
|
|
|
|
|
import forestry.arboriculture.FruitProviderPod.EnumPodType;
|
|
|
|
|
import forestry.arboriculture.FruitProviderRandom;
|
|
|
|
|
import forestry.arboriculture.FruitProviderRipening;
|
|
|
|
|
import forestry.arboriculture.GuiHandlerArboriculture;
|
|
|
|
|
import forestry.arboriculture.VillageHandlerArboriculture;
|
2015-09-27 19:35:46 -07:00
|
|
|
import forestry.arboriculture.WoodItemAccess;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.arboriculture.blocks.BlockArbFence;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockArbStairs;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockFruitPod;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockLog;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockPlanks;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockSapling;
|
|
|
|
|
import forestry.arboriculture.blocks.BlockSlab;
|
2014-12-13 23:38:36 -08:00
|
|
|
import forestry.arboriculture.commands.CommandTree;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.arboriculture.genetics.GrowthProvider;
|
|
|
|
|
import forestry.arboriculture.genetics.GrowthProviderTropical;
|
2015-08-01 00:14:16 -07:00
|
|
|
import forestry.arboriculture.genetics.TreeBranchDefinition;
|
|
|
|
|
import forestry.arboriculture.genetics.TreeDefinition;
|
|
|
|
|
import forestry.arboriculture.genetics.TreeFactory;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.arboriculture.genetics.TreeHelper;
|
2015-08-01 00:14:16 -07:00
|
|
|
import forestry.arboriculture.genetics.TreeMutationFactory;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.arboriculture.genetics.TreekeepingMode;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.arboriculture.genetics.alleles.AlleleFruit;
|
|
|
|
|
import forestry.arboriculture.genetics.alleles.AlleleGrowth;
|
|
|
|
|
import forestry.arboriculture.genetics.alleles.AlleleLeafEffectNone;
|
|
|
|
|
import forestry.arboriculture.items.ItemBlockLeaves;
|
|
|
|
|
import forestry.arboriculture.items.ItemBlockWood;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.arboriculture.items.ItemGermlingGE;
|
|
|
|
|
import forestry.arboriculture.items.ItemGrafter;
|
|
|
|
|
import forestry.arboriculture.items.ItemTreealyzer;
|
2015-06-13 16:36:46 -07:00
|
|
|
import forestry.arboriculture.network.PacketHandlerArboriculture;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.arboriculture.proxy.ProxyArboriculture;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.arboriculture.tiles.TileArboristChest;
|
|
|
|
|
import forestry.arboriculture.tiles.TileFruitPod;
|
|
|
|
|
import forestry.arboriculture.tiles.TileLeaves;
|
|
|
|
|
import forestry.arboriculture.tiles.TileSapling;
|
|
|
|
|
import forestry.arboriculture.tiles.TileWood;
|
|
|
|
|
import forestry.core.blocks.BlockBase;
|
2015-01-24 00:25:33 -08:00
|
|
|
import forestry.core.config.Config;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.core.config.Constants;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.core.config.ForestryBlock;
|
|
|
|
|
import forestry.core.config.ForestryItem;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.core.config.GameMode;
|
2014-12-13 18:58:49 -08:00
|
|
|
import forestry.core.fluids.Fluids;
|
2015-05-07 22:20:34 -07:00
|
|
|
import forestry.core.genetics.alleles.Allele;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.core.items.ItemBlockForestry;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.core.items.ItemFruit.EnumFruit;
|
2015-05-29 22:25:54 -07:00
|
|
|
import forestry.core.network.IPacketHandler;
|
2014-05-02 21:31:20 +02:00
|
|
|
import forestry.core.proxy.Proxies;
|
2015-09-25 15:06:43 -07:00
|
|
|
import forestry.core.recipes.RecipeUtil;
|
|
|
|
|
import forestry.core.recipes.ShapedRecipeCustom;
|
|
|
|
|
import forestry.core.recipes.ShapelessRecipeCustom;
|
|
|
|
|
import forestry.core.tiles.MachineDefinition;
|
2015-08-01 00:14:16 -07:00
|
|
|
import forestry.factory.recipes.FabricatorRecipe;
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
@Plugin(pluginID = "Arboriculture", name = "Arboriculture", author = "Binnie & SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.arboriculture.description")
|
2014-09-20 22:43:13 -07:00
|
|
|
public class PluginArboriculture extends ForestryPlugin {
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
@SidedProxy(clientSide = "forestry.arboriculture.proxy.ProxyArboricultureClient", serverSide = "forestry.arboriculture.proxy.ProxyArboriculture")
|
2014-05-02 21:31:20 +02:00
|
|
|
public static ProxyArboriculture proxy;
|
|
|
|
|
public static String treekeepingMode = "NORMAL";
|
2015-08-01 00:14:16 -07:00
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
public static int modelIdSaplings;
|
|
|
|
|
public static int modelIdLeaves;
|
|
|
|
|
public static int modelIdPods;
|
2015-08-01 00:14:16 -07:00
|
|
|
|
2015-08-02 01:15:41 -07:00
|
|
|
private static MachineDefinition definitionChest;
|
2014-11-29 22:13:28 -08:00
|
|
|
public static final List<Block> validFences = new ArrayList<Block>();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-04-05 14:16:41 -07:00
|
|
|
@Override
|
|
|
|
|
protected void setupAPI() {
|
|
|
|
|
super.setupAPI();
|
|
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
TreeManager.treeFactory = new TreeFactory();
|
|
|
|
|
TreeManager.treeMutationFactory = new TreeMutationFactory();
|
|
|
|
|
|
2015-09-27 19:35:46 -07:00
|
|
|
TreeManager.woodItemAccess = new WoodItemAccess();
|
|
|
|
|
|
2015-04-05 14:16:41 -07:00
|
|
|
// Init tree interface
|
2015-08-01 00:14:16 -07:00
|
|
|
TreeManager.treeRoot = new TreeHelper();
|
|
|
|
|
AlleleManager.alleleRegistry.registerSpeciesRoot(TreeManager.treeRoot);
|
2015-04-05 14:16:41 -07:00
|
|
|
|
|
|
|
|
// Modes
|
2015-08-01 00:14:16 -07:00
|
|
|
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.easy);
|
|
|
|
|
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.normal);
|
|
|
|
|
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.hard);
|
|
|
|
|
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.hardcore);
|
|
|
|
|
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.insane);
|
2015-04-05 14:16:41 -07:00
|
|
|
}
|
|
|
|
|
|
2014-05-02 21:31:20 +02:00
|
|
|
@Override
|
|
|
|
|
public void preInit() {
|
|
|
|
|
super.preInit();
|
|
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
// Wood blocks
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.logs.registerBlock(new BlockLog(false), ItemBlockWood.class, "logs");
|
2015-08-01 00:14:16 -07:00
|
|
|
OreDictionary.registerOre("logWood", ForestryBlock.logs.getWildcard());
|
2014-08-18 05:20:29 -07:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.planks.registerBlock(new BlockPlanks(false), ItemBlockWood.class, "planks");
|
2015-08-01 00:14:16 -07:00
|
|
|
OreDictionary.registerOre("plankWood", ForestryBlock.planks.getWildcard());
|
2014-08-18 05:20:29 -07:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.slabs.registerBlock(new BlockSlab(false), ItemBlockWood.class, "slabs");
|
2015-08-01 00:14:16 -07:00
|
|
|
OreDictionary.registerOre("slabWood", ForestryBlock.slabs.getWildcard());
|
2014-11-03 00:30:19 -08:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.fences.registerBlock(new BlockArbFence(false), ItemBlockWood.class, "fences");
|
2015-08-01 00:14:16 -07:00
|
|
|
OreDictionary.registerOre("fenceWood", ForestryBlock.fences.getWildcard());
|
2014-11-03 00:30:19 -08:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks.block(), false), ItemBlockWood.class, "stairs");
|
2015-08-01 00:14:16 -07:00
|
|
|
OreDictionary.registerOre("stairWood", ForestryBlock.stairs.getWildcard());
|
2014-08-18 05:20:29 -07:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.logsFireproof.registerBlock(new BlockLog(true), ItemBlockWood.class, "logsFireproof");
|
|
|
|
|
ForestryBlock.planksFireproof.registerBlock(new BlockPlanks(true), ItemBlockWood.class, "planksFireproof");
|
|
|
|
|
ForestryBlock.slabsFireproof.registerBlock(new BlockSlab(true), ItemBlockWood.class, "slabsFireproof");
|
|
|
|
|
ForestryBlock.fencesFireproof.registerBlock(new BlockArbFence(true), ItemBlockWood.class, "fencesFireproof");
|
|
|
|
|
ForestryBlock.stairsFireproof.registerBlock(new BlockArbStairs(ForestryBlock.planksFireproof.block(), true), ItemBlockWood.class, "stairsFireproof");
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-09-27 19:35:46 -07:00
|
|
|
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
|
|
|
|
WoodItemAccess.registerLog(ForestryBlock.logs.block(), woodType, false);
|
|
|
|
|
WoodItemAccess.registerPlanks(ForestryBlock.planks.block(), woodType, false);
|
|
|
|
|
WoodItemAccess.registerSlab(ForestryBlock.slabs.block(), woodType, false);
|
|
|
|
|
WoodItemAccess.registerFence(ForestryBlock.fences.block(), woodType, false);
|
|
|
|
|
WoodItemAccess.registerStairs(ForestryBlock.stairs.block(), woodType, false);
|
|
|
|
|
|
|
|
|
|
WoodItemAccess.registerLog(ForestryBlock.logsFireproof.block(), woodType, true);
|
|
|
|
|
WoodItemAccess.registerPlanks(ForestryBlock.planksFireproof.block(), woodType, true);
|
|
|
|
|
WoodItemAccess.registerSlab(ForestryBlock.slabsFireproof.block(), woodType, true);
|
|
|
|
|
WoodItemAccess.registerFence(ForestryBlock.fencesFireproof.block(), woodType, true);
|
|
|
|
|
WoodItemAccess.registerStairs(ForestryBlock.stairsFireproof.block(), woodType, true);
|
2014-08-18 05:20:29 -07:00
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Saplings
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.saplingGE.registerBlock(new BlockSapling(), ItemBlockForestry.class, "saplingGE");
|
2015-06-17 01:01:29 -07:00
|
|
|
OreDictionary.registerOre("treeSapling", ForestryBlock.saplingGE.getWildcard());
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Leaves
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.leaves.registerBlock(new BlockForestryLeaves(), ItemBlockLeaves.class, "leaves");
|
2014-11-20 19:10:10 -08:00
|
|
|
OreDictionary.registerOre("treeLeaves", ForestryBlock.leaves.getWildcard());
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Pods
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.pods.registerBlock(new BlockFruitPod(), ItemBlockForestry.class, "pods");
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Machines
|
2015-09-25 15:06:43 -07:00
|
|
|
ForestryBlock.arboriculture.registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "arboriculture");
|
2014-08-18 05:20:29 -07:00
|
|
|
ForestryBlock.arboriculture.block().setCreativeTab(Tabs.tabArboriculture);
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
definitionChest = ((BlockBase) ForestryBlock.arboriculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_ARBCHEST_META,
|
2015-09-25 15:30:25 -07:00
|
|
|
"forestry.ArbChest", TileArboristChest.class, Proxies.render.getRenderChest("arbchest"),
|
2015-09-25 15:06:43 -07:00
|
|
|
ShapedRecipeCustom.createShapedRecipe(ForestryBlock.arboriculture.getItemStack(1, Constants.DEFINITION_ARBCHEST_META),
|
2014-08-18 05:20:29 -07:00
|
|
|
" # ",
|
|
|
|
|
"XYX",
|
|
|
|
|
"XXX",
|
2015-08-21 01:45:09 -05:00
|
|
|
'#', "blockGlass",
|
2014-08-18 05:20:29 -07:00
|
|
|
'X', "treeSapling",
|
2015-08-21 02:01:41 -05:00
|
|
|
'Y', "chestWood"))
|
2015-08-26 01:17:42 +01:00
|
|
|
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F));
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Init rendering
|
|
|
|
|
proxy.initializeRendering();
|
|
|
|
|
|
|
|
|
|
// Register vanilla and forestry fence ids
|
2015-08-01 00:14:16 -07:00
|
|
|
validFences.add(ForestryBlock.fences.block());
|
|
|
|
|
validFences.add(ForestryBlock.fencesFireproof.block());
|
2014-05-02 21:31:20 +02:00
|
|
|
validFences.add(Blocks.fence);
|
|
|
|
|
validFences.add(Blocks.fence_gate);
|
|
|
|
|
validFences.add(Blocks.nether_brick_fence);
|
|
|
|
|
|
2014-12-13 21:29:55 -08:00
|
|
|
// Commands
|
2014-12-13 23:38:36 -08:00
|
|
|
PluginCore.rootCommand.addChildCommand(new CommandTree());
|
2015-05-07 22:20:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void doInit() {
|
|
|
|
|
super.doInit();
|
2015-04-05 14:16:41 -07:00
|
|
|
|
|
|
|
|
// Create alleles
|
|
|
|
|
createAlleles();
|
2015-08-01 00:14:16 -07:00
|
|
|
TreeDefinition.initTrees();
|
2015-04-05 14:16:41 -07:00
|
|
|
registerErsatzGenomes();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
GameRegistry.registerTileEntity(TileSapling.class, "forestry.Sapling");
|
|
|
|
|
GameRegistry.registerTileEntity(TileLeaves.class, "forestry.Leaves");
|
2015-08-01 00:14:16 -07:00
|
|
|
GameRegistry.registerTileEntity(TileWood.class, "forestry.Wood");
|
2014-05-02 21:31:20 +02:00
|
|
|
GameRegistry.registerTileEntity(TileFruitPod.class, "forestry.Pods");
|
|
|
|
|
definitionChest.register();
|
|
|
|
|
|
2015-06-21 22:34:42 -07:00
|
|
|
if (Config.enableVillagers) {
|
2015-09-25 15:06:43 -07:00
|
|
|
VillagerRegistry.instance().registerVillagerId(Constants.ID_VILLAGER_LUMBERJACK);
|
|
|
|
|
Proxies.render.registerVillagerSkin(Constants.ID_VILLAGER_LUMBERJACK, Constants.TEXTURE_SKIN_LUMBERJACK);
|
|
|
|
|
VillagerRegistry.instance().registerVillageTradeHandler(Constants.ID_VILLAGER_LUMBERJACK, new VillageHandlerArboriculture());
|
2015-01-24 00:25:33 -08:00
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void postInit() {
|
|
|
|
|
super.postInit();
|
|
|
|
|
registerDungeonLoot();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerItems() {
|
|
|
|
|
|
|
|
|
|
ForestryItem.sapling.registerItem(new ItemGermlingGE(EnumGermlingType.SAPLING), "sapling");
|
2014-11-20 19:10:10 -08:00
|
|
|
OreDictionary.registerOre("treeSapling", ForestryItem.sapling.getWildcard());
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2014-10-01 22:28:21 -07:00
|
|
|
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
|
|
|
|
ForestryItem.pollenFertile.registerItem(new ItemGermlingGE(EnumGermlingType.POLLEN), "pollenFertile");
|
|
|
|
|
ForestryItem.treealyzer.registerItem(new ItemTreealyzer(), "treealyzer");
|
|
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
ForestryItem.grafter.registerItem(new ItemGrafter(4), "grafter");
|
|
|
|
|
ForestryItem.grafterProven.registerItem(new ItemGrafter(149), "grafterProven");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerCrates() {
|
2015-02-18 00:03:56 -08:00
|
|
|
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.CHERRY.getStack(), "cratedCherry");
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.WALNUT.getStack(), "cratedWalnut");
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.CHESTNUT.getStack(), "cratedChestnut");
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.LEMON.getStack(), "cratedLemon");
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.PLUM.getStack(), "cratedPlum");
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.PAPAYA.getStack(), "cratedPapaya");
|
|
|
|
|
crateRegistry.registerCrate(EnumFruit.DATES.getStack(), "cratedDates");
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void registerRecipes() {
|
|
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
Proxies.common.addSmelting(ForestryBlock.logs.getWildcard(), new ItemStack(Items.coal, 1, 1), 0.15F);
|
2014-09-21 16:41:26 -07:00
|
|
|
|
2015-08-20 00:44:20 -07:00
|
|
|
ShapelessRecipeCustom.buildRecipe(ForestryBlock.planks.getItemStack(4), ForestryBlock.logs.getWildcard()).setPreserveNBT();
|
|
|
|
|
ShapelessRecipeCustom.buildRecipe(ForestryBlock.planksFireproof.getItemStack(4), ForestryBlock.logsFireproof.getWildcard()).setPreserveNBT();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2014-11-03 00:30:19 -08:00
|
|
|
// Fabricator recipes
|
|
|
|
|
if (PluginManager.Module.FACTORY.isEnabled() && PluginManager.Module.APICULTURE.isEnabled()) {
|
|
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
// Fireproof log recipe
|
|
|
|
|
RecipeManagers.fabricatorManager.addRecipe(new FabricatorRecipe(null, Fluids.GLASS.getFluid(500), ForestryBlock.logsFireproof.getItemStack(), new Object[]{
|
|
|
|
|
" # ",
|
|
|
|
|
"#X#",
|
|
|
|
|
" # ",
|
|
|
|
|
'#', ForestryItem.refractoryWax,
|
2015-08-20 00:44:20 -07:00
|
|
|
'X', ForestryBlock.logs.getWildcard()}).setPreserveNBT());
|
2014-11-03 00:30:19 -08:00
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
// Fireproof plank recipe
|
|
|
|
|
RecipeManagers.fabricatorManager.addRecipe(new FabricatorRecipe(null, Fluids.GLASS.getFluid(500), ForestryBlock.planksFireproof.getItemStack(5), new Object[]{
|
|
|
|
|
"X#X",
|
|
|
|
|
"#X#",
|
|
|
|
|
"X#X",
|
|
|
|
|
'#', ForestryItem.refractoryWax,
|
2015-08-20 00:44:20 -07:00
|
|
|
'X', ForestryBlock.planks.getWildcard()}).setPreserveNBT());
|
2014-11-03 00:30:19 -08:00
|
|
|
}
|
|
|
|
|
|
2015-08-20 00:44:20 -07:00
|
|
|
ShapedRecipeCustom.buildPriorityRecipe(ForestryBlock.slabs.getItemStack(6), "###", '#', ForestryBlock.planks.getWildcard()).setPreserveNBT();
|
|
|
|
|
ShapedRecipeCustom.buildPriorityRecipe(ForestryBlock.slabsFireproof.getItemStack(6), "###", '#', ForestryBlock.planksFireproof.getWildcard()).setPreserveNBT();
|
2014-11-03 00:30:19 -08:00
|
|
|
|
2015-08-20 00:44:20 -07:00
|
|
|
ShapedRecipeCustom.buildRecipe(ForestryBlock.fences.getItemStack(3), "#X#", "#X#", '#', ForestryBlock.planks.getWildcard(), 'X', "stickWood").setPreserveNBT();
|
|
|
|
|
ShapedRecipeCustom.buildRecipe(ForestryBlock.fencesFireproof.getItemStack(3), "#X#", "#X#", '#', ForestryBlock.planksFireproof.getWildcard(), 'X', "stickWood").setPreserveNBT();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-01-07 07:07:45 -08:00
|
|
|
if (PluginManager.Module.FACTORY.isEnabled()) {
|
|
|
|
|
// Treealyzer
|
|
|
|
|
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, ForestryItem.treealyzer.getItemStack(), "X#X", "X#X", "RDR",
|
2015-08-21 01:45:09 -05:00
|
|
|
'#', "paneGlass",
|
2015-01-07 07:07:45 -08:00
|
|
|
'X', "ingotCopper",
|
2015-08-21 01:45:09 -05:00
|
|
|
'R', "dustRedstone",
|
|
|
|
|
'D', "gemDiamond");
|
2015-01-07 07:07:45 -08:00
|
|
|
|
|
|
|
|
// SQUEEZER RECIPES
|
|
|
|
|
int seedOilMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
|
|
|
|
|
int juiceMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple");
|
|
|
|
|
int mulchMultiplier = GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple");
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{EnumFruit.CHERRY.getStack()}, Fluids.SEEDOIL.getFluid(5 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 5);
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(60, new ItemStack[]{EnumFruit.WALNUT.getStack()}, Fluids.SEEDOIL.getFluid(18 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 5);
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(70, new ItemStack[]{EnumFruit.CHESTNUT.getStack()}, Fluids.SEEDOIL.getFluid(22 * seedOilMultiplier), ForestryItem.mulch.getItemStack(), 2);
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.LEMON.getStack()}, Fluids.JUICE.getFluid(juiceMultiplier * 2), ForestryItem.mulch.getItemStack(), (int) Math.floor(mulchMultiplier * 0.5f));
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.PLUM.getStack()}, Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.5f)), ForestryItem.mulch.getItemStack(), mulchMultiplier * 3);
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.PAPAYA.getStack()}, Fluids.JUICE.getFluid(juiceMultiplier * 3), ForestryItem.mulch.getItemStack(), (int) Math.floor(mulchMultiplier * 0.5f));
|
|
|
|
|
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{EnumFruit.DATES.getStack()}, Fluids.JUICE.getFluid((int) Math.floor(juiceMultiplier * 0.25)), ForestryItem.mulch.getItemStack(), mulchMultiplier);
|
|
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
RecipeUtil.addFermenterRecipes(ForestryItem.sapling.getItemStack(), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
|
2015-01-07 07:07:45 -08:00
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Stairs
|
2015-08-01 00:14:16 -07:00
|
|
|
ShapedRecipeCustom.buildPriorityRecipe(ForestryBlock.stairs.getItemStack(4),
|
|
|
|
|
"# ",
|
|
|
|
|
"## ",
|
|
|
|
|
"###",
|
2015-08-20 00:44:20 -07:00
|
|
|
'#', ForestryBlock.planks.getWildcard()).setPreserveNBT();
|
2015-08-01 00:14:16 -07:00
|
|
|
|
|
|
|
|
ShapedRecipeCustom.buildPriorityRecipe(ForestryBlock.stairsFireproof.getItemStack(4),
|
|
|
|
|
"# ",
|
|
|
|
|
"## ",
|
|
|
|
|
"###",
|
2015-08-20 00:44:20 -07:00
|
|
|
'#', ForestryBlock.planksFireproof.getWildcard()).setPreserveNBT();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// Grafter
|
2015-08-01 00:14:16 -07:00
|
|
|
Proxies.common.addRecipe(ForestryItem.grafter.getItemStack(),
|
|
|
|
|
" B",
|
|
|
|
|
" # ",
|
|
|
|
|
"# ",
|
|
|
|
|
'B', "ingotBronze",
|
|
|
|
|
'#', "stickWood");
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
2015-04-05 14:16:41 -07:00
|
|
|
private static void createAlleles() {
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
TreeBranchDefinition.createAlleles();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// FRUITS
|
2015-05-07 22:20:34 -07:00
|
|
|
Allele.fruitNone = new AlleleFruit("none", new FruitProviderNone("none", null));
|
2015-08-01 00:14:16 -07:00
|
|
|
Allele.fruitApple = new AlleleFruit("apple", new FruitProviderRandom("apple", EnumFruitFamily.POMES, new ItemStack(Items.apple), 1.0f).setColour(0xff2e2e).setOverlay("pomes"));
|
|
|
|
|
Allele.fruitCocoa = new AlleleFruit("cocoa", new FruitProviderPod("cocoa", EnumFruitFamily.JUNGLE, EnumPodType.COCOA));
|
2014-05-02 21:31:20 +02:00
|
|
|
// .setColours(0xecdca5, 0xc4d24a), true);
|
2015-08-01 00:14:16 -07:00
|
|
|
Allele.fruitChestnut = new AlleleFruit("chestnut", new FruitProviderRipening("chestnut", EnumFruitFamily.NUX, EnumFruit.CHESTNUT.getStack(), 1.0f).setRipeningPeriod(6).setColours(0x7f333d, 0xc4d24a).setOverlay("nuts"), true);
|
|
|
|
|
Allele.fruitWalnut = new AlleleFruit("walnut", new FruitProviderRipening("walnut", EnumFruitFamily.NUX, EnumFruit.WALNUT.getStack(), 1.0f).setRipeningPeriod(8).setColours(0xfba248, 0xc4d24a).setOverlay("nuts"), true);
|
|
|
|
|
Allele.fruitCherry = new AlleleFruit("cherry", new FruitProviderRipening("cherry", EnumFruitFamily.PRUNES, EnumFruit.CHERRY.getStack(), 1.0f).setColours(0xff2e2e, 0xc4d24a).setOverlay("berries"), true);
|
|
|
|
|
Allele.fruitDates = new AlleleFruit("dates", new FruitProviderPod("dates", EnumFruitFamily.JUNGLE, EnumPodType.DATES, EnumFruit.DATES.getStack(4)));
|
|
|
|
|
Allele.fruitPapaya = new AlleleFruit("papaya", new FruitProviderPod("papaya", EnumFruitFamily.JUNGLE, EnumPodType.PAPAYA, EnumFruit.PAPAYA.getStack()));
|
2014-05-02 21:31:20 +02:00
|
|
|
// Allele.fruitCoconut = new AlleleFruit("fruitCoconut", new
|
|
|
|
|
// FruitProviderPod("coconut", jungle, EnumPodType.COCONUT, new
|
|
|
|
|
// ItemStack[] { new ItemStack(
|
|
|
|
|
// ForestryItem.fruits, 1, EnumFruit.COCONUT.ordinal()) }));
|
2015-08-01 00:14:16 -07:00
|
|
|
Allele.fruitLemon = new AlleleFruit("lemon", new FruitProviderRipening("lemon", EnumFruitFamily.PRUNES, EnumFruit.LEMON.getStack(), 1.0f).setColours(0xeeee00, 0x99ff00).setOverlay("citrus"), true);
|
|
|
|
|
Allele.fruitPlum = new AlleleFruit("plum", new FruitProviderRipening("plum", EnumFruitFamily.PRUNES, EnumFruit.PLUM.getStack(), 1.0f).setColours(0x663446, 0xeeff1a).setOverlay("plums"), true);
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// / TREES // GROWTH PROVIDER 1350 - 1399
|
2015-05-07 22:20:34 -07:00
|
|
|
Allele.growthLightlevel = new AlleleGrowth("lightlevel", new GrowthProvider());
|
|
|
|
|
Allele.growthAcacia = new AlleleGrowth("acacia", new GrowthProvider());
|
|
|
|
|
Allele.growthTropical = new AlleleGrowth("tropical", new GrowthProviderTropical());
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
// / TREES // EFFECTS 1900 - 1999
|
2015-05-07 22:20:34 -07:00
|
|
|
Allele.leavesNone = new AlleleLeafEffectNone();
|
2014-05-02 21:31:20 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-05 14:16:41 -07:00
|
|
|
private static void registerErsatzGenomes() {
|
2015-08-01 00:14:16 -07:00
|
|
|
AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 0), TreeDefinition.Oak.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 1), TreeDefinition.Spruce.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 2), TreeDefinition.Birch.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 3), TreeDefinition.Jungle.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves2, 1, 0), TreeDefinition.Acacia.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves2, 1, 1), TreeDefinition.DarkOak.getIndividual());
|
|
|
|
|
|
|
|
|
|
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 0), TreeDefinition.Oak.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 1), TreeDefinition.Spruce.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 2), TreeDefinition.Birch.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 3), TreeDefinition.Jungle.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 4), TreeDefinition.Acacia.getIndividual());
|
|
|
|
|
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 5), TreeDefinition.DarkOak.getIndividual());
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IGuiHandler getGuiHandler() {
|
|
|
|
|
return new GuiHandlerArboriculture();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-09-20 22:43:13 -07:00
|
|
|
public IFuelHandler getFuelHandler() {
|
2015-04-05 14:16:41 -07:00
|
|
|
return new FuelHandler();
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPacketHandler getPacketHandler() {
|
|
|
|
|
return new PacketHandlerArboriculture();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean processIMCMessage(IMCMessage message) {
|
|
|
|
|
if (message.key.equals("add-fence-block") && message.isStringMessage()) {
|
2014-07-12 07:55:59 +02:00
|
|
|
Block block = GameData.getBlockRegistry().getRaw(message.getStringValue());
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-06-13 16:36:46 -07:00
|
|
|
if (block != null && block != Blocks.air) {
|
2014-05-02 21:31:20 +02:00
|
|
|
validFences.add(block);
|
2015-06-13 16:36:46 -07:00
|
|
|
} else {
|
|
|
|
|
logInvalidIMCMessage(message);
|
2015-01-26 22:26:21 -08:00
|
|
|
}
|
2015-06-13 16:36:46 -07:00
|
|
|
return true;
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
return super.processIMCMessage(message);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-05 14:16:41 -07:00
|
|
|
private static void registerDungeonLoot() {
|
2015-09-25 15:06:43 -07:00
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(ForestryItem.grafter.getItemStack(), 1, 1, 8));
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2015-09-25 15:06:43 -07:00
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Oak.getMemberStack(EnumGermlingType.SAPLING), 2, 3, 6));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Spruce.getMemberStack(EnumGermlingType.SAPLING), 2, 3, 6));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Birch.getMemberStack(EnumGermlingType.SAPLING), 2, 3, 6));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Larch.getMemberStack(EnumGermlingType.SAPLING), 1, 2, 4));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Lime.getMemberStack(EnumGermlingType.SAPLING), 1, 2, 4));
|
2014-05-02 21:31:20 +02:00
|
|
|
|
2014-10-01 22:28:21 -07:00
|
|
|
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
2015-09-25 15:06:43 -07:00
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Oak.getMemberStack(EnumGermlingType.POLLEN), 2, 3, 4));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Spruce.getMemberStack(EnumGermlingType.POLLEN), 2, 3, 4));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Birch.getMemberStack(EnumGermlingType.POLLEN), 2, 3, 4));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Larch.getMemberStack(EnumGermlingType.POLLEN), 1, 2, 3));
|
|
|
|
|
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Lime.getMemberStack(EnumGermlingType.POLLEN), 1, 2, 3));
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
2015-04-05 14:16:41 -07:00
|
|
|
|
|
|
|
|
private static class FuelHandler implements IFuelHandler {
|
|
|
|
|
@Override
|
|
|
|
|
public int getBurnTime(ItemStack fuel) {
|
|
|
|
|
if (ForestryItem.sapling.isItemEqual(fuel)) {
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-01 00:14:16 -07:00
|
|
|
if (ForestryBlock.slabs.isItemEqual(fuel)) {
|
|
|
|
|
return 150;
|
2015-04-05 14:16:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-02 21:31:20 +02:00
|
|
|
}
|