예제 #1
0
 public GuiTablet(NBTTagCompound n, World world) {
   nbt = n;
   if (nbt.getBoolean("canDisplay")) {
     UUID trans = UUID.fromString(nbt.getString("trans"));
     tile =
         (TileEntityTTrans)
             Minecraft.getMinecraft()
                 .theWorld
                 .getBlockTileEntity(
                     (Integer) TabMesg.getTabVar(trans, "x"),
                     (Integer) TabMesg.getTabVar(trans, "y"),
                     (Integer) TabMesg.getTabVar(trans, "z"));
     if (TabletRenderer.isInOfRange(trans)) {
       mon = tile.mon;
       tex = mon.tex;
     } else {
       tex.fill(Color.red);
       tex.drawText("Out of range.", 0, 0, Color.white);
       tex.texUpdate();
     }
   }
 }
예제 #2
0
 @Override
 public void drawScreen(int x, int y, float par3) {
   x = applyXOffset(x);
   y = applyYOffset(y);
   if (nbt.getBoolean("canDisplay")) {
     int wheel = Mouse.getDWheel();
     if (wheel != 0) {
       PacketSenders.GPUEvent(x, y, tile, wheel);
     }
     if (isMouseDown) {
       if (x > -1 & y > -1 & x < mon.getWidth() + 1 & y < mon.getHeight() + 1) {
         mx = x;
         my = y;
         if (mlx != mx | mly != my) {
           PacketSenders.mouseEventMove(mx, my, tile);
         }
         mlx = mx;
         mly = my;
       } else {
         mouseMovedOrUp(unapplyXOffset(x) / 2, unapplyYOffset(y) / 2, mouseButton);
       }
     }
   }
   drawWorldBackground(0);
   synchronized (tex) {
     try {
       if (tex.renderLock) {
         tex.wait(1L);
       }
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   }
   TextureUtil.uploadTexture(
       TabletRenderer.dyntex.getGlTextureId(), tex.rgbCache, 16 * 32, 9 * 32);
   drawTexturedModalRect(unapplyXOffset(0), unapplyYOffset(0), tex.getWidth(), tex.getHeight());
   GL11.glDisable(GL11.GL_TEXTURE_2D);
 }
예제 #3
0
 public int unapplyYOffset(int y) {
   return y + ((height / 4) - tex.getHeight() / 4) * 2;
 }
예제 #4
0
 public int unapplyXOffset(int x) {
   return x + ((width / 4) - tex.getWidth() / 4) * 2;
 }