Ejemplo n.º 1
0
  public String getItemDisplayName(ItemStack par1ItemStack) {
    String var2 = ("" + StatCollector.translateToLocal(this.getItemName() + ".name")).trim();
    String var3 = EntityList.getStringFromID(par1ItemStack.getItemDamage());
    if (var3 != null) {
      var2 = var2 + " " + StatCollector.translateToLocal("entity." + var3 + ".name");
    }

    return var2;
  }
Ejemplo n.º 2
0
 public Packet24MobSpawn(EntityLiving entityliving) {
   entityId = entityliving.entityId;
   type = (byte) EntityList.getEntityID(entityliving);
   xPosition = MathHelper.floor_double(entityliving.posX * 32D);
   yPosition = MathHelper.floor_double(entityliving.posY * 32D);
   zPosition = MathHelper.floor_double(entityliving.posZ * 32D);
   yaw = (byte) (int) ((entityliving.rotationYaw * 256F) / 360F);
   pitch = (byte) (int) ((entityliving.rotationPitch * 256F) / 360F);
   metaData = entityliving.getDataWatcher();
 }
Ejemplo n.º 3
0
  @SideOnly(Side.CLIENT)

  /** will create the entity from the internalID the first time it is accessed */
  public Entity getMobEntity() {
    if (this.spawnedMob == null) {
      Entity var1 = EntityList.createEntityByName(this.getMobID(), (World) null);
      this.writeNBTTagsTo(var1);
      this.spawnedMob = var1;
    }

    return this.spawnedMob;
  }
Ejemplo n.º 4
0
  public static boolean func_48440_a(
      World par0World, int par1, double par2, double par4, double par6) {
    if (!EntityList.entityEggs.containsKey(Integer.valueOf(par1))) {
      return false;
    } else {
      Entity var8 = EntityList.createEntityByID(par1, par0World);
      if (var8 != null) {
        var8.setLocationAndAngles(par2, par4, par6, par0World.rand.nextFloat() * 360.0F, 0.0F);
        par0World.spawnEntityInWorld(var8);
        ((EntityLiving) var8).playLivingSound();
      }

      return var8 != null;
    }
  }
Ejemplo n.º 5
0
 public void handleMobSpawn(Packet24MobSpawn var1) {
   double var2 = (double) var1.xPosition / 32.0D;
   double var4 = (double) var1.yPosition / 32.0D;
   double var6 = (double) var1.zPosition / 32.0D;
   float var8 = (float) (var1.yaw * 360) / 256.0F;
   float var9 = (float) (var1.pitch * 360) / 256.0F;
   EntityLiving var10 = (EntityLiving) EntityList.createEntity(var1.type, this.mc.theWorld);
   var10.serverPosX = var1.xPosition;
   var10.serverPosY = var1.yPosition;
   var10.serverPosZ = var1.zPosition;
   var10.entityId = var1.entityId;
   var10.setPositionAndRotation(var2, var4, var6, var8, var9);
   var10.isMultiplayerEntity = true;
   this.worldClient.func_712_a(var1.entityId, var10);
   List var11 = var1.getMetadata();
   if (var11 != null) {
     var10.getDataWatcher().updateWatchedObjectsFromList(var11);
   }
 }
Ejemplo n.º 6
0
  @Override
  protected void onImpact(MovingObjectPosition movingobjectposition) {
    // 飛翔体の接触判定
    if (movingobjectposition.entityHit != null) {
      if (!movingobjectposition.entityHit.attackEntityFrom(
          DamageSource.causeThrownDamage(this, thrower), 0)) ;
    }
    if (eggItemStack == null) {
      return;
    }
    if (!worldObj.isRemote) {
      // 着弾時処理
      String s = mod_IME_mobEgg.getInnerEntityName(eggItemStack.getItemDamage());
      if (s.isEmpty()) {
        // 設定がない場合はランダムで対象を指定
        List<String> ll = new ArrayList<String>();
        for (Entry<String, Boolean> t : mod_IME_mobEgg.randomMap.entrySet()) {
          if (t.getValue()) {
            ll.add(t.getKey());
          }
        }
        if (ll.isEmpty()) return;
        s = ll.get(rand.nextInt(ll.size()));
      }

      // EntityListから招喚対象を抽出する
      Entity entity = EntityList.createEntityByName(s, worldObj);
      if (entity instanceof EntityLiving) {
        // 初期設定値を与える
        ((EntityLiving) entity).func_110161_a(null);
      }
      if (entity != null) {
        entity.setLocationAndAngles(posX, posY + 1.0F, posZ, rotationYaw, 0.0F);
        worldObj.spawnEntityInWorld(entity);
      }
      setDead();
    }
    for (int i = 0; i < 8; i++) {
      worldObj.spawnParticle("snowballpoof", posX, posY, posZ, 0.0D, 0.0D, 0.0D);
    }
  }
Ejemplo n.º 7
0
 public String callEntityType() {
   return EntityList.getEntityString(this.field_85155_a)
       + " ("
       + this.field_85155_a.getClass().getCanonicalName()
       + ")";
 }
