本文整理汇总了Java中net.minecraft.client.gui.inventory.GuiContainer.getGuiTop方法的典型用法代码示例。如果您正苦于以下问题:Java GuiContainer.getGuiTop方法的具体用法?Java GuiContainer.getGuiTop怎么用?Java GuiContainer.getGuiTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.inventory.GuiContainer
的用法示例。
在下文中一共展示了GuiContainer.getGuiTop方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canShiftDropItems
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
private boolean canShiftDropItems(GuiContainer gui)
{
if (GuiScreen.isShiftKeyDown() == false || Mouse.getEventButton() != 0 ||
InventoryUtils.isStackEmpty(gui.mc.player.inventory.getItemStack()))
{
return false;
}
int left = gui.getGuiLeft();
int top = gui.getGuiTop();
int xSize = gui.getXSize();
int ySize = gui.getYSize();
int mouseAbsX = Mouse.getEventX() * gui.width / gui.mc.displayWidth;
int mouseAbsY = gui.height - Mouse.getEventY() * gui.height / gui.mc.displayHeight - 1;
boolean isOutsideGui = mouseAbsX < left || mouseAbsY < top || mouseAbsX >= left + xSize || mouseAbsY >= top + ySize;
return isOutsideGui && this.getSlotAtPosition(gui, mouseAbsX - left, mouseAbsY - top) == null;
}
示例2: create
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
public static InfoGuiOverlayDisplayParams create(GuiContainer gui, String guiClassName)
{
if (gui == null) { return InfoGuiOverlayDisplayParams.EMPTY; }
// Check for blacklisted gui's
if (isBlacklisted(gui)) { return InfoGuiOverlayDisplayParams.EMPTY; }
int overlayX = 0;
int overlayY = 0;
if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_LEFT)) {
overlayX = gui.getGuiLeft() - GuiExtraSlotsOverlay.GUI_WIDTH - ModConfig.extraSlotsMargin();
} else if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_RIGHT)) {
overlayX = gui.getGuiLeft() + gui.getXSize() + ModConfig.extraSlotsMargin();
}
overlayY = gui.getGuiTop() + gui.getYSize() - GuiExtraSlotsOverlay.GUI_HEIGHT - 4;
// HOTFIX: Chest containers have their height (YSize) wrong
if (gui instanceof GuiChest || gui instanceof GuiShulkerBox) {
overlayY -= 1;
}
final InfoGuiOverlayDisplayParams displayParams = new InfoGuiOverlayDisplayParams(overlayX, overlayY, true);
return displayParams;
}
示例3: buttonDown
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
public boolean buttonDown(Pair<Float,Float> input) {
GuiContainer gui = (GuiContainer) Minecraft.getMinecraft().currentScreen;
if(gui == null) return true;
Slot cs = gui.getSlotUnderMouse();
int xStart, yStart;
if(cs == null) {
xStart = Mouse.getEventX() * gui.width / Minecraft.getMinecraft().displayWidth;
yStart = gui.height - Mouse.getEventY() * gui.height / Minecraft.getMinecraft().displayHeight - 1;
} else {
xStart = cs.xPos + gui.getGuiLeft();
yStart = cs.yPos + gui.getGuiTop();
}
float x = input.getLeft();
float y = input.getRight();
Slot newSlot = null;
if(Direction.UP.isTriggered(x, y)) {
newSlot = search(gui, xStart + (SLOT_WIDTH / 2), yStart, 0, -SLOT_WIDTH, SLOT_WIDTH/2, 0);
} else if(Direction.DOWN.isTriggered(x, y)) {
newSlot = search(gui, xStart + SLOT_WIDTH / 2, yStart + SLOT_WIDTH, 0, SLOT_WIDTH, SLOT_WIDTH/2, 0);
} else if(Direction.LEFT.isTriggered(x, y)) {
newSlot = search(gui, xStart, yStart + SLOT_WIDTH / 2, -SLOT_WIDTH, 0, 0, SLOT_WIDTH/2);
} else if(Direction.RIGHT.isTriggered(x, y)){
newSlot = search(gui, xStart + SLOT_WIDTH, yStart + SLOT_WIDTH / 2, SLOT_WIDTH, 0, 0, SLOT_WIDTH/2);
}
if(newSlot != null) {
ActionEmulationHelper.moveMouseInGui(newSlot.xPos + SLOT_WIDTH / 2 + gui.getGuiLeft(), newSlot.yPos + SLOT_WIDTH / 2 + gui.getGuiTop(), gui.width, gui.height);
}
return true;
}
示例4: getSlotAt
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
private Slot getSlotAt(GuiContainer gui, int x, int y) {
for(Slot slot : gui.inventorySlots.inventorySlots) {
if(slot.canBeHovered()) {
int slotX = slot.xPos + gui.getGuiLeft();
int slotY = slot.yPos + gui.getGuiTop();
if(slotX <= x && x <= slotX + SLOT_WIDTH && slotY <= y && y <= slotY + SLOT_WIDTH) {
return slot;
}
}
}
return null;
}
示例5: GuiHarshenButton
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
public GuiHarshenButton(int buttonId, GuiContainer parentGui, int x, int y, int width, int height, String buttonText, boolean directionToInventory) {
super(buttonId, x, parentGui.getGuiTop() + y, width, height, buttonText);
this.parentGui = parentGui;
this.directionToInventory = directionToInventory;
}
示例6: mouseClicked
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
@Override
public boolean mouseClicked(GuiScreen screen, int mouseX, int mouseY, int button) {
if (!(screen instanceof GuiContainer) || !NEIClientConfig.isEnabled() || isSpreading(((GuiContainer) screen))) {
return false;
}
GuiContainer gui = ((GuiContainer) screen);
Slot slot = GuiHelper.getSlotMouseOver(gui);
int slotID = -1;
boolean outsideGui = (mouseX < gui.getGuiLeft() || mouseY < gui.getGuiTop() || mouseX >= gui.getGuiLeft() + gui.getXSize() || mouseY >= gui.getGuiTop() + gui.getYSize()) && slot == null;
if (slot != null) {
slotID = slot.slotNumber;
}
if (outsideGui) {
slotID = -999;
}
//Shift / Click delete.
if (deleteMode && slot != null && slot.slotNumber >= 0) {
if (NEIClientUtils.shiftKey() && button == 0) {
ItemStack itemstack1 = slot.getStack();
if (!itemstack1.isEmpty()) {
NEIClientUtils.deleteItemsOfType(itemstack1);
}
} else if (button == 1) {
NEIClientUtils.decreaseSlotStack(slot.slotNumber);
} else {
NEIClientUtils.deleteSlotStack(slot.slotNumber);
}
return true;
}
//Creative click the slot 64 times because mojang.
//Seems to already be a thing.. Gonna leave this here and wipe it in a cleanup pass.
//if (button == 1 && slot instanceof SlotCrafting)//right click
//{
// for (int i1 = 0; i1 < 64; i1++)//click this slot 64 times
// {
// manager.handleSlotClick(slot.slotNumber, button, ClickType.PICKUP);
// }
// return true;
//}
//Control click slot = give me an item.
if (NEIClientUtils.controlKey() && slot != null && !slot.getStack().isEmpty() && slot.isItemValid(slot.getStack())) {
NEIClientUtils.cheatItem(slot.getStack(), button, 1);
return true;
}
//Custom slots or container? No thanx, bia!
if (GuiInfo.hasCustomSlots(gui) || ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) {
return false;
}
//Disabled for now.
//if (slotID >= 0 && NEIClientUtils.shiftKey() && !NEIClientUtils.getHeldItem().isEmpty() && !slot.getHasStack()) {
// ItemStack held = NEIClientUtils.getHeldItem();
// GuiHelper.clickSlot(container, slot.slotNumber, button, ClickType.PICKUP);
// if (slot.isItemValid(held)) {
// fastTransferManager.performMassTransfer(container, pickedUpFromSlot, slot.slotNumber, held);
// }
//
// return true;
//}
if (slotID == -999 && NEIClientUtils.shiftKey() && button == 0 && !NEIClientUtils.getHeldItem().isEmpty()) {
fastTransferManager.throwAll(gui, pickedUpFromSlot);
return true;
}
return false;
}
示例7: handleDraggedClick
import net.minecraft.client.gui.inventory.GuiContainer; //导入方法依赖的package包/类
private boolean handleDraggedClick(int mousex, int mousey, int button) {
if (draggedStack.isEmpty()) {
return false;
}
GuiContainer gui = NEIClientUtils.getGuiContainer();
boolean handled = false;
for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
if (handler.handleDragNDrop(gui, mousex, mousey, draggedStack, button)) {
handled = true;
if (draggedStack.getCount() == 0) {
draggedStack = ItemStack.EMPTY;
return true;
}
}
}
if (handled) {
return true;
}
Slot overSlot = gui.getSlotAtPosition(mousex, mousey);
if (overSlot != null && overSlot.isItemValid(draggedStack)) {
if (NEIClientConfig.canCheatItem(draggedStack)) {
int contents = overSlot.getHasStack() ? overSlot.getStack().getCount() : 0;
int add = button == 0 ? draggedStack.getCount() : 1;
if (overSlot.getHasStack() && !NEIServerUtils.areStacksSameType(draggedStack, overSlot.getStack())) {
contents = 0;
}
int total = Math.min(contents + add, Math.min(overSlot.getSlotStackLimit(), draggedStack.getMaxStackSize()));
if (total > contents) {
int slotNumber = overSlot.slotNumber;
if (gui instanceof GuiContainerCreative) {
//Because Mojang..
slotNumber = slotNumber - gui.inventorySlots.inventorySlots.size() + 9 + 36;
}
NEIClientUtils.setSlotContents(slotNumber, NEIServerUtils.copyStack(draggedStack, total), true);
NEIClientPacketHandler.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false);
draggedStack.shrink(total - contents);
}
if (draggedStack.getCount() == 0) {
draggedStack = ItemStack.EMPTY;
}
} else {
draggedStack = ItemStack.EMPTY;
}
} else if (mousex < gui.getGuiLeft() || mousey < gui.getGuiTop() || mousex >= gui.getGuiLeft() + gui.getXSize() || mousey >= gui.getGuiTop() + gui.getYSize()) {
draggedStack = ItemStack.EMPTY;
}
return true;
}