當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureManager.bindTexture方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureManager.bindTexture方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureManager.bindTexture方法的具體用法?Java TextureManager.bindTexture怎麽用?Java TextureManager.bindTexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.texture.TextureManager的用法示例。


在下文中一共展示了TextureManager.bindTexture方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderItemInWorld

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static void renderItemInWorld(ItemStack stack){
    if(!stack.isEmpty()){
        Minecraft mc = Minecraft.getMinecraft();
        RenderItem renderer = mc.getRenderItem();
        TextureManager manager = mc.getTextureManager();

        IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null);

        manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
        GlStateManager.enableRescaleNormal();
        GlStateManager.enableBlend();
        GlStateManager.pushMatrix();
        model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.FIXED, false);
        renderer.renderItem(stack, model);
        GlStateManager.cullFace(GlStateManager.CullFace.BACK);
        GlStateManager.popMatrix();
        GlStateManager.disableRescaleNormal();
        GlStateManager.disableBlend();
        manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
    }
}
 
開發者ID:canitzp,項目名稱:Metalworks,代碼行數:25,代碼來源:Util.java

示例2: draw

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@Override
public void draw() {
	
	super.draw();
	if (this.title != null) {
		
		TextureManager render = mc.renderEngine;
		render.bindTexture(resource);
		
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		GlStateManager.color(1F, 1F, 1F, 1F);
		int k = (gui.width - gui.WIDTH) / 2;
		gui.drawTexturedModalRect(k, 5, 0, 0, gui.WIDTH, gui.HEIGHT);
		drawSplitStringWithShadow(I18n.format(this.title), drawX + 10, drawY + 140, this.wordWrap, Color.gray.getRGB());
		gui.drawCenteredString(mc.fontRendererObj, "-by " + gui.reader.getName(), drawX + 60, drawY + 155, Color.lightGray.getRGB());
		GlStateManager.disableBlend();
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:20,代碼來源:PageTitle.java

示例3: drawBackground

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void drawBackground(TileCrusher tile, GuiMachine<TileCrusher> gui, TextureManager texture, int guiLeft, int guiTop, int mouseX, int mouseY, float partialTicks) {
    texture.bindTexture(LOC);
    gui.drawTexturedModalRect(guiLeft, guiTop, 0, 0, gui.getXSize(), gui.getYSize());
    if(tile.maxBurn > 0){
        int i = (int) ((tile.burn / (tile.maxBurn  * 1.0F)) * 25.0F);
        gui.drawTexturedModalRect(guiLeft + 83, guiTop + 25, 0, 74, 30, 25 - i);
    }
}
 
開發者ID:canitzp,項目名稱:Metalworks,代碼行數:11,代碼來源:InterfaceCrusher.java

示例4: drawBackground

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void drawBackground(TileDuster tile, GuiMachine<TileDuster> gui, TextureManager texture, int guiLeft, int guiTop, int mouseX, int mouseY, float partialTicks) {
    texture.bindTexture(LOC);
    gui.drawTexturedModalRect(guiLeft, guiTop, 0, 0, gui.getXSize(), gui.getYSize());
    if(tile.maxBurn > 0){
        int i = (int) ((tile.burn / (tile.maxBurn  * 1.0F)) * 25.0F);
        gui.drawTexturedModalRect(guiLeft + 73, guiTop + 29, 176, 0, 30, 25 - i);
    }
}
 
開發者ID:canitzp,項目名稱:Metalworks,代碼行數:11,代碼來源:InterfaceDuster.java

示例5: drawBackground

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void drawBackground(TileBlastFurnace tile, GuiMachine<TileBlastFurnace> gui, TextureManager texture, int guiLeft, int guiTop, int mouseX, int mouseY, float partialTicks) {
    texture.bindTexture(LOC);
    gui.drawTexturedModalRect(guiLeft, guiTop, 0, 0, gui.getXSize(), gui.getYSize());
    if(tile.maxBurn > 0){
        int i = (int) ((tile.burnLeft / (tile.maxBurn  * 1.0F)) * 26);
        gui.drawTexturedModalRect(guiLeft + 68, guiTop + 29, 180, 0, 43, 26 - i);
    }
}
 
開發者ID:canitzp,項目名稱:Metalworks,代碼行數:11,代碼來源:InterfaceBlastFurnace.java

示例6: bindTexture

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
protected void bindTexture(ResourceLocation location)
{
    TextureManager texturemanager = this.rendererDispatcher.renderEngine;

    if (texturemanager != null)
    {
        texturemanager.bindTexture(location);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:10,代碼來源:TileEntitySpecialRenderer.java

示例7: render

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public void render(ModelBiped p_render_1_, AbstractClientPlayer p_render_2_, float p_render_3_, float p_render_4_)
{
    TextureManager texturemanager = Config.getTextureManager();

    if (this.usePlayerTexture)
    {
        texturemanager.bindTexture(p_render_2_.getLocationSkin());
    }
    else if (this.textureLocation != null)
    {
        if (this.texture == null && this.textureImage != null)
        {
            this.texture = new DynamicTexture(this.textureImage);
            Minecraft.getMinecraft().getTextureManager().loadTexture(this.textureLocation, this.texture);
        }

        texturemanager.bindTexture(this.textureLocation);
    }
    else
    {
        texturemanager.bindTexture(this.locationMissing);
    }

    for (int i = 0; i < this.modelRenderers.length; ++i)
    {
        PlayerItemRenderer playeritemrenderer = this.modelRenderers[i];
        GlStateManager.pushMatrix();

        if (p_render_2_.isSneaking())
        {
            GlStateManager.translate(0.0F, 0.2F, 0.0F);
        }

        playeritemrenderer.render(p_render_1_, p_render_3_);
        GlStateManager.popMatrix();
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:38,代碼來源:PlayerItemModel.java

示例8: bindTexturePackIcon

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public void bindTexturePackIcon(TextureManager textureManagerIn)
{
    if (this.locationTexturePackIcon == null)
    {
        this.locationTexturePackIcon = textureManagerIn.getDynamicTextureLocation("texturepackicon", new DynamicTexture(this.texturePackIcon));
    }

    textureManagerIn.bindTexture(this.locationTexturePackIcon);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:10,代碼來源:ResourcePackRepository.java

示例9: bindTexturePackIcon

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public void bindTexturePackIcon(TextureManager textureManagerIn)
{
    BufferedImage bufferedimage = null;

    try
    {
        bufferedimage = this.reResourcePack.getPackImage();
    }
    catch (IOException var5)
    {
        ;
    }

    if (bufferedimage == null)
    {
        try
        {
            bufferedimage = ResourcePackRepository.this.rprDefaultResourcePack.getPackImage();
        }
        catch (IOException ioexception)
        {
            throw new Error("Couldn\'t bind resource pack icon", ioexception);
        }
    }

    if (this.locationTexturePackIcon == null)
    {
        this.locationTexturePackIcon = textureManagerIn.getDynamicTextureLocation("texturepackicon", new DynamicTexture(bufferedimage));
    }

    textureManagerIn.bindTexture(this.locationTexturePackIcon);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:33,代碼來源:ResourcePackRepository.java

示例10: customRenderItem

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public static void customRenderItem(ItemStack is, boolean normal) {
        RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
        TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();

//        IBakedModel ibakedmodel = renderItem.getItemModelMesher().getItemModel(is);
        EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());
        IBakedModel ibakedmodel = renderItem.getItemModelWithOverrides(is, player.getEntityWorld(), player);

        textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
        preTransform(renderItem, is);
        GlStateManager.enableRescaleNormal();
        GlStateManager.alphaFunc(516, 0.1F);

        if (normal) {
            GlStateManager.enableBlend();
            GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        }

        GlStateManager.pushMatrix();
        ibakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.NONE, false);

        renderItem.renderItem(is, ibakedmodel);
        GlStateManager.cullFace(GlStateManager.CullFace.BACK);
        GlStateManager.popMatrix();
        GlStateManager.disableRescaleNormal();

        if (normal) {
            GlStateManager.disableBlend();
        }

        textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
    }
 
開發者ID:McJty,項目名稱:Lector,代碼行數:35,代碼來源:RenderHelper.java

示例11: render

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public void render(float partialTicks, double x1, double y1, double z1, double x2, double y2, double z2) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    TextureManager textureManager = mc.renderEngine;

    double laserLength = PneumaticCraftUtils.distBetween(x1, y1, z1, x2, y2, z2);
    double laserSize = 0.4;

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslated(x1, y1, z1);

    double dx = x2 - x1;
    double dy = y2 - y1;
    double dz = z2 - z1;
    float f3 = MathHelper.sqrt(dx * dx + dz * dz);
    double rotYaw = Math.atan2(dx, dz) * 180.0D / Math.PI;
    double rotPitch = 90 - (float) (Math.atan2(dy, f3) * 180.0D / Math.PI);

    GL11.glRotated(rotYaw, 0, 1, 0);
    GL11.glRotated(rotPitch, 1, 0, 0);

    GL11.glScaled(laserSize, laserSize, laserSize);
    GL11.glTranslated(0, 0.6, 0);
    GL11.glRotated((ticksExisted + partialTicks) * 200, 0, 1, 0);

    GL11.glPushMatrix();
    GL11.glScaled(1, laserLength / laserSize, 1);

    /*   GL11.glTranslated(0, -0.01, 0);
       textureManager.bindTexture(Textures.RENDER_LASER_ANIMATION);
       renderAnimation(partialTicks, laserLength / laserSize);
       GL11.glTranslated(0, 0.01, 0);*/

    textureManager.bindTexture(Textures.RENDER_LASER);
    renderQuad(glowColor);
    textureManager.bindTexture(Textures.RENDER_LASER_OVERLAY);
    renderQuad(coreColor);
    GL11.glPopMatrix();

    GL11.glRotated(180, 1, 0, 0);
    textureManager.bindTexture(Textures.RENDER_LASER_START);
    renderQuad(glowColor);
    textureManager.bindTexture(Textures.RENDER_LASER_START_OVERLAY);
    renderQuad(coreColor);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glColor4d(1, 1, 1, 1);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:55,代碼來源:RenderLaser.java

示例12: renderOverlay

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
	if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR && renderTime > 0) {
		Minecraft mc = Minecraft.getMinecraft();
		TextureManager manager = mc.getTextureManager();
		Optional<IEnergy> optional = EnergyHandler.getEnergy(mc.player);

		if (optional.isPresent()) {
			IEnergy energy = optional.get();

			GlStateManager.pushMatrix();
			GlStateManager.enableBlend();

			ScaledResolution resolution = event.getResolution();
			double interpEnergy = 0;
			if (oldEnergy >= 0) {
				interpEnergy = (double) (energy.get() - oldEnergy) * event.getPartialTicks() + oldEnergy;
			} else {
				interpEnergy = energy.get();
			}
			double filled = interpEnergy / energy.getMax();

			// System.out.println("fil: " + filled + ", chg: " + energy.get() + ", max: " + energy.getMax());

			int height = ConfigHandler.ENERGY_HUD.height;
			int width = ConfigHandler.ENERGY_HUD.width;
			int x = ConfigHandler.ENERGY_HUD.x;
			int y = resolution.getScaledHeight() - ConfigHandler.ENERGY_HUD.y;

			if (ConfigHandler.ENERGY_HUD.hide) {
				GlStateManager.color(1F, 1F, 1F, visible);
			}

			double barWidth = width * 7 / 25;

			GlStateManager.disableCull();
			manager.bindTexture(ResourceLocations.ENERGY_BACKGROUND[0]);
			renderTexture(x + 9, y + 88, barWidth, -(height - 28D) * filled, 0, filled);

			if (visible == 1f) {
				GlStateManager.pushMatrix();
				GlStateManager.color(1F, 1F, 1F, visible == 1F ? barAlpha : visible);

				manager.bindTexture(ResourceLocations.ENERGY_BACKGROUND[1]);
				renderTexture(x + 9, y + 88, barWidth, -(height - 28D) * filled, 0, filled);
				GlStateManager.enableCull();

				GlStateManager.popMatrix();
			}

			if (ConfigHandler.ENERGY_HUD.hide) {
				GlStateManager.color(1F, 1F, 1F, visible);
			}

			manager.bindTexture(energy.getType().getTexture());
			renderTexture(x, y, width, height, 0, 1);

			int textColor = 0x990066;
			if (ConfigHandler.ENERGY_HUD.hide) {
				int alpha = (int) (visible * 255);
				textColor = alpha << 24 | 0x990066;
			}

			String text = "E: " + energy.get();
			mc.fontRenderer.drawStringWithShadow(text, x, y - 10, textColor);
			GlStateManager.disableBlend();
			GlStateManager.popMatrix();
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:71,代碼來源:EnergyHUD.java

示例13: FontRenderer

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public FontRenderer(GameSettings gameSettingsIn, ResourceLocation location, TextureManager textureManagerIn, boolean unicode)
{
    this.locationFontTexture = location;
    this.renderEngine = textureManagerIn;
    this.unicodeFlag = unicode;
    textureManagerIn.bindTexture(this.locationFontTexture);

    for (int i = 0; i < 32; ++i)
    {
        int j = (i >> 3 & 1) * 85;
        int k = (i >> 2 & 1) * 170 + j;
        int l = (i >> 1 & 1) * 170 + j;
        int i1 = (i >> 0 & 1) * 170 + j;

        if (i == 6)
        {
            k += 85;
        }

        if (gameSettingsIn.anaglyph)
        {
            int j1 = (k * 30 + l * 59 + i1 * 11) / 100;
            int k1 = (k * 30 + l * 70) / 100;
            int l1 = (k * 30 + i1 * 70) / 100;
            k = j1;
            l = k1;
            i1 = l1;
        }

        if (i >= 16)
        {
            k /= 4;
            l /= 4;
            i1 /= 4;
        }

        this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255;
    }

    this.readGlyphSizes();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:42,代碼來源:FontRenderer.java

示例14: renderItem

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
	TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
	ResourceLocation resource = textureManager.getResourceLocation(stack.getItemSpriteNumber());

	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
	ItemStack usingItem = player.getItemInUse();
	int useRemaining = player.getItemInUseCount();

	ItemBow bow = (ItemBow) stack.getItem();

	IIcon icon = bow.getIcon(stack, 0);
	if (usingItem != null && usingItem == stack) {
		int charge = stack.getMaxItemUseDuration() - useRemaining;
		if (charge >= 18)
			icon = bow.getItemIconForUseDuration(2);
		else if (charge > 13)
			icon = bow.getItemIconForUseDuration(1);
		else if (charge > 0)
			icon = bow.getItemIconForUseDuration(0);
	}
	if (icon == null)
		icon = ((TextureMap) textureManager.getTexture(resource)).getAtlasSprite("missingno");

	OpenGLHelper.pushMatrix();
	textureManager.bindTexture(resource);

	OpenGLHelper.colour(bow.getColorFromItemStack(stack, 0));

	OpenGLHelper.disableLighting();
	OpenGLHelper.enableAlpha();
	OpenGLHelper.enableBlend();
	OpenGlHelper.glBlendFunc(770, 771, 1, 0);

	renderItem.renderIcon(0, 0, icon, 16, 16);

	OpenGLHelper.enableLighting();
	OpenGLHelper.disableAlpha();
	OpenGLHelper.disableBlend();

	if (stack.hasEffect(0))
		renderItem.renderEffect(textureManager, 0, 0);

	OpenGLHelper.popMatrix();
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:46,代碼來源:ItemBowRenderer.java

示例15: FontRenderer

import net.minecraft.client.renderer.texture.TextureManager; //導入方法依賴的package包/類
public FontRenderer(GameSettings p_i1035_1_, ResourceLocation p_i1035_2_, TextureManager p_i1035_3_, boolean p_i1035_4_)
   {
this.gameSettings = p_i1035_1_;
this.locationFontTextureBase = p_i1035_2_;
this.locationFontTexture = p_i1035_2_;
this.renderEngine = p_i1035_3_;
this.unicodeFlag = p_i1035_4_;
p_i1035_3_.bindTexture(this.locationFontTexture);

for (int var5 = 0; var5 < 32; ++var5)
{
    int var6 = (var5 >> 3 & 1) * 85;
    int var7 = (var5 >> 2 & 1) * 170 + var6;
    int var8 = (var5 >> 1 & 1) * 170 + var6;
    int var9 = (var5 >> 0 & 1) * 170 + var6;

    if (var5 == 6)
    {
	var7 += 85;
    }

    if (p_i1035_1_.anaglyph)
    {
	int var10 = (var7 * 30 + var8 * 59 + var9 * 11) / 100;
	int var11 = (var7 * 30 + var8 * 70) / 100;
	int var12 = (var7 * 30 + var9 * 70) / 100;
	var7 = var10;
	var8 = var11;
	var9 = var12;
    }

    if (var5 >= 16)
    {
	var7 /= 4;
	var8 /= 4;
	var9 /= 4;
    }

    this.colorCode[var5] = (var7 & 255) << 16 | (var8 & 255) << 8 | var9 & 255;
}

this.readGlyphSizes();
   }
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:44,代碼來源:FontRenderer.java


注:本文中的net.minecraft.client.renderer.texture.TextureManager.bindTexture方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。