aboutsummaryrefslogtreecommitdiff
path: root/src/Java/powercrystals/minefactoryreloaded/api/IFactoryHarvestable.java
blob: 5b6be99f89c9de9ffd8384f358d543ca573e86d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package powercrystals.minefactoryreloaded.api;

import java.util.*;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

/**
 * Defines a harvestable block for the Harvester.
 *
 * @author PowerCrystals
 */
public interface IFactoryHarvestable {

	/**
	 * @return The block this harvestable instance is managing.
	 */
	public Block getPlant();

	/**
	 * @return The type of harvest the Harvester should perform on this block.
	 */
	public HarvestType getHarvestType();

	/**
	 * Used to determine if the harvester should replace this block with air.
	 *
	 * @return Whether or not the Harvester should break the block when
	 *         harvesting. If false, no changes will be performed by the
	 *         Harvester itself.
	 */
	public boolean breakBlock();

	/**
	 * Used to determine if this crop can be harvested (is it at a stage that
	 * drops crops, etc.)
	 *
	 * @param world
	 *            The world this block is in.
	 * @param harvesterSettings
	 *            The harvester's current settings. Do not modify these.
	 * @param x
	 *            The X coordinate of the block being harvested.
	 * @param y
	 *            The Y coordinate of the block being harvested.
	 * @param z
	 *            The Z coordinate of the block being harvested.
	 *
	 * @return True if this block can be harvested.
	 */
	public boolean canBeHarvested(World world, Map<String, Boolean> harvesterSettings, int x, int y, int z);

	/**
	 * @param world
	 *            The world this block is in.
	 * @param rand
	 *            A Random instance to use when generating drops.
	 * @param harvesterSettings
	 *            The harvester's current settings. Do not modify these.
	 * @param x
	 *            The X coordinate of the block being harvested.
	 * @param y
	 *            The Y coordinate of the block being harvested.
	 * @param z
	 *            The Z coordinate of the block being harvested.
	 *
	 * @return The drops generated by breaking this block. For a default
	 *         implementation, calling Block.getDrops() is usually
	 *         sufficient.
	 */
	public List<ItemStack> getDrops(World world, Random rand, Map<String, Boolean> harvesterSettings, int x, int y, int z);

	/**
	 * Called before the block is going to be harvested, after getDrops. Usually
	 * empty.
	 *
	 * @param world
	 *            The world this block is in.
	 * @param x
	 *            The X coordinate of the block being harvested.
	 * @param y
	 *            The Y coordinate of the block being harvested.
	 * @param z
	 *            The Z coordinate of the block being harvested.
	 */
	public void preHarvest(World world, int x, int y, int z);

	/**
	 * Called after the block is going to be harvested. Used to re-till soil,
	 * for example.
	 *
	 * @param world
	 *            The world this block is in.
	 * @param x
	 *            The X coordinate of the block being harvested.
	 * @param y
	 *            The Y coordinate of the block being harvested.
	 * @param z
	 *            The Z coordinate of the block being harvested.
	 */
	public void postHarvest(World world, int x, int y, int z);

}