当前位置: 首页>>代码示例>>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;未经允许,请勿转载。