Beispiel #1
0
 @Override
 public void harvestBlock(
     World world, EntityPlayer entityplayer, int x, int y, int z, int fortune) {
   super.harvestBlock(world, entityplayer, x, y, z, fortune);
   if (!name.equals("oreEnder")) return;
   if (!world.isRemote
       && world.rand.nextInt(100) < 20
       && ArtificeConfig.spawnEndermen
       && !EnchantmentHelper.getSilkTouchModifier(entityplayer)) {
     int tries = world.rand.nextInt(20);
     for (int i = 0; i < tries; i++) {
       int spawnX = x + world.rand.nextInt(3) - world.rand.nextInt(3);
       int spawnY = y + world.rand.nextInt(3) - world.rand.nextInt(3);
       int spawnZ = z + world.rand.nextInt(3) - world.rand.nextInt(3);
       if (canSpawnEnder(world, spawnX, spawnY, spawnZ)) {
         EntityEnderman ender = new EntityEnderman(world);
         ender.setLocationAndAngles(
             (double) spawnX + world.rand.nextDouble(),
             (double) spawnY + world.rand.nextDouble(),
             (double) spawnZ + world.rand.nextDouble(),
             world.rand.nextFloat(),
             world.rand.nextFloat());
         world.spawnEntityInWorld(ender);
         ender.spawnExplosionParticle();
         ender.playSound("mob.endermen.portal", 1.0F, 1.0F);
         break;
       }
     }
   }
 }
