本文整理匯總了Java中net.minecraft.client.renderer.texture.TextureManager.getResourceLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java TextureManager.getResourceLocation方法的具體用法?Java TextureManager.getResourceLocation怎麽用?Java TextureManager.getResourceLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.renderer.texture.TextureManager
的用法示例。
在下文中一共展示了TextureManager.getResourceLocation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}