Пример #1
0
  @SideOnly(Side.CLIENT)
  @Override
  public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
    if (isActive(world, x, y, z) && shouldDoWorkThisTick(world, x, y, z, 5)) {
      float startX = x + 1.0F;
      float startY = y + 0.85F;
      float startZ = z + 1.0F;
      for (int i = 0; i < 1; i++) {
        float xOffset = -0.2F - rand.nextFloat() * 0.6F;
        float yOffset = -0.1F + rand.nextFloat() * 0.2F;
        float zOffset = -0.2F - rand.nextFloat() * 0.6F;

        EntityFX fx =
            Minecraft.getMinecraft()
                .renderGlobal
                .doSpawnParticle(
                    "spell",
                    startX + xOffset,
                    startY + yOffset,
                    startZ + zOffset,
                    0.0D,
                    0.0D,
                    0.0D);
        if (fx != null) {
          fx.setRBGColorF(0.2f, 0.2f, 0.8f);
          fx.motionY *= 0.5f;
        }
      }
    }
  }
  private void spawnParticles() {
    double var8 = posX;
    double var10 = posY;
    double var12 = posZ;
    String var14 = "iconcrack_" + Item.potion.itemID;
    Random var7 = rand;
    for (int var15 = 0; var15 < 8; ++var15) {
      worldObj.spawnParticle(
          var14,
          var8,
          var10,
          var12,
          var7.nextGaussian() * 0.15D,
          var7.nextDouble() * 0.2D,
          var7.nextGaussian() * 0.15D);
    }

    float red = 0.3F;
    float green = 1.0F;
    float blue = 0.1F;
    String var19 = "spell";

    for (int var20 = 0; var20 < 100; ++var20) {
      double var39 = var7.nextDouble() * 4.0D;
      double var23 = var7.nextDouble() * Math.PI * 2.0D;
      double var25 = Math.cos(var23) * var39;
      double var27 = 0.01D + var7.nextDouble() * 0.5D;
      double var29 = Math.sin(var23) * var39;
      if (worldObj.isRemote) {
        EntityFX var31 =
            Minecraft.getMinecraft()
                .renderGlobal
                .doSpawnParticle(
                    var19,
                    var8 + var25 * 0.1D,
                    var10 + 0.3D,
                    var12 + var29 * 0.1D,
                    var25,
                    var27,
                    var29);
        if (var31 != null) {
          float var32 = 0.75F + var7.nextFloat() * 0.25F;
          var31.setRBGColorF(red * var32, green * var32, blue * var32);
          var31.multiplyVelocity((float) var39);
        }
      }
    }

    worldObj.playSoundEffect(
        posX + 0.5D,
        posY + 0.5D,
        posZ + 0.5D,
        "random.glass",
        1.0F,
        worldObj.rand.nextFloat() * 0.1F + 0.9F);
  }