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


Java GuiContainer类代码示例

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


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

示例1: drawPotionEffect

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
public static void drawPotionEffect(PotionEffect potion, int x, int y) {
    int index = potion.getPotion().getStatusIconIndex();
    GlStateManager.pushMatrix();
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.disableLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableColorMaterial();
    GlStateManager.enableLighting();
    GlStateManager.enableTexture2D();
    GlStateManager.color(1.f, 1.f, 1.f, 1.f);
    MC.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND);
    drawTexturedRect(x, y, index % 8 * 18, 198 + index / 8 * 18, 18, 18, 100);
    potion.getPotion().renderHUDEffect(x, y, potion, MC, 255);
    GlStateManager.disableLighting();
    GlStateManager.enableDepth();
    GlStateManager.color(1.f, 1.f, 1.f, 1.f);
    GlStateManager.popMatrix();
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:19,代码来源:SurfaceHelper.java

示例2: ModuleChestStealer

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
public ModuleChestStealer() {
    super("ChestStealer", "steals chest", Ordering.OTHER, 0, 0);
    addValue(mode, delay, validate, itemFilter, itemFilterMode);
    addTicker(new Ticker("cheststealer_ticker", () -> {
        if (Wrapper.theWorld() == null) return;
        if (Wrapper.currentScreen() == null || !(Wrapper.currentScreen() instanceof GuiChest)) return;
        GuiChest chest = (GuiChest) Wrapper.currentScreen();

        if (validate.getValue() && !ItemUtil.isValidChest(chest)) return;

        int item = (mode.getCurrent().equalsIgnoreCase("vertical") ? getItemVertical(chest) : mode.getCurrent().equalsIgnoreCase("horizontal") ? getItemHorizontal(chest) : getItemRandom(chest));

        if (item == -1 || ItemUtil.isChestEmpty(chest) || ItemUtil.player_inventoryFull()) {
            try {
                Thread.sleep(100, 150);
            } catch (InterruptedException e) {
            }
            Wrapper.displayGuiScreen(null);
            return;
        }

        sleep((long) Math.floor(delay.getValue() / 1.5 + ThreadLocalRandom.current().nextInt((int) delay.getValue() / 4, (int) delay.getValue() / 3)));
        Wrapper.windowClick(Wrapper.inventoryId((Container) ReflectionUtil.getFieldValue("field_147002_h", chest, GuiContainer.class)), item, 0, ClickMode.QUICK_MOVE);
    }));
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:26,代码来源:ModuleChestStealer.java

示例3: checks

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
private boolean checks() {

        if (!Mouse.isButtonDown(Wrapper.convertKeyToLWJGL(Wrapper.getKeyCode(Wrapper.keybindAttack()))))
            return false;

        if (Wrapper.theWorld() == null || Wrapper.thePlayer() == null)
            return false;

        if (Bit.getInstance().getGlobalValueManager().find_bool("weapon only").getValue()
                && !Wrapper.isHoldingWeapon() && Wrapper.currentScreen() == null)
            return false;

        if ((Wrapper.currentScreen() != null && !inventory.getValue()) || (inventory.getValue() && Wrapper.currentScreen() != null && !(Wrapper.currentScreen() instanceof GuiContainer)))
            return false;

        if (Wrapper.player_isUsingItem() || Wrapper.player_isBlocking())
            return false;

        return true;
    }
 
开发者ID:Ygore,项目名称:bit-client,代码行数:21,代码来源:ModuleAutoclicker.java

示例4: onItemStackTooltip

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onItemStackTooltip(RenderTooltipEvent.Pre event) {
	if (!Config.isToggledEnabled() && !isEnableKeyHeld()) {
		return;
	}
	ItemStack itemStack = event.getStack();
	//noinspection ConstantConditions
	if (itemStack == null || itemStack.isEmpty()) {
		return;
	}
	if (Config.isJeiOnly() && !ItemStack.areItemStacksEqual(itemStack, JeiCompat.getStackUnderMouse())) {
		return;
	}

	Minecraft minecraft = Minecraft.getMinecraft();
	GuiScreen currentScreen = minecraft.currentScreen;
	if (currentScreen instanceof GuiContainer) {
		GuiContainer guiContainer = (GuiContainer) currentScreen;
		renderZoomedStack(itemStack, guiContainer, minecraft);
	}
}
 
开发者ID:mezz,项目名称:ItemZoom,代码行数:22,代码来源:EventHandler.java

示例5: load

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@Override
public void load(GuiContainer gui) {
    if (isEnabled()) {
        setInputFocused(null);

        ItemList.loadItems.restart();

        getLayoutStyle().init();
        layout(gui);
    }

    NEIController.load(gui);

    if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+
    {
        gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:19,代码来源:LayoutManager.java

示例6: clearCraftingGridOfItems

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
private static boolean clearCraftingGridOfItems(GuiContainer gui, SlotRange range, RecipeStorage recipes, boolean nonMatchingOnly)
{
    int numSlots = gui.inventorySlots.inventorySlots.size();

    for (int i = 0, slotNum = range.getFirst();
        i < range.getSlotCount() && i < recipes.getSelectedRecipe().getRecipeLength() && slotNum < numSlots;
        i++, slotNum++)
    {
        Slot slotTmp = gui.inventorySlots.getSlot(slotNum);

        if (slotTmp != null && slotTmp.getHasStack() &&
            (nonMatchingOnly == false || areStacksEqual(recipes.getSelectedRecipe().getRecipe()[i], slotTmp.getStack()) == false))
        {
            shiftClickSlot(gui, slotNum);

            // Failed to clear the slot
            if (slotTmp.getHasStack())
            {
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:maruohon,项目名称:itemscroller,代码行数:26,代码来源:InventoryUtils.java

示例7: mouseClicked

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
    ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
    if (stackover == null || !(gui instanceof GuiRecipe)) {
        return false;
    }

    if (button == 0) {
        return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
    }

    if (button == 1) {
        return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
    }

    return false;
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:18,代码来源:RecipeItemInputHandler.java

示例8: load

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@Override
public void load(GuiContainer gui) {
    if (isEnabled()) {
        setInputFocused(null);

        ItemList.loadItems.restart();
        overlayRenderer = null;

        getLayoutStyle().init();
        layout(gui);
    }

    NEIController.load(gui);

    if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+
        gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us
}
 
开发者ID:SneakyTactician,项目名称:BIGB,代码行数:18,代码来源:LayoutManager.java

示例9: foregroundRenderEvent

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@SubscribeEvent
public void foregroundRenderEvent(GuiContainerEvent.DrawForeground event) {
    GuiContainer container = event.getGuiContainer();
    GlStateTracker.pushState();
    Point mousePos = GuiDraw.getMousePosition();

    GlStateManager.translate(-container.getGuiLeft(), -container.getGuiTop(), 100F);
    drawHandlers.forEach(handler -> handler.renderObjects(container, mousePos.x, mousePos.y));

    drawHandlers.forEach(handler -> handler.postRenderObjects(container, mousePos.x, mousePos.y));

    GlStateManager.translate(container.getGuiLeft(), container.getGuiTop(), -100F);
    GuiHelper.enable3DRender();

    GlStateManager.pushMatrix();
    for (Slot slot : container.inventorySlots.inventorySlots) {
        GlStateTracker.pushState();
        drawHandlers.forEach(handler -> handler.renderSlotOverlay(container, slot));
        GlStateTracker.popState();
    }
    GlStateManager.popMatrix();

    GlStateTracker.popState();
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:25,代码来源:NEIClientEventHandler.java

示例10: handleItemDisplayName

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@Override
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack stack, List<String> currenttip) {
    String overridename = ItemInfo.getNameOverride(stack);
    if (overridename != null)
        currenttip.set(0, overridename);

    String mainname = currenttip.get(0);
    if (showIDs()) {
        mainname += " " + Item.getIdFromItem(stack.getItem());
        if (stack.getItemDamage() != 0)
            mainname += ":" + stack.getItemDamage();

        currenttip.set(0, mainname);
    }

    return currenttip;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:18,代码来源:LayoutManager.java

示例11: mapIngredSlots

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Slot[][] mapIngredSlots(GuiContainer gui, List<PositionedStack> ingredients)
{
    Slot[][] recipeSlotList = new Slot[ingredients.size()][];
    for(int i = 0; i < ingredients.size(); i++)//identify slots
    {
        LinkedList<Slot> recipeSlots = new LinkedList<Slot>();
        PositionedStack pstack = ingredients.get(i);
        for(Slot slot : (List<Slot>)gui.inventorySlots.inventorySlots)
        {
            if(slot.xDisplayPosition == pstack.relx+offsetx && slot.yDisplayPosition == pstack.rely+offsety)
            {
                recipeSlots.add(slot);
                break;
            }
        }
        recipeSlotList[i] = recipeSlots.toArray(new Slot[0]);
    }
    return recipeSlotList;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:DefaultOverlayHandler.java

示例12: overlayRecipe

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex, final boolean shift) {
    final List<PositionedStack> ingredients = (List<PositionedStack>)recipe.getIngredientStacks(recipeIndex);
    final List<DistributedIngred> ingredStacks = this.getPermutationIngredients(ingredients);
    if (!this.clearIngredients(gui, ingredients)) {
        return;
    }
    this.findInventoryQuantities(gui, ingredStacks);
    final List<IngredientDistribution> assignedIngredients = this.assignIngredients(ingredients, ingredStacks);
    if (assignedIngredients == null) {
        return;
    }
    this.assignIngredSlots(gui, ingredients, assignedIngredients);
    final int quantity = this.calculateRecipeQuantity(assignedIngredients);
    if (quantity != 0) {
        this.moveIngredients(gui, assignedIngredients, quantity);
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:18,代码来源:FMPMicroBlocksOverlayHandler.java

示例13: setExternalGuiPosition

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
public void setExternalGuiPosition(GuiScreen gui)
{
    if (gui instanceof GuiContainer) {
        final int candidateGuiLeft = ((GuiContainer) gui).getGuiLeft();
        final int candidateGuiTop = ((GuiContainer) gui).getGuiTop();

        // -- NOTE --
        // The creative inventory would cause this method to be fired twice, once for
        // net.minecraft.client.gui.inventory.GuiContainerCreative (with correct values)
        // and once for net.minecraft.client.gui.inventory.GuiInventory (with wrong values).
        //
        // I ignore the second call so the gui overlay preserves the correct values.
        if (gui instanceof GuiInventory && candidateGuiLeft == 0 && candidateGuiTop == 0) { return; }

        this._externalGuiLeft = candidateGuiLeft;
        this._externalGuiTop = candidateGuiTop;

    } else {
        this._externalGuiLeft = -1;
        this._externalGuiTop = -1;

    }

    LogHelper.trace("GuiExtraSlotsOverlay.setExternalGuiPosition() - left: %d, top: %d", this._externalGuiLeft, this._externalGuiTop);
}
 
开发者ID:sidben,项目名称:VisibleArmorSlots,代码行数:26,代码来源:GuiExtraSlotsOverlay.java

示例14: renderObjects

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@Override
public void renderObjects(GuiContainer gui, int mousex, int mousey) {
    if (!isHidden()) {
        layout(gui);
        if (isEnabled()) {
            getLayoutStyle().drawBackground(gui);
            for (Widget widget : drawWidgets) {
                widget.draw(mousex, mousey);
            }
        } else {
            options.draw(mousex, mousey);
        }

        GlStateManager.enableLighting();
        GlStateManager.disableDepth();
    } else {
        showItemPanel = false;
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:20,代码来源:LayoutManager.java

示例15: mapIngredSlots

import net.minecraft.client.gui.inventory.GuiContainer; //导入依赖的package包/类
@SuppressWarnings ("unchecked")
public Slot[][] mapIngredSlots(GuiContainer gui, List<PositionedStack> ingredients) {
    Slot[][] recipeSlotList = new Slot[ingredients.size()][];
    for (int i = 0; i < ingredients.size(); i++)//identify slots
    {
        LinkedList<Slot> recipeSlots = new LinkedList<>();
        PositionedStack pstack = ingredients.get(i);
        for (Slot slot : gui.inventorySlots.inventorySlots) {
            if (slot.xPos == pstack.relx + offsetx && slot.yPos == pstack.rely + offsety) {
                recipeSlots.add(slot);
                break;
            }
        }
        recipeSlotList[i] = recipeSlots.toArray(new Slot[0]);
    }
    return recipeSlotList;
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:18,代码来源:DefaultOverlayHandler.java


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