Search in sources :

Example 21 with CapManager

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;
    }
}
Also used : CapManager(com.teamwizardry.wizardry.api.capability.CapManager) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d)

Example 22 with CapManager

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();
}
Also used : CapManager(com.teamwizardry.wizardry.api.capability.CapManager)

Example 23 with CapManager

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));
}
Also used : CapManager(com.teamwizardry.wizardry.api.capability.CapManager) Nonnull(javax.annotation.Nonnull)

Example 24 with CapManager

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());
        }
    }
}
Also used : CapManager(com.teamwizardry.wizardry.api.capability.CapManager) PotionEffect(net.minecraft.potion.PotionEffect) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 25 with CapManager

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();
}
Also used : CapManager(com.teamwizardry.wizardry.api.capability.CapManager)

Aggregations

CapManager (com.teamwizardry.wizardry.api.capability.CapManager)26 Vec3d (net.minecraft.util.math.Vec3d)8 BlockPos (net.minecraft.util.math.BlockPos)6 ItemStack (net.minecraft.item.ItemStack)5 Entity (net.minecraft.entity.Entity)4 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 TileEntity (net.minecraft.tileentity.TileEntity)3 ParticleBuilder (com.teamwizardry.librarianlib.features.particle.ParticleBuilder)2 InterpFadeInOut (com.teamwizardry.librarianlib.features.particle.functions.InterpFadeInOut)2 ClientRunnable (com.teamwizardry.librarianlib.features.utilities.client.ClientRunnable)2 IWizardryCapability (com.teamwizardry.wizardry.api.capability.IWizardryCapability)2 PacketExplode (com.teamwizardry.wizardry.common.network.PacketExplode)2 TilePearlHolder (com.teamwizardry.wizardry.common.tile.TilePearlHolder)2 EntityItem (net.minecraft.entity.item.EntityItem)2 PotionEffect (net.minecraft.potion.PotionEffect)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 NetworkRegistry (net.minecraftforge.fml.common.network.NetworkRegistry)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 BasicAnimation (com.teamwizardry.librarianlib.features.animator.animations.BasicAnimation)1