Esempio n. 1
0
  @SubscribeEvent
  public void onTick(TickEvent.WorldTickEvent e) {
    if (e.phase != TickEvent.Phase.END || e.side != Side.SERVER) return;
    for (EntityPlayer player : (ArrayList<EntityPlayer>) e.world.playerEntities) {
      if (MiscHelper.getWarpTag(player).hasKey("wither")) {
        int wither = MiscHelper.getWarpTag(player).getInteger("wither");
        for (int i = 0; i < 6; i++) {
          int targetX = (int) player.posX + e.world.rand.nextInt(4) - e.world.rand.nextInt(4);
          int targetY = (int) player.posY + e.world.rand.nextInt(4) - e.world.rand.nextInt(4);
          int targetZ = (int) player.posZ + e.world.rand.nextInt(4) - e.world.rand.nextInt(4);

          if (!e.world.getBlock(targetX, targetY - 1, targetZ).getMaterial().blocksMovement())
            return;
          for (int xb = targetX - 1; xb < targetX + 1; xb++) {
            for (int yb = targetY; yb < targetY + 2; yb++) {
              for (int zb = targetZ - 1; zb < targetZ + 1; zb++) {
                if (e.world.getBlock(xb, yb, zb).getMaterial().blocksMovement()) return;
              }
            }
          }

          EntityLightningBolt bolt = new EntityLightningBolt(e.world, targetX, targetY, targetZ);
          e.world.addWeatherEffect(bolt);
          e.world.playSoundEffect(
              targetX,
              targetY,
              targetZ,
              "random.explode",
              4.0F,
              (1.0F + (e.world.rand.nextFloat() - e.world.rand.nextFloat()) * 0.2F) * 0.7F);
          e.world.spawnParticle("hugeexplosion", targetX, targetY, targetZ, 1.0D, 0.0D, 0.0D);
          EntityWither ew = new EntityWither(e.world);
          ew.setLocationAndAngles(
              (double) targetX + 0.5D,
              (double) targetY - 0.5D,
              (double) targetZ + 0.5D,
              e.world.rand.nextFloat(),
              e.world.rand.nextFloat());
          ew.func_82206_m();
          if (e.world.spawnEntityInWorld(ew)) {
            MiscHelper.getWarpTag(player).setInteger("wither", --wither);
            if (wither <= 0) MiscHelper.getWarpTag(player).removeTag("wither");
            break;
          }
        }
      }
    }
  }
Esempio n. 2
0
 protected void func_77041_b(EntityWither p_82415_1_, float p_82415_2_) {
   int var3 = p_82415_1_.func_82212_n();
   if (var3 > 0) {
     float var4 = 2.0F - ((float) var3 - p_82415_2_) / 220.0F * 0.5F;
     GL11.glScalef(var4, var4, var4);
   } else {
     GL11.glScalef(2.0F, 2.0F, 2.0F);
   }
 }
Esempio n. 3
0
  protected int func_77032_a(EntityWither p_82417_1_, int p_82417_2_, float p_82417_3_) {
    if (p_82417_1_.func_82205_o()) {
      if (p_82417_1_.func_82150_aj()) {
        GL11.glDepthMask(false);
      } else {
        GL11.glDepthMask(true);
      }

      if (p_82417_2_ == 1) {
        float var4 = (float) p_82417_1_.field_70173_aa + p_82417_3_;
        this.func_110776_a(field_110913_a);
        GL11.glMatrixMode(5890);
        GL11.glLoadIdentity();
        float var5 = MathHelper.func_76134_b(var4 * 0.02F) * 3.0F;
        float var6 = var4 * 0.01F;
        GL11.glTranslatef(var5, var6, 0.0F);
        this.func_77042_a(this.field_77045_g);
        GL11.glMatrixMode(5888);
        GL11.glEnable(3042);
        float var7 = 0.5F;
        GL11.glColor4f(var7, var7, var7, 1.0F);
        GL11.glDisable(2896);
        GL11.glBlendFunc(1, 1);
        GL11.glTranslatef(0.0F, -0.01F, 0.0F);
        GL11.glScalef(1.1F, 1.1F, 1.1F);
        return 1;
      }

      if (p_82417_2_ == 2) {
        GL11.glMatrixMode(5890);
        GL11.glLoadIdentity();
        GL11.glMatrixMode(5888);
        GL11.glEnable(2896);
        GL11.glDisable(3042);
      }
    }

    return -1;
  }
Esempio n. 4
0
 protected ResourceLocation func_110775_a(EntityWither p_110911_1_) {
   int var2 = p_110911_1_.func_82212_n();
   return var2 > 0 && (var2 > 80 || var2 / 5 % 2 != 1) ? field_110913_a : field_110912_f;
 }