use of com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability in project Wizardry by TeamWizardry.
the class TileManaNode method drainMana.
public double drainMana(double mana) {
if (!world.isBlockLoaded(pos))
return -1;
IManaCapability cap = getWizardryCap();
if (cap == null)
return -1;
double amount = MathHelper.clamp(cap.getMana(), 0, mana);
ManaManager.forObject(cap).removeMana(amount).close();
return amount;
}
use of com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability in project Wizardry by TeamWizardry.
the class BloodRenderLayer method doRenderLayer.
@Override
public void doRenderLayer(@Nonnull AbstractClientPlayer entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (Minecraft.getMinecraft().player == null || Minecraft.getMinecraft().world == null)
return;
IManaCapability cap = ManaCapabilityProvider.getCap(entity);
if (cap != null) {
EnumBloodType type = cap.getBloodType();
if (type != null && type != EnumBloodType.NONE) {
render.bindTexture(EnumBloodType.getResourceLocation(type));
ClientUtilMethods.glColor(type.color);
setModelVisibilities(entity);
GlStateManager.enableBlendProfile(Profile.PLAYER_SKIN);
GlStateManager.disableLighting();
ShaderHelper.INSTANCE.useShader(Shaders.rawColor);
render.getMainModel().render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.enableLighting();
ShaderHelper.INSTANCE.releaseShader();
GlStateManager.disableBlendProfile(Profile.PLAYER_SKIN);
GlStateManager.color(1.0F, 1.0F, 1.0F);
}
}
}
use of com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability in project Wizardry by TeamWizardry.
the class ItemJar method getItemStackDisplayName.
@Override
public String getItemStackDisplayName(ItemStack stack) {
if (stack.getItemDamage() == 2) {
FairyData fairy = FairyData.deserialize(NBTHelper.getCompound(stack, "fairy"));
if (fairy == null)
return super.getItemStackDisplayName(stack);
IManaCapability cap = fairy.handler;
double mana = ManaManager.getMana(cap) / ManaManager.getMaxMana(cap);
boolean dulled = fairy.isDepressed;
if (dulled) {
return I18n.translateToLocal("item.wizardry.fairy_jar.dulled.name").trim();
} else if (mana > 0.25 && mana < 0.5) {
return I18n.translateToLocal("item.wizardry.fairy_jar.barely_excited.name").trim();
} else if (mana >= 0.5 && mana < 0.75) {
return I18n.translateToLocal("item.wizardry.fairy_jar.moderately_excited.name").trim();
} else if (mana > 0.75 && mana < 1) {
return I18n.translateToLocal("item.wizardry.fairy_jar.very_excited.name").trim();
} else if (mana >= 1) {
return I18n.translateToLocal("item.wizardry.fairy_jar.overloaded.name").trim();
} else
return super.getItemStackDisplayName(stack);
} else
return super.getItemStackDisplayName(stack);
}
use of com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability in project Wizardry by TeamWizardry.
the class PacketUpdateManaCap method handle.
@Override
public void handle(@Nonnull MessageContext ctx) {
if (ctx.side.isServer())
return;
EntityPlayer player = LibrarianLib.PROXY.getClientPlayer();
IManaCapability cap = ManaCapabilityProvider.getCap(player);
if (cap != null) {
cap.deserializeNBT(tags);
}
}
use of com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability in project Wizardry by TeamWizardry.
the class ModCapabilities method onLogin.
@SubscribeEvent
public static void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
if (event.player.world.isRemote)
return;
IManaCapability manaCap = ManaCapabilityProvider.getCap(event.player);
if (manaCap != null)
manaCap.dataChanged(event.player);
IMiscCapability miscCap = MiscCapabilityProvider.getCap(event.player);
if (miscCap != null)
miscCap.dataChanged(event.player);
}
Aggregations