Revamp the entire skillset and rebalance everything.
This commit is contained in:
@@ -1,9 +1,43 @@
|
||||
package net.fretux.ascend.compat;
|
||||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
public class AscendMMCompat {
|
||||
/** Optional Mind & Motion bridge with all foreign types isolated in Loaded. */
|
||||
public final class AscendMMCompat {
|
||||
private AscendMMCompat() {}
|
||||
|
||||
public static boolean isMindMotionPresent() {
|
||||
return ModList.get().isLoaded("mindmotion");
|
||||
}
|
||||
|
||||
public static boolean consumeClearMind(Player player) {
|
||||
return isMindMotionPresent() && Loaded.consumeClearMind(player);
|
||||
}
|
||||
|
||||
public static void restoreMind(Player player) {
|
||||
if (isMindMotionPresent()) Loaded.restoreMind(player);
|
||||
}
|
||||
|
||||
private static final class Loaded {
|
||||
private static boolean consumeClearMind(Player player) {
|
||||
final boolean[] success = {false};
|
||||
player.getCapability(net.fretux.mindmotion.player.PlayerCapabilityProvider.SANITY).ifPresent(sanity -> {
|
||||
if (sanity.getMaxSanity() > 0 && sanity.getSanity() / sanity.getMaxSanity() >= 0.90f) {
|
||||
sanity.setSanity(0);
|
||||
sanity.setInsanity(0);
|
||||
success[0] = true;
|
||||
}
|
||||
});
|
||||
return success[0];
|
||||
}
|
||||
|
||||
private static void restoreMind(Player player) {
|
||||
player.getCapability(net.fretux.mindmotion.player.PlayerCapabilityProvider.SANITY).ifPresent(sanity -> {
|
||||
sanity.setSanity(sanity.getMaxSanity());
|
||||
sanity.setInsanity(0);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user