net.minecraft.client.gui.Gui.drawScaledCustomSizeModalRect()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中net.minecraft.client.gui.Gui.drawScaledCustomSizeModalRect()方法的一些代码示例,展示了Gui.drawScaledCustomSizeModalRect()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gui.drawScaledCustomSizeModalRect()方法的具体详情如下:
包路径:net.minecraft.client.gui.Gui
类名称:Gui
方法名:drawScaledCustomSizeModalRect

Gui.drawScaledCustomSizeModalRect介绍

暂无

代码示例

代码示例来源:origin: ForestryMC/ForestryMC

public void draw(int xOffset, int yOffset, int width, int height) {
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    textureManager.bindTexture(textureLocation);

    // Enable correct lighting.
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    Gui.drawScaledCustomSizeModalRect(xOffset, yOffset, u, v, uWidth, vHeight, width, height, textureWidth, textureHeight);
  }
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
public void render(int mouseX, int mouseY, float partialTick) {
  super.render(mouseX, mouseY, partialTick);
  Minecraft.getMinecraft().renderEngine.bindTexture(texture);
  int textureWidth = getElement().getWidth();
  int textureHeight = getElement().getHeight();
  float scale = getScale(width, textureWidth);
  int scaledWidth = (int) (scale * textureWidth);
  int padding = Math.min(0, (width - scaledWidth) / 2);
  Gui.drawScaledCustomSizeModalRect(renderX + padding, renderY, 0, 0, textureWidth, textureHeight, scaledWidth, (int) (textureHeight * scale),
      textureWidth, textureHeight);
}

代码示例来源:origin: Vazkii/Patchouli

public void render(int x, int y) {
  Minecraft mc = Minecraft.getMinecraft();
  switch(type) {
  case STACK:
    RenderHelper.enableGUIStandardItemLighting();
    mc.getRenderItem().renderItemIntoGUI(stack, x, y);    
    break;
    
  case RESOURCE:
    GlStateManager.color(1F, 1F, 1F, 1F);
    mc.renderEngine.bindTexture(res);
    Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, 16, 16, 16, 16, 16, 16);
    break;
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

Gui.drawScaledCustomSizeModalRect(-4, 26, 0, 0, 16, 16, 16, 16, 64, 64);

代码示例来源:origin: gegy1000/Terrarium

private void renderTile(int cameraX, int cameraY, int cameraZoom, SlippyMapTilePos pos, SlippyMapTile image, float partialTicks) {
  image.update(partialTicks);
  if (image.getLocation() != null) {
    int deltaZoom = cameraZoom - pos.getZoom();
    double zoomScale = Math.pow(2.0, deltaZoom);
    int size = MathHelper.floor(SlippyMap.TILE_SIZE * zoomScale);
    int renderX = (pos.getX() << deltaZoom) * SlippyMap.TILE_SIZE - cameraX;
    int renderY = (pos.getY() << deltaZoom) * SlippyMap.TILE_SIZE - cameraY;
    MC.getTextureManager().bindTexture(image.getLocation());
    GlStateManager.color(1.0F, 1.0F, 1.0F, image.getTransition());
    Gui.drawScaledCustomSizeModalRect(renderX, renderY, 0, 0, SlippyMap.TILE_SIZE, SlippyMap.TILE_SIZE, size, size, SlippyMap.TILE_SIZE, SlippyMap.TILE_SIZE);
  }
}

代码示例来源:origin: gegy1000/Terrarium

@Override
public void onDrawMap(SlippyMap map, ScaledResolution resolution, int mouseX, int mouseY) {
  if (this.marker != null) {
    int scale = resolution.getScaleFactor();
    int markerX = this.marker.getX(map.getCameraZoom()) - map.getCameraX();
    int markerY = this.marker.getY(map.getCameraZoom()) - map.getCameraY();
    Minecraft.getMinecraft().getTextureManager().bindTexture(WIDGETS_TEXTURE);
    Gui.drawScaledCustomSizeModalRect(markerX - 4 * scale, markerY - 8 * scale, 0.0F, 32.0F, 16, 16, 8 * scale, 8 * scale, 256, 256);
  }
}

相关文章