Merge branch 'Greenhouse' of https://github.com/ForestryMC/ForestryMC into mc-1.12

This commit is contained in:
Nedelosk committed 2017-08-14 19:50:34 +02:00
commit 26bf69effc
413 files changed
+13569 -7506

No files matched your search

@@ -28,4 +28,8 @@ public class ForestryPluginUids {
public static final String ACT_ADD = "forestry.actuallyadditions";
public static final String HARVESTCRAFT = "forestry.harvestcraft";
public static final String IMMERSIVE_ENGINEERING = "forestry.immersiveengineering";
public static final String MAGICAL_AGRICULTURE = "forestry.mysticalagriculture";
public static final String RUSTIC = "forestry.rustic";
public static final String ROOTS = "forestry.roots";
public static final String BETTER_WITH_MODS = "forestry.betterwithmods";
}
@@ -0,0 +1,82 @@
package forestry.plugins.compat;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.plugins.BlankForestryPlugin;
public abstract class CompatPlugin extends BlankForestryPlugin {
protected final String modName;
protected final String modID;
public CompatPlugin(String modName, String modID) {
this.modName = modName;
this.modID = modID;
}
@Override
public final boolean isAvailable() {
return ModUtil.isModLoaded(modID);
}
@Override
public final String getFailMessage() {
return modName + " not found";
}
@Nullable
protected ItemStack getItemStack(@Nonnull String itemName) {
return getItemStack(itemName, 0);
}
@Nullable
protected ItemStack getItemStack(@Nonnull String itemName, int meta) {
Item item = getItem(itemName);
if (item == null) {
return null;
}
return new ItemStack(item, 1, meta);
}
@Nullable
protected Block getBlock(@Nonnull String blockName) {
ResourceLocation key = new ResourceLocation(modID, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
}
Log.error("Could not find block {}", key);
return null;
}
@Nullable
protected Item getItem(String itemName) {
ResourceLocation key = new ResourceLocation(modID, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return ForgeRegistries.ITEMS.getValue(key);
}
Log.error("Could not find item {}", key);
return null;
}
@Nullable
protected Fluid getFluid(String fluidName) {
Fluid fluid = FluidRegistry.getFluid(fluidName);
if (fluid == null) {
Log.error("Could not find fluid {}", fluidName);
}
return fluid;
}
}
@@ -3,39 +3,28 @@ package forestry.plugins.compat;
import javax.annotation.Nullable;
import java.util.Arrays;
import forestry.api.core.ForestryAPI;
import forestry.api.recipes.RecipeManagers;
import forestry.core.fluids.Fluids;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.farming.FarmRegistry;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import forestry.api.core.ForestryAPI;
import forestry.api.recipes.RecipeManagers;
import forestry.core.fluids.Fluids;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.ACT_ADD, name = "Actually Additions", author = "Ellpeck", url = "http://ellpeck.de/actadd", unlocalizedDescription = "for.plugin.actuallyadditions.description")
public class PluginActuallyAdditions extends BlankForestryPlugin {
public class PluginActuallyAdditions extends CompatPlugin {
private static final String ACT_ADD = "actuallyadditions";
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(ACT_ADD);
}
@Override
public String getFailMessage() {
return "Actually Additions not found!";
public PluginActuallyAdditions() {
super("Actually Additions", ACT_ADD);
}
@Override
@@ -79,46 +68,15 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
}
}
private static void registerSeedPlant(@Nullable Item seedItem, String blockName) {
private void registerSeedPlant(@Nullable Item seedItem, String blockName) {
if (seedItem != null) {
Block plantBlock = getBlock(blockName);
if (plantBlock != null) {
FarmableAgingCrop crop = new FarmableAgingCrop(new ItemStack(seedItem), plantBlock, BlockCrops.AGE, 7);
FarmRegistry.getInstance().registerFarmables("farmWheat", crop);
ForestryAPI.farmRegistry.registerFarmables("farmWheat", crop);
FarmableAgingCrop cropOrchard = new FarmableAgingCrop(new ItemStack(seedItem), plantBlock, BlockCrops.AGE, 7, 0);
FarmRegistry.getInstance().registerFarmables("farmOrchard", cropOrchard);
ForestryAPI.farmRegistry.registerFarmables("farmOrchard", cropOrchard);
}
}
}
@Nullable
private static Fluid getFluid(String fluidName) {
Fluid fluid = FluidRegistry.getFluid(fluidName);
if (fluid == null) {
Log.error("Could not find fluid {}", fluidName);
}
return fluid;
}
@Nullable
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(ACT_ADD, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
} else {
Log.error("Could not find {}", key);
return null;
}
}
@Nullable
private static Item getItem(String itemName) {
ResourceLocation key = new ResourceLocation(ACT_ADD, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return ForgeRegistries.ITEMS.getValue(key);
} else {
Log.error("Could not find {}", key);
return null;
}
}
}
@@ -0,0 +1,46 @@
package forestry.plugins.compat;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.farming.logic.FarmableDoubleCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.BETTER_WITH_MODS, name = "Better With Mods", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.betterwithmods.description")
public class PluginBetterWithMods extends CompatPlugin {
public PluginBetterWithMods() {
super("Better With Mods", "betterwithmods");
}
@Override
public void registerRecipes() {
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
PropertyBool TOP = PropertyBool.create("top");
PropertyInteger AGE = BlockCrops.AGE;
ItemStack hempSeed = getItemStack("hemp");
Block hempCrop = getBlock("hemp");
if (hempSeed != null && hempCrop != null) {
IBlockState defaultState = hempCrop.getDefaultState();
IBlockState planted = defaultState.withProperty(AGE, 0).withProperty(TOP, false);
IBlockState mature = defaultState.withProperty(AGE, 7).withProperty(TOP, false);
IBlockState topMature = defaultState.withProperty(AGE, 7).withProperty(TOP, true);
farmRegistry.registerFarmables("farmWheat", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, false));
farmRegistry.registerFarmables("farmOrchard", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, true));
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
}
}
}
@@ -12,6 +12,16 @@ package forestry.plugins.compat;
import java.util.Collections;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.ForestryAPI;
@@ -23,21 +33,12 @@ import forestry.core.items.EnumElectronTube;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.farming.FarmRegistry;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicEnder;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
@ForestryPlugin(pluginID = ForestryPluginUids.EXTRA_UTILITIES, name = "ExtraUtilities", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.extrautilities.description")
public class PluginExtraUtilities extends BlankForestryPlugin {
@@ -72,7 +73,7 @@ public class PluginExtraUtilities extends BlankForestryPlugin {
} else {
int harvestAge = Collections.max(growthProperty.getAllowedValues());
int replantAge = enderLillyBlock.getDefaultState().getValue(growthProperty);
FarmRegistry.getInstance().registerFarmables("farmEnder", new FarmableAgingCrop(new ItemStack(enderLillyItem), enderLillyBlock, growthProperty, harvestAge, replantAge));
ForestryAPI.farmRegistry.registerFarmables("farmEnder", new FarmableAgingCrop(new ItemStack(enderLillyItem), enderLillyBlock, growthProperty, harvestAge, replantAge));
Circuits.farmEnderManaged = new CircuitFarmLogic("managedEnder", new FarmLogicEnder());
}
}
@@ -10,9 +10,13 @@
******************************************************************************/
package forestry.plugins.compat;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.api.fuels.FuelManager;
@@ -24,52 +28,17 @@ import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemRegistryCore;
import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.ModUtil;
import forestry.farming.FarmRegistry;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
@ForestryPlugin(pluginID = ForestryPluginUids.HARVESTCRAFT, name = "HarvestCraft", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.harvestcraft.description")
public class PluginHarvestCraft extends BlankForestryPlugin {
public class PluginHarvestCraft extends CompatPlugin {
private static final String HC = "harvestcraft";
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(HC);
}
@Override
public String getFailMessage() {
return "HarvestCraft not found";
}
@Nullable
private static ItemStack getItemStack(String itemName) {
ResourceLocation key = new ResourceLocation(HC, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return new ItemStack(ForgeRegistries.ITEMS.getValue(key), 1);
} else {
return null;
}
}
@Nullable
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(HC, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
} else {
return null;
}
public PluginHarvestCraft() {
super("HarvestCraft", HC);
}
@Override
@@ -206,7 +175,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
genericCropsBuilder.addAll(herbs);
genericCropsBuilder.addAll(spices);
IFarmRegistry farmRegistry = FarmRegistry.getInstance();
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ImmutableList<String> genericCrops = genericCropsBuilder.build();
@@ -1,108 +1,68 @@
package forestry.plugins.compat;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.ICrop;
import forestry.api.fuels.FuelManager;
import forestry.api.fuels.GeneratorFuel;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.utils.ModUtil;
import forestry.farming.FarmRegistry;
import forestry.farming.logic.CropDestroy;
import forestry.farming.logic.FarmableBase;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import java.util.stream.Stream;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.api.fuels.FuelManager;
import forestry.api.fuels.GeneratorFuel;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.farming.logic.FarmableDoubleCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.IMMERSIVE_ENGINEERING, name = "ImmersiveEngineering", author = "marcin212", url = Constants.URL, unlocalizedDescription = "for.plugin.immersiveengineering.description")
public class PluginImmersiveEngineering extends BlankForestryPlugin {
private static final String IE = "immersiveengineering";
public class PluginImmersiveEngineering extends CompatPlugin {
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded(IE);
}
@Override
public String getFailMessage() {
return "ImmersiveEngineering not found";
public PluginImmersiveEngineering() {
super("ImmersiveEngineering", "immersiveengineering");
}
@Override
public void postInit() {
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ItemStack hempSeed = getItemStack("seed");
Block hempCrop = getBlock("hemp");
if (hempCrop != null) {
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
IProperty age = hempCrop.getBlockState().getProperties().stream().filter(p -> p.getName().equals("type")).findAny().orElseGet(null);
Stream<IProperty<?>> propertyStream = hempCrop.getBlockState().getProperties().stream();
IProperty age = propertyStream.filter(p -> p.getName().equals("type")).findAny().orElseGet(null);
if (hempSeed != null && hempCrop != Blocks.AIR && age != null) {
Optional bottom0 = age.parseValue("bottom0");
Optional bottom4 = age.parseValue("bottom4");
Optional top0 = age.parseValue("top0");
if (bottom0.isPresent() && top0.isPresent()) {
IBlockState defaultState = hempCrop.getDefaultState();
IBlockState planted = defaultState.withProperty(age, (Comparable) bottom0.get());
IBlockState mature = defaultState.withProperty(age, (Comparable) top0.get());
FarmRegistry.getInstance().registerFarmables("farmWheat", new FarmableBase(hempSeed, planted, mature, false) {
@Override
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
IBlockState stateUp = world.getBlockState(pos.up());
if (stateUp != matureState) {
return null;
}
return new CropDestroy(world, stateUp, pos.up(), null);
}
});
IBlockState mature = defaultState.withProperty(age, (Comparable) bottom4.get());
IBlockState topMature = defaultState.withProperty(age, (Comparable) top0.get());
farmRegistry.registerFarmables("farmWheat", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, false));
farmRegistry.registerFarmables("farmOrchard", new FarmableDoubleCrop(hempSeed, planted, mature, topMature, true));
RecipeManagers.squeezerManager.addRecipe(10, hempSeed, Fluids.SEED_OIL.getFluid(seedAmount));
}
}
}
Fluid ethanol = FluidRegistry.getFluid("ethanol");
if(ethanol != null){
if (ethanol != null) {
GeneratorFuel ethanolFuel = new GeneratorFuel(new FluidStack(ethanol, 1), (int) (32 * ForestryAPI.activeMode.getFloatSetting("fuel.ethanol.generator")), 4);
FuelManager.generatorFuel.put(ethanol, ethanolFuel);
}
}
@Nullable
private static Block getBlock(String blockName) {
ResourceLocation key = new ResourceLocation(IE, blockName);
if (ForgeRegistries.BLOCKS.containsKey(key)) {
return ForgeRegistries.BLOCKS.getValue(key);
} else {
return null;
}
}
@Nullable
private static ItemStack getItemStack(String itemName, int meta) {
ResourceLocation key = new ResourceLocation(IE, itemName);
if (ForgeRegistries.ITEMS.containsKey(key)) {
return new ItemStack(ForgeRegistries.ITEMS.getValue(key), 1, meta);
} else {
return null;
}
}
@Nullable
private static ItemStack getItemStack(String itemName) {
return getItemStack(itemName, 0);
}
}
@@ -1,28 +0,0 @@
package forestry.plugins.compat;
import forestry.api.core.CamouflageManager;
import forestry.core.config.Constants;
import forestry.core.utils.ModUtil;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.MALISIS_DOORES, name = "malisisdoors", author = "nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.malisisDoors.description")
public class PluginMalisisDoors extends BlankForestryPlugin {
@Override
public boolean isAvailable() {
return ModUtil.isModLoaded("malisisdoors");
}
@Override
public String getFailMessage() {
return "Malisis Door's not found";
}
@Override
public void preInit() {
CamouflageManager.camouflageAccess.addModIdToBlackList("door", "malisisdoors");
}
}
@@ -0,0 +1,159 @@
package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.item.ItemStack;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.MAGICAL_AGRICULTURE, name = "Mystical Agriculture", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.mysticalagriculture.description")
public class PluginMysticalAgriculture extends CompatPlugin {
private static final String MAGICAL_AGRICULTURE = "mysticalagriculture";
public PluginMysticalAgriculture() {
super("Mystical Agriculture", MAGICAL_AGRICULTURE);
}
@Override
public void registerRecipes() {
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
ImmutableList<String> crops = ImmutableList.of(
"stone",
"dirt",
"nature",
"wood",
"water",
"ice",
"fire",
"dye",
"nether",
"coal",
"iron",
"nether_quartz",
"glowstone",
"redstone",
"obsidian",
"gold",
"lapis_lazuli",
"end",
"experience",
"diamond",
"emerald",
"zombie",
"pig",
"chicken",
"cow",
"sheep",
"slime",
"skeleton",
"creeper",
"spider",
"rabbit",
"guardian",
"blaze",
"ghast",
"enderman",
"wither_skeleton",
"rubber",
"silicon",
"sulfur",
"aluminum",
"copper",
"saltpeter",
"tin",
"bronze",
"zinc",
"brass",
"silver",
"lead",
"steel",
"nickel",
"constantan",
"electrum",
"invar",
"mithril",
"tungsten",
"titanium",
"chrome",
"platinum",
"iridium",
"ruby",
"sapphire",
"peridot",
"amber",
"topaz",
"malachite",
"tanzanite",
"blizz",
"blitz",
"basalz",
"signalum",
"lumium",
"enderium",
"aluminum_brass",
"knightslime",
"ardite",
"cobalt",
"manyullyn",
"electrical_steel",
"redstone_alloy",
"conductive_iron",
"soularium", "dark_steel",
"pulsating_iron",
"energetic_alloy",
"vibrant_alloy",
"mystical_flower",
"manasteel",
"terrasteel",
"osmium",
"glowstone_ingot",
"refined_obsidian",
"aquarium",
"cold_iron",
"star_steel",
"adamantine",
"marble",
"limestone",
"basalt",
"apatite",
"meteoric_iron",
"desh",
"vinteum",
"chimerite",
"blue_topaz",
"moonstone",
"sunstone",
"ender_amethyst",
"draconium",
"yellorium",
"certus_quartz",
"fluix",
"quartz_enriched_iron"
);
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
for (String cropName : crops) {
ItemStack seeds = getItemStack(cropName + "_seeds");
Block block = getBlock(cropName + "_crop");
if (seeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, seeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (seeds != null && block != null) {
farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(seeds, block, BlockCrops.AGE, 7));
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(seeds, block, BlockCrops.AGE, 7, 0));
}
}
}
}
}
@@ -0,0 +1,64 @@
package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.item.ItemStack;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.ROOTS, name = "Roots", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.roots.description")
public class PluginRoots extends CompatPlugin {
public PluginRoots() {
super("Roots", "roots");
}
@Override
public void registerRecipes() {
ImmutableList<String> crops = ImmutableList.of(
"moonglow",
"terra_moss",
"aubergine"
);
ImmutableList<String> seeds = ImmutableList.of(
"moontinged_seed",
"terra_moss_spore",
"aubergine_seeds"
);
ImmutableList<String> fruits = ImmutableList.of(
"moonglow_leaf",
"terra_moss_ball",
"aubergine_item"
);
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
int juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple") / 25;
for (int i = 0; i < fruits.size(); i++) {
ItemStack seed = getItemStack(seeds.get(i));
Block block = getBlock(crops.get(i));
ItemStack fruit = getItemStack(fruits.get(i));
if (seed != null && i != 1) {
RecipeManagers.squeezerManager.addRecipe(10, seed, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (fruit != null && i == 2) {
RecipeManagers.squeezerManager.addRecipe(10, fruit, Fluids.JUICE.getFluid(juiceAmount));
}
if (seed != null && block != null) {
farmRegistry.registerFarmables("farmWheat", new FarmableAgingCrop(seed, block, BlockCrops.AGE, 7));
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(seed, block, BlockCrops.AGE, 7, 0));
}
}
}
}
@@ -0,0 +1,78 @@
package forestry.plugins.compat;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.item.ItemStack;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.IFarmRegistry;
import forestry.api.recipes.RecipeManagers;
import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.farming.logic.FarmableRusticGrape;
import forestry.farming.logic.FarmableRusticSapling;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.RUSTIC, name = "rustic", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.rustic.description")
public class PluginRustic extends CompatPlugin {
public PluginRustic() {
super("Rustic", "rustic");
}
@Override
public void registerRecipes() {
ImmutableList<String> fruits = ImmutableList.of(
"tomato",
"chili_pepper"
);
ImmutableList<String> crops = ImmutableList.of(
"tomato",
"chili"
);
PropertyInteger cropAge = PropertyInteger.create("age", 0, 3);
int seedAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
int juiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple");
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ItemStack grapes = getItemStack("grapes");
ItemStack grapeSeeds = getItemStack("grape_stem");
Block grapeLeaves = getBlock("grape_leaves");
if (grapeSeeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, grapeSeeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (grapes != null) {
RecipeManagers.squeezerManager.addRecipe(10, grapes, Fluids.JUICE.getFluid(juiceAmount / 12));
}
if (grapeLeaves != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableRusticGrape(grapeLeaves));
}
ItemStack sapling = getItemStack("sapling");
ItemStack ironBerries = getItemStack("ironberries");
ItemStack olives = getItemStack("olives");
if (sapling != null && ironBerries != null && olives != null) {
farmRegistry.registerFarmables("farmArboreal", new FarmableRusticSapling(sapling.getItem(), new ItemStack[]{ironBerries, olives}));
}
for (int i = 0; i < fruits.size(); i++) {
String fruitName = fruits.get(i);
ItemStack seeds = getItemStack(fruitName + "_seeds");
Block block = getBlock(crops.get(i) + "_crop");
ItemStack fruit = getItemStack(fruitName);
if (seeds != null) {
RecipeManagers.squeezerManager.addRecipe(10, seeds, Fluids.SEED_OIL.getFluid(seedAmount));
}
if (fruit != null) {
RecipeManagers.squeezerManager.addRecipe(10, fruit, Fluids.JUICE.getFluid(juiceAmount / 25));
}
if (seeds != null && block != null) {
farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(seeds, block, cropAge, 3, 2));
}
}
}
}