Package net.minecraft.entity

Examples of net.minecraft.entity.EntityLivingBase


  }
 
  @SubscribeEvent
  public void onLivingUpdate(LivingUpdateEvent event) {
   
    EntityLivingBase entity = event.entityLiving;
    EntityPlayer player = ((entity instanceof EntityPlayer) ? (EntityPlayer)entity : null);
    ItemStack backpack = ItemBackpack.getBackpack(entity);
   
    PropertiesBackpack backpackData;
    if (backpack == null) {
     
      backpackData = EntityUtils.getProperties(entity, PropertiesBackpack.class);
      if (backpackData == null) return;
     
      // If the entity is supposed to spawn
      // with a backpack, equip it with one.
      if (backpackData.spawnsWithBackpack) {
       
        ItemStack[] contents = null;
        if (entity instanceof EntityFrienderman) {
          backpack = new ItemStack(BetterStorageItems.itemEnderBackpack);
          // Remove drop chance for the backpack.
          ((EntityLiving)entity).setEquipmentDropChance(EquipmentSlot.CHEST, 0.0F);
        } else {
          backpack = new ItemStack(BetterStorageItems.itemBackpack, 1, RandomUtils.getInt(120, 240));
          ItemBackpack backpackType = (ItemBackpack)backpack.getItem();
          if (RandomUtils.getBoolean(0.15)) {
            // Give the backpack a random color.
            int r = RandomUtils.getInt(32, 224);
            int g = RandomUtils.getInt(32, 224);
            int b = RandomUtils.getInt(32, 224);
            int color = (r << 16) | (g << 8) | b;
            StackUtils.set(backpack, color, "display", "color");
          }
          contents = new ItemStack[backpackType.getBackpackColumns() * backpackType.getBackpackRows()];
          // Set drop chance for the backpack to 100%.
          ((EntityLiving)entity).setEquipmentDropChance(EquipmentSlot.CHEST, 1.0F);
        }
       
        // If the entity spawned with enchanted armor,
        // move the enchantments over to the backpack.
        ItemStack armor = entity.getEquipmentInSlot(EquipmentSlot.CHEST);
        if (armor != null && armor.isItemEnchanted()) {
          NBTTagCompound compound = new NBTTagCompound();
          compound.setTag("ench", armor.getTagCompound().getTag("ench"));
          backpack.setTagCompound(compound);
        }
View Full Code Here


  public void onLivingDeath(LivingDeathEvent event) {
   
    // If an entity wearing a backpack dies,
    // try to place it, or drop the items.
   
    EntityLivingBase entity = event.entityLiving;
    if (entity.worldObj.isRemote) return;

    EntityPlayer player = ((entity instanceof EntityPlayer) ? (EntityPlayer)entity : null);
    ItemStack backpack = ItemBackpack.getBackpack(entity);
    if (backpack == null) return;
View Full Code Here

        boolean unused = false;
        int left_align = width / 2 + 91;

        mc.mcProfiler.endStartSection("mountHealth");
        GL11.glEnable(GL11.GL_BLEND);
        EntityLivingBase mount = (EntityLivingBase)tmp;
        int health = (int)Math.ceil((double)mount.getHealth());
        float healthMax = mount.getMaxHealth();
        int hearts = (int)(healthMax + 0.5F) / 2;

        if (hearts > 30) hearts = 30;

        final int MARGIN = 52;
View Full Code Here

    @SuppressWarnings("rawtypes")
    List list = housing.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);

    for (Object obj : list) {
      EntityLivingBase entity = (EntityLivingBase) obj;

      int damage = 8;

      // Players are not attacked if they wear a full set of apiarist's
      // armor.
      if (entity instanceof EntityPlayer) {
        int count = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
        // Full set, no damage/effect
        if (count > 3)
          continue;
        else if (count > 2)
          damage = 1;
        else if (count > 1)
          damage = 2;
        else if (count > 0)
          damage = 3;
      }

      entity.attackEntityFrom(damageSourceBeeRadioactive, damage);

    }

    Random rand = housing.getWorld().rand;
    // Radioactivity destroys environment
View Full Code Here

    float rotationZ = ActiveRenderInfo.rotationZ;
    float rotationYZ = ActiveRenderInfo.rotationYZ;
    float rotationXY = ActiveRenderInfo.rotationXY;
    float rotationXZ = ActiveRenderInfo.rotationXZ;

    EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;
    EntityFX.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
    EntityFX.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
    EntityFX.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;

    // bind the texture
View Full Code Here

    AxisAlignedBB hurtBox = getBounding(genome, housing, 1.0f);
    @SuppressWarnings("rawtypes")
    List list = world.getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);

    for (Object obj : list) {
      EntityLivingBase entity = (EntityLivingBase) obj;

      int chance = ignitionChance;
      int duration = fireDuration;

      // Players are not attacked if they wear a full set of apiarist's
      // armor.
      if (entity instanceof EntityPlayer) {
        int count = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
        // Full set, no damage/effect
        if (count > 3)
          continue;
        else if (count > 2) {
          chance = 5;
          duration = 50;
        } else if (count > 1) {
          chance = 20;
          duration = 200;
        } else if (count > 0) {
          chance = 35;
          duration = 350;
        }
      }

      if (world.rand.nextInt(1000) >= chance)
        continue;

      entity.setFire(duration);
    }

    return storedData;
  }
View Full Code Here

    setDamageBypassesArmor();
  }

  @Override
  public IChatComponent func_151519_b(EntityLivingBase living) {
    EntityLivingBase other = living.func_94060_bK();
    String ssp = "death." + this.damageType;
    String smp = ssp + ".player";

    if (other != null) {
      return new ChatComponentTranslation(smp, living.func_145748_c_(), other.func_145748_c_());
    } else {
      return new ChatComponentTranslation(ssp, living.func_145748_c_());
    }
  }
