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

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

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

Gui.drawModalRectWithCustomSizedTexture介绍

暂无

代码示例

代码示例来源:origin: mezz/JustEnoughItems

@Override
  public void draw(Minecraft minecraft, int xOffset, int yOffset, int maskTop, int maskBottom, int maskLeft, int maskRight) {
    minecraft.getTextureManager().bindTexture(this.resourceLocation);

    int x = xOffset + this.paddingLeft + maskLeft;
    int y = yOffset + this.paddingTop + maskTop;
    int u = this.u + maskLeft;
    int v = this.v + maskTop;
    int width = this.width - maskRight - maskLeft;
    int height = this.height - maskBottom - maskTop;
    Gui.drawModalRectWithCustomSizedTexture(x, y, u, v, width, height, textureWidth, textureHeight);
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
  int u = 0, v = 0;
  this.mc.getTextureManager().bindTexture(Const.Res.SLOT);
  Gui.drawModalRectWithCustomSizedTexture(
    this.width / 2 - 9,
    this.guiTop + 34 - 1,
    u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
 }
}

代码示例来源:origin: WesCook/Nutrition

@Override
@SideOnly(Side.CLIENT)
public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) {
  if (mc.currentScreen != null) {
    mc.getTextureManager().bindTexture(icon);
    Gui.drawModalRectWithCustomSizedTexture(x + 6, y + 7, 0, 0, 18, 18, 18, 18);
  }
}

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

@Override
boolean renderKey(Minecraft mc, boolean canHover, CoordinateHolder c) {
  boolean hovered = (canHover && isHovered(c)) || Keyboard.isKeyDown(getKey(clicks));
  int u = 320 + w * type;
  int v = hovered ? h : 0;
  drawModalRectWithCustomSizedTexture(c.baseX + x, c.baseY + y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
  if(hovered)
    renderNote(mc, c);
  return hovered;
}

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

@Override
boolean renderKey(Minecraft mc, boolean canHover, CoordinateHolder c) {
  boolean hovered = (canHover && isHovered(c)) || Keyboard.isKeyDown(getKey(clicks));
  int u = 374;
  int v = hovered ? h : 0;
  drawModalRectWithCustomSizedTexture(c.baseX + x, c.baseY + y, u, v, w, h, TEXTURE_WIDTH, TEXTURE_HEIGHT);
  if(hovered)
    renderNote(mc, c);
  return hovered;
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
  int u = 0, v = 0;
  this.mc.getTextureManager().bindTexture(Const.Res.SLOT);
  Gui.drawModalRectWithCustomSizedTexture(
    this.width / 2 - 9,
    this.guiTop + 34 - 1,
    u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
 }
}

代码示例来源:origin: WesCook/Nutrition

@Override
  @SideOnly(Side.CLIENT)
  public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha) {
    mc.getTextureManager().bindTexture(icon);
    Gui.drawModalRectWithCustomSizedTexture(x + 3, y + 3, 0, 0, 18, 18, 18, 18);
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
 GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
 this.mc.getTextureManager().bindTexture(table);
 int thisX = (this.width - this.xSize) / 2;
 int thisY = (this.height - this.ySize) / 2;
 int texture_width = 176;
 int texture_height = 79;
 int u = 0, v = 0;
 Gui.drawModalRectWithCustomSizedTexture(thisX, thisY, u, v, this.xSize, this.ySize, texture_width, texture_height);
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
  int u = 0, v = 0;
  this.mc.getTextureManager().bindTexture(Const.Res.SLOT);
  for (int k = 0; k < this.tile.getSizeInventory(); k++) {
   Gui.drawModalRectWithCustomSizedTexture(this.guiLeft + ContainerBuilder.SLOTX_START - 1 + k * Const.SQ, this.guiTop + ContainerBuilder.SLOTY - 1, u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
  }
 }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
  int u = 0, v = 0;
  this.mc.getTextureManager().bindTexture(Const.Res.SLOT);
  for (int k = 0; k < this.tile.getSizeInventory(); k++) { // x had - 3 ??
   Gui.drawModalRectWithCustomSizedTexture(this.guiLeft + ContainerPlacer.SLOTX_START - 1 + k * Const.SQ, this.guiTop + ContainerPlacer.SLOTY - 1, u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
  }
 }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
 super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
 int u = 0, v = 0;
 this.mc.getTextureManager().bindTexture(Const.Res.SLOT);
 for (int k = 0; k < this.tile.getSizeInventory(); k++) {
  Gui.drawModalRectWithCustomSizedTexture(this.guiLeft + ContainerFan.SLOTX_START - 1 + k * Const.SQ, this.guiTop + ContainerFan.SLOTY - 1, u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
 }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
 protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
  int u = 0, v = 0;
  this.mc.getTextureManager().bindTexture(Const.Res.SLOT);
  int row = 0, col = 0;
  for (int i = 0; i < tile.getSizeInventory(); i++) {
   row = i / GUI_ROWS;// /3 will go 000, 111, 222
   col = i % GUI_ROWS; // and %3 will go 012 012 012
   Gui.drawModalRectWithCustomSizedTexture(this.guiLeft + ContainerPattern.SLOTX_START - 1 + row * Const.SQ, this.guiTop + ContainerPattern.SLOTY_START - 1 + col * Const.SQ, u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
  }
 }
}

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

@Override
public void render(int mouseX, int mouseY, float pticks) {
  int w = 66;
  int h = 26;
  
  mc.renderEngine.bindTexture(book.craftingResource);
  GlStateManager.enableBlend();
  Gui.drawModalRectWithCustomSizedTexture(GuiBook.PAGE_WIDTH / 2 - w / 2, 10, 0, 128 - h, w, h, 128, 128);
  
  parent.drawCenteredStringNoShadow(title != null && !title.isEmpty() ? title : itemStack.getDisplayName(), GuiBook.PAGE_WIDTH / 2, 0, book.headerColor);
  parent.renderItemStack(GuiBook.PAGE_WIDTH / 2 - 8, 15, mouseX, mouseY, itemStack);
  
  super.render(mouseX, mouseY, pticks);
}

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

@Override
public void render(BookPage page, int mouseX, int mouseY, float pticks) {
  super.render(page, mouseX, mouseY, pticks);
  
  if(framed) {
    GlStateManager.enableBlend();
    GlStateManager.color(1F, 1F, 1F, 1F);
    page.mc.renderEngine.bindTexture(page.book.craftingResource);
    Gui.drawModalRectWithCustomSizedTexture(x - 4, y - 4, 83, 71, 24, 24, 128, 128);
  }
  
  page.parent.renderIngredient(x, y, mouseX, mouseY, ingredient);
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@SideOnly(Side.CLIENT)
public static void renderItemAt(ResourceLocation res, int x, int y) {
 int w = 16, h = 16;
 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
 Minecraft.getMinecraft().getTextureManager().bindTexture(res);
 Gui.drawModalRectWithCustomSizedTexture(x, y, 0F, 0F, w, h, w, h);
}

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

private void drawBackground(GuiScreen gui, int x, int y) {
  if(gui instanceof IItemSearchBar && ((IItemSearchBar) gui).renderBackground(x, y) || gui == null)
    return;
  
  GlStateManager.color(1F, 1F, 1F, 1F);
  GlStateManager.disableLighting();
  Minecraft.getMinecraft().getTextureManager().bindTexture(LibMisc.GENERAL_ICONS_RESOURCE);
  Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 244, 90, 12, 256, 256);
}

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

@Override
public void render(BookPage page, int mouseX, int mouseY, float pticks) {
  if(scale == 0F)
    return;
  
  page.mc.renderEngine.bindTexture(resource);
  GlStateManager.pushMatrix();
  GlStateManager.translate(x, y, 0);
  GlStateManager.scale(scale, scale, scale);
  GlStateManager.color(1F, 1F, 1F, 1F);
  GlStateManager.enableBlend();
  Gui.drawModalRectWithCustomSizedTexture(0, 0, u, v, width, height, textureWidth, textureHeight);
  GlStateManager.popMatrix();
}

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

@Override
protected void drawRecipe(Tuple<ItemStack, ItemStack> recipe, int recipeX, int recipeY, int mouseX, int mouseY, boolean second) {
  mc.renderEngine.bindTexture(book.craftingResource);
  GlStateManager.enableBlend();
  Gui.drawModalRectWithCustomSizedTexture(recipeX, recipeY, 11, 71, 96, 24, 128, 128);
  parent.drawCenteredStringNoShadow(getTitle(second), GuiBook.PAGE_WIDTH / 2, recipeY - 10, book.headerColor);
  parent.renderItemStack(recipeX + 4, recipeY + 4, mouseX, mouseY, recipe.getFirst());
  parent.renderItemStack(recipeX + 76, recipeY + 4, mouseX, mouseY, recipe.getSecond());
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
 super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
 int u = 0, v = 0;
 this.mc.getTextureManager().bindTexture(SLOT_BOTTLE);
 for (int k = 0; k < this.tile.getSizeInventory(); k++) {
  if (k == 0)
   this.mc.getTextureManager().bindTexture(SLOT_BOTTLE);
  else
   this.mc.getTextureManager().bindTexture(SLOT_EBOTTLE);
  Gui.drawModalRectWithCustomSizedTexture(this.guiLeft + ContainerPylon.SLOTX - 1, this.guiTop + ContainerPylon.SLOTY - 1 + k * (8 + Const.SQ), u, v, Const.SQ, Const.SQ, Const.SQ, Const.SQ);
 }
 fluidBar.draw(tile.getCurrentFluidStack());
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
 this.mc.getTextureManager().bindTexture(getScreenSize().texture());
 int thisX = this.getMiddleX();
 int thisY = this.getMiddleY();
 int u = 0, v = 0;
 Gui.drawModalRectWithCustomSizedTexture(thisX, thisY, u, v,
   getScreenSize().width(), getScreenSize().height(),
   getScreenSize().width(), getScreenSize().height());
}

相关文章