コード例 #1
0
  public void upgradeMob(EntityLivingBase mob) {
    int diff = mob.worldObj.difficultySetting.getDifficultyId();

    if (ConfigHardcore.upgradeZombieWep) {
      if (mob instanceof EntitySkeleton) {
        if (((EntitySkeleton) mob).getSkeletonType() == 1) {
          giveEntityWeapon(mob, 5, rand.nextInt(7));
        }
      }
      if (mob instanceof EntityZombie) {
        int tier = 2;
        if (mob instanceof EntityPigZombie) {
          tier = 7;
          giveEntityWeapon(mob, tier, rand.nextInt(4));
        } else {
          if (mob.getHeldItem() != null && mob.getHeldItem().getItem() == Items.iron_sword) {
            giveEntityWeapon(mob, tier, 0);
          } else {
            if (rand.nextFloat() * (zombieWepChance * ConfigHardcore.zombieWepChance) < diff) {
              giveEntityWeapon(mob, tier, rand.nextInt(4));
            }
          }
        }
        if (rand.nextFloat() * (zombieKnightChance * ConfigHardcore.zombieWepChance) < diff) {
          createZombieKnight((EntityZombie) mob);
        } else if (rand.nextFloat() * (zombieBruteChance * ConfigHardcore.zombieWepChance) < diff) {
          createZombieBrute((EntityZombie) mob);
        }
      }
    }
    if (mob instanceof EntitySpider) {
      if (mob.riddenByEntity == null) {
        if (rand.nextFloat() * (skeletalRiderChance * ConfigHardcore.zombieWepChance) < diff) {
          EntitySkeleton rider = new EntitySkeleton(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.setCurrentItemOrArmor(0, new ItemStack(ToolListMF.lances[2]));
          rider.mountEntity(mob);
          mob.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(64.0D);
          mob.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, Integer.MAX_VALUE, 10));
        } else if (rand.nextFloat() * (witchRiderChance * ConfigHardcore.zombieWepChance) < diff) {
          EntityWitch rider = new EntityWitch(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.mountEntity(mob);
        } else if (rand.nextFloat() * (creeperJockeyChance * ConfigHardcore.zombieWepChance)
            < diff) {
          EntityCreeper rider = new EntityCreeper(mob.worldObj);
          rider.setPosition(mob.posX, mob.posY, mob.posZ);
          mob.worldObj.spawnEntityInWorld(rider);
          rider.mountEntity(mob);
        }
      }
    }
  }
コード例 #2
0
 @SubscribeEvent
 public void entityStruckByLightning(EntityStruckByLightningEvent event) {
   if (EtFuturum.enableVillagerTurnsIntoWitch && event.entity instanceof EntityVillager) {
     EntityVillager villager = (EntityVillager) event.entity;
     if (!villager.worldObj.isRemote) {
       EntityWitch witch = new EntityWitch(villager.worldObj);
       witch.copyLocationAndAnglesFrom(villager);
       witch.onSpawnWithEgg(null);
       villager.worldObj.spawnEntityInWorld(witch);
       villager.setDead();
     }
   }
 }
コード例 #3
0
ファイル: RenderWitch.java プロジェクト: tjkenmate/MCOverhaul
 /** Renders the desired {@code T} type Entity. */
 public void doRender(
     EntityWitch entity, double x, double y, double z, float entityYaw, float partialTicks) {
   ((ModelWitch) this.mainModel).holdingItem = entity.getHeldItemMainhand() != null;
   super.doRender(entity, x, y, z, entityYaw, partialTicks);
 }
コード例 #4
0
  /**
   * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it
   * closes Mineshafts at the end, it adds Fences...
   */
  public boolean addComponentParts(
      World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) {
    if (!this.func_74935_a(par1World, par3StructureBoundingBox, 0)) {
      return false;
    } else {
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          1,
          1,
          1,
          5,
          1,
          7,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          1,
          4,
          2,
          5,
          4,
          7,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          2,
          1,
          0,
          4,
          1,
          0,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          2,
          2,
          2,
          3,
          3,
          2,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          1,
          2,
          3,
          1,
          3,
          6,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          5,
          2,
          3,
          5,
          3,
          6,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          2,
          2,
          7,
          4,
          3,
          7,
          Block.planks.blockID,
          1,
          Block.planks.blockID,
          1,
          false);
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          1,
          0,
          2,
          1,
          3,
          2,
          Block.wood.blockID,
          Block.wood.blockID,
          false);
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          5,
          0,
          2,
          5,
          3,
          2,
          Block.wood.blockID,
          Block.wood.blockID,
          false);
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          1,
          0,
          7,
          1,
          3,
          7,
          Block.wood.blockID,
          Block.wood.blockID,
          false);
      this.fillWithBlocks(
          par1World,
          par3StructureBoundingBox,
          5,
          0,
          7,
          5,
          3,
          7,
          Block.wood.blockID,
          Block.wood.blockID,
          false);
      this.placeBlockAtCurrentPosition(
          par1World, Block.fence.blockID, 0, 2, 3, 2, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World, Block.fence.blockID, 0, 3, 3, 7, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 3, 4, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 4, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 5, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World, Block.flowerPot.blockID, 7, 1, 3, 5, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World, Block.workbench.blockID, 0, 3, 2, 6, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World, Block.cauldron.blockID, 0, 4, 2, 6, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World, Block.fence.blockID, 0, 1, 2, 1, par3StructureBoundingBox);
      this.placeBlockAtCurrentPosition(
          par1World, Block.fence.blockID, 0, 5, 2, 1, par3StructureBoundingBox);
      int i = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3);
      int j = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1);
      int k = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0);
      int l = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          0,
          4,
          1,
          6,
          4,
          1,
          Block.stairsWoodSpruce.blockID,
          i,
          Block.stairsWoodSpruce.blockID,
          i,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          0,
          4,
          2,
          0,
          4,
          7,
          Block.stairsWoodSpruce.blockID,
          k,
          Block.stairsWoodSpruce.blockID,
          k,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          6,
          4,
          2,
          6,
          4,
          7,
          Block.stairsWoodSpruce.blockID,
          j,
          Block.stairsWoodSpruce.blockID,
          j,
          false);
      this.fillWithMetadataBlocks(
          par1World,
          par3StructureBoundingBox,
          0,
          4,
          8,
          6,
          4,
          8,
          Block.stairsWoodSpruce.blockID,
          l,
          Block.stairsWoodSpruce.blockID,
          l,
          false);
      int i1;
      int j1;

      for (i1 = 2; i1 <= 7; i1 += 5) {
        for (j1 = 1; j1 <= 5; j1 += 4) {
          this.fillCurrentPositionBlocksDownwards(
              par1World, Block.wood.blockID, 0, j1, -1, i1, par3StructureBoundingBox);
        }
      }

      if (!this.hasWitch) {
        i1 = this.getXWithOffset(2, 5);
        j1 = this.getYWithOffset(2);
        int k1 = this.getZWithOffset(2, 5);

        if (par3StructureBoundingBox.isVecInside(i1, j1, k1)) {
          this.hasWitch = true;
          EntityWitch entitywitch = new EntityWitch(par1World);
          entitywitch.setLocationAndAngles(
              (double) i1 + 0.5D, (double) j1, (double) k1 + 0.5D, 0.0F, 0.0F);
          entitywitch.onSpawnWithEgg((EntityLivingData) null);
          par1World.spawnEntityInWorld(entitywitch);
        }
      }

      return true;
    }
  }