use of com.teamwizardry.wizardry.api.capability.IWizardryCapability in project Wizardry by TeamWizardry.
the class TileManaInteracter method drainMana.
public double drainMana(double mana) {
if (!world.isBlockLoaded(pos))
return -1;
IWizardryCapability cap = getWizardryCap();
if (cap == null)
return -1;
double amount = MathHelper.clamp(cap.getMana(), 0, mana);
CapManager manager = new CapManager(cap);
manager.removeMana(amount);
return amount;
}
use of com.teamwizardry.wizardry.api.capability.IWizardryCapability 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) {
IWizardryCapability cap = WizardryCapabilityProvider.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.IWizardryCapability in project Wizardry by TeamWizardry.
the class TilePearlHolder method update.
@Override
public void update() {
super.update();
if (containsNacrePearl()) {
if (world.isRemote)
return;
updateCooldown(getItemStack());
IWizardryCapability pearlCap = WizardryCapabilityProvider.getCap(getItemStack());
if (pearlCap == null || pearlCap.getMana() > pearlCap.getMaxMana() || isPartOfStructure || structurePos != null)
return;
if (world.isBlockPowered(getPos()))
return;
if (isCoolingDown(getItemStack()))
return;
if (pearlCap.getMana() == 0)
return;
BlockPos closestMagnet = null;
for (int i = -10; i < 10; i++) for (int j = -10; j < 10; j++) for (int k = -10; k < 10; k++) {
BlockPos pos = new BlockPos(getPos().getX() + i, getPos().getY() + j, getPos().getZ() + k);
if (world.getBlockState(pos).getBlock() != ModBlocks.MANA_MAGNET)
continue;
if (closestMagnet == null)
closestMagnet = pos;
else if (pos.distanceSq(getPos()) < getPos().distanceSq(closestMagnet))
closestMagnet = pos;
}
if (closestMagnet == null)
return;
{
Vec3d direction = new Vec3d(closestMagnet).subtract(new Vec3d(getPos())).normalize();
SpellData spell = new SpellData(getWorld());
spell.addData(LOOK, direction);
spell.addData(ORIGIN, new Vec3d(getPos()).addVector(0.5, 1.5, 0.5));
spell.addData(CAPABILITY, pearlCap);
SpellUtils.runSpell(getItemStack(), spell);
setCooldown(world, null, null, getItemStack(), spell);
}
}
}
use of com.teamwizardry.wizardry.api.capability.IWizardryCapability in project Wizardry by TeamWizardry.
the class PacketUpdateCaps method handle.
@Override
public void handle(@Nonnull MessageContext ctx) {
EntityPlayer player = LibrarianLib.PROXY.getClientPlayer();
IWizardryCapability cap = WizardryCapabilityProvider.getCap(player);
if (cap != null) {
cap.deserializeNBT(tags);
}
}
Aggregations