Пример #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;
        }
      }
    }
  }
Пример #2
0
  @Override
  public void generateGundPowderSpark(
      World world, BlockPos pos, float offsetX, float offsetY, float offsetZ) {
    double motionX = 0.08 + world.rand.nextGaussian() * 0.05D;
    double motionY = 0.1 + world.rand.nextGaussian() * 0.1D;
    double motionZ = 0.05 + world.rand.nextGaussian() * 0.05D;

    EntityFX particle =
        new EntityGunpowderSparkFX(
            world,
            pos.getX() + offsetX,
            pos.getY() + offsetY,
            pos.getZ() + offsetZ,
            motionX,
            motionY,
            motionZ);

    particle.motionX = motionX;
    particle.motionY = motionY;
    particle.motionZ = motionZ;

    Minecraft.getMinecraft().effectRenderer.addEffect(particle);
  }