Package net.minecraft.entity

Examples of net.minecraft.entity.EntityLivingBase


    }

    if (handle) {
      Entity source = event.source.getSourceOfDamage();
      if (source != null && source instanceof EntityLivingBase) {
        EntityLivingBase attacker = (EntityLivingBase) source;
        ItemStack itemInUse = attacker.getHeldItem();
        if (itemInUse != null && itemInUse.getItem() == this)
          attacker.attackEntityFrom(DamageSource.magic, 2);
      }
    }
  }
View Full Code Here


    super.render(entity, v1, v2, v3, v4, v5, v6);
  }

  @Override
  public void setRotationAngles(float v1, float v2, float v3, float v4, float v5, float v6, Entity entity) {
    EntityLivingBase living = (EntityLivingBase) entity;
    isSneak = living != null && living.isSneaking();
    if (living != null && living instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) living;

      ItemStack itemstack = player.inventory.getCurrentItem();
      heldItemRight = itemstack != null ? 1 : 0;
View Full Code Here

  public final String NBTTunnelDirection = "TTEnchantTunnelDir";

  @SubscribeEvent
  public void onEntityDamaged(LivingHurtEvent event) {
    if (event.source.getEntity() instanceof EntityLivingBase) {
      EntityLivingBase attacker = (EntityLivingBase) event.source.getEntity();
      ItemStack heldItem = attacker.getHeldItem();

      if (heldItem == null)
        return;

     
      if (attacker instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) attacker;

        ItemStack legs = player.getCurrentArmor(1);
        int pounce = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.pounce, legs);
        if (pounce > 0) {
          if (player.worldObj.getBlock((int) Math.floor(player.posX), (int) Math.floor(player.posY) - 1, (int) Math.floor(player.posZ)) == net.minecraft.init.Blocks.air) {

            event.ammount *= 1 + (.25 * pounce);
          }
        }

      }

      int finalStrike = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.finalStrike, heldItem);
      if (finalStrike > 0) {
        Random rand = new Random();
        if (rand.nextInt(20 - finalStrike) == 0) {
          event.ammount *= 3;
        }
      }

      int valiance = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.valiance, heldItem);
      if (valiance > 0) {
        if (attacker.getHealth() / attacker.getMaxHealth() < .5F) {
          event.ammount *= (1 + .1 * valiance);
        }
      }

      int focusedStrikes = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.focusedStrike, heldItem);

      int dispersedStrikes = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.dispersedStrikes, heldItem);

      if (focusedStrikes > 0 || dispersedStrikes > 0) {
        if (heldItem.stackTagCompound == null) {
          heldItem.stackTagCompound = new NBTTagCompound();
        }
        int lastTarget = heldItem.stackTagCompound.getInteger(NBTLastTarget);
        int successiveStrikes = heldItem.stackTagCompound.getInteger(NBTSuccessiveStrike);
        int entityId = event.entityLiving.getEntityId();

        if (lastTarget != entityId) {
          heldItem.stackTagCompound.setInteger(NBTSuccessiveStrike, 0);
          successiveStrikes = 0;
        } else {
          heldItem.stackTagCompound.setInteger(NBTSuccessiveStrike, successiveStrikes + 1);
          successiveStrikes = 1;
        }

        if (focusedStrikes > 0) {
          event.ammount /= 2;
          event.ammount += (.5 * successiveStrikes * event.ammount * focusedStrikes);
        }
        if (dispersedStrikes > 0) {
          event.ammount *= 1 + (successiveStrikes / 5);
          event.ammount /= (1 + (successiveStrikes * 2));
        }

        heldItem.stackTagCompound.setInteger("TTEnchantLastTarget", entityId);

      }

      int vampirism = EnchantmentHelper.getEnchantmentLevel(LibEnchantIDs.idVampirism, heldItem);
      if (vampirism > 0) {
        attacker.heal(vampirism);
        event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "thaumcraft:zap", 0.6F, 1F);
      }
    }
  }
View Full Code Here

          ignoreLeftClick = false;

          break;
        }
        case 2: {
          EntityLivingBase living = (EntityLivingBase) entity;
          PotionEffect effect = new PotionEffect(Potion.resistance.id, 1, 1);
          living.addPotionEffect(effect);

          SoulHeartHandler.addHearts(player);

          break;
        }
View Full Code Here

  @Override
  public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {

   
    EntityLivingBase entityPlayer = Minecraft.getMinecraft().thePlayer;
    Matrix4d lookMat = RenderUtil.createBillboardMatrix(te, entityPlayer);

    int brightness = RenderUtil.setTesselatorBrightness(entityPlayer.worldObj, te.xCoord, te.yCoord, te.zCoord);
    render(x, y, z, lookMat, brightness);
View Full Code Here

            for(MerchantRecipe recipe : recipes)
              if(!recipe.isRecipeDisabled() && (equalStacks(pstack, recipe.getItemToBuy()) || equalStacks(pstack, recipe.getItemToSell())))
                positionsBuilder.append(villager.getEntityId()).append(";");

        } else if(e instanceof EntityLivingBase) {
          EntityLivingBase living = (EntityLivingBase) e;
          ItemStack estack = living.getEquipmentInSlot(0);
          if(pstack != null && estack != null && equalStacks(estack, pstack))
            positionsBuilder.append(living.getEntityId()).append(";");
        }
      }

      if(pstack != null) {
        range = 12;
View Full Code Here

    this.depthTest = depthTest;

    moteHalfLife = particleMaxAge / 2;
    noClip = true;
    setSize(0.01F, 0.01F);
    EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity;

    if(distanceLimit) {
      int visibleDistance = 50;
      if (!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics)
        visibleDistance = 25;

      if (renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance)
        particleMaxAge = 0;
    }

    prevPosX = posX;
    prevPosY = posY;
View Full Code Here

      if(ManaItemHandler.requestManaExact(stack, player, COST, true) && item != null) {
        if(item instanceof EntityItem)
          ((EntityItem)item).delayBeforeCanPickup = 5;

        if(item instanceof EntityLivingBase) {
          EntityLivingBase targetEntity = (EntityLivingBase)item;
          targetEntity.fallDistance = 0.0F;
          if(targetEntity.getActivePotionEffect(Potion.moveSlowdown) == null)
            targetEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2, 3, true));
        }

        Vector3 target3 = Vector3.fromEntityCenter(player);
        target3.add(new Vector3(player.getLookVec()).multiply(length));
        target3.y += 0.5;
View Full Code Here

        }
      }
  }

  public static boolean brainwashEntity(EntityLiving entity, List<IMob> mobs) {
    EntityLivingBase target = entity.getAttackTarget();
    boolean did = false;

    if(target == null || !(target instanceof IMob)) {
      IMob newTarget;
      do newTarget = mobs.get(entity.worldObj.rand.nextInt(mobs.size()));
View Full Code Here

    return false;
  }

  @SubscribeEvent
  public void onLivingHurt(LivingHurtEvent event) {
    EntityLivingBase entity = event.entityLiving;
    if(entity.ridingEntity != null && entity.ridingEntity instanceof EntityLivingBase)
      entity = (EntityLivingBase) entity.ridingEntity;

    if(entity instanceof EntityHorse && event.source == DamageSource.fall) {
      EntityHorse horse = (EntityHorse) entity;
View Full Code Here

TOP

Related Classes of net.minecraft.entity.EntityLivingBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.