Search in sources :

Example 11 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class AMEventHandler method onEntityConstructing.

@SubscribeEvent
public void onEntityConstructing(EntityConstructing event) {
    if (event.entity instanceof EntityLivingBase) {
        event.entity.registerExtendedProperties(ExtendedProperties.identifier, new ExtendedProperties());
        ((EntityLivingBase) event.entity).getAttributeMap().registerAttribute(ArsMagicaApi.maxManaBonus);
        ((EntityLivingBase) event.entity).getAttributeMap().registerAttribute(ArsMagicaApi.maxBurnoutBonus);
        ((EntityLivingBase) event.entity).getAttributeMap().registerAttribute(ArsMagicaApi.xpGainModifier);
        ((EntityLivingBase) event.entity).getAttributeMap().registerAttribute(ArsMagicaApi.burnoutReductionRate);
        ((EntityLivingBase) event.entity).getAttributeMap().registerAttribute(ArsMagicaApi.manaRegenTimeModifier);
        if (event.entity instanceof EntityPlayer) {
            event.entity.registerExtendedProperties(RiftStorage.identifier, new RiftStorage());
            event.entity.registerExtendedProperties(AffinityData.identifier, new AffinityData());
            event.entity.registerExtendedProperties(SkillData.identifier, new SkillData((EntityPlayer) event.entity));
        }
    } else if (event.entity instanceof EntityItemFrame) {
        AMCore.proxy.itemFrameWatcher.startWatchingFrame((EntityItemFrame) event.entity);
    }
}
Also used : RiftStorage(am2.playerextensions.RiftStorage) SkillData(am2.playerextensions.SkillData) EntityItemFrame(net.minecraft.entity.item.EntityItemFrame) AffinityData(am2.playerextensions.AffinityData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ExtendedProperties(am2.playerextensions.ExtendedProperties) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 12 with AffinityData

use of am2.playerextensions.AffinityData in project ArsMagica2 by Mithion.

the class AffinityHelper method onEntityJump.

@SubscribeEvent
public void onEntityJump(LivingJumpEvent event) {
    EntityLivingBase ent = event.entityLiving;
    if (!(ent instanceof EntityPlayer))
        return;
    AffinityData affinityData = AffinityData.For(ent);
    float airDepth = affinityData.getAffinityDepth(Affinity.AIR);
    if (airDepth >= 0.5f) {
        float velocity = airDepth * 0.35f;
        if (ExtendedProperties.For(ent).getIsFlipped())
            velocity *= -1;
        ent.addVelocity(0, velocity, 0);
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) AffinityData(am2.playerextensions.AffinityData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

AffinityData (am2.playerextensions.AffinityData)10 Affinity (am2.api.spell.enums.Affinity)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 ItemStack (net.minecraft.item.ItemStack)3 EntityEnderman (net.minecraft.entity.monster.EntityEnderman)2 AffinityChangingEvent (am2.api.events.AffinityChangingEvent)1 ManaCostEvent (am2.api.events.ManaCostEvent)1 SpellRecipeItemsEvent (am2.api.events.SpellRecipeItemsEvent)1 AMVector2 (am2.api.math.AMVector2)1 AMVector3 (am2.api.math.AMVector3)1 PowerTypes (am2.api.power.PowerTypes)1 AMDataWriter (am2.network.AMDataWriter)1 ExtendedProperties (am2.playerextensions.ExtendedProperties)1 RiftStorage (am2.playerextensions.RiftStorage)1 SkillData (am2.playerextensions.SkillData)1 SpellRequirements (am2.spell.SpellUtils.SpellRequirements)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Block (net.minecraft.block.Block)1