-
Notifications
You must be signed in to change notification settings - Fork 1
Magic Helper Methods
All entities start off with a Magic Level of 0 and a Max Magic of 100 by default. They are added to LivingEntities, so you just call it like any other LivingEntity method
Here's a small example on how you'd call these methods:
public void exampleManaMethod(LivingEntity user) {
if (user.canAddMana(10)) {
user.addMana(10)
}
Adds Mana to entity if the entity's mana isn't at the maximum level
If the amount of mana added to the entity is greater than the max level, but the entity's mana bar isn't full, the entity's mana will fill to be the max level
If the amount of mana added is negative, removeMana(amount * -1) will be called
Removes Mana from entity if the entity's mana isn't less than or equal to 0
If the amount of mana removed from the entity is greater than the amount of mana the entity has, mana won't be removed
If the amount of mana added is negative, addMana(amount * -1) will be called
Returns true if the Mana isn't at its max level
Returns true if the amount of mana can be removed from the entity without dipping below 0
Increases the entity's Maximum mana by amount. If Replenish is true, the entity will also have its mana increase by amount
If the amount of mana added is negative, decreaseMaxMana(amount * -1) will be called
Decreases the entity's Maximum mana by amount. If The Mana decrease ends up being less than 1, it doesn't remove the mana.
If the amount of mana added is negative, increaseMaxMana(amount * -1, false) will be called
Checks if the entity's maximum mana can be decreased by amount without being less than 1
Allows an entity to regenerate mana passively if it is true.
tickPause determines how many ticks need to pass before increasing the entity's mana by amount (if tickPause is 40 and amount is 1, the entity will regenerate 1 mana every 40 ticks)
Returns true if the entity is passively regenerating Mana
Sets the current Mana to any value; it's recommended to use add or remove mana to modify mana however
Returns current Mana level
Sets the current Max Mana to any value; it's recommended to use increase or decrease max Mana to modify max mana however
Returns current Max Mana level
While the methods getWhenNeededRenderTime() and setWhenNeededRenderTime() exist, they should be left alone as they are used for Client-Side rendering of the Magic Bar if the Magic Bar is set to only be on screen When Needed.