Search in sources :

Example 61 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class EntitySpellProjectile method getShootingEntity.

private EntityLivingBase getShootingEntity() {
    int entityID = this.dataWatcher.getWatchableObjectInt(DW_SHOOTER);
    Entity e = this.worldObj.getEntityByID(entityID);
    if (e != null && e instanceof EntityLivingBase)
        return (EntityLivingBase) e;
    return null;
}
Also used : Entity(net.minecraft.entity.Entity) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 62 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class AMPacketProcessorClient method handleSpellApplyEffect.

private void handleSpellApplyEffect(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    double x = rdr.getDouble();
    double y = rdr.getDouble();
    double z = rdr.getDouble();
    ItemStack spellStack = rdr.getBoolean() ? rdr.getItemStack() : null;
    if (spellStack == null)
        return;
    int casterID = rdr.getInt();
    int targetID = rdr.getInt();
    Entity caster = Minecraft.getMinecraft().theWorld.getEntityByID(casterID);
    Entity target = Minecraft.getMinecraft().theWorld.getEntityByID(targetID);
    if (caster == null || target == null || !(caster instanceof EntityLivingBase) || !(target instanceof EntityLivingBase))
        return;
    SpellHelper.instance.applyStackStage(spellStack, (EntityLivingBase) caster, (EntityLivingBase) target, x, y, z, 0, Minecraft.getMinecraft().theWorld, false, false, 0);
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityLivingBase(net.minecraft.entity.EntityLivingBase) ItemStack(net.minecraft.item.ItemStack)

Example 63 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class AMPacketProcessorServer method handlePossibleClientExpropDesync.

private void handlePossibleClientExpropDesync(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    int entityID = rdr.getInt();
    EntityLivingBase e = getEntityByID(entityID);
    if (e != null && e instanceof EntityPlayer) {
        ExtendedProperties props = ExtendedProperties.For(e);
        if (!props.detectPossibleDesync()) {
            props.setFullSync();
            props.forceSync();
        }
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ExtendedProperties(am2.playerextensions.ExtendedProperties)

Example 64 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class AMPacketProcessorServer method handleRequestBetaParticles.

private void handleRequestBetaParticles(byte[] data, EntityPlayerMP player) {
    AMDataReader rdr = new AMDataReader(data, false);
    int requesterID = rdr.getInt();
    int entityID = rdr.getInt();
    EntityLivingBase entity = getEntityByID(entityID);
    if (player == null || entity == null || !(entity instanceof EntityPlayer))
        return;
    if (!AMCore.proxy.playerTracker.hasAA((EntityPlayer) entity))
        return;
    byte[] expropData = ExtendedProperties.For(entity).getAuraData();
    AMDataWriter writer = new AMDataWriter();
    writer.add(entity.getEntityId());
    writer.add(expropData);
    AMNetHandler.INSTANCE.sendPacketToClientPlayer(player, AMPacketIDs.REQUEST_BETA_PARTICLES, writer.generate());
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 65 with EntityLivingBase

use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.

the class AMPacketProcessorClient method handleSyncAir.

private void handleSyncAir(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    int entityID = rdr.getInt();
    int air = rdr.getInt();
    EntityLivingBase ent = AMCore.proxy.getEntityByID(entityID);
    if (ent == null)
        return;
    ent.setAir(air);
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Aggregations

EntityLivingBase (net.minecraft.entity.EntityLivingBase)270 EntityPlayer (net.minecraft.entity.player.EntityPlayer)100 Entity (net.minecraft.entity.Entity)72 PotionEffect (net.minecraft.potion.PotionEffect)43 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)39 ItemStack (net.minecraft.item.ItemStack)36 Vec3d (net.minecraft.util.math.Vec3d)25 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)25 BlockPos (net.minecraft.util.math.BlockPos)24 TileEntity (net.minecraft.tileentity.TileEntity)23 World (net.minecraft.world.World)20 IBlockState (net.minecraft.block.state.IBlockState)19 AMVector3 (am2.api.math.AMVector3)15 IArsMagicaBoss (am2.bosses.IArsMagicaBoss)15 ArrayList (java.util.ArrayList)15 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)15 Block (net.minecraft.block.Block)12 EntityItem (net.minecraft.entity.item.EntityItem)11 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)11 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)10