Ejemplo n.º 8
0
 /** Returns the string that identifies this Entity's class */
 protected final String getEntityString() {
   return EntityList.getEntityString(this);
 }
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    if (!anyPlayerInRange()) {
      return;
    }

    if (worldObj.isRemote) {
      double d = (float) xCoord + worldObj.rand.nextFloat();
      double d1 = (float) yCoord + worldObj.rand.nextFloat();
      double d3 = (float) zCoord + worldObj.rand.nextFloat();
      worldObj.spawnParticle("smoke", d, d1, d3, 0.0D, 0.0D, 0.0D);
      worldObj.spawnParticle("flame", d, d1, d3, 0.0D, 0.0D, 0.0D);
      yaw2 = yaw % 360D;
      yaw += 4.5454545021057129D;
    } else {
      if (delay == -1) {
        updateDelay();
      }

      if (delay > 0) {
        delay--;
        return;
      }

      for (int i = 0; i < field_70395_h; i++) {
        Entity entity = EntityList.createEntityByName(mobID, worldObj);

        if (entity == null) {
          return;
        }

        int j =
            worldObj
                .getEntitiesWithinAABB(
                    entity.getClass(),
                    AxisAlignedBB.getAABBPool()
                        .addOrModifyAABBInPool(
                            xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)
                        .expand(8D, 4D, 8D))
                .size();

        if (j >= 6) {
          updateDelay();
          return;
        }

        if (entity == null) {
          continue;
        }

        double d2 =
            (double) xCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * 4D;
        double d4 = (yCoord + worldObj.rand.nextInt(3)) - 1;
        double d5 =
            (double) zCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * 4D;
        EntityLiving entityliving = (entity instanceof EntityLiving) ? (EntityLiving) entity : null;
        entity.setLocationAndAngles(d2, d4, d5, worldObj.rand.nextFloat() * 360F, 0.0F);

        if (entityliving != null && !entityliving.getCanSpawnHere()) {
          continue;
        }

        func_70383_a(entity);
        worldObj.spawnEntityInWorld(entity);
        worldObj.playAuxSFX(2004, xCoord, yCoord, zCoord, 0);

        if (entityliving != null) {
          entityliving.spawnExplosionParticle();
        }

        updateDelay();
      }
    }

    super.updateEntity();
  }
Ejemplo n.º 10
0
  /**
   * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses
   * this to count ticks and creates a new spawn inside its implementation.
   */
  public void updateEntity() {
    if (this.anyPlayerInRange()) {
      if (this.worldObj.isRemote) {
        double var1 = (double) ((float) this.xCoord + this.worldObj.rand.nextFloat());
        double var3 = (double) ((float) this.yCoord + this.worldObj.rand.nextFloat());
        double var5 = (double) ((float) this.zCoord + this.worldObj.rand.nextFloat());
        this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
        this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);

        if (this.delay > 0) {
          --this.delay;
        }

        this.yaw2 = this.yaw;
        this.yaw = (this.yaw + (double) (1000.0F / ((float) this.delay + 200.0F))) % 360.0D;
      } else {
        if (this.delay == -1) {
          this.updateDelay();
        }

        if (this.delay > 0) {
          --this.delay;
          return;
        }

        for (int var11 = 0; var11 < this.spawnCount; ++var11) {
          Entity var2 = EntityList.createEntityByName(this.mobID, this.worldObj);

          if (var2 == null) {
            return;
          }

          int var12 =
              this.worldObj
                  .getEntitiesWithinAABB(
                      var2.getClass(),
                      AxisAlignedBB.getAABBPool()
                          .addOrModifyAABBInPool(
                              (double) this.xCoord,
                              (double) this.yCoord,
                              (double) this.zCoord,
                              (double) (this.xCoord + 1),
                              (double) (this.yCoord + 1),
                              (double) (this.zCoord + 1))
                          .expand(
                              (double) (this.field_82348_s * 2),
                              4.0D,
                              (double) (this.field_82348_s * 2)))
                  .size();

          if (var12 >= this.field_82350_j) {
            this.updateDelay();
            return;
          }

          if (var2 != null) {
            double var4 =
                (double) this.xCoord
                    + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble())
                        * (double) this.field_82348_s;
            double var6 = (double) (this.yCoord + this.worldObj.rand.nextInt(3) - 1);
            double var8 =
                (double) this.zCoord
                    + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble())
                        * (double) this.field_82348_s;
            EntityLiving var10 = var2 instanceof EntityLiving ? (EntityLiving) var2 : null;
            var2.setLocationAndAngles(
                var4, var6, var8, this.worldObj.rand.nextFloat() * 360.0F, 0.0F);

            if (var10 == null || var10.getCanSpawnHere()) {
              this.writeNBTTagsTo(var2);
              this.worldObj.spawnEntityInWorld(var2);
              this.worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);

              if (var10 != null) {
                var10.spawnExplosionParticle();
              }

              this.updateDelay();
            }
          }
        }
      }

      super.updateEntity();
    }
  }