View Full Code Here

    AxisAlignedBB hurtBox = getBounding(genome, housing, 1.0f);
    @SuppressWarnings("rawtypes")
    List list = housing.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);

    for (Object obj : list) {
      EntityLivingBase entity = (EntityLivingBase) obj;

      int damage = 4;

      // Players are not attacked if they wear a full set of apiarist's
      // armor.
      if (entity instanceof EntityPlayer) {
        int count = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
        // Full set, no damage/effect
        if (count > 3)
          continue;
        else if (count > 2)
          damage = 1;
        else if (count > 1)
          damage = 2;
        else if (count > 0)
          damage = 3;
      }

      entity.attackEntityFrom(damageSourceBeeAggressive, damage);
    }

    return storedData;
  }
View Full Code Here

    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    this.particleMaxAge = 0;
    this.random = RAND.nextFloat() * RAND.nextInt(360 / ROTATIONSPEED);
    EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity;
    int visibleDistance = 50;
    if(!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) {
      visibleDistance = 25;
    }
    if(renderentity.getDistance(this.posX, this.posY, this.posZ) > visibleDistance) {
      this.setDead();
    }
  }
View Full Code Here

    this.random = RAND.nextFloat() * RAND.nextInt(10);
    dir = dir.getOpposite();
    this.yaw = ((float)(Math.atan2(dir.offsetX, dir.offsetZ) * 180.0D / Math.PI));
    this.pitch = ((float)(Math.atan2(dir.offsetY, MathHelper.sqrt_double(dir.offsetX * dir.offsetX + dir.offsetZ * dir.offsetZ)) * 180.0D / Math.PI));
    this.particleMaxAge = 0;
    EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity;
    int visibleDistance = 50;
    if(!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) {
      visibleDistance = 25;
    }
    if(renderentity.getDistance(this.posX, this.posY, this.posZ) > visibleDistance) {
      this.setDead();
    }
  }
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.