aboutsummaryrefslogtreecommitdiff
path: root/src/Java/powercrystals/minefactoryreloaded/api/IFactoryFruit.java
blob: 3f956422c01f9d1aa23703fbe5ed46f8ff69b936 (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
105
106
package powercrystals.minefactoryreloaded.api;

import java.util.List;
import java.util.Random;

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

/**
 * Defines a fruit entry for the Fruit Picker.
 *
 * @author powercrystals
 *
 */
public interface IFactoryFruit {

	/**
	 * @return The block this fruit has in the world.
	 */
	public Block getPlant();

	/**
	 * Used to determine if this fruit can be picked (is it ripe yet, etc)
	 *
	 * @param world
	 *            The world where the fruit is being picked
	 * @param x
	 *            The x-coordinate of the fruit
	 * @param y
	 *            The y-coordinate of the fruit
	 * @param z
	 *            The z-coordinate of the fruit
	 *
	 * @return True if the fruit can be picked
	 */
	public boolean canBePicked(World world, int x, int y, int z);

	/**
	 * @deprecated This method is no longer called. ReplacementBlock now handles
	 *             interaction.
	 */
	@Deprecated
	public boolean breakBlock();

	/**
	 * Called by the Fruit Picker to determine what block to replace the picked
	 * block with. At the time this method is called, the fruit still exists.
	 *
	 * @param world
	 *            The world where the fruit is being picked
	 * @param x
	 *            The x-coordinate of the fruit
	 * @param y
	 *            The y-coordinate of the fruit
	 * @param z
	 *            The z-coordinate of the fruit
	 *
	 * @return The block to replace the fruit block with, or null for air.
	 */
	public ReplacementBlock getReplacementBlock(World world, int x, int y, int z);

	/**
	 * Called by the Fruit Picker to determine what drops to generate. At the
	 * time this method is called, the fruit still exists.
	 *
	 * @param world
	 *            The world where the fruit is being picked
	 * @param x
	 *            The x-coordinate of the fruit
	 * @param y
	 *            The y-coordinate of the fruit
	 * @param z
	 *            The z-coordinate of the fruit
	 */
	public List<ItemStack> getDrops(World world, Random rand, int x, int y, int z);

	/**
	 * Called by the Fruit Picker after getDrops, prior to the block being
	 * replaced/removed.
	 *
	 * @param world
	 *            The world where the fruit is being picked
	 * @param x
	 *            The x-coordinate of the fruit
	 * @param y
	 *            The y-coordinate of the fruit
	 * @param z
	 *            The z-coordinate of the fruit
	 */
	public void prePick(World world, int x, int y, int z);

	/**
	 * Called by the Fruit Picker after the fruit is picked.
	 *
	 * @param world
	 *            The world where the fruit is being picked
	 * @param x
	 *            The x-coordinate of the fruit
	 * @param y
	 *            The y-coordinate of the fruit
	 * @param z
	 *            The z-coordinate of the fruit
	 */
	public void postPick(World world, int x, int y, int z);
}