Merge apibutnotreally with the main packages
Do not consider anything outside of the true API safe to use. And even then, I'm changing things. Just wait. Please I beg you.
This commit is contained in:
parent
616c08094b
commit
2fecb427fd
399 changed files with 958 additions and 977 deletions
|
@ -1,33 +0,0 @@
|
|||
package WayofTime.bloodmagic.apibutnotreally.util.helper;
|
||||
|
||||
import WayofTime.bloodmagic.apibutnotreally.Constants;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class PurificationHelper {
|
||||
public static double getCurrentPurity(EntityAnimal animal) {
|
||||
NBTTagCompound data = animal.getEntityData();
|
||||
if (data.hasKey(Constants.NBT.CURRENT_PURITY)) {
|
||||
return data.getDouble(Constants.NBT.CURRENT_PURITY);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setCurrentPurity(EntityAnimal animal, double amount) {
|
||||
NBTTagCompound data = animal.getEntityData();
|
||||
data.setDouble(Constants.NBT.CURRENT_PURITY, amount);
|
||||
}
|
||||
|
||||
public static double addPurity(EntityAnimal animal, double added, double max) {
|
||||
double currentPurity = getCurrentPurity(animal);
|
||||
double newAmount = Math.min(max, currentPurity + added);
|
||||
|
||||
if (newAmount < max) {
|
||||
setCurrentPurity(animal, newAmount);
|
||||
return newAmount - currentPurity;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue