mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 11:49:14 +00:00
Growthcraft Plugin
Orchard support for rice, grape, hops Forester Backpack plant support Squeezer/fermenter Centrifuging GC beecombs
This commit is contained in:
1 parent
767c92a66a
commit
bcd97662b2
6 files changed
+295
-1
No files matched your search
@@ -0,0 +1,70 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.vect.Vect;
|
||||
|
||||
public class CropBasicGrowthCraft extends Crop {
|
||||
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
private final boolean isRice;
|
||||
private final boolean isGrape;
|
||||
|
||||
public CropBasicGrowthCraft(World world, Block block, int meta, Vect position, boolean isRice, boolean isGrape) {
|
||||
super(world, position);
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.isRice = isRice;
|
||||
this.isGrape = isGrape;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCrop(Vect pos) {
|
||||
return getBlock(pos) == block && getBlockMeta(pos) == meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<ItemStack> harvestBlock(Vect pos) {
|
||||
ArrayList<ItemStack> harvest = block.getDrops(world, pos.x, pos.y, pos.z, meta, 0);
|
||||
if (harvest.size() > 1) {
|
||||
harvest.remove(0); //Hops have rope as first drop.
|
||||
}
|
||||
Proxies.common.addBlockDestroyEffects(world, pos.x, pos.y, pos.z, Blocks.melon_block, 0);
|
||||
if (isGrape) {
|
||||
world.setBlockToAir(pos.x, pos.y, pos.z);
|
||||
|
||||
} else {
|
||||
world.setBlockMetadataWithNotify(pos.x, pos.y, pos.z, 0, Defaults.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
if (isRice) {
|
||||
world.setBlockMetadataWithNotify(pos.x, pos.y - 1, pos.z, 7, Defaults.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
return harvest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("CropBasicGrowthCraft [ position: [ %s ]; block: %s; meta: %s ]", position.toString(), block.getUnlocalizedName(), meta);
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -54,6 +55,12 @@ public class FarmLogicOrchard extends FarmLogic {
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
|
||||
traversalBlocksBuilder.add(Blocks.farmland);
|
||||
}
|
||||
if (PluginManager.Module.GROWTHCRAFT.isEnabled()) {
|
||||
Block grapeVine = GameRegistry.findBlock("Growthcraft|Grapes", "grc.grapeVine1");
|
||||
if (grapeVine != null) {
|
||||
traversalBlocksBuilder.add(grapeVine);
|
||||
}
|
||||
}
|
||||
if (PluginManager.Module.PLANTMEGAPACK.isEnabled()) {
|
||||
traversalBlocksBuilder.add(Blocks.water);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.vect.Vect;
|
||||
|
||||
public class FarmableBasicGrowthCraft implements IFarmable {
|
||||
|
||||
private final Block block;
|
||||
private final int matureMeta;
|
||||
private final boolean isRice;
|
||||
private final boolean isGrape;
|
||||
|
||||
public FarmableBasicGrowthCraft(Block block, int matureMeta,boolean isRice, boolean isGrape) {
|
||||
this.block = block;
|
||||
this.matureMeta = matureMeta;
|
||||
this.isRice = isRice;
|
||||
this.isGrape = isGrape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICrop getCropAt(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z) != block) {
|
||||
return null;
|
||||
}
|
||||
if (world.getBlockMetadata(x, y, z) != matureMeta) {
|
||||
return null;
|
||||
}
|
||||
return new CropBasicGrowthCraft(world, block, matureMeta, new Vect(x, y, z), isRice, isGrape);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
return StackUtils.equals(block, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
return world.setBlock(x, y, z, block, 0, Defaults.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindfall(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*******************************************************************************
|
||||
* 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 com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.RecipeUtil;
|
||||
import forestry.factory.gadgets.MachineFabricator;
|
||||
import forestry.farming.logic.FarmableBasicFruit;
|
||||
import forestry.farming.logic.FarmableBasicGrowthCraft;
|
||||
import forestry.farming.logic.FarmableGenericCrop;
|
||||
import forestry.farming.logic.FarmableGenericSapling;
|
||||
|
||||
@Plugin(pluginID = "Growthcraft", name = "Growthcraft", author = "Nirek", url = Defaults.URL, unlocalizedDescription = "for.plugin.growthcraft.description")
|
||||
public class PluginGrowthCraft extends ForestryPlugin {
|
||||
|
||||
private static final String GC = "Growthcraft";
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Proxies.common.isModLoaded(GC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailMessage() {
|
||||
return "GrowthCraft not found";
|
||||
}
|
||||
|
||||
protected void registerRecipes() {
|
||||
|
||||
int saplingYield = GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling");
|
||||
int juiceAmount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple");
|
||||
int seedamount = GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed");
|
||||
|
||||
ItemStack appleSeed = GameRegistry.findItemStack("Growthcraft|Apples", "grc.appleSeeds", 1);
|
||||
ItemStack grapeSeed = GameRegistry.findItemStack("Growthcraft|Grapes", "grc.grapeSeeds", 1);
|
||||
ItemStack hopSeed = GameRegistry.findItemStack("Growthcraft|Hops", "grc.hopSeeds", 1);
|
||||
ItemStack riceSeed = GameRegistry.findItemStack("Growthcraft|Rice", "grc.rice", 1);
|
||||
|
||||
if ( appleSeed != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{appleSeed}, Fluids.SEEDOIL.getFluid(seedamount));
|
||||
BackpackManager.backpackItems[2].add(appleSeed);
|
||||
}
|
||||
if (grapeSeed != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{grapeSeed}, Fluids.SEEDOIL.getFluid(seedamount));
|
||||
BackpackManager.backpackItems[2].add(grapeSeed);
|
||||
}
|
||||
if (hopSeed != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{hopSeed}, Fluids.SEEDOIL.getFluid(seedamount));
|
||||
BackpackManager.backpackItems[2].add(hopSeed);
|
||||
}
|
||||
if (riceSeed != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{riceSeed}, Fluids.SEEDOIL.getFluid(seedamount));
|
||||
BackpackManager.backpackItems[2].add(riceSeed);
|
||||
}
|
||||
|
||||
ItemStack hops = GameRegistry.findItemStack("Growthcraft|Hops","grc.hops", 1);
|
||||
|
||||
if (hops != null) {
|
||||
RecipeUtil.injectLeveledRecipe(hops, saplingYield, Fluids.BIOMASS);
|
||||
BackpackManager.backpackItems[2].add(hops);
|
||||
|
||||
}
|
||||
Block hopVine = GameRegistry.findBlock("Growthcraft|Hops", "grc.hopVine");
|
||||
if (hopVine != null) {
|
||||
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(hopVine, 3, false, false)); // need custom fruit to weed out rope
|
||||
}
|
||||
Block riceBlock = GameRegistry.findBlock("Growthcraft|Rice", "grc.riceBlock");
|
||||
if (riceBlock != null) {
|
||||
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(riceBlock, 7, true,false)); //need to set paddyfield to 7
|
||||
}
|
||||
|
||||
ItemStack emptyComb = new ItemStack(GameRegistry.findItem("Growthcraft|Bees", "grc.honeyComb"), 1, 0);
|
||||
ItemStack fullComb = new ItemStack(GameRegistry.findItem("Growthcraft|Bees", "grc.honeyComb"), 1, 1);
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, emptyComb, ImmutableMap.of(
|
||||
ForestryItem.beeswax.getItemStack(), 1.0f)
|
||||
);
|
||||
RecipeManagers.centrifugeManager.addRecipe(20, fullComb, ImmutableMap.of(
|
||||
ForestryItem.beeswax.getItemStack(), 1.0f,
|
||||
ForestryItem.honeyDrop.getItemStack(), 0.9f,
|
||||
ForestryItem.honeydew.getItemStack(), 0.1f)
|
||||
);
|
||||
|
||||
ItemStack bamboo = GameRegistry.findItemStack("Growthcraft|Bamboo", "grc.bamboo", 1);
|
||||
ItemStack bambooShoot = GameRegistry.findItemStack("Growthcraft|Bamboo", "grc.bambooShoot", 1);
|
||||
ItemStack bambooShootFood = GameRegistry.findItemStack("Growthcraft|Bamboo", "grc.bambooShootFood", 1);
|
||||
if (bamboo != null) {
|
||||
RecipeUtil.injectLeveledRecipe(bamboo, saplingYield, Fluids.BIOMASS);
|
||||
BackpackManager.backpackItems[2].add(bamboo);
|
||||
}
|
||||
if (bambooShoot != null) {
|
||||
RecipeUtil.injectLeveledRecipe(bambooShoot, saplingYield, Fluids.BIOMASS);
|
||||
BackpackManager.backpackItems[2].add(bambooShoot);
|
||||
}
|
||||
if (bambooShootFood != null) {
|
||||
RecipeUtil.injectLeveledRecipe(bambooShootFood, saplingYield, Fluids.BIOMASS);
|
||||
BackpackManager.backpackItems[2].add(bambooShootFood);
|
||||
}
|
||||
|
||||
ItemStack grapes = GameRegistry.findItemStack("Growthcraft|Grapes","grc.grapes",1); //squeeze
|
||||
|
||||
if (grapes != null) {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{grapes}, Fluids.JUICE.getFluid(juiceAmount));
|
||||
}
|
||||
Block grapeBlock = GameRegistry.findBlock("Growthcraft|Grapes","grc.grapeBlock");
|
||||
if (grapeBlock != null) {
|
||||
Farmables.farmables.get("farmOrchard").add(new FarmableBasicGrowthCraft(grapeBlock, 0,false,true));
|
||||
}
|
||||
|
||||
ItemStack bambooLeaves = GameRegistry.findItemStack("Growthcraft|Bamboo","grc.bambooLeaves",1);
|
||||
if (bambooLeaves != null) {
|
||||
BackpackManager.backpackItems[2].add(bambooLeaves);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,7 @@ public class PluginManager {
|
||||
CHISEL(new PluginChisel()),
|
||||
ENDERIO(new PluginEnderIO()),
|
||||
EXTRAUTILITIES(new PluginExtraUtilities()),
|
||||
GROWTHCRAFT(new PluginGrowthCraft()),
|
||||
HARVESTCRAFT(new PluginHarvestCraft()),
|
||||
IMMERSIVEENGINEERING(new PluginImmersiveEngineering()),
|
||||
INDUSTRIALCRAFT(new PluginIC2()),
|
||||
|
||||
Reference in new issue
Block a user