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


Java Slot.getBackgroundSprite方法代碼示例

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


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

示例1: drawDankNullSlot

import net.minecraft.inventory.Slot; //導入方法依賴的package包/類
private void drawDankNullSlot(Slot slotIn) {
	GuiContainer gui = this;
	int i = EasyMappings.slotPosX(slotIn);
	int j = EasyMappings.slotPosY(slotIn);
	ItemStack itemstack = slotIn.getStack();
	boolean flag = false;
	boolean flag1 = (slotIn == MCPrivateUtils.getGuiClickedSlot(gui)) && (MCPrivateUtils.getGuiDraggedStack(gui) != null) && (!MCPrivateUtils.getGuiIsRightMouseClick(gui));
	ItemStack itemstack1 = EasyMappings.player().inventory.getItemStack();
	String s = null;
	if ((slotIn == MCPrivateUtils.getGuiClickedSlot(gui)) && (MCPrivateUtils.getGuiDraggedStack(gui) != null) && (MCPrivateUtils.getGuiIsRightMouseClick(gui)) && (!itemstack.isEmpty())) {
		itemstack = itemstack.copy();
		itemstack.setCount(itemstack.getCount() / 2);
	}
	else if ((MCPrivateUtils.getGuiDragSplitting(gui)) && (MCPrivateUtils.getGuiDragSplittingSlots(gui).contains(slotIn)) && (!itemstack1.isEmpty())) {
		if (MCPrivateUtils.getGuiDragSplittingSlots(gui).size() == 1) {
			return;
		}
		MCPrivateUtils.getGuiDragSplittingSlots(gui).remove(slotIn);
		GuiUtils.updateDragSplitting(gui);
	}
	MCPrivateUtils.setGuiZLevel(gui, 100.0F);
	MCPrivateUtils.setGuiScreenRendererZLevel(gui, 100.0F);
	if (itemstack.isEmpty()) {
		TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite();
		if (textureatlassprite != null) {
			GlStateManager.disableLighting();
			GuiUtils.bindTexture(slotIn.getBackgroundLocation());
			GuiUtils.drawTexturedModalRect(gui, i, j, textureatlassprite, 16, 16);
			GlStateManager.enableLighting();
			flag1 = true;
		}
	}
	if (!flag1) {
		if (flag) {
			Gui.drawRect(i, j, i + 16, j + 16, -2130706433);
		}
		GlStateManager.enableDepth();
		Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(itemstack, i, j);
		pRenderItem.renderItemOverlayIntoGUI(RenderUtils.getFontRenderer(), itemstack, i, j, s);
	}
	MCPrivateUtils.setGuiScreenRendererZLevel(gui, 0.0F);
	MCPrivateUtils.setGuiZLevel(gui, 0.0F);
}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:44,代碼來源:GuiDankNull.java

示例2: drawSlot

import net.minecraft.inventory.Slot; //導入方法依賴的package包/類
private void drawSlot(Slot slotIn)
{
    int i = slotIn.xPos;
    int j = slotIn.yPos;
    ItemStack itemstack = slotIn.getStack();
    boolean flag = false;
    boolean flag1 = false;
    String s = null;

    this.zLevel = 100.0F;
    this.itemRender.zLevel = 100.0F;

    if (itemstack.isEmpty() && slotIn.isEnabled())
    {
        TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite();

        if (textureatlassprite != null)
        {
            GlStateManager.disableLighting();
            this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation());
            this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16);
            GlStateManager.enableLighting();
            flag1 = true;
        }
    }

    if (!flag1)
    {
        if (flag)
        {
            drawRect(i, j, i + 16, j + 16, -2130706433);
        }

        GlStateManager.enableDepth();
        this.itemRender.renderItemAndEffectIntoGUI(this.mc.player, itemstack, i, j);
        this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, itemstack, i, j, s);
    }

    this.itemRender.zLevel = 0.0F;
    this.zLevel = 0.0F;
}
 
開發者ID:iChun,項目名稱:Clef,代碼行數:42,代碼來源:GuiPlayTrackBlock.java


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