Ejemplo n.º 1
0
 public void handleBlockDig(Packet14BlockDig packet14blockdig) {
   WorldServer worldserver = mcServer.getWorldManager(playerEntity.dimension);
   if (packet14blockdig.status == 4) {
     playerEntity.dropCurrentItem();
     return;
   }
   boolean flag =
       worldserver.field_819_z =
           worldserver.worldProvider.worldType != 0
               || mcServer.configManager.isOp(playerEntity.username);
   boolean flag1 = false;
   if (packet14blockdig.status == 0) {
     flag1 = true;
   }
   if (packet14blockdig.status == 2) {
     flag1 = true;
   }
   int i = packet14blockdig.xPosition;
   int j = packet14blockdig.yPosition;
   int k = packet14blockdig.zPosition;
   if (flag1) {
     double d = playerEntity.posX - ((double) i + 0.5D);
     double d1 = playerEntity.posY - ((double) j + 0.5D);
     double d3 = playerEntity.posZ - ((double) k + 0.5D);
     double d5 = d * d + d1 * d1 + d3 * d3;
     if (d5 > 36D) {
       return;
     }
   }
   ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
   int l = (int) MathHelper.abs(i - chunkcoordinates.posX);
   int i1 = (int) MathHelper.abs(k - chunkcoordinates.posZ);
   if (l > i1) {
     i1 = l;
   }
   if (packet14blockdig.status == 0) {
     if (i1 > 16 || flag) {
       playerEntity.itemInWorldManager.func_324_a(i, j, k, packet14blockdig.face);
     } else {
       playerEntity.playerNetServerHandler.sendPacket(
           new Packet53BlockChange(i, j, k, worldserver));
     }
   } else if (packet14blockdig.status == 2) {
     playerEntity.itemInWorldManager.func_22045_b(i, j, k);
     if (worldserver.getBlockId(i, j, k) != 0) {
       playerEntity.playerNetServerHandler.sendPacket(
           new Packet53BlockChange(i, j, k, worldserver));
     }
   } else if (packet14blockdig.status == 3) {
     double d2 = playerEntity.posX - ((double) i + 0.5D);
     double d4 = playerEntity.posY - ((double) j + 0.5D);
     double d6 = playerEntity.posZ - ((double) k + 0.5D);
     double d7 = d2 * d2 + d4 * d4 + d6 * d6;
     if (d7 < 256D) {
       playerEntity.playerNetServerHandler.sendPacket(
           new Packet53BlockChange(i, j, k, worldserver));
     }
   }
   worldserver.field_819_z = false;
 }
Ejemplo n.º 2
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    if (panorama) {
      renderSkybox(par1, par2, par3);
    } else {
      drawDefaultBackground();
    }
    Tessellator tessellator = Tessellator.instance;
    if (oldlogo) {
      drawLogo(par3);
    }
    char c = 274;
    int i = width / 2 - c / 2;
    byte byte0 = 30;
    if (panorama) {
      drawGradientRect(0, 0, width, height, 0x80ffffff, 0xffffff);
      drawGradientRect(0, 0, width, height, 0, 0x80000000);
    }
    if (!oldlogo) {
      mc.func_110434_K().func_110577_a(field_110352_y);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      if ((double) updateCounter < 0.0001D) {
        drawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 99, 44);
        drawTexturedModalRect(i + 99, byte0 + 0, 129, 0, 27, 44);
        drawTexturedModalRect(i + 99 + 26, byte0 + 0, 126, 0, 3, 44);
        drawTexturedModalRect(i + 99 + 26 + 3, byte0 + 0, 99, 0, 26, 44);
        drawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44);
      } else {
        drawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 155, 44);
        drawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44);
      }
    }

    tessellator.setColorOpaque_I(0xffffff);
    GL11.glPushMatrix();
    GL11.glTranslatef(width / 2 + 90, 70F, 0.0F);
    GL11.glRotatef(-20F, 0.0F, 0.0F, 1.0F);
    float f =
        1.8F
            - MathHelper.abs(
                MathHelper.sin(
                        ((float) (Minecraft.getSystemTime() % 1000L) / 1000F)
                            * (float) Math.PI
                            * 2.0F)
                    * 0.1F);
    f = (f * 100F) / (float) (fontRenderer.getStringWidth(splashText) + 32);
    GL11.glScalef(f, f, f);
    drawCenteredString(fontRenderer, splashText, 0, -8, 0xffff00);
    GL11.glPopMatrix();
    String s = version.contains(":") ? version.split(":", 2)[1] : version;
    if (s.equals("OFF")) {
      s = "Minecraft " + (new CallableMinecraftVersion(null)).minecraftVersion();
    }

    if (mc.isDemo()) {
      s = (new StringBuilder()).append(s).append(" Demo").toString();
    }

    if (panorama) {
      drawString(fontRenderer, s, 2, height - 10, 0xffffff);
    } else {
      drawString(fontRenderer, s, 2, 2, 0x505050);
    }
    String s1 = "Copyright Mojang AB. Do not distribute!";
    drawString(
        fontRenderer, s1, width - fontRenderer.getStringWidth(s1) - 2, height - 10, 0xffffff);

    if (field_92025_p != null && field_92025_p.length() > 0) {
      drawRect(
          field_92022_t - 2, field_92021_u - 2, field_92020_v + 2, field_92019_w - 1, 0x55200000);
      drawString(fontRenderer, field_92025_p, field_92022_t, field_92021_u, 0xffffff);
      drawString(
          fontRenderer,
          field_96138_a,
          (width - field_92024_r) / 2,
          ((GuiButton) buttonList.get(0)).yPosition - 12,
          0xffffff);
    }

    super.drawScreen(par1, par2, par3);
  }