Beispiel #2
0
  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {

    EntityEnderman enderman = new EntityEnderman(world);
    enderman.setLocationAndAngles(player.posX, player.posY, player.posZ, 0, 0);
    world.spawnEntityInWorld(enderman);

    if (!player.capabilities.isCreativeMode) {
      stack.stackSize--;
    }
    return stack;
  }
  @SubscribeEvent
  public void onLivingDrops(LivingDropsEvent event) {
    if (InitConfig.extraBlockDrops) {
      if (event.entityLiving instanceof EntityAnimal) {
        event.drops.add(
            new EntityItem(
                event.entityLiving.worldObj,
                event.entityLiving.posX,
                event.entityLiving.posY,
                event.entityLiving.posZ,
                new ItemStack(Items.bone, this.rand.nextInt(3) * event.lootingLevel, 1)));
      } else if (event.entityLiving instanceof EntityCreeper) {
        if (this.rand.nextInt(50) > 5) {
          event.drops.add(
              new EntityItem(
                  event.entityLiving.worldObj,
                  event.entityLiving.posX,
                  event.entityLiving.posY,
                  event.entityLiving.posZ,
                  new ItemStack(Blocks.tnt, this.rand.nextInt(1) + event.lootingLevel, 1)));
        }
      } else if (event.entityLiving instanceof EntityEnderman) {
        EntityEnderman enderman = (EntityEnderman) event.entityLiving;
        event.drops.add(
            new EntityItem(
                event.entityLiving.worldObj,
                event.entityLiving.posX,
                event.entityLiving.posY,
                event.entityLiving.posZ,
                enderman.getHeldItem()));
      }
    } else if ((event.entityLiving instanceof EntityDragon) && InitConfig.dragonDrop) {
      event.entityLiving.dropItem(InitItems.itemEnderGlove, 1);
    }
    if (event.source.getEntity() instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) event.source.getEntity();
      Iterator<EntityItem> iterator = event.drops.iterator();
      while (iterator.hasNext()) {
        EntityItem entItem = iterator.next();
        ItemStack is = entItem.getEntityItem();

        if (is != null) {
          InventoryUtils.addItemStackToInventory(InventoryUtils.getPlayerEnderChest(player), is);
          entItem.setDead();
        }
      }
    }
  }
 @Override
 protected void applyEntityAttributes() {
   super.applyEntityAttributes();
   this.getEntityAttribute(SharedMonsterAttributes.attackDamage)
       .setBaseValue(TFC_MobData.EndermanDamage);
   this.getEntityAttribute(SharedMonsterAttributes.maxHealth)
       .setBaseValue(TFC_MobData.EndermanHealth); // MaxHealth
 }
  @Override
  public List<RandomMob> getRandomMobs(World world) {
    List<RandomMob> mobs = new ArrayList<RandomMob>();

    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityMooshroom.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntitySlime.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityCow.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityChicken.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntitySheep.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityWitch.class, world), 10));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityGhast.class, world), 15));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityPig.class, world), 100));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityCreeper.class, world), 25));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntitySquid.class, world), 30));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityOcelot.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityWolf.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityBat.class, world), 35));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityHorse.class, world), 20));
    mobs.add(new RandomMob(MFRUtil.prepareMob(EntityMinecartHopper.class, world), 15));

    EntityCreeper chargedCreeper = (EntityCreeper) MFRUtil.prepareMob(EntityCreeper.class, world);
    NBTTagCompound creeperNBT = new NBTTagCompound();
    chargedCreeper.writeToNBT(creeperNBT);
    creeperNBT.setBoolean("powered", true);
    creeperNBT.setShort("Fuse", (short) 120);
    chargedCreeper.readFromNBT(creeperNBT);
    mobs.add(new RandomMob(chargedCreeper, 5));

    EntityTNTPrimed armedTNT = (EntityTNTPrimed) MFRUtil.prepareMob(EntityTNTPrimed.class, world);
    armedTNT.fuse = 120;
    mobs.add(new RandomMob(armedTNT, 5));

    EntitySlime invisislime = (EntitySlime) MFRUtil.prepareMob(EntitySlime.class, world);
    invisislime.addPotionEffect(new PotionEffect(Potion.invisibility.id, 120 * 20));
    mobs.add(new RandomMob(invisislime, 5));

    EntityMooshroom invisishroom =
        (EntityMooshroom) MFRUtil.prepareMob(EntityMooshroom.class, world);
    invisishroom.addPotionEffect(new PotionEffect(Potion.invisibility.id, 120 * 20));
    mobs.add(new RandomMob(invisishroom, 5));

    EntityWolf invisiwolf = (EntityWolf) MFRUtil.prepareMob(EntityWolf.class, world);
    invisiwolf.addPotionEffect(new PotionEffect(Potion.invisibility.id, 120 * 20));
    invisiwolf.setAngry(true);
    mobs.add(new RandomMob(invisiwolf, 5));

    EntityTNTPrimed tntJockey = (EntityTNTPrimed) MFRUtil.prepareMob(EntityTNTPrimed.class, world);
    EntityBat tntMount = (EntityBat) MFRUtil.prepareMob(EntityBat.class, world);
    tntJockey.fuse = 120;
    tntJockey.mountEntity(tntMount);
    mobs.add(new RandomMob(tntMount, 2));

    EntitySkeleton skeleton1 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    EntitySkeleton skeleton2 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    EntitySkeleton skeleton3 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    EntitySkeleton skeleton4 = (EntitySkeleton) MFRUtil.prepareMob(EntitySkeleton.class, world);
    skeleton4.mountEntity(skeleton3);
    skeleton3.mountEntity(skeleton2);
    skeleton2.mountEntity(skeleton1);
    mobs.add(new RandomMob(skeleton1, 2));

    EntityBlaze blazeJockey = (EntityBlaze) MFRUtil.prepareMob(EntityBlaze.class, world);
    EntityGhast blazeMount = (EntityGhast) MFRUtil.prepareMob(EntityGhast.class, world);
    blazeJockey.mountEntity(blazeMount);
    mobs.add(new RandomMob(blazeMount, 2));

    EntityCreeper creeperJockey = (EntityCreeper) MFRUtil.prepareMob(EntityCreeper.class, world);
    EntityCaveSpider creeperMount =
        (EntityCaveSpider) MFRUtil.prepareMob(EntityCaveSpider.class, world);
    creeperJockey.mountEntity(creeperMount);
    mobs.add(new RandomMob(creeperMount, 2));

    tntJockey = (EntityTNTPrimed) MFRUtil.prepareMob(EntityTNTPrimed.class, world);
    EntityXPOrb tntMount2 = (EntityXPOrb) MFRUtil.prepareMob(EntityXPOrb.class, world);
    tntJockey.fuse = 120;
    tntMount2.xpValue = 1;
    tntMount2.xpOrbAge = Short.MIN_VALUE;
    tntMount2.field_70532_c = Short.MAX_VALUE;
    tntJockey.mountEntity(tntMount2);
    mobs.add(new RandomMob(tntMount2, 2));

    creeperJockey = (EntityCreeper) MFRUtil.prepareMob(EntityCreeper.class, world);
    EntityXPOrb creeperMount2 = (EntityXPOrb) MFRUtil.prepareMob(EntityXPOrb.class, world);
    creeperMount2.xpValue = 1;
    creeperMount2.xpOrbAge = Short.MIN_VALUE;
    creeperMount2.field_70532_c = Short.MAX_VALUE;
    creeperJockey.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 20));
    creeperJockey.onStruckByLightning(null);
    creeperJockey.mountEntity(creeperMount2);
    mobs.add(new RandomMob(creeperMount2, 1));

    EntityEnderman direBane = (EntityEnderman) MFRUtil.prepareMob(EntityEnderman.class, world);
    direBane.addPotionEffect(new PotionEffect(Potion.regeneration.id, 120 * 20));
    direBane.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 120 * 20));
    direBane.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(120);
    direBane.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.7);
    direBane.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(15);
    direBane.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(32);
    direBane.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(1);
    direBane.stepHeight = 2;
    EntityPlayer player = world.getPlayerEntityByName("direwolf20");
    if (player != null) {
      direBane.setCustomNameTag("Bane of direwolf");
      direBane.setAlwaysRenderNameTag(true);
      direBane.func_110163_bv();
      ItemStack armor = new ItemStack(Item.plateGold);
      AutoEnchantmentHelper.addRandomEnchantment(direBane.getRNG(), armor, 60);
      int i = EntityLiving.getArmorPosition(armor);
      direBane.setCurrentItemOrArmor(i, armor);
      direBane.setEquipmentDropChance(i, 2.0F);
    }
    mobs.add(new RandomMob(direBane, 1));

    return mobs;
  }