当前位置: 首页>>代码示例>>Java>>正文


Java InventoryEffectRenderer类代码示例

本文整理汇总了Java中net.minecraft.client.renderer.InventoryEffectRenderer的典型用法代码示例。如果您正苦于以下问题:Java InventoryEffectRenderer类的具体用法?Java InventoryEffectRenderer怎么用?Java InventoryEffectRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InventoryEffectRenderer类属于net.minecraft.client.renderer包,在下文中一共展示了InventoryEffectRenderer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawButton

import net.minecraft.client.renderer.InventoryEffectRenderer; //导入依赖的package包/类
@Override
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY){
    if (this.visible)
    {
        if(mc.currentScreen instanceof InventoryEffectRenderer) {
            if (deltaY != 0) {
                this.yPosition -= deltaY;
                deltaY = 0;
            }
            int size = mc.player.getActivePotionEffects().size();
            if (size > 0) {
                int off = 33;
                if (size > 4) {
                    off = -2 * height;
                    size = 1;
                }
                deltaY = off * size;
                this.yPosition += deltaY;
            }
        }
        this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
        int k = this.getHoverState(this.hovered);
        drawTextureBox(k);
        this.mouseDragged(mc, mouseX, mouseY);
        int color = 14737632;

        if (packedFGColour != 0)
        {
            color = packedFGColour;
        }
        else if (!this.enabled)
        {
            color = 10526880;
        } else if (this.hovered)
        {
            color = 16777120;
        }
        this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, color);
    }
}
 
开发者ID:Mine-and-blade-admin,项目名称:Battlegear2,代码行数:41,代码来源:GuiPlaceableButton.java

示例2: onPreDraw

import net.minecraft.client.renderer.InventoryEffectRenderer; //导入依赖的package包/类
@Override
public void onPreDraw(GuiContainer gui) {
    if (!isHidden() && isEnabled() && gui instanceof InventoryEffectRenderer)//Reset the gui to the center of the screen, for potion effect offsets etc
    {
        gui.guiLeft = (gui.width - gui.xSize) / 2;
        gui.guiTop = (gui.height - gui.ySize) / 2;

        if (gui instanceof GuiContainerCreative && gui.buttonList.size() >= 2) {
            GuiButton button1 = (GuiButton) gui.buttonList.get(0);
            GuiButton button2 = (GuiButton) gui.buttonList.get(1);
            button1.xPosition = gui.guiLeft;
            button2.xPosition = gui.guiLeft + gui.xSize - 20;
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:16,代码来源:LayoutManager.java

示例3: onTick

import net.minecraft.client.renderer.InventoryEffectRenderer; //导入依赖的package包/类
@Override
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock) {
    GuiScreen screen = minecraft.currentScreen;
    if (screen instanceof InventoryEffectRenderer) {
        this.lastRequestedStack = ItemStack.EMPTY;
        itemdash.onTick();
    }
    if (inGame) {
        pbh.handleMouse(this.survivalPick);
    }
    if (this.pickSlot) {
        InventoryPlayer inv = minecraft.player.inventory;
        // inv.setPickedItemStack but doesn't give the item (just in case)
        int slot = inv.getSlotFor(this.lastRequestedStack);

        if (InventoryPlayer.isHotbar(slot)) {
            inv.currentItem = slot;
        } else if (slot != -1) {
            mc.playerController.pickItem(slot);
        } else {
            // happens with items on the server that had nbt.
            LOGGER.warn("Inventory didn't have {}?", this.lastRequestedStack);
        }
        this.lastRequestedStack = ItemStack.EMPTY;
        this.pickSlot = false;
    }
}
 
开发者ID:MineLittlePony,项目名称:ItemDash,代码行数:28,代码来源:LiteModItemDash.java

示例4: postInitGui

import net.minecraft.client.renderer.InventoryEffectRenderer; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void postInitGui(GuiScreenEvent.InitGuiEvent.Post event){
    if (Battlegear.battlegearEnabled && event.getGui() instanceof InventoryEffectRenderer) {
        if(!ClientProxy.tconstructEnabled || Minecraft.getMinecraft().player.capabilities.isCreativeMode) {
            onOpenGui(event.getButtonList(), ((InventoryEffectRenderer) event.getGui()).getGuiLeft()-30, ((InventoryEffectRenderer) event.getGui()).getGuiTop());
        }
    }
}
 
开发者ID:Mine-and-blade-admin,项目名称:Battlegear2,代码行数:9,代码来源:BattlegearClientEvents.java

示例5: onGuiDrawScreen

import net.minecraft.client.renderer.InventoryEffectRenderer; //导入依赖的package包/类
@SubscribeEvent
public void onGuiDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
	Minecraft mc = Minecraft.getMinecraft();

	if (!(event.gui instanceof InventoryEffectRenderer)) {
		return;
	}

	int i = this.guiLeft - 124;
	int j = this.guiTop;

	Collection collection = mc.thePlayer.getActivePotionEffects();

	if (!collection.isEmpty()) {

		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		GL11.glDisable(GL11.GL_LIGHTING);
		int k = 33;

		if (collection.size() > 5) {
			k = 132 / (collection.size() - 1);
		}

		for (Iterator iterator = mc.thePlayer.getActivePotionEffects().iterator(); iterator.hasNext(); j += k) {
			PotionEffect potioneffect = (PotionEffect) iterator.next();

			if (potioneffect instanceof BaublePotionEffect) {
				mc.getTextureManager().bindTexture(INVENTORY);
				Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
				GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
				event.gui.drawTexturedModalRect(i, j, 0, 166, 140, 32);

				if (potion.hasStatusIcon()) {
					int l = potion.getStatusIconIndex();
					event.gui.drawTexturedModalRect(i + 6, j + 7, l % 8 * 18, 198 + l / 8 * 18, 18, 18);
				}

				String s1 = I18n.format(potion.getName());

				if (potioneffect.getAmplifier() == 1) {
					s1 = s1 + " II";
				} else if (potioneffect.getAmplifier() == 2) {
					s1 = s1 + " III";
				} else if (potioneffect.getAmplifier() == 3) {
					s1 = s1 + " IV";
				}

				mc.fontRenderer.drawStringWithShadow(s1, i + 10 + 18, j + 6, 16777215);
				mc.fontRenderer.drawStringWithShadow("Bauble", i + 10 + 18, j + 6 + 10, 8355711);
			}
		}
	}
}
 
开发者ID:dmillerw,项目名称:AlchemicalBling,代码行数:54,代码来源:PotionEffectRenderer.java


注:本文中的net.minecraft.client.renderer.InventoryEffectRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。