use of com.teamwizardry.wizardry.api.capability.CapManager in project Wizardry by TeamWizardry.
the class ClusterObject method tick.
public void tick(World world, Random random) {
tick++;
if ((world.getTotalWorldTime() - worldTime) >= destTime) {
CapManager manager = new CapManager(plate.getWizardryCap());
if (manager.isManaEmpty()) {
origin = dest;
dest = new Vec3d(RandUtil.nextDouble(-0.3, 0.3), RandUtil.nextDouble(0.5, 0.6), RandUtil.nextDouble(-0.3, 0.3));
worldTime = world.getTotalWorldTime();
destTime = RandUtil.nextDouble(10, 30);
return;
}
ItemStack input = plate.inputPearl.getHandler().getStackInSlot(0);
CapManager manager1 = new CapManager(input);
double t = 1 - (manager1.getMana() / manager1.getMaxMana());
double radius = RandUtil.nextDouble(5, 8) * t;
angle += RandUtil.nextDouble(-1.5, 1.5);
double x = MathHelper.cos((float) angle) * radius;
double z = MathHelper.sin((float) angle) * radius;
Vec3d newDest = new Vec3d(x, (2 + (random.nextFloat() * 7)) * t, z);
origin = dest;
dest = newDest;
worldTime = world.getTotalWorldTime();
destTime = RandUtil.nextDouble(10, 30) * t;
}
}
use of com.teamwizardry.wizardry.api.capability.CapManager in project Wizardry by TeamWizardry.
the class ItemRealHaloBauble method onWornTick.
@Override
public void onWornTick(@Nonnull ItemStack stack, @Nonnull EntityLivingBase player) {
CapManager manager = new CapManager(player).setManualSync(true);
manager.setMaxMana(ConfigValues.realHaloBufferSize);
manager.setMaxBurnout(ConfigValues.realHaloBufferSize);
if (manager.getMana() > ConfigValues.realHaloBufferSize)
manager.setMana(ConfigValues.realHaloBufferSize);
if (manager.getBurnout() > ConfigValues.realHaloBufferSize)
manager.setBurnout(ConfigValues.realHaloBufferSize);
if (!manager.isManaFull())
manager.addMana(manager.getMaxMana() * ConfigValues.haloGenSpeed);
if (!manager.isBurnoutEmpty())
manager.removeBurnout(manager.getMaxBurnout() * ConfigValues.haloGenSpeed);
if (manager.isSomethingChanged())
manager.sync();
}
use of com.teamwizardry.wizardry.api.capability.CapManager in project Wizardry by TeamWizardry.
the class ItemOrb method getUnlocalizedName.
@Override
@Nonnull
public String getUnlocalizedName(@Nonnull ItemStack stack) {
CapManager manager = new CapManager(stack);
float percentage = (int) (10 * manager.getMana() / manager.getMaxMana()) / 10f;
return super.getUnlocalizedName(stack) + ".fill." + ((int) (percentage * 100));
}
use of com.teamwizardry.wizardry.api.capability.CapManager in project Wizardry by TeamWizardry.
the class ItemSyringe method onUsingTick.
@Override
public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) {
if (!(player instanceof EntityPlayer))
return;
if (count <= 1) {
player.swingArm(player.getActiveHand());
((EntityPlayer) player).getCooldownTracker().setCooldown(this, stack.getItemDamage() == 1 ? 100 : 500);
if (stack.getItemDamage() == 2) {
player.addPotionEffect(new PotionEffect(ModPotions.STEROID, 500, 0, true, false));
stack.setItemDamage(0);
} else if (stack.getItemDamage() == 1) {
CapManager manager = new CapManager(player);
manager.addMana(manager.getMaxMana() / 2);
player.attackEntityFrom(DamageSourceMana.INSTANCE, 2);
stack.setItemDamage(0);
} else if (stack.getItemDamage() == 0) {
player.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) player), 2);
stack.setItemDamage(3);
ItemNBTHelper.setUUID(stack, "uuid", player.getUniqueID());
}
}
}
use of com.teamwizardry.wizardry.api.capability.CapManager in project Wizardry by TeamWizardry.
the class ItemCreativeHaloBauble method onWornTick.
@Override
public void onWornTick(@Nonnull ItemStack stack, @Nonnull EntityLivingBase player) {
CapManager manager = new CapManager(player).setManualSync(true);
manager.setMaxMana(ConfigValues.creativeHaloBufferSize);
manager.setMaxBurnout(ConfigValues.creativeHaloBufferSize);
manager.setMana(ConfigValues.creativeHaloBufferSize);
manager.setBurnout(0);
if (manager.isSomethingChanged())
manager.sync();
}
Aggregations