Ejemplo n.º 3
0
 public void handlePlace(Packet15Place packet15place) {
   WorldServer worldserver = mcServer.getWorldManager(playerEntity.dimension);
   ItemStack itemstack = playerEntity.inventory.getCurrentItem();
   boolean flag =
       worldserver.field_819_z =
           worldserver.worldProvider.worldType != 0
               || mcServer.configManager.isOp(playerEntity.username);
   if (packet15place.direction == 255) {
     if (itemstack == null) {
       return;
     }
     playerEntity.itemInWorldManager.func_6154_a(playerEntity, worldserver, itemstack);
   } else {
     int i = packet15place.xPosition;
     int j = packet15place.yPosition;
     int k = packet15place.zPosition;
     int l = packet15place.direction;
     ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
     int i1 = (int) MathHelper.abs(i - chunkcoordinates.posX);
     int j1 = (int) MathHelper.abs(k - chunkcoordinates.posZ);
     if (i1 > j1) {
       j1 = i1;
     }
     if (hasMoved
         && playerEntity.getDistanceSq((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D)
             < 64D
         && (j1 > 16 || flag)) {
       playerEntity.itemInWorldManager.activeBlockOrUseItem(
           playerEntity, worldserver, itemstack, i, j, k, l);
     }
     playerEntity.playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
     if (l == 0) {
       j--;
     }
     if (l == 1) {
       j++;
     }
     if (l == 2) {
       k--;
     }
     if (l == 3) {
       k++;
     }
     if (l == 4) {
       i--;
     }
     if (l == 5) {
       i++;
     }
     playerEntity.playerNetServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
   }
   itemstack = playerEntity.inventory.getCurrentItem();
   if (itemstack != null && itemstack.stackSize == 0) {
     playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] = null;
   }
   playerEntity.isChangingQuantityOnly = true;
   playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem] =
       ItemStack.func_20117_a(
           playerEntity.inventory.mainInventory[playerEntity.inventory.currentItem]);
   Slot slot =
       playerEntity.currentCraftingInventory.func_20127_a(
           playerEntity.inventory, playerEntity.inventory.currentItem);
   playerEntity.currentCraftingInventory.updateCraftingMatrix();
   playerEntity.isChangingQuantityOnly = false;
   if (!ItemStack.areItemStacksEqual(
       playerEntity.inventory.getCurrentItem(), packet15place.itemStack)) {
     sendPacket(
         new Packet103SetSlot(
             playerEntity.currentCraftingInventory.windowId,
             slot.id,
             playerEntity.inventory.getCurrentItem()));
   }
   worldserver.field_819_z = false;
 }