-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathCapabilityHelper.java
More file actions
38 lines (29 loc) · 1.31 KB
/
CapabilityHelper.java
File metadata and controls
38 lines (29 loc) · 1.31 KB
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
package com.crowsofwar.avatar.api.capabilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
public class CapabilityHelper {
/** Holds the capability **/
@CapabilityInject(IAdvancedGliderCapabilityHandler.class)
public static final Capability<IAdvancedGliderCapabilityHandler> GLIDER_CAPABILITY = null;
//===================================== Helper Methods ==================================================
/**
* Gets the gliding capability of a given player.
*
* @param player - the player to check
* @return The capability if the player has the capability, null otherwise
*/
public static IAdvancedGliderCapabilityHandler getGliderCapability(EntityPlayer player) {
return player.getCapability(GLIDER_CAPABILITY, null);
}
/**
* Checks if the player has the glider capability.
* Should theoretically always be true if using this API, as it injects the capability.
*
* @param player - the player to check
* @return - True if the player has the capability, False otherwise
*/
public static boolean hasGliderCapability(EntityPlayer player) {
return player.hasCapability(GLIDER_CAPABILITY, null);
}
}