summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/BlockChangeDelegate.java
blob: 734106053b9285ebfc6a57db99fee2ec51dcbb8a (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
package org.bukkit;

/**
 * A delegate for handling block changes. This serves as a direct interface
 * between generation algorithms in the server implementation and utilizing
 * code.
 */
public interface BlockChangeDelegate {

    /**
     * Set a block type at the specified coordinates without doing all world updates and notifications.
     * It is safe to have this call World.setTypeId, but it may be slower than World.setRawTypeId.
     *
     * @param x X coordinate
     * @param y Y coordinate
     * @param z Z coordinate
     * @param typeId New block ID
     * @return true if the block was set successfully
     */
    public boolean setRawTypeId(int x, int y, int z, int typeId);

    /**
     * Set a block type and data at the specified coordinates without doing all world updates and notifications.
     * It is safe to have this call World.setTypeId, but it may be slower than World.setRawTypeId.
     *
     * @param x X coordinate
     * @param y Y coordinate
     * @param z Z coordinate
     * @param typeId New block ID
     * @param data Block data
     * @return true if the block was set successfully
     */
    public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data);

    /**
     * Set a block type at the specified coordinates.
     * This method cannot call World.setRawTypeId, a full update is needed.
     *
     * @param x X coordinate
     * @param y Y coordinate
     * @param z Z coordinate
     * @param typeId New block ID
     * @return true if the block was set successfully
     */
    public boolean setTypeId(int x, int y, int z, int typeId);

    /**
     * Set a block type and data at the specified coordinates.
     * This method cannot call World.setRawTypeId, a full update is needed.
     *
     * @param x X coordinate
     * @param y Y coordinate
     * @param z Z coordinate
     * @param typeId New block ID
     * @param data Block data
     * @return true if the block was set successfully
     */
    public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data);

    /**
     * Get the block type at the location.
     *
     * @param x X coordinate
     * @param y Y coordinate
     * @param z Z coordinate
     * @return The block ID
     */
    public int getTypeId(int x, int y, int z);

    /**
     * Gets the height of the world.
     *
     * @return Height of the world
     */
    public int getHeight();

    /**
     * Checks if the specified block is empty (air) or not.
     *
     * @param x X coordinate
     * @param y Y coordinate
     * @param z Z coordinate
     * @return True if the block is considered empty.
     */
    public boolean isEmpty(int x, int y, int z);
}