mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 04:22:32 +00:00
Add Better with Mods Integration and Fix IE, Roots and Rustic Integration
This commit is contained in:
1 parent
4e17804997
commit
96ed44a186
28 files changed
+400
-213
No files matched your search
@@ -53,7 +53,6 @@ public class ForestryAPI {
|
||||
/**
|
||||
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
|
||||
*/
|
||||
@Nullable
|
||||
public static IFarmRegistry farmRegistry;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,7 +23,10 @@ public interface IFarmRegistry {
|
||||
|
||||
/**
|
||||
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
|
||||
*
|
||||
* @return Null if the farming plugin is not active.
|
||||
*/
|
||||
@Nullable
|
||||
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package forestry.farming;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.api.farming.ISimpleFarmLogic;
|
||||
|
||||
public class DummyFarmRegistry implements IFarmRegistry {
|
||||
|
||||
@Override
|
||||
public void registerFarmables(String identifier, IFarmable... farmable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IFarmable> getFarmables(String identifier) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFertilizer(ItemStack itemStack, int value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertilizeValue(ItemStack itemStack) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package forestry.farming;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -8,13 +11,14 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import forestry.api.farming.IFarmRegistry;
|
||||
import forestry.api.farming.IFarmable;
|
||||
@@ -24,9 +28,6 @@ import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.farming.logic.FarmLogicSimple;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public final class FarmRegistry implements IFarmRegistry {
|
||||
|
||||
@@ -34,10 +35,6 @@ public final class FarmRegistry implements IFarmRegistry {
|
||||
private final Multimap<String, IFarmable> farmables = HashMultimap.create();
|
||||
private final Map<ItemStack, Integer> fertilizers = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
ForestryAPI.farmRegistry = INSTANCE;
|
||||
}
|
||||
|
||||
public static FarmRegistry getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,16 @@ public class PluginFarming extends BlankForestryPlugin {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAPI() {
|
||||
ForestryAPI.farmRegistry = FarmRegistry.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disabledSetupAPI() {
|
||||
ForestryAPI.farmRegistry = new DummyFarmRegistry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemsAndBlocks() {
|
||||
blocks = new BlockRegistryFarming();
|
||||
@@ -111,7 +121,7 @@ public class PluginFarming extends BlankForestryPlugin {
|
||||
BlockRegistryFarming blocks = getBlocks();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
IFarmRegistry registry = FarmRegistry.getInstance();
|
||||
IFarmRegistry registry = ForestryAPI.farmRegistry;
|
||||
|
||||
registry.registerFarmables("farmArboreal", new FarmableVanillaSapling());
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package forestry.farming.logic;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.utils.NetworkUtil;
|
||||
|
||||
public class CropDestroyDouble extends Crop {
|
||||
|
||||
protected final IBlockState blockState;
|
||||
protected final IBlockState blockStateUp;
|
||||
@Nullable
|
||||
protected final IBlockState replantState;
|
||||
|
||||
public CropDestroyDouble(World world, IBlockState blockState, IBlockState blockStateUp, BlockPos position, @Nullable IBlockState replantState) {
|
||||
super(world, position);
|
||||
this.blockState = blockState;
|
||||
this.blockStateUp = blockStateUp;
|
||||
this.replantState = replantState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCrop(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos) == blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NonNullList<ItemStack> harvestBlock(World world, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
Block blockUp = blockStateUp.getBlock();
|
||||
NonNullList<ItemStack> harvested = NonNullList.create();
|
||||
harvested.addAll(block.getDrops(world, pos, blockState, 0));
|
||||
harvested.addAll(blockUp.getDrops(world, pos.up(), blockStateUp, 0));
|
||||
|
||||
PacketFXSignal packet = new PacketFXSignal(PacketFXSignal.VisualFXType.BLOCK_BREAK, PacketFXSignal.SoundFXType.BLOCK_BREAK, pos, blockState);
|
||||
NetworkUtil.sendNetworkPacket(packet, pos, world);
|
||||
|
||||
world.setBlockToAir(pos.up());
|
||||
if (replantState != null) {
|
||||
world.setBlockState(pos, replantState, Constants.FLAG_BLOCK_SYNC);
|
||||
} else {
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
return harvested;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("CropDestroyDouble [ position: [ %s ]; block: %s ]", position.toString(), blockState);
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -32,13 +26,20 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.PluginCore;
|
||||
|
||||
public class FarmLogicArboreal extends FarmLogicHomogeneous {
|
||||
public FarmLogicArboreal(ItemStack resource, IBlockState ground, Collection<IFarmable> germlings) {
|
||||
super(resource, ground, germlings);
|
||||
}
|
||||
|
||||
public FarmLogicArboreal() {
|
||||
super(new ItemStack(Blocks.DIRT), PluginCore.getBlocks().humus.getDefaultState(), FarmRegistry.getInstance().getFarmables("farmArboreal"));
|
||||
super(new ItemStack(Blocks.DIRT), PluginCore.getBlocks().humus.getDefaultState(), ForestryAPI.farmRegistry.getFarmables("farmArboreal"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
public class FarmLogicCereal extends FarmLogicCrops {
|
||||
|
||||
public FarmLogicCereal() {
|
||||
super(FarmRegistry.getInstance().getFarmables("farmWheat"));
|
||||
super(ForestryAPI.farmRegistry.getFarmables("farmWheat"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,12 +13,6 @@ package forestry.farming.logic;
|
||||
import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -27,10 +21,17 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
public class FarmLogicEnder extends FarmLogicHomogeneous {
|
||||
|
||||
public FarmLogicEnder() {
|
||||
super(new ItemStack(Blocks.END_STONE), Blocks.END_STONE.getDefaultState(), FarmRegistry.getInstance().getFarmables("farmEnder"));
|
||||
super(new ItemStack(Blocks.END_STONE), Blocks.END_STONE.getDefaultState(), ForestryAPI.farmRegistry.getFarmables("farmEnder"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,11 +13,6 @@ package forestry.farming.logic;
|
||||
import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,12 +20,18 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
public class FarmLogicGourd extends FarmLogic {
|
||||
|
||||
private final IFarmable[] seeds;
|
||||
|
||||
public FarmLogicGourd() {
|
||||
Collection<IFarmable> farmables = FarmRegistry.getInstance().getFarmables("farmGourd");
|
||||
Collection<IFarmable> farmables = ForestryAPI.farmRegistry.getFarmables("farmGourd");
|
||||
seeds = farmables.toArray(new IFarmable[farmables.size()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,6 @@ package forestry.farming.logic;
|
||||
import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -27,10 +21,17 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
public class FarmLogicInfernal extends FarmLogicHomogeneous {
|
||||
|
||||
public FarmLogicInfernal() {
|
||||
super(new ItemStack(Blocks.SOUL_SAND), Blocks.SOUL_SAND.getDefaultState(), FarmRegistry.getInstance().getFarmables("farmInfernal"));
|
||||
super(new ItemStack(Blocks.SOUL_SAND), Blocks.SOUL_SAND.getDefaultState(), ForestryAPI.farmRegistry.getFarmables("farmInfernal"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,17 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
|
||||
public class FarmLogicMushroom extends FarmLogicArboreal {
|
||||
|
||||
public FarmLogicMushroom() {
|
||||
super(new ItemStack(Blocks.MYCELIUM), Blocks.MYCELIUM.getDefaultState(), FarmRegistry.getInstance().getFarmables("farmShroom"));
|
||||
super(new ItemStack(Blocks.MYCELIUM), Blocks.MYCELIUM.getDefaultState(), ForestryAPI.farmRegistry.getFarmables("farmShroom"));
|
||||
addSoil(new ItemStack(Blocks.DIRT, 1, 2), Blocks.DIRT.getStateFromMeta(2), true);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -19,7 +21,14 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
@@ -27,13 +36,6 @@ import forestry.api.farming.IFarmable;
|
||||
import forestry.api.genetics.IFruitBearer;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmLogicOrchard extends FarmLogic {
|
||||
|
||||
@@ -42,7 +44,7 @@ public class FarmLogicOrchard extends FarmLogic {
|
||||
private final ImmutableList<Block> traversalBlocks;
|
||||
|
||||
public FarmLogicOrchard() {
|
||||
this.farmables = FarmRegistry.getInstance().getFarmables("farmOrchard");
|
||||
this.farmables = ForestryAPI.farmRegistry.getFarmables("farmOrchard");
|
||||
|
||||
ImmutableList.Builder<Block> traversalBlocksBuilder = ImmutableList.builder();
|
||||
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.AGRICRAFT) || ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
|
||||
|
||||
@@ -13,12 +13,6 @@ package forestry.farming.logic;
|
||||
import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -27,8 +21,15 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class FarmLogicReeds extends FarmLogic {
|
||||
private final Collection<IFarmable> germlings = FarmRegistry.getInstance().getFarmables("farmPoales");
|
||||
private final Collection<IFarmable> germlings = ForestryAPI.farmRegistry.getFarmables("farmPoales");
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
|
||||
@@ -13,12 +13,6 @@ package forestry.farming.logic;
|
||||
import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -27,8 +21,15 @@ import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class FarmLogicSucculent extends FarmLogic {
|
||||
private final Collection<IFarmable> germlings = FarmRegistry.getInstance().getFarmables("farmSucculentes");
|
||||
private final Collection<IFarmable> germlings = ForestryAPI.farmRegistry.getFarmables("farmSucculentes");
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
public class FarmLogicVegetable extends FarmLogicCrops {
|
||||
|
||||
public FarmLogicVegetable() {
|
||||
super(FarmRegistry.getInstance().getFarmables("farmVegetables"));
|
||||
super(ForestryAPI.farmRegistry.getFarmables("farmVegetables"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package forestry.farming.logic;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.ICrop;
|
||||
|
||||
public class FarmableDoubleCrop extends FarmableBase {
|
||||
private final IBlockState topMatureState;
|
||||
|
||||
public FarmableDoubleCrop(ItemStack germling, IBlockState plantedState, IBlockState matureState, IBlockState topMatureState, boolean replant) {
|
||||
super(germling, plantedState, matureState, replant);
|
||||
this.topMatureState = topMatureState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
return blockState.getBlock() == plantedState.getBlock() && blockState != topMatureState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
|
||||
BlockPos posUp = pos.up();
|
||||
IBlockState stateUp = world.getBlockState(posUp);
|
||||
if (blockState != matureState || stateUp != topMatureState) {
|
||||
return null;
|
||||
}
|
||||
return new CropDestroyDouble(world, blockState, stateUp, pos, replant ? plantedState : null);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package forestry.farming.logic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -38,7 +37,7 @@ public class FarmableRusticSapling implements IFarmable {
|
||||
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos).getBlock() == Blocks.SAPLING;
|
||||
return world.getBlockState(pos).getBlock() == germlingBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,16 @@ package forestry.farming.multiblock;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmInventory;
|
||||
@@ -24,15 +34,6 @@ import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
import forestry.farming.FarmRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
public class InventoryFarm extends InventoryAdapterRestricted implements IFarmInventory {
|
||||
public static final int SLOT_RESOURCES_1 = 0;
|
||||
@@ -137,7 +138,7 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
|
||||
return false;
|
||||
}
|
||||
|
||||
return FarmRegistry.getInstance().getFertilizeValue(itemstack) > 0;
|
||||
return ForestryAPI.farmRegistry.getFertilizeValue(itemstack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,7 +214,7 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fertilizerValue = FarmRegistry.getInstance().getFertilizeValue(fertilizerStack);
|
||||
int fertilizerValue = ForestryAPI.farmRegistry.getFertilizeValue(fertilizerStack);
|
||||
if(fertilizerValue > 0){
|
||||
return fertilizerValue * FERTILIZER_MODIFIER;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user