Esempio n. 1
0
 public EntityPixelmon sendOut(int id, World world) {
   for (int i = 0; i < partyPokemon.length; i++) {
     NBTTagCompound n = partyPokemon[i];
     if (n != null) {
       if (n.getInteger("pixelmonID") == id) {
         n.setFloat("FallDistance", 0);
         n.setBoolean("IsInBall", false);
         EntityPixelmon e = (EntityPixelmon) PixelmonEntityList.createEntityFromNBT(n, world);
         if (mode == PokeballManagerMode.Player) {
           e.setOwner(player.username);
           e.playerOwned = true;
         } else e.setTrainer(trainer);
         e.motionX = e.motionY = e.motionZ = 0;
         e.isDead = false;
         return e;
       }
     }
   }
   return null;
 }
  public void renderAModelAt(
      TileEntityFossilMachine tile, double d, double d1, double d2, float f) {
    pokemon = new EntityPixelmon(tile.worldObj);
    // this is for rotation
    int j = 0;
    int i = tile.getBlockMetadata();

    if (i == 0) {
      j = 0;
    }

    if (i == 1) {
      j = 90;
    }

    if (i == 2) {
      j = 180;
    }

    if (i == 3) {
      j = 270;
    }

    bindTextureByName("/pixelmon/texture/blocks/fossilmachine.png");
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d + 0.6F, (float) d1 + 2.3F, (float) d2 + 0.5F);
    GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.5F, -1.5F, -1.5F);
    model.renderModel(tile, 0.0625F);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
    GL11.glTranslatef((float) d + 0.6F, (float) d1 + 2.3F, (float) d2 + 0.5F);
    GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.5F, -1.5F, -1.5F);
    model.renderGlass(tile, 0.0625F);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();

    renderCompletionLevel(tile, tile.completionRate + "%", d, d1, d2, 64, false, -1);
    if (tile.staticFlicker && tile.completionRate == 100 && tile.currentPokeball == -1)
      renderCompletionLevel(tile, "Insert Pokeball", d, d1 + 0.08f, d2, 64, true, -65536);
    else if (tile.completionRate > 0 && tile.completionRate < 100)
      renderCompletionLevel(tile, "Working" + tile.dots, d, d1 + 0.08f, d2, 64, true, -16711936);
    else if (tile.staticFlicker && tile.completionRate == 0 && tile.currentFossil == -1)
      renderCompletionLevel(tile, "Insert Fossil", d, d1 + 0.08f, d2, 64, true, -65536);
    else if (tile.staticFlicker && tile.completionRate == 100 && tile.currentPokeball != -1)
      renderCompletionLevel(tile, "Retrieve Pokemon", d, d1 + 0.08f, d2, 64, true, -16711936);
    renderBarLevel(tile, d, d1, d2, 64);

    bindTextureByName("/pixelmon/texture/fossils/" + fossilTexture(tile) + ".png");

    GL11.glPushMatrix();
    if (tile.currentFossil != -1) {
      if (i == 0)
        GL11.glTranslatef((float) d + 0.55F, (float) d1 + 1.3F + tile.y, (float) d2 + 0.55F);
      if (i == 1)
        GL11.glTranslatef((float) d + 0.65F, (float) d1 + 1.3F + tile.y, (float) d2 + 0.55F);
      if (i == 2)
        GL11.glTranslatef((float) d + 0.55F, (float) d1 + 1.3F + tile.y, (float) d2 + 0.55F);
      if (i == 3)
        GL11.glTranslatef((float) d + 0.55F, (float) d1 + 1.3F + tile.y, (float) d2 + 0.55F);
      GL11.glScalef(
          0.8F - tile.fossilProgress / 1000 / 2,
          -0.8F + tile.fossilProgress / 1000 / 2,
          -0.8F + tile.fossilProgress / 1000 / 2);
      if (i == 0 || i == 2) GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
      else if (i == 1 || i == 3) GL11.glRotatef(j + 180F, 0.0F, 1.0F, 0.0F);
      renderModel(tile, 0.0625F);
    }
    GL11.glPopMatrix();

    // Pokeball rendering

    if (tile.currentPokeball != -1) {
      bindTextureByName("/pixelmon/texture/pokeballs/" + tile.currentPokeballTexture);

      GL11.glPushMatrix();
      if (i == 0) {
        GL11.glTranslatef((float) d + 0.79F, (float) d1 + 0.4F, (float) d2 + 1.35F);
      }
      if (i == 1) {
        GL11.glTranslatef((float) d + 1.45F, (float) d1 + 0.4F, (float) d2 + 0.31F);
      }
      if (i == 2) {
        GL11.glTranslatef((float) d + 0.41F, (float) d1 + 0.4F, (float) d2 - 0.34F);
      }
      if (i == 3) {
        GL11.glTranslatef((float) d - 0.24F, (float) d1 + 0.4F, (float) d2 + 0.69F);
      }
      GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(1F, -1F, -1F);
      pokeball.renderModel(tile, 0.0625F);
      GL11.glPopMatrix();
    }

    if (EnumPokemon.hasPokemon(tile.currentPokemon) && !EnumTrainers.has(tile.currentPokemon))
      pokemon =
          ((EntityPixelmon)
              PixelmonEntityList.createEntityByName(tile.currentPokemon, tile.getWorldObj()));

    // Pokemon Rendering

    GL11.glPushMatrix();
    if (pokemon != null
        && EnumPokemon.hasPokemon(tile.currentPokemon)
        && !EnumTrainers.has(tile.currentPokemon)) {
      GL11.glTranslatef((float) d + 0.65F, (float) d1 + 1.3F, (float) d2 + 0.5F);
      pokemon.setWorld(tile.getWorldObj());
      float var10 = 0.6375F;
      GL11.glRotatef(j, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(
          0.0f + tile.pokemonProgress / 1000 / 4,
          0.0f + tile.pokemonProgress / 1000 / 4,
          0.0f + tile.pokemonProgress / 1000 / 4);
      if (tile.isShiny) pokemon.setIsShiny(true);
      pokemon.setLocationAndAngles(d, d1, d2, 0.0F, 0.0F);
      RenderManager.instance.renderEntityWithPosYaw(pokemon, 0.0D, 0.0D, 0.0D, 0.0F, f);
    }
    GL11.glPopMatrix();
  }