コード例 #1
0
  public boolean interact(EntityPlayer var1) {
    ItemStack var2 = var1.inventory.getCurrentItem();

    if (var2 != null) {
      if (!Revival.enableDebugging()) {
        if (var2.getItem() == FAItemRegistry.chickenEss) {
          if (!this.worldObj.isRemote) {
            Revival.ShowMessage(
                StatCollector.translateToLocal(LocalizationStrings.STATUS_ESSENCE_FAIL), var1);
            return true;
          }
        }
      }
    }

    return super.interact(var1);
  }
コード例 #2
0
  @SubscribeEvent
  public void notifyPickup(PlayerEvent.ItemSmeltedEvent event) {

    // Analyzer Achievements
    if (Revival.isDNA(event.smelting.getItem())) {
      event.player.addStat(FossilAchievementHandler.dinoDna, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.stoneboard) {
      event.player.addStat(FossilAchievementHandler.tablet, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.fossilSeed
        || event.smelting.getItem() == FAItemRegistry.fossilSeed_fern) {
      event.player.addStat(FossilAchievementHandler.fossilSeeds, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.failuresaurusFlesh) {
      event.player.addStat(FossilAchievementHandler.failuresaurusAnalyzer, 1);
    }

    // Cultivator Achievements
    if (EnumDinoType.isDinoEgg(event.smelting.getItem())) {
      event.player.addStat(FossilAchievementHandler.dinoEgg, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.embryoCow
        || event.smelting.getItem() == FAItemRegistry.embryoElasmotherium
        || event.smelting.getItem() == FAItemRegistry.embryoHorse
        || event.smelting.getItem() == FAItemRegistry.embryoMammoth
        || event.smelting.getItem() == FAItemRegistry.embryoPig
        || event.smelting.getItem() == FAItemRegistry.embryoQuagga
        || event.smelting.getItem() == FAItemRegistry.embryoSheep
        || event.smelting.getItem() == FAItemRegistry.embryoSmilodon) {
      event.player.addStat(FossilAchievementHandler.mammalEmbryo, 1);
    }

    if (event.smelting.getItem() == FAItemRegistry.cultivatedChickenEgg
        || event.smelting.getItem() == FAItemRegistry.cultivatedConfuciusornisEgg
        || event.smelting.getItem() == FAItemRegistry.cultivatedDodoEgg
        || event.smelting.getItem() == FAItemRegistry.cultivatedTerrorBirdEgg) {
      event.player.addStat(FossilAchievementHandler.birdEgg, 1);
    }

    // Workbench Achievements
    if (event.smelting.getItem() == FAItemRegistry.ancientSword) {
      event.player.addStat(FossilAchievementHandler.fixedSword, 1);
    }
    if (event.smelting.getItem() == FAItemRegistry.ancienthelmet) {
      event.player.addStat(FossilAchievementHandler.fixedHelmet, 1);
    }
    if (event.smelting.getItem() == Item.getItemFromBlock(FABlockRegistry.vaseAmphoraBlock)
        || event.smelting.getItem() == Item.getItemFromBlock(FABlockRegistry.vaseKylixBlock)
        || event.smelting.getItem() == Item.getItemFromBlock(FABlockRegistry.vaseVoluteBlock)) {
      event.player.addStat(FossilAchievementHandler.fixedVase, 1);
    }
  }
コード例 #3
0
  private void generateStructure(World world, Random rand, int chunkX, int chunkZ) {
    // Need to create a new instance each time or the generate() methods may
    // overlap themselves and cause a crash
    // WorldGeneratorAcademy gen = new WorldGeneratorAcademy();
    FossilWaterStructureGenerator gen = new FossilWaterStructureGenerator();
    int struct; // This will store a random index of the structure to
    // generate
    struct = rand.nextInt(gen.structures.size());
    int x = chunkX + rand.nextInt(16);
    int z = chunkZ + rand.nextInt(16);
    // nice way of getting a height to work from; it returns the topmost
    // non-air block at an x/z position, such as tall grass, dirt or leaves
    int y = world.getHeightValue(x, z);

    // find ground level, ignoring blocks such as grass and water

    while ((!world.doesBlockHaveSolidTopSurface(world, x, y, z)) // && y >
    // world.provider.getAverageGroundLevel())
    // && (!world.doesBlockHaveSolidTopSurface(world, x + 10, y+4, z + 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y+4, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y+4, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y+4, z + 11))
    ) {
      --y;
    }

    if (!world.doesBlockHaveSolidTopSurface(world, x, y, z)
        || (Block.getIdFromBlock(world.getBlock(x, y + 2, z)) != Block.getIdFromBlock(Blocks.water))
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y, z + 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x + 10, y, z - 11)
    // || !world.doesBlockHaveSolidTopSurface(world, x - 10, y, z + 11))
    // && world.canBlockSeeTheSky(x, y, z)
    ) {
      return;
    } else {
      Revival.Console("Gen: Shipwreck Spawn at " + x + ", " + y + ", " + z);
    }

    int widthX = ((Structure) gen.structures.get(struct)).getWidthX();
    int widthZ = ((Structure) gen.structures.get(struct)).getWidthZ();
    int height = ((Structure) gen.structures.get(struct)).getHeight();
    // Set structure and random facing, then generate; no offset needed here
    gen.setStructure((Structure) gen.structures.get(struct));
    gen.setStructureFacing(rand.nextInt(4));
    gen.generate(world, rand, x, y - (rand.nextInt(3) + 3), z);
  }
コード例 #4
0
 public void TriggerOrder(EntityPlayer player) {
   this.Order = this.Order.Next();
   this.worldObj.playSoundEffect(
       (double) this.xCoord,
       (double) this.yCoord,
       (double) this.zCoord,
       "fossil:drum_single",
       8.0F,
       1.0F); // (float)Math.pow(2.0D,
   // (double)(this.Order.ordinal()/*.ToInt()
   // - 1*/)));
   // String var2 = Revival.GetLangTextByKey("Drum.Head");
   // String var3 = this.GetOrderString();
   Revival.ShowMessage(
       StatCollector.translateToLocal(LocalizationStrings.DRUM_TRIGGER)
           + StatCollector.translateToLocal("order." + this.Order.toString()),
       player);
   this.markDirty();
 }
コード例 #5
0
  public boolean SendOrder(Item item, EntityPlayer var2) {
    // var2.itemID == this.ItemToControl.itemID && this.isTamed() &&
    // var1.username.equalsIgnoreCase(this.getOwnerName())
    /*
     * String var3 = ""; String var4 = ""; String var5 =
     * Revival.GetLangTextByKey("Drum.Msg.Head"); String var6 =
     * Revival.GetLangTextByKey("Drum.Msg.Middle"); String var7 =
     * Revival.GetLangTextByKey("Drum.Msg.Tail");
     */
    this.worldObj.playSoundEffect(
        (double) this.xCoord,
        (double) this.yCoord,
        (double) this.zCoord,
        "fossil:drum_triple",
        8.0F,
        1.0F); // (float)Math.pow(2.0D,
    // (double)(this.Order.ordinal()/*ToInt()
    // - 1*/)));

    if (item != FAItemRegistry.skullStick) // That is treated specially ;)
    {
      for (int i = 0; i < EnumPrehistoric.values().length; ++i) {
        if (EnumPrehistoric.values()[i].orderItem != null
            && EnumPrehistoric.values()[i].orderItem == item) {
          Revival.ShowMessage(
              StatCollector.translateToLocal(LocalizationStrings.DRUM_ORDERING)
                  + StatCollector.translateToLocal(
                      "fossil.entity." + EnumPrehistoric.values()[i].toString())
                  + ": "
                  + StatCollector.translateToLocal("order." + this.Order.toString()),
              var2);
        }
      } // Output: Ordering Triceratops: Stay

      List list =
          this.worldObj.getEntitiesWithinAABB(
              EntityDinosaur.class,
              AxisAlignedBB.getBoundingBox(
                      (double) this.xCoord,
                      (double) this.yCoord,
                      (double) this.zCoord,
                      (double) this.xCoord + 1.0D,
                      (double) this.yCoord + 1.0D,
                      (double) this.zCoord + 1.0D)
                  .expand(30.0D, 4.0D, 30.0D));
      Iterator it = list.iterator();

      while (it.hasNext()) {
        Entity var3 = (Entity) it.next();
        EntityDinosaur var4 = (EntityDinosaur) var3;

        if (item == var4.SelfType.orderItem
            && var4.isTamed()
            && var2.getCommandSenderName().equalsIgnoreCase(var4.getCommandSenderName()))
        // {
        {
          var4.SetOrder(this.Order);
        }

        /*
         * Revival.ShowMessage("YES",var2); } else
         * Revival.ShowMessage("NOPE",var2);
         */
      }
    } else {
      Revival.ShowMessage(
          StatCollector.translateToLocal(
              LocalizationStrings.DRUM_TREX + String.valueOf(this.Order.ordinal() + 1)),
          var2);
      List list =
          this.worldObj.getEntitiesWithinAABB(
              EntityTyrannosaurus.class,
              AxisAlignedBB.getBoundingBox(
                      (double) this.xCoord,
                      (double) this.yCoord,
                      (double) this.zCoord,
                      (double) this.xCoord + 1.0D,
                      (double) this.yCoord + 1.0D,
                      (double) this.zCoord + 1.0D)
                  .expand(50.0D, 4.0D, 50.0D));
      Iterator it = list.iterator();

      while (it.hasNext()) {
        Entity var4 = (Entity) it.next();
        EntityTyrannosaurus var5 = (EntityTyrannosaurus) var4;

        if (var5.isAdult() && !var5.isTamed()) {
          var5.setAngry(true);
          var5.setAttackTarget(var2);
        }
      }
    }

    return true;
    /*
     * if (var1 != Item.stick.itemID && var1 != Items.bone && var1 !=
     * Revival.skullStick.itemID && var1 != Item.arrow.itemID) { return
     * false; } else { if (var1 == Item.stick.itemID) { this.OrderTri();
     * var3 = Revival.GetLangTextByKey("Dino.Triceratops"); }
     *
     * if (var1 == Items.bone) { this.OrderRaptor(); var3 =
     * Revival.GetLangTextByKey("Dino.Raptor"); }
     *
     * if (var1 == Item.arrow.itemID) { this.OrderPTS(); var3 =
     * Revival.GetLangTextByKey("Dino.Pterosaur"); }
     *
     * if (var1 == Revival.skullStick.itemID) { this.OrderTRex(var2); }
     *
     * var4 = this.GetOrderString();
     *
     * if (var1 != Revival.skullStick.itemID) { Revival.ShowMessage(var5 +
     * var3 + var6 + var4 + var7, var2); return true; } else { String var8 =
     * Revival.GetLangTextByKey("Drum.Msg.TRex." +
     * String.valueOf(this.Order.ordinal()/*ToInt() + 1*));
     * Revival.ShowMessage(var8, var2); return true; } }
     */
  }