Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void livingTick(LivingEvent.LivingUpdateEvent event)
- {
- if ((!event.entity.worldObj.isRemote) && ((event.entity instanceof EntityPlayer)))
- {
- EntityPlayer player = (EntityPlayer)event.entity;
- if ((this.isDirty) || (player.ticksExisted % 40 == 0))
- {
- int max = 0;
- int charged = 0;
- int kinetic = 0;
- int healing = 0;
- int emergency = 0;
- this.isDirty = false;
- for (int a = 0; a < 4; a++) {
- if ((player.inventory.armorItemInSlot(a) != null) && ((player.inventory.armorItemInSlot(a).getItem() instanceof IRunicArmor)))
- {
- int amount = getFinalCharge(player.inventory.armorItemInSlot(a));
- max += amount;
- }
- }
- IInventory baubles = BaublesApi.getBaubles(player);
- for (int a = 0; a < 4; a++) {
- if ((baubles.getStackInSlot(a) != null) && ((baubles.getStackInSlot(a).getItem() instanceof IRunicArmor)))
- {
- int amount = getFinalCharge(baubles.getStackInSlot(a));
- if ((baubles.getStackInSlot(a).getItem() instanceof ItemRingRunic)) {
- switch (baubles.getStackInSlot(a).getItemDamage())
- {
- case 2:
- charged++; break;
- case 3:
- healing++;
- }
- } else if (((baubles.getStackInSlot(a).getItem() instanceof ItemAmuletRunic)) && (baubles.getStackInSlot(a).getItemDamage() == 1)) {
- emergency++;
- } else if (((baubles.getStackInSlot(a).getItem() instanceof ItemGirdleRunic)) && (baubles.getStackInSlot(a).getItemDamage() == 1)) {
- kinetic++;
- }
- max += amount;
- }
- }
- if (max > 0)
- {
- this.runicInfo.put(Integer.valueOf(player.getEntityId()), new Integer[] { Integer.valueOf(max), Integer.valueOf(charged), Integer.valueOf(kinetic), Integer.valueOf(healing), Integer.valueOf(emergency) });
- if (this.runicCharge.containsKey(Integer.valueOf(player.getEntityId())))
- {
- int charge = ((Integer)this.runicCharge.get(Integer.valueOf(player.getEntityId()))).intValue();
- if (charge > max)
- {
- this.runicCharge.put(Integer.valueOf(player.getEntityId()), Integer.valueOf(max));
- PacketHandler.INSTANCE.sendTo(new PacketRunicCharge(player, Short.valueOf((short)max), max), (EntityPlayerMP)player);
- }
- }
- }
- else
- {
- this.runicInfo.remove(Integer.valueOf(player.getEntityId()));
- this.runicCharge.put(Integer.valueOf(player.getEntityId()), Integer.valueOf(0));
- PacketHandler.INSTANCE.sendTo(new PacketRunicCharge(player, Short.valueOf((short)0), 0), (EntityPlayerMP)player);
- }
- }
- if (this.rechargeDelay > 0)
- {
- this.rechargeDelay -= 1;
- }
- else if (this.runicInfo.containsKey(Integer.valueOf(player.getEntityId())))
- {
- if (!this.lastCharge.containsKey(Integer.valueOf(player.getEntityId()))) {
- this.lastCharge.put(Integer.valueOf(player.getEntityId()), Integer.valueOf(-1));
- }
- if (!this.runicCharge.containsKey(Integer.valueOf(player.getEntityId()))) {
- this.runicCharge.put(Integer.valueOf(player.getEntityId()), Integer.valueOf(0));
- }
- if (!this.nextCycle.containsKey(Integer.valueOf(player.getEntityId()))) {
- this.nextCycle.put(Integer.valueOf(player.getEntityId()), Long.valueOf(0L));
- }
- long time = System.currentTimeMillis();
- int charge = ((Integer)this.runicCharge.get(Integer.valueOf(player.getEntityId()))).intValue();
- if (charge > ((Integer[])this.runicInfo.get(Integer.valueOf(player.getEntityId())))[0].intValue())
- {
- charge = ((Integer[])this.runicInfo.get(Integer.valueOf(player.getEntityId())))[0].intValue();
- }
- else if ((charge < ((Integer[])this.runicInfo.get(Integer.valueOf(player.getEntityId())))[0].intValue()) && (((Long)this.nextCycle.get(Integer.valueOf(player.getEntityId()))).longValue() < time) && (WandManager.consumeVisFromInventory(player, new AspectList().add(Aspect.AIR, Config.shieldCost).add(Aspect.EARTH, Config.shieldCost))))
- {
- long interval = Config.shieldRecharge - ((Integer[])this.runicInfo.get(Integer.valueOf(player.getEntityId())))[1].intValue() * 500;
- this.nextCycle.put(Integer.valueOf(player.getEntityId()), Long.valueOf(time + interval));
- charge++;
- this.runicCharge.put(Integer.valueOf(player.getEntityId()), Integer.valueOf(charge));
- }
- if (((Integer)this.lastCharge.get(Integer.valueOf(player.getEntityId()))).intValue() != charge)
- {
- PacketHandler.INSTANCE.sendTo(new PacketRunicCharge(player, Short.valueOf((short)charge), ((Integer[])this.runicInfo.get(Integer.valueOf(player.getEntityId())))[0].intValue()), (EntityPlayerMP)player);
- this.lastCharge.put(Integer.valueOf(player.getEntityId()), Integer.valueOf(charge));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement