forked from MightyPirates/TIS-3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInfraredAPI.java
37 lines (32 loc) · 1.21 KB
/
InfraredAPI.java
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
package li.cil.tis3d.api;
import li.cil.tis3d.api.infrared.InfraredPacket;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nullable;
/**
* API entry point for spawning infrared packets and related tasks.
* <p>
* This is made available in the init phase, so you'll either have to (soft)
* depend on TIS-3D or you must not make calls to this before the init phase.
*/
public final class InfraredAPI {
/**
* Emit a new infrared packet with the specified value.
*
* @param world the world to spawn the packet in.
* @param position the location to spawn the packet at.
* @param direction the direction the packet shall travel in.
* @param value the value the packet carries.
* @return the packet that was spawned.
*/
@Nullable
public static InfraredPacket sendPacket(final World world, final Vec3d position, final Vec3d direction, final short value) {
if (API.infraredAPI != null) {
return API.infraredAPI.sendPacket(world, position, direction, value);
}
return null;
}
// --------------------------------------------------------------------- //
private InfraredAPI() {
}
}