Add Better with Mods Integration and Fix IE, Roots and Rustic Integration

This commit is contained in:
Nedelosk committed 2017-07-24 00:12:36 +02:00
1 parent 4e17804997
commit 96ed44a186
28 files changed
+400 -213

No files matched your search

@@ -31,4 +31,5 @@ public class ForestryPluginUids {
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";
}
@@ -14,7 +14,6 @@ import net.minecraftforge.fluids.FluidStack;
import forestry.api.core.ForestryAPI;
import forestry.api.recipes.RecipeManagers;
import forestry.core.fluids.Fluids;
import forestry.farming.FarmRegistry;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@@ -74,9 +73,9 @@ public class PluginActuallyAdditions extends CompatPlugin {
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);
}
}
}
@@ -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());
}
}
@@ -28,7 +28,6 @@ import forestry.core.config.Constants;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemRegistryCore;
import forestry.core.recipes.RecipeUtil;
import forestry.farming.FarmRegistry;
import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@@ -176,7 +175,7 @@ public class PluginHarvestCraft extends CompatPlugin {
genericCropsBuilder.addAll(herbs);
genericCropsBuilder.addAll(spices);
IFarmRegistry farmRegistry = FarmRegistry.getInstance();
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
ImmutableList<String> genericCrops = genericCropsBuilder.build();
@@ -10,16 +10,24 @@
******************************************************************************/
package forestry.plugins.compat;
import java.util.Set;
import com.google.common.collect.ImmutableMap;
import javax.annotation.Nonnull;
import java.util.Set;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import com.google.common.collect.ImmutableMap;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.CircuitSocketType;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.Farmables;
import forestry.api.fuels.EngineBronzeFuel;
import forestry.api.fuels.FuelManager;
import forestry.api.recipes.RecipeManagers;
@@ -31,7 +39,6 @@ import forestry.apiculture.items.EnumPropolis;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.core.PluginCore;
import forestry.core.blocks.BlockBogEarth;
import forestry.core.circuits.Circuit;
import forestry.core.circuits.CircuitLayout;
import forestry.core.circuits.Circuits;
import forestry.core.config.Constants;
@@ -42,27 +49,20 @@ import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.ModUtil;
import forestry.core.utils.OreDictUtil;
import forestry.energy.PluginEnergy;
import forestry.energy.blocks.BlockRegistryEnergy;
import forestry.energy.circuits.CircuitElectricBoost;
import forestry.energy.circuits.CircuitElectricChoke;
import forestry.energy.circuits.CircuitElectricEfficiency;
import forestry.farming.FarmRegistry;
import forestry.farming.circuits.CircuitFarmLogic;
import forestry.farming.logic.FarmLogicRubber;
import forestry.farming.logic.FarmableBasicIC2Crop;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import ic2.api.item.IC2Items;
import ic2.api.recipe.Recipes;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.event.FMLInterModComms;
@ForestryPlugin(pluginID = ForestryPluginUids.INDUSTRIALCRAFT2, name = "IndustrialCraft2", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.ic2.description")
public class PluginIC2 extends BlankForestryPlugin {
@@ -120,7 +120,7 @@ public class PluginIC2 extends BlankForestryPlugin {
ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
if(fertilizer != null){
FarmRegistry.getInstance().registerFertilizer(fertilizer, 250);
ForestryAPI.farmRegistry.registerFertilizer(fertilizer, 250);
}
}
@@ -288,7 +288,7 @@ public class PluginIC2 extends BlankForestryPlugin {
ChipsetManager.solderManager.addRecipe(layoutManual, coreItems.tubes.get(EnumElectronTube.RUBBER, 1), Circuits.farmRubberManual);
}
FarmRegistry.getInstance().registerFarmables("farmOrchard", new FarmableBasicIC2Crop());
ForestryAPI.farmRegistry.registerFarmables("farmOrchard", new FarmableBasicIC2Crop());
}
@@ -2,71 +2,65 @@ package forestry.plugins.compat;
import com.google.common.base.Optional;
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.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.core.ForestryAPI;
import forestry.api.farming.ICrop;
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.FarmRegistry;
import forestry.farming.logic.CropDestroy;
import forestry.farming.logic.FarmableBase;
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 CompatPlugin {
private static final String IE = "immersiveengineering";
public PluginImmersiveEngineering() {
super("ImmersiveEngineering", IE);
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);
}
@@ -15,7 +15,7 @@ import forestry.farming.logic.FarmableAgingCrop;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.RUSTIC, name = "Roots", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.roots.description")
@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");
@@ -23,43 +23,41 @@ public class PluginRoots extends CompatPlugin {
@Override
public void registerRecipes() {
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
ImmutableList<String> crops = ImmutableList.of(
"moonglow",
"terra_moss",
"aubergine"
);
ImmutableList<String> crops = ImmutableList.of(
"moonglow",
"terra_moss",
"aubergine"
);
ImmutableList<String> seeds = ImmutableList.of(
"moontinged_seed",
"terra_moss_spore",
"aubergine_seeds"
);
ImmutableList<String> seeds = ImmutableList.of(
"moontinged_seed",
"terra_moss_spore",
"aubergine_seeds"
);
ImmutableList<String> fruits = ImmutableList.of(
"moonglow_leaf",
"terra_moss_ball",
"aubergine_item"
);
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;
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));
}
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));
}
}
}
@@ -17,7 +17,7 @@ import forestry.farming.logic.FarmableRusticSapling;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
@ForestryPlugin(pluginID = ForestryPluginUids.ROOTS, name = "rustic", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.rustic.description")
@ForestryPlugin(pluginID = ForestryPluginUids.RUSTIC, name = "rustic", author = "Nedelosk", url = Constants.URL, unlocalizedDescription = "for.plugin.rustic.description")
public class PluginRustic extends CompatPlugin {
public PluginRustic() {
@@ -26,54 +26,52 @@ public class PluginRustic extends CompatPlugin {
@Override
public void registerRecipes() {
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
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;
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 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}));
}
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));
}
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));
}
}
}