Search in sources :

Example 66 with EntityLivingBase

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

the class AMPacketProcessorServer method handleSpellCustomize.

private void handleSpellCustomize(byte[] data, EntityPlayerMP player) {
    AMDataReader rdr = new AMDataReader(data, false);
    int entityID = rdr.getInt();
    EntityLivingBase ent = getEntityByID(entityID);
    if (player == null) {
        return;
    }
    int IIconIndex = rdr.getInt();
    String name = rdr.getString();
    if (player.openContainer instanceof ContainerSpellCustomization) {
        ((ContainerSpellCustomization) player.openContainer).setNameAndIndex(name, IIconIndex);
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) ContainerSpellCustomization(am2.containers.ContainerSpellCustomization)

Example 67 with EntityLivingBase

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

the class AMPacketProcessorClient method handleSyncProps.

private void handleSyncProps(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    int entityID = rdr.getInt();
    EntityLivingBase ent = AMCore.proxy.getEntityByID(entityID);
    if (ent == null)
        return;
    if (!ExtendedProperties.For(ent).handleDataPacket(data)) {
        LogHelper.error("Critical Error Handling Sync Packet!");
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 68 with EntityLivingBase

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

the class AMPacketProcessorClient method handleVelocityAdd.

private void handleVelocityAdd(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    int entityID = rdr.getInt();
    double velX = rdr.getDouble();
    double velY = rdr.getDouble();
    double velZ = rdr.getDouble();
    Entity ent = AMCore.proxy.getEntityByID(entityID);
    EntityLivingBase localPlayer = Minecraft.getMinecraft().thePlayer;
    //this is only really required for the local player, as other entities seem to work across the network.
    if (ent.getEntityId() != localPlayer.getEntityId()) {
        return;
    }
    if (localPlayer.motionY > 0)
        return;
    localPlayer.addVelocity(velX, velY, velZ);
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 69 with EntityLivingBase

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

the class AMPacketProcessorClient method handleRequestBetaParticles.

private void handleRequestBetaParticles(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    int entityID = rdr.getInt();
    byte[] expropData = rdr.getRemainingBytes();
    EntityLivingBase ent = AMCore.proxy.getEntityByID(entityID);
    if (ent == null)
        return;
    ExtendedProperties.For(ent).readAuraData(expropData);
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 70 with EntityLivingBase

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

the class Appropriation method applyEffectEntity.

@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
    if (target instanceof EntityPlayer || target instanceof IBossDisplayData)
        return false;
    if (!(target instanceof EntityLivingBase))
        return false;
    for (Class clazz : AMCore.config.getAppropriationMobBlacklist()) if (target.getClass() == clazz)
        return false;
    if (!(caster instanceof EntityPlayer))
        return false;
    ItemStack originalSpellStack = getOriginalSpellStack((EntityPlayer) caster);
    if (originalSpellStack == null)
        return false;
    if (!world.isRemote) {
        if (originalSpellStack.stackTagCompound.hasKey(storageKey)) {
            restore((EntityPlayer) caster, world, originalSpellStack, (int) target.posX, (int) target.posY, (int) target.posZ, target.posX, target.posY + target.getEyeHeight(), target.posZ);
        } else {
            NBTTagCompound data = new NBTTagCompound();
            data.setString("class", target.getClass().getName());
            data.setString(storageType, "ent");
            NBTTagCompound targetData = new NBTTagCompound();
            target.writeToNBT(targetData);
            data.setTag("targetNBT", targetData);
            originalSpellStack.stackTagCompound.setTag(storageKey, data);
            setOriginalSpellStackData((EntityPlayer) caster, originalSpellStack);
            target.setDead();
        }
    }
    return true;
}
Also used : IBossDisplayData(net.minecraft.entity.boss.IBossDisplayData) EntityLivingBase(net.minecraft.entity.EntityLivingBase) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) DummyEntityPlayer(am2.utility.DummyEntityPlayer) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

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