net.minecraft.client.Minecraft.getTextureManager()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(196)

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

Minecraft.getTextureManager介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public void bindTexture( final String file )
{
  final ResourceLocation loc = new ResourceLocation( AppEng.MOD_ID, "textures/" + file );
  this.mc.getTextureManager().bindTexture( loc );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

public void bindTexture( final String base, final String file )
{
  final ResourceLocation loc = new ResourceLocation( base, "textures/" + file );
  this.mc.getTextureManager().bindTexture( loc );
}

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

@Override
public void bindTexture() {
  Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
}

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

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  mc.getTextureManager().bindTexture(texture);
  drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
  for(int i1 = 0; i1 < 7; ++i1) {
    Slot slot = inventorySlots.inventorySlots.get(i1);
    if(slot.getHasStack() && slot.getSlotStackLimit() == 1)
      drawTexturedModalRect(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void drawButton( final Minecraft par1Minecraft, final int par2, final int par3, final float partial )
{
  if( this.visible )
  {
    par1Minecraft.getTextureManager().bindTexture( this.texture );
    final int max = this.source.getMaxProgress();
    final int current = this.source.getCurrentProgress();
    if( this.layout == Direction.VERTICAL )
    {
      final int diff = this.height - ( max > 0 ? ( this.height * current ) / max : 0 );
      this.drawTexturedModalRect( this.x, this.y + diff, this.fill_u, this.fill_v + diff, this.width, this.height - diff );
    }
    else
    {
      final int diff = this.width - ( max > 0 ? ( this.width * current ) / max : 0 );
      this.drawTexturedModalRect( this.x, this.y, this.fill_u + diff, this.fill_v, this.width - diff, this.height );
    }
    this.mouseDragged( par1Minecraft, par2, par3 );
  }
}

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

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  mc.getTextureManager().bindTexture(texture);
  int k = (width - xSize) / 2;
  int l = (height - ySize) / 2;
  drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
  List<Slot> slotList = inventorySlots.inventorySlots;
  for(Slot slot : slotList)
    if(slot instanceof SlotItemHandler) {
      SlotItemHandler slotf = (SlotItemHandler) slot;
      if(!slotf.getHasStack()) {
        ItemStack stack = new ItemStack(ModBlocks.flower, 1, slotf.getSlotIndex()); // index matches colors
        int x = guiLeft + slotf.xPos;
        int y = guiTop + slotf.yPos;
        RenderHelper.enableGUIStandardItemLighting();
        mc.getRenderItem().renderItemIntoGUI(stack, x, y);
        RenderHelper.disableStandardItemLighting();
        mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
      }
    }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void drawContent( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks )
{
  final IAEFluidStack fs = this.getFluidStack();
  if( fs != null )
  {
    GlStateManager.disableLighting();
    GlStateManager.disableBlend();
    final Fluid fluid = fs.getFluid();
    mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
    final TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
    // Set color for dynamic fluids
    // Convert int color to RGB
    final float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
    final float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
    final float blue = ( fluid.getColor() & 255 ) / 255.0F;
    GlStateManager.color( red, green, blue );
    this.drawTexturedModalRect( this.xPos(), this.yPos(), sprite, this.getWidth(), this.getHeight() );
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void drawButton( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks )
{
  if( this.visible )
  {
    GlStateManager.disableBlend();
    GlStateManager.disableLighting();
    drawRect( this.x, this.y, this.x + this.width, this.y + this.height, AEColor.GRAY.blackVariant | 0xFF000000 );
    final IAEFluidStack fluid = this.tank.getFluidInSlot( this.slot );
    if( fluid != null && fluid.getStackSize() > 0 )
    {
      mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
      float red = ( fluid.getFluid().getColor() >> 16 & 255 ) / 255.0F;
      float green = ( fluid.getFluid().getColor() >> 8 & 255 ) / 255.0F;
      float blue = ( fluid.getFluid().getColor() & 255 ) / 255.0F;
      GlStateManager.color( red, green, blue );
      TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getFluid().getStill().toString() );
      final int scaledHeight = (int) ( this.height * ( (float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity() ) );
      int iconHeightRemainder = scaledHeight % 16;
      if( iconHeightRemainder > 0 )
      {
        this.drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder, sprite, 16, iconHeightRemainder );
      }
      for( int i = 0; i < scaledHeight / 16; i++ )
      {
        this.drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder - ( i + 1 ) * 16, sprite, 16, 16 );
      }
    }
  }
}

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

private @Nonnull ResourceLocation getArmoredTexture(EntityHorse horse) {
 String s = horseArmorTextures[horse.getHorseArmorType().ordinal()];
 ResourceLocation resourcelocation = textureCache.get(s);
 if (resourcelocation == null) {
  resourcelocation = new ResourceLocation("Layered:" + s);
  Minecraft.getMinecraft().getTextureManager().loadTexture(resourcelocation, new LayeredTexture(textureName, s));
  textureCache.put(s, resourcelocation);
 }
 return resourcelocation;
}

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

protected void bindTexture(ResourceLocation texturePath) {
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
  textureManager.bindTexture(texturePath);
}

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

@Override
public void drawElement(int mouseX, int mouseY) {
  super.drawElement(mouseX, mouseY);
  TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
  textureManager.bindTexture(new ResourceLocation(Constants.MOD_ID, "textures/gui/habitat_former.png"));
  Optional<ClimateButton> optional = buttons.stream().min(BUTTON_COMPARATOR);
  if (!optional.isPresent()) {
    return;
  }
  ClimateButton button = optional.get();
  drawTexturedModalRect(button.getX() - 1, button.getY() - 1, 0, 233, 22, 22);
}

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

public DynaTextureProvider(int textureSize, @Nonnull ResourceLocation fallBackTexture) {
 this.textureManager = Minecraft.getMinecraft().getTextureManager();
 this.resourceManager = Minecraft.getMinecraft().getResourceManager();
 this.fallBackTexture = fallBackTexture;
 this.dynamicTexture = new DynamicTexture(textureSize, textureSize);
 this.imageData = this.dynamicTexture.getTextureData();
 this.resourceLocation = textureManager.getDynamicTextureLocation(EnderIO.DOMAIN, this.dynamicTexture);
 for (int i = 0; i < this.imageData.length; ++i) {
  this.imageData[i] = 0;
 }
 instances.add(this);
}

代码示例来源:origin: TheGreyGhost/MinecraftByExample

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
  // Bind the image texture of our custom container
  Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
  // Draw the image
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

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

protected void drawSprite(ResourceLocation textureMap, TextureAtlasSprite sprite, int x, int y) {
  GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0F);
  Minecraft.getMinecraft().getTextureManager().bindTexture(textureMap);
  manager.gui.drawTexturedModalRect(x, y, sprite, 16, 16);
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
  protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    ResourceLocation soulForgeGuiTextures = new ResourceLocation(BloodMagic.MODID + ":textures/gui/masterRoutingNode.png");
    this.mc.getTextureManager().bindTexture(soulForgeGuiTextures);
    int i = (this.width - this.xSize) / 2;
    int j = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
  }
}

代码示例来源: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: ForestryMC/ForestryMC

@Override
public void draw(int startX, int startY) {
  GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0F);
  TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
  textureManager.bindTexture(manager.gui.textureFile);
  manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 228, pressed ? 47 : 22, width, height);
}

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

@Override
public void draw(GuiForestry gui, IFilterRuleType selectable, int x, int y) {
  TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
  textureManager.bindTexture(selectable.getTextureMap());
  TextureAtlasSprite sprite = selectable.getSprite();
  gui.drawTexturedModalRect(x, y, sprite, 16, 16);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

GlStateManager.disableBlend();
final Fluid fluid = fs.getFluid();
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );

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

@Override
public void draw(int startX, int startY) {
  if (!getStackIndex().isEmpty()) {
    Minecraft minecraft = Minecraft.getMinecraft();
    TextureManager textureManager = minecraft.getTextureManager();
    textureManager.bindTexture(getLogic().getTextureMap());
    RenderItem renderItem = minecraft.getRenderItem();
    renderItem.renderItemIntoGUI(getStackIndex(), startX + xPos, startY + yPos);
  }
}

相关文章