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);
}
}
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);
}
}
Aggregations