Get rid of most code in MatteryScreen
This commit is contained in:
parent
72b577434c
commit
58bd62d1a2
@ -49,8 +49,8 @@ public class MatterPanelScreen extends MatteryScreen<MatterPanelMenu> {
|
|||||||
|
|
||||||
var frame = new FramePanel(this, null, 0, 0, width, height, getTitle()) {
|
var frame = new FramePanel(this, null, 0, 0, width, height, getTitle()) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean mouseScrolledInner(double mouse_x, double mouse_y, double scroll) {
|
protected boolean mouseScrolledInner(double x, double y, double scroll) {
|
||||||
return scroll_panel.mouseScrolledInner(mouse_x, mouse_y, scroll);
|
return scroll_panel.mouseScrolledInner(x, y, scroll);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ public class MatterPanelScreen extends MatteryScreen<MatterPanelMenu> {
|
|||||||
|
|
||||||
var grid = new GridPanel(this, frame, 0, 0, GRID_WIDTH * AbstractSlotPanel.REGULAR_DIMENSIONS, 0, GRID_WIDTH, GRID_HEIGHT) {
|
var grid = new GridPanel(this, frame, 0, 0, GRID_WIDTH * AbstractSlotPanel.REGULAR_DIMENSIONS, 0, GRID_WIDTH, GRID_HEIGHT) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean mouseScrolledInner(double mouse_x, double mouse_y, double scroll) {
|
protected boolean mouseScrolledInner(double x, double y, double scroll) {
|
||||||
return scroll_panel.mouseScrolledInner(mouse_x, mouse_y, scroll);
|
return scroll_panel.mouseScrolledInner(x, y, scroll);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -123,12 +123,12 @@ public class MatterPanelScreen extends MatteryScreen<MatterPanelMenu> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean mouseScrolledInner(double mouse_x, double mouse_y, double scroll) {
|
protected boolean mouseScrolledInner(double x, double y, double scroll) {
|
||||||
return scroll_panel.mouseScrolledInner(mouse_x, mouse_y, scroll);
|
return scroll_panel.mouseScrolledInner(x, y, scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean mouseClickedInner(double mouse_x, double mouse_y, int flag) {
|
protected boolean mouseClickedInner(double x, double y, int flag) {
|
||||||
if (slot >= menu.getPatterns().size()) {
|
if (slot >= menu.getPatterns().size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -166,12 +166,12 @@ public class MatterPanelScreen extends MatteryScreen<MatterPanelMenu> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean mouseScrolledInner(double mouse_x, double mouse_y, double scroll) {
|
protected boolean mouseScrolledInner(double x, double y, double scroll) {
|
||||||
return scroll_panel.mouseScrolledInner(mouse_x, mouse_y, scroll);
|
return scroll_panel.mouseScrolledInner(x, y, scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean mouseClickedInner(double mouse_x, double mouse_y, int flag) {
|
protected boolean mouseClickedInner(double x, double y, int flag) {
|
||||||
if (slot >= menu.getTasks().size()) {
|
if (slot >= menu.getTasks().size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ private open class AndroidResearchButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
val hovered = (screen as AndroidStationScreen).hoveredResearch
|
val hovered = (screen as AndroidStationScreen).hoveredResearch
|
||||||
|
|
||||||
val isBlockedByHovered = hovered != null && node.type in hovered.type.allBlocking
|
val isBlockedByHovered = hovered != null && node.type in hovered.type.allBlocking
|
||||||
@ -342,8 +342,8 @@ private open class AndroidResearchButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (mouse_click_type == InputConstants.MOUSE_BUTTON_LEFT) {
|
if (button == InputConstants.MOUSE_BUTTON_LEFT) {
|
||||||
if (node.canResearch && !node.isResearched) {
|
if (node.canResearch && !node.isResearched) {
|
||||||
MatteryPlayerNetworkChannel.sendToServer(AndroidResearchRequestPacket(node.type))
|
MatteryPlayerNetworkChannel.sendToServer(AndroidResearchRequestPacket(node.type))
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
val rows = Int2ObjectAVLTreeMap<EditablePanel>()
|
val rows = Int2ObjectAVLTreeMap<EditablePanel>()
|
||||||
|
|
||||||
canvas = object : DraggableCanvasPanel(this@AndroidStationScreen, research, width = (GRID_WIDTH * 22).toFloat(), height = 0f) {
|
canvas = object : DraggableCanvasPanel(this@AndroidStationScreen, research, width = (GRID_WIDTH * 22).toFloat(), height = 0f) {
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
drawColor = RGBAColor.BLACK
|
drawColor = RGBAColor.BLACK
|
||||||
drawRect(stack, 0f, 0f, width, height)
|
drawRect(stack, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
@ -404,9 +404,9 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
for (i in 0 .. tree.height) {
|
for (i in 0 .. tree.height) {
|
||||||
rows.computeIfAbsent(i, Int2ObjectFunction {
|
rows.computeIfAbsent(i, Int2ObjectFunction {
|
||||||
object : EditablePanel(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
object : EditablePanel(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int) = false
|
override fun mouseClickedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int) = false
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseDraggedInner(mouse_x: Double, mouse_y: Double, flag: Int, drag_x: Double, drag_y: Double) = false
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double) = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -418,9 +418,9 @@ class AndroidStationScreen constructor(p_97741_: AndroidStationMenu, p_97742_: I
|
|||||||
for (research in graph.second) {
|
for (research in graph.second) {
|
||||||
val row = rows.computeIfAbsent(research.researchTreeDepth, Int2ObjectFunction {
|
val row = rows.computeIfAbsent(research.researchTreeDepth, Int2ObjectFunction {
|
||||||
object : EditablePanel(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
object : EditablePanel(this@AndroidStationScreen, canvas, 0f, it * 24f, 10000f, 22f) {
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int) = false
|
override fun mouseClickedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int) = false
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int) = false
|
||||||
override fun mouseDraggedInner(mouse_x: Double, mouse_y: Double, flag: Int, drag_x: Double, drag_y: Double) = false
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double) = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -63,18 +63,18 @@ class DriveViewerScreen(menu: DriveViewerMenu, inventory: Inventory, title: Comp
|
|||||||
return menu.networkedItemView.sortedView.getOrNull(index)?.stack?.item ?: ItemStack.EMPTY
|
return menu.networkedItemView.sortedView.getOrNull(index)?.stack?.item ?: ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseScrolledInner(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return scrollBar.mouseScrolledInner(mouse_x, mouse_y, scroll)
|
return scrollBar.mouseScrolledInner(x, y, scroll)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
val index = i + scrollBar.getScroll(GRID_WIDTH)
|
val index = i + scrollBar.getScroll(GRID_WIDTH)
|
||||||
menu.networkedItemView.mouseClick(index, mouse_click_type)
|
menu.networkedItemView.mouseClick(index, button)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouse_x, mouse_y, flag)
|
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
||||||
renderRegular(stack, getItemStack(), "")
|
renderRegular(stack, getItemStack(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,17 +55,17 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
return menu.networkedItemView.sortedView.getOrNull(index)?.stack?.item ?: ItemStack.EMPTY
|
return menu.networkedItemView.sortedView.getOrNull(index)?.stack?.item ?: ItemStack.EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseScrolledInner(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return viewScrollBar.mouseScrolledInner(mouse_x, mouse_y, scroll)
|
return viewScrollBar.mouseScrolledInner(x, y, scroll)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
menu.networkedItemView.mouseClick(index, mouse_click_type)
|
menu.networkedItemView.mouseClick(index, button)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouse_x, mouse_y, flag)
|
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
val itemstack = menu.networkedItemView.sortedView.getOrNull(index)?.stack ?: ITEM_STORAGE.empty
|
val itemstack = menu.networkedItemView.sortedView.getOrNull(index)?.stack ?: ITEM_STORAGE.empty
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
val arrowAndButtons = object : EditablePanel(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.w) {
|
val arrowAndButtons = object : EditablePanel(this@ItemMonitorScreen, bottomPanel, width = ProgressGaugePanel.GAUGE_BACKGROUND.w) {
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.h / 2f)
|
ProgressGaugePanel.GAUGE_BACKGROUND.render(stack, y = height / 2f - ProgressGaugePanel.GAUGE_BACKGROUND.h / 2f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,8 +178,8 @@ class ItemMonitorScreen(menu: ItemMonitorMenu, inventory: Inventory, title: Comp
|
|||||||
return ItemStack(Items.ARROW, 42)
|
return ItemStack(Items.ARROW, 42)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseScrolledInner(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return craftingHistoryScroll.mouseScrolledInner(mouse_x, mouse_y, scroll)
|
return craftingHistoryScroll.mouseScrolledInner(x, y, scroll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,143 +1,76 @@
|
|||||||
package ru.dbotthepony.mc.otm.client.screen;
|
package ru.dbotthepony.mc.otm.client.screen
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import net.minecraft.ChatFormatting
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import net.minecraft.client.gui.Font
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
import net.minecraft.client.renderer.entity.ItemRenderer
|
||||||
import net.minecraft.Util;
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.world.inventory.Slot
|
||||||
import net.minecraft.client.gui.components.Widget;
|
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Background
|
||||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
import net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground
|
||||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraft.network.chat.Component;
|
import org.lwjgl.opengl.GL11
|
||||||
import net.minecraft.util.Mth;
|
import org.lwjgl.opengl.GL13
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import ru.dbotthepony.mc.otm.client.screen.panels.EditablePanel
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
|
||||||
import net.minecraft.world.inventory.ClickType;
|
import ru.dbotthepony.mc.otm.client.screen.panels.SlotPanel
|
||||||
import net.minecraft.world.inventory.Slot;
|
import ru.dbotthepony.mc.otm.menu.MatteryMenu
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraftforge.client.event.ContainerScreenEvent;
|
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
|
||||||
import ru.dbotthepony.mc.otm.menu.MatteryMenu;
|
|
||||||
import ru.dbotthepony.mc.otm.menu.MatterySlot;
|
|
||||||
import ru.dbotthepony.mc.otm.client.screen.panels.*;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_ALWAYS;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_LESS;
|
|
||||||
import static org.lwjgl.opengl.GL13.GL_TEXTURE0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class encapsulate most of logic for handling EditablePanel and it's children
|
* This class encapsulate most of logic for handling EditablePanel and it's children.
|
||||||
* It inherits AbstractContainerScreen, but most of methods of AbstractContainerScreen are re implemented or straight removed
|
|
||||||
* since they are present inside EditablePanel subclasses, therefore
|
|
||||||
* it inherits AbstractContainerScreen just for signature compatibility
|
|
||||||
*
|
*
|
||||||
* Widgets such as slots are not drawn/interacted with using MatteryScreen,
|
* Widgets such as slots are not drawn/interacted with using MatteryScreen,
|
||||||
* but are handled by appropriate panels
|
* but are handled by appropriate panels
|
||||||
*
|
*
|
||||||
* @param <T> type of menu, which extends MatteryMenu
|
* @param <T> type of menu, which extends MatteryMenu
|
||||||
*/
|
*/
|
||||||
@MethodsReturnNonnullByDefault
|
@Suppress("LeakingThis")
|
||||||
@ParametersAreNonnullByDefault
|
abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, title: Component) : AbstractContainerScreen<T>(menu, inventory, title) {
|
||||||
public abstract class MatteryScreen<T extends MatteryMenu> extends AbstractContainerScreen<T> {
|
protected val panels = ArrayDeque<EditablePanel>()
|
||||||
public static final float SNAPBACK_SPEED = 100.0F;
|
|
||||||
public static final int QUICKDROP_DELAY = 500;
|
|
||||||
public static final int DOUBLECLICK_SPEED = 250;
|
|
||||||
public static final int SLOT_ITEM_BLIT_OFFSET = 100;
|
|
||||||
public static final int HOVER_ITEM_BLIT_OFFSET = 200;
|
|
||||||
|
|
||||||
public final T menu;
|
var inventoryFrame: FramePanel? = null
|
||||||
public final Component playerInventoryTitle;
|
var mainFrame: FramePanel? = null
|
||||||
|
private var madeMainFrame = false
|
||||||
|
|
||||||
@Nullable
|
fun addPanel(panel: EditablePanel): Boolean {
|
||||||
public Slot hoveredSlot;
|
if (!panels.contains(panel)) {
|
||||||
@Nullable
|
panels.addFirst(panel)
|
||||||
public Slot clickedSlot;
|
return true
|
||||||
@Nullable
|
|
||||||
public Slot snapbackEnd;
|
|
||||||
@Nullable
|
|
||||||
public Slot quickdropSlot;
|
|
||||||
@Nullable
|
|
||||||
public Slot lastClickSlot;
|
|
||||||
|
|
||||||
protected int leftPos;
|
|
||||||
protected int topPos;
|
|
||||||
protected boolean isSplittingStack;
|
|
||||||
protected ItemStack draggingItem = ItemStack.EMPTY;
|
|
||||||
protected int snapbackStartX;
|
|
||||||
protected int snapbackStartY;
|
|
||||||
protected long snapbackTime;
|
|
||||||
protected ItemStack snapbackItem = ItemStack.EMPTY;
|
|
||||||
protected long quickdropTime;
|
|
||||||
public final Set<Slot> quickCraftSlots = Sets.newHashSet();
|
|
||||||
|
|
||||||
public boolean isQuickCrafting() {
|
|
||||||
return isQuickCrafting;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isQuickCrafting;
|
return false
|
||||||
|
|
||||||
public int getQuickCraftingType() {
|
|
||||||
return quickCraftingType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int quickCraftingType;
|
fun removePanel(panel: EditablePanel): Boolean {
|
||||||
protected int quickCraftingButton;
|
val indexOf = panels.indexOf(panel)
|
||||||
protected boolean skipNextRelease;
|
|
||||||
protected int quickCraftingRemainder;
|
|
||||||
protected long lastClickTime;
|
|
||||||
protected int lastClickButton;
|
|
||||||
protected boolean doubleclick;
|
|
||||||
protected ItemStack lastQuickMoved = ItemStack.EMPTY;
|
|
||||||
|
|
||||||
protected final ArrayList<EditablePanel> panels = new ArrayList<>();
|
if (indexOf != -1) {
|
||||||
public FramePanel inventory_frame;
|
panels.removeAt(indexOf)
|
||||||
public FramePanel main_frame;
|
return true
|
||||||
private boolean made_main_frame = false;
|
|
||||||
|
|
||||||
public static final float DEFAULT_FRAME_WIDTH = 18 * 9 + 16;
|
|
||||||
public static final float DEFAULT_FRAME_HEIGHT = 100;
|
|
||||||
|
|
||||||
public static final float INVENTORY_FRAME_WIDTH = DEFAULT_FRAME_WIDTH;
|
|
||||||
public static final float INVENTORY_FRAME_HEIGHT = 3 * 18 + 18 + 24;
|
|
||||||
|
|
||||||
public MatteryScreen(T menu, Inventory inventory, Component title) {
|
|
||||||
super(menu, inventory, title);
|
|
||||||
this.menu = menu;
|
|
||||||
playerInventoryTitle = inventory.getDisplayName();
|
|
||||||
|
|
||||||
if (menu.getPlayerInventorySlots().size() != 0) {
|
|
||||||
inventory_frame = new FramePanel(this, null, 0, 0, INVENTORY_FRAME_WIDTH, INVENTORY_FRAME_HEIGHT, inventory.getDisplayName());
|
|
||||||
panels.add(inventory_frame);
|
|
||||||
|
|
||||||
for (var slot : menu.getPlayerInventorySlots()) {
|
|
||||||
new SlotPanel<>(
|
|
||||||
this,
|
|
||||||
inventory_frame,
|
|
||||||
slot,
|
|
||||||
slot.x,
|
|
||||||
slot.y,
|
|
||||||
18, 18);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPanel(EditablePanel panel) {
|
return false
|
||||||
if (!panels.contains(panel))
|
|
||||||
panels.add(panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePanel(EditablePanel panel) {
|
/**
|
||||||
panels.remove(panel);
|
* Moves panel at top of all other panels
|
||||||
|
*
|
||||||
|
* @param panel panel to be pushed up
|
||||||
|
*/
|
||||||
|
fun popup(panel: EditablePanel) {
|
||||||
|
val indexOf = panels.indexOf(panel)
|
||||||
|
|
||||||
|
require(indexOf != -1) { "No such panel $panel" }
|
||||||
|
|
||||||
|
if (indexOf == panels.size - 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
panels.removeAt(indexOf)
|
||||||
|
panels.addFirst(panel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,571 +80,287 @@ public abstract class MatteryScreen<T extends MatteryMenu> extends AbstractConta
|
|||||||
*
|
*
|
||||||
* @return FramePanel created, or null
|
* @return FramePanel created, or null
|
||||||
*/
|
*/
|
||||||
@Nullable
|
protected open fun makeMainFrame(): FramePanel? {
|
||||||
protected FramePanel makeMainFrame() {
|
return FramePanel(this, null, 0f, 0f, DEFAULT_FRAME_WIDTH, DEFAULT_FRAME_HEIGHT, getTitle())
|
||||||
return new FramePanel(this, null, 0, 0, DEFAULT_FRAME_WIDTH, DEFAULT_FRAME_HEIGHT, getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final float GAUGE_TOP_WITH_SLOT = 17;
|
var itemRenderer: ItemRenderer
|
||||||
public static final float GAUGE_TOP_WITHOUT_SLOT = 26;
|
get() = itemRenderer
|
||||||
public static final float SLOT_TOP_UNDER_GAUGE = 70;
|
set(itemRenderer) { super.itemRenderer = itemRenderer }
|
||||||
public static final float PROGRESS_ARROW_TOP = 42;
|
var font: Font
|
||||||
public static final float PROGRESS_SLOT_TOP = 41;
|
get() = font
|
||||||
public static final float LEFT_MARGIN = 8;
|
set(font) { super.font = font }
|
||||||
|
var hoveredSlot: Slot?
|
||||||
|
get() = hoveredSlot
|
||||||
|
set(value) { super.hoveredSlot = value }
|
||||||
|
val quickCraftSlots: MutableSet<Slot> get() = quickCraftSlots
|
||||||
|
val quickCraftingType get() = quickCraftingType
|
||||||
|
val isQuickCrafting get() = isQuickCrafting
|
||||||
|
|
||||||
public ItemRenderer getItemRenderer() {
|
public override fun recalculateQuickCraftRemaining() {
|
||||||
return itemRenderer;
|
super.recalculateQuickCraftRemaining()
|
||||||
}
|
}
|
||||||
|
|
||||||
public Font getFont() {
|
fun movePanels() {
|
||||||
return font;
|
var top = height / 2
|
||||||
|
val mainFrame = mainFrame
|
||||||
|
val inventoryFrame = inventoryFrame
|
||||||
|
|
||||||
|
if (mainFrame != null) {
|
||||||
|
top -= (mainFrame.height / 2).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if (inventoryFrame != null) {
|
||||||
* Moves panel at top of all other panels
|
top -= (inventoryFrame.height / 2).toInt()
|
||||||
*
|
|
||||||
* @param panel panel to be pushed up
|
|
||||||
*/
|
|
||||||
public void popup(EditablePanel panel) {
|
|
||||||
if (!panels.contains(panel))
|
|
||||||
throw new IllegalArgumentException("No such panel " + panel);
|
|
||||||
|
|
||||||
if (panels.indexOf(panel) == panels.size())
|
|
||||||
return;
|
|
||||||
|
|
||||||
panels.remove(panel);
|
|
||||||
panels.add(panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void movePanels() {
|
if (mainFrame != null) {
|
||||||
var top = height / 2;
|
mainFrame.setPos(width / 2 - mainFrame.width / 2, top.toFloat())
|
||||||
|
top += mainFrame.height.toInt()
|
||||||
if (main_frame != null) {
|
|
||||||
top -= main_frame.getHeight() / 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory_frame != null) {
|
if (inventoryFrame != null) {
|
||||||
top -= inventory_frame.getHeight() / 2;
|
inventoryFrame.setPos(width / 2 - inventoryFrame.width / 2, top.toFloat())
|
||||||
}
|
top += inventoryFrame.height.toInt()
|
||||||
|
|
||||||
if (main_frame != null) {
|
|
||||||
main_frame.setPos(width / 2 - main_frame.getWidth() / 2, top);
|
|
||||||
top += main_frame.getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inventory_frame != null) {
|
|
||||||
inventory_frame.setPos(width / 2 - inventory_frame.getWidth() / 2, top);
|
|
||||||
top += inventory_frame.getHeight();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun init() {
|
||||||
protected void init() {
|
super.init()
|
||||||
super.init();
|
|
||||||
|
|
||||||
movePanels();
|
if (!madeMainFrame) {
|
||||||
|
madeMainFrame = true
|
||||||
|
mainFrame = makeMainFrame()?.also(this::addPanel)
|
||||||
|
movePanels()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
movePanels()
|
||||||
public boolean mouseClicked(double p_97748_, double p_97749_, int p_97750_) {
|
}
|
||||||
var happen_to_click = false;
|
|
||||||
|
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
override fun mouseClicked(x: Double, y: Double, button: Int): Boolean {
|
||||||
var panel = panels.get(i);
|
var click = false
|
||||||
|
|
||||||
if (happen_to_click) {
|
for (panel in panels) {
|
||||||
panel.killFocusForEverythingExceptInner();
|
if (click || !panel.mouseClickedChecked(x, y, button)) {
|
||||||
} else if (panel.mouseClickedChecked(p_97748_, p_97749_, p_97750_)) {
|
panel.killFocusForEverythingExceptInner()
|
||||||
happen_to_click = true;
|
|
||||||
} else {
|
} else {
|
||||||
panel.killFocusForEverythingExceptInner();
|
if (returnSlot != null) {
|
||||||
|
super.mouseClicked(x, y, button)
|
||||||
|
returnSlot = null
|
||||||
|
}
|
||||||
|
|
||||||
|
click = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun mouseDragged(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
public boolean mouseDragged(double p_97752_, double p_97753_, int p_97754_, double p_97755_, double p_97756_) {
|
for (panel in panels) {
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
if (panel.mouseDraggedChecked(x, y, button, xDelta, yDelta)) {
|
||||||
var panel = panels.get(i);
|
if (returnSlot != null) {
|
||||||
|
super.mouseDragged(x, y, button, xDelta, yDelta)
|
||||||
|
returnSlot = null
|
||||||
|
}
|
||||||
|
|
||||||
if (panel.mouseDraggedChecked(p_97752_, p_97753_, p_97754_, p_97755_, p_97756_)) {
|
return true
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun mouseReleased(p_97812_: Double, p_97813_: Double, p_97814_: Int): Boolean {
|
||||||
public boolean mouseReleased(double p_97812_, double p_97813_, int p_97814_) {
|
for (panel in panels) {
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
|
||||||
var panel = panels.get(i);
|
|
||||||
|
|
||||||
if (panel.mouseReleasedChecked(p_97812_, p_97813_, p_97814_)) {
|
if (panel.mouseReleasedChecked(p_97812_, p_97813_, p_97814_)) {
|
||||||
return true;
|
if (returnSlot != null) {
|
||||||
|
super.mouseReleased(p_97812_, p_97813_, p_97814_)
|
||||||
|
returnSlot = null
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle quick moving ("quickcraft") by ourselves if we depressed outside of slot
|
return super.mouseReleased(p_97812_, p_97813_, p_97814_)
|
||||||
onMouseReleasedSlot(null, p_97812_, p_97813_, p_97814_, true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun mouseScrolled(p_94686_: Double, p_94687_: Double, p_94688_: Double): Boolean {
|
||||||
public boolean mouseScrolled(double p_94686_, double p_94687_, double p_94688_) {
|
for (panel in panels) {
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
|
||||||
var panel = panels.get(i);
|
|
||||||
|
|
||||||
if (panel.mouseScrolledChecked(p_94686_, p_94687_, p_94688_)) {
|
if (panel.mouseScrolledChecked(p_94686_, p_94687_, p_94688_)) {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun keyReleased(p_94715_: Int, p_94716_: Int, p_94717_: Int): Boolean {
|
||||||
public boolean keyReleased(int p_94715_, int p_94716_, int p_94717_) {
|
for (panel in panels) {
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
|
||||||
var panel = panels.get(i);
|
|
||||||
|
|
||||||
if (panel.keyReleased(p_94715_, p_94716_, p_94717_)) {
|
if (panel.keyReleased(p_94715_, p_94716_, p_94717_)) {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun charTyped(p_94683_: Char, p_94684_: Int): Boolean {
|
||||||
public boolean charTyped(char p_94683_, int p_94684_) {
|
for (panel in panels) {
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
|
||||||
var panel = panels.get(i);
|
|
||||||
|
|
||||||
if (panel.charTyped(p_94683_, p_94684_)) {
|
if (panel.charTyped(p_94683_, p_94684_)) {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun keyPressed(key: Int, scancode: Int, mods: Int): Boolean {
|
||||||
public boolean keyPressed(int p_97765_, int p_97766_, int p_97767_) {
|
for (panel in panels) {
|
||||||
InputConstants.Key mouseKey = InputConstants.getKey(p_97765_, p_97766_);
|
if (panel.keyPressed(key, scancode, mods)) {
|
||||||
|
if (returnSlot != null) {
|
||||||
|
super.keyPressed(key, scancode, mods)
|
||||||
|
returnSlot = null
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
return true
|
||||||
var panel = panels.get(i);
|
|
||||||
|
|
||||||
if (panel.keyPressed(p_97765_, p_97766_, p_97767_)) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean handled = this.checkHotbarKeyPressed(p_97765_, p_97766_);// Forge MC-146650: Needs to return true when the key is handled
|
return super.keyPressed(key, scancode, mods)
|
||||||
if (this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
|
|
||||||
if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
|
||||||
this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 0, ClickType.CLONE);
|
|
||||||
handled = true;
|
|
||||||
} else if (this.minecraft.options.keyDrop.isActiveAndMatches(mouseKey)) {
|
|
||||||
this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, hasControlDown() ? 1 : 0, ClickType.THROW);
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
} else if (this.minecraft.options.keyDrop.isActiveAndMatches(mouseKey)) {
|
|
||||||
handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return handled;
|
override fun renderBg(p_97787_: PoseStack, p_97788_: Float, p_97789_: Int, p_97790_: Int) {}
|
||||||
|
|
||||||
// nothing dangerous in super method
|
var returnSlot: Slot? = null
|
||||||
return super.keyPressed(p_97765_, p_97766_, p_97767_);
|
|
||||||
|
init {
|
||||||
|
if (menu.playerInventorySlots.isNotEmpty()) {
|
||||||
|
inventoryFrame = FramePanel(this, null, 0f, 0f, INVENTORY_FRAME_WIDTH, INVENTORY_FRAME_HEIGHT, inventory.displayName).also(this::addPanel)
|
||||||
|
|
||||||
|
for (slot in menu.playerInventorySlots) {
|
||||||
|
SlotPanel(this, inventoryFrame, slot, slot.x.toFloat(), slot.y.toFloat())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderFloatingItem(ItemStack p_97783_, int p_97784_, int p_97785_, String p_97786_) {
|
override fun findSlot(x: Double, y: Double): Slot? {
|
||||||
PoseStack posestack = RenderSystem.getModelViewStack();
|
return returnSlot
|
||||||
posestack.translate(0.0D, 0.0D, 32.0D);
|
|
||||||
|
|
||||||
RenderSystem.applyModelViewMatrix();
|
|
||||||
this.setBlitOffset(200);
|
|
||||||
this.itemRenderer.blitOffset = 200.0F;
|
|
||||||
|
|
||||||
net.minecraft.client.gui.Font font = p_97783_.getItem().getRenderPropertiesInternal() instanceof IClientItemExtensions ext ? ext.getFont(p_97783_, IClientItemExtensions.FontContext.TOOLTIP) : null;
|
|
||||||
if (font == null) font = this.font;
|
|
||||||
|
|
||||||
this.itemRenderer.renderAndDecorateItem(p_97783_, p_97784_, p_97785_);
|
|
||||||
this.itemRenderer.renderGuiItemDecorations(font, p_97783_, p_97784_, p_97785_ - (this.draggingItem.isEmpty() ? 0 : 8), p_97786_);
|
|
||||||
|
|
||||||
this.setBlitOffset(0);
|
|
||||||
this.itemRenderer.blitOffset = 0.0F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun render(poseStack: PoseStack, mouseX: Int, mouseY: Int, partialTick: Float) {
|
||||||
protected void renderBg(PoseStack p_97787_, float p_97788_, int p_97789_, int p_97790_) {
|
val mouseXf = mouseX.toFloat()
|
||||||
|
val mouseYf = mouseY.toFloat()
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(PoseStack pose, int mouse_x, int mouse_y, float flag) {
|
|
||||||
if (!made_main_frame) {
|
|
||||||
made_main_frame = true;
|
|
||||||
main_frame = makeMainFrame();
|
|
||||||
|
|
||||||
if (main_frame != null) {
|
|
||||||
addPanel(main_frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
movePanels();
|
|
||||||
}
|
|
||||||
|
|
||||||
int render_x = this.leftPos;
|
|
||||||
int render_y = this.topPos;
|
|
||||||
|
|
||||||
// dark background
|
// dark background
|
||||||
this.renderBackground(pose);
|
this.renderBackground(poseStack)
|
||||||
|
|
||||||
hoveredSlot = null;
|
hoveredSlot = null
|
||||||
|
var hovered = false
|
||||||
var hovered = false;
|
|
||||||
|
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
|
||||||
var panel = panels.get(i);
|
|
||||||
|
|
||||||
|
for (panel in panels) {
|
||||||
if (hovered) {
|
if (hovered) {
|
||||||
panel.unsetHovered();
|
panel.unsetHovered()
|
||||||
} else if (panel.tickHover(mouse_x, mouse_y)) {
|
} else if (panel.tickHover(mouseXf, mouseYf)) {
|
||||||
hovered = true;
|
hovered = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc()
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend()
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest()
|
||||||
RenderSystem.enableTexture();
|
RenderSystem.enableTexture()
|
||||||
RenderSystem.activeTexture(GL_TEXTURE0);
|
RenderSystem.activeTexture(GL13.GL_TEXTURE0)
|
||||||
|
|
||||||
float depth = -900f;
|
var depth = -900f
|
||||||
|
|
||||||
for (var panel : panels) {
|
for (i in panels.indices.reversed()) {
|
||||||
RenderSystem.depthFunc(GL_ALWAYS);
|
val panel = panels[i]
|
||||||
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
panel.setAccumulatedDepth(depth);
|
panel.accumulatedDepth = depth
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
depth = Math.max(depth, panel.render(pose, mouse_x, mouse_y, flag));
|
depth = depth.coerceAtLeast(panel.render(poseStack, mouseXf, mouseYf, partialTick))
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.depthFunc(GL_LESS);
|
RenderSystem.depthFunc(GL11.GL_LESS)
|
||||||
|
MinecraftForge.EVENT_BUS.post(Background(this, poseStack, mouseX, mouseY))
|
||||||
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new ContainerScreenEvent.Render.Background(this, pose, mouse_x, mouse_y));
|
RenderSystem.disableDepthTest()
|
||||||
|
|
||||||
RenderSystem.disableDepthTest();
|
|
||||||
|
|
||||||
// Screen.super.render
|
// Screen.super.render
|
||||||
for (Widget widget : this.renderables) {
|
for (widget in renderables) {
|
||||||
widget.render(pose, mouse_x, mouse_y, flag);
|
widget.render(poseStack, mouseX, mouseY, partialTick)
|
||||||
}
|
}
|
||||||
// /Screen.super.render
|
// /Screen.super.render
|
||||||
|
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest()
|
||||||
|
MinecraftForge.EVENT_BUS.post(Foreground(this, poseStack, mouseX, mouseY))
|
||||||
|
|
||||||
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new ContainerScreenEvent.Render.Foreground(this, pose, mouse_x, mouse_y));
|
var itemstack = if (draggingItem.isEmpty) menu.carried else draggingItem
|
||||||
|
|
||||||
var itemstack = this.draggingItem.isEmpty() ? this.menu.getCarried() : this.draggingItem;
|
if (!itemstack.isEmpty) {
|
||||||
|
val i2 = if (draggingItem.isEmpty) 8 else 16
|
||||||
|
var overrideCount: String? = null
|
||||||
|
|
||||||
if (!itemstack.isEmpty()) {
|
if (isQuickCrafting && quickCraftSlots.size > 1) {
|
||||||
int i2 = this.draggingItem.isEmpty() ? 8 : 16;
|
itemstack = itemstack.copy()
|
||||||
String override_count = null;
|
itemstack.count = quickCraftingRemainder
|
||||||
|
|
||||||
if (this.isQuickCrafting && this.quickCraftSlots.size() > 1) {
|
if (itemstack.isEmpty) {
|
||||||
itemstack = itemstack.copy();
|
overrideCount = ChatFormatting.YELLOW.toString() + "0"
|
||||||
itemstack.setCount(this.quickCraftingRemainder);
|
|
||||||
|
|
||||||
if (itemstack.isEmpty()) {
|
|
||||||
override_count = ChatFormatting.YELLOW + "0";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderFloatingItem(itemstack, mouse_x - render_x - 8, mouse_y - render_y - i2, override_count);
|
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
||||||
|
renderFloatingItem(itemstack, mouseX - 8, mouseY - i2, overrideCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest()
|
||||||
|
|
||||||
// forge's hard limit tooltip Z position to 500 units
|
// forge's hard limit tooltip Z position to 500 units
|
||||||
// so if we have anything drawn above 500 units, lift it up
|
// so if we have anything drawn above 500 units, lift it up
|
||||||
if (depth > 500) {
|
if (depth > 500f) {
|
||||||
pose.pushPose();
|
poseStack.pushPose()
|
||||||
pose.translate(0, 0, depth - 500);
|
poseStack.translate(0.0, 0.0, depth - 500.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.menu.getCarried().isEmpty()) {
|
if (menu.carried.isEmpty) {
|
||||||
if (this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
|
val hoveredSlot = hoveredSlot
|
||||||
this.renderTooltip(pose, this.hoveredSlot.getItem(), mouse_x, mouse_y);
|
|
||||||
|
if (hoveredSlot != null && hoveredSlot.hasItem()) {
|
||||||
|
this.renderTooltip(poseStack, hoveredSlot.item, mouseX, mouseY)
|
||||||
} else {
|
} else {
|
||||||
for (int i = panels.size() - 1; i >= 0; i--) {
|
for (panel in panels) {
|
||||||
var panel = panels.get(i);
|
if (panel.renderTooltips(poseStack, mouseXf, mouseYf, partialTick)) {
|
||||||
|
break
|
||||||
if (panel.renderTooltips(pose, mouse_x, mouse_y, flag)) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth > 500) {
|
if (depth > 500f) {
|
||||||
pose.popPose();
|
poseStack.popPose()
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AbstractContainerScreen
|
override fun containerTick() {
|
||||||
public void recalculateQuickCraftRemaining() {
|
for (panel in panels) {
|
||||||
ItemStack itemstack = this.menu.getCarried();
|
panel.tick()
|
||||||
|
|
||||||
if (!itemstack.isEmpty() && this.isQuickCrafting) {
|
|
||||||
if (this.quickCraftingType == 2) {
|
|
||||||
this.quickCraftingRemainder = itemstack.getMaxStackSize();
|
|
||||||
} else {
|
|
||||||
this.quickCraftingRemainder = itemstack.getCount();
|
|
||||||
|
|
||||||
for(Slot slot : this.quickCraftSlots) {
|
|
||||||
ItemStack itemstack1 = itemstack.copy();
|
|
||||||
ItemStack itemstack2 = slot.getItem();
|
|
||||||
int i = itemstack2.isEmpty() ? 0 : itemstack2.getCount();
|
|
||||||
AbstractContainerMenu.getQuickCraftSlotCount(this.quickCraftSlots, this.quickCraftingType, itemstack1, i);
|
|
||||||
int j = Math.min(itemstack1.getMaxStackSize(), slot.getMaxStackSize(itemstack1));
|
|
||||||
if (itemstack1.getCount() > j) {
|
|
||||||
itemstack1.setCount(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.quickCraftingRemainder -= itemstack1.getCount() - i;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSlotClicked(MatterySlot slot, int mouse_button) {
|
companion object {
|
||||||
InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(mouse_button);
|
const val DEFAULT_FRAME_WIDTH = 18f * 9f + 16f
|
||||||
boolean flag = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey);
|
const val DEFAULT_FRAME_HEIGHT = 100f
|
||||||
|
const val INVENTORY_FRAME_WIDTH = DEFAULT_FRAME_WIDTH
|
||||||
long i = Util.getMillis();
|
const val INVENTORY_FRAME_HEIGHT = 3f * 18f + 18f + 24f
|
||||||
|
const val GAUGE_TOP_WITH_SLOT = 17f
|
||||||
this.doubleclick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == mouse_button;
|
const val GAUGE_TOP_WITHOUT_SLOT = 26f
|
||||||
this.skipNextRelease = false;
|
const val SLOT_TOP_UNDER_GAUGE = 70f
|
||||||
|
const val PROGRESS_ARROW_TOP = 42f
|
||||||
if (mouse_button != 0 && mouse_button != 1 && !flag) {
|
const val PROGRESS_SLOT_TOP = 41f
|
||||||
this.checkHotbarMouseClicked(mouse_button);
|
const val LEFT_MARGIN = 8f
|
||||||
} else if (!this.isQuickCrafting) {
|
|
||||||
if (this.menu.getCarried().isEmpty()) {
|
|
||||||
if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
|
||||||
this.slotClicked(slot, slot.index, mouse_button, ClickType.CLONE);
|
|
||||||
} else {
|
|
||||||
boolean shift_click = (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 340) || InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 344));
|
|
||||||
ClickType clicktype = ClickType.PICKUP;
|
|
||||||
|
|
||||||
if (shift_click) {
|
|
||||||
this.lastQuickMoved = slot != null && slot.hasItem() ? slot.getItem().copy() : ItemStack.EMPTY;
|
|
||||||
clicktype = ClickType.QUICK_MOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.slotClicked(slot, slot.index, mouse_button, clicktype);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.skipNextRelease = true;
|
|
||||||
} else {
|
|
||||||
this.isQuickCrafting = true;
|
|
||||||
this.quickCraftingButton = mouse_button;
|
|
||||||
this.quickCraftSlots.clear();
|
|
||||||
|
|
||||||
if (mouse_button == 0) {
|
|
||||||
this.quickCraftingType = 0;
|
|
||||||
} else if (mouse_button == 1) {
|
|
||||||
this.quickCraftingType = 1;
|
|
||||||
} else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
|
||||||
this.quickCraftingType = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lastClickSlot = slot;
|
|
||||||
this.lastClickTime = i;
|
|
||||||
this.lastClickButton = mouse_button;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkHotbarMouseClicked(int mouse_code) {
|
|
||||||
if (this.hoveredSlot != null && this.menu.getCarried().isEmpty()) {
|
|
||||||
if (this.minecraft.options.keySwapOffhand.matchesMouse(mouse_code)) {
|
|
||||||
this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 40, ClickType.SWAP);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
if (this.minecraft.options.keyHotbarSlots[i].matchesMouse(mouse_code)) {
|
|
||||||
this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, i, ClickType.SWAP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSlotMouseDragged(@Nonnull MatterySlot slot, int click_type) {
|
|
||||||
ItemStack itemstack = this.menu.getCarried();
|
|
||||||
|
|
||||||
if (this.clickedSlot != null && this.minecraft.options.touchscreen().get()) {
|
|
||||||
if (click_type == 0 || click_type == 1) {
|
|
||||||
if (this.draggingItem.isEmpty()) {
|
|
||||||
if (slot != this.clickedSlot && !this.clickedSlot.getItem().isEmpty()) {
|
|
||||||
this.draggingItem = this.clickedSlot.getItem().copy();
|
|
||||||
}
|
|
||||||
} else if (this.draggingItem.getCount() > 1 && AbstractContainerMenu.canItemQuickReplace(slot, this.draggingItem, false)) {
|
|
||||||
long i = Util.getMillis();
|
|
||||||
if (this.quickdropSlot == slot) {
|
|
||||||
if (i - this.quickdropTime > 500L) {
|
|
||||||
this.slotClicked(this.clickedSlot, this.clickedSlot.index, 0, ClickType.PICKUP);
|
|
||||||
this.slotClicked(slot, slot.index, 1, ClickType.PICKUP);
|
|
||||||
this.slotClicked(this.clickedSlot, this.clickedSlot.index, 0, ClickType.PICKUP);
|
|
||||||
this.quickdropTime = i + 750L;
|
|
||||||
this.draggingItem.shrink(1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.quickdropSlot = slot;
|
|
||||||
this.quickdropTime = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (this.isQuickCrafting && !itemstack.isEmpty() && (itemstack.getCount() > this.quickCraftSlots.size() || this.quickCraftingType == 2) && AbstractContainerMenu.canItemQuickReplace(slot, itemstack, true) && slot.mayPlace(itemstack) && this.menu.canDragTo(slot)) {
|
|
||||||
this.quickCraftSlots.add(slot);
|
|
||||||
this.recalculateQuickCraftRemaining();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onMouseReleasedSlot(@Nullable MatterySlot slot, double p_97812_, double p_97813_, int p_97814_, boolean outside) {
|
|
||||||
int i = this.leftPos;
|
|
||||||
int j = this.topPos;
|
|
||||||
InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(p_97814_);
|
|
||||||
int k = outside ? -999 : slot != null ? slot.index : -1;
|
|
||||||
|
|
||||||
if (this.doubleclick && p_97814_ == 0 && slot != null && this.menu.canTakeItemForPickAll(ItemStack.EMPTY, slot)) {
|
|
||||||
if (hasShiftDown()) {
|
|
||||||
if (!this.lastQuickMoved.isEmpty()) {
|
|
||||||
for(Slot slot2 : this.menu.slots) {
|
|
||||||
if (slot2 != null && slot2.mayPickup(this.minecraft.player) && slot2.hasItem() && slot2.isSameInventory(slot) && AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
|
|
||||||
this.slotClicked(slot2, slot2.index, p_97814_, ClickType.QUICK_MOVE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.slotClicked(slot, k, p_97814_, ClickType.PICKUP_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.doubleclick = false;
|
|
||||||
this.lastClickTime = 0L;
|
|
||||||
} else {
|
|
||||||
if (this.isQuickCrafting && this.quickCraftingButton != p_97814_) {
|
|
||||||
this.isQuickCrafting = false;
|
|
||||||
this.quickCraftSlots.clear();
|
|
||||||
this.skipNextRelease = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.skipNextRelease) {
|
|
||||||
this.skipNextRelease = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.clickedSlot != null && this.minecraft.options.touchscreen().get()) {
|
|
||||||
if (p_97814_ == 0 || p_97814_ == 1) {
|
|
||||||
if (this.draggingItem.isEmpty() && slot != this.clickedSlot) {
|
|
||||||
this.draggingItem = this.clickedSlot.getItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean flag2 = AbstractContainerMenu.canItemQuickReplace(slot, this.draggingItem, false);
|
|
||||||
if (k != -1 && !this.draggingItem.isEmpty() && flag2) {
|
|
||||||
this.slotClicked(this.clickedSlot, this.clickedSlot.index, p_97814_, ClickType.PICKUP);
|
|
||||||
this.slotClicked(slot, k, 0, ClickType.PICKUP);
|
|
||||||
if (this.menu.getCarried().isEmpty()) {
|
|
||||||
this.snapbackItem = ItemStack.EMPTY;
|
|
||||||
} else {
|
|
||||||
this.slotClicked(this.clickedSlot, this.clickedSlot.index, p_97814_, ClickType.PICKUP);
|
|
||||||
this.snapbackStartX = Mth.floor(p_97812_ - (double)i);
|
|
||||||
this.snapbackStartY = Mth.floor(p_97813_ - (double)j);
|
|
||||||
this.snapbackEnd = this.clickedSlot;
|
|
||||||
this.snapbackItem = this.draggingItem;
|
|
||||||
this.snapbackTime = Util.getMillis();
|
|
||||||
}
|
|
||||||
} else if (!this.draggingItem.isEmpty()) {
|
|
||||||
this.snapbackStartX = Mth.floor(p_97812_ - (double)i);
|
|
||||||
this.snapbackStartY = Mth.floor(p_97813_ - (double)j);
|
|
||||||
this.snapbackEnd = this.clickedSlot;
|
|
||||||
this.snapbackItem = this.draggingItem;
|
|
||||||
this.snapbackTime = Util.getMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.draggingItem = ItemStack.EMPTY;
|
|
||||||
this.clickedSlot = null;
|
|
||||||
}
|
|
||||||
} else if (this.isQuickCrafting && !this.quickCraftSlots.isEmpty()) {
|
|
||||||
this.slotClicked((Slot)null, -999, AbstractContainerMenu.getQuickcraftMask(0, this.quickCraftingType), ClickType.QUICK_CRAFT);
|
|
||||||
|
|
||||||
for(Slot slot1 : this.quickCraftSlots) {
|
|
||||||
this.slotClicked(slot1, slot1.index, AbstractContainerMenu.getQuickcraftMask(1, this.quickCraftingType), ClickType.QUICK_CRAFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.slotClicked((Slot)null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT);
|
|
||||||
} else if (!this.menu.getCarried().isEmpty()) {
|
|
||||||
if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
|
|
||||||
this.slotClicked(slot, k, p_97814_, ClickType.CLONE);
|
|
||||||
} else {
|
|
||||||
boolean flag1 = k != -999 && (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 340) || InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 344));
|
|
||||||
|
|
||||||
if (flag1) {
|
|
||||||
this.lastQuickMoved = slot.hasItem() ? slot.getItem().copy() : ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.slotClicked(slot, k, p_97814_, flag1 ? ClickType.QUICK_MOVE : ClickType.PICKUP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.menu.getCarried().isEmpty()) {
|
|
||||||
this.lastClickTime = 0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isQuickCrafting = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void slotClicked(Slot p_97778_, int p_97779_, int p_97780_, ClickType p_97781_) {
|
|
||||||
if (p_97778_ != null) {
|
|
||||||
p_97779_ = p_97778_.index;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.minecraft.gameMode.handleInventoryMouseClick(this.menu.containerId, p_97779_, p_97780_, p_97781_, this.minecraft.player);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean checkHotbarKeyPressed(int p_97806_, int p_97807_) {
|
|
||||||
if (this.menu.getCarried().isEmpty() && this.hoveredSlot != null) {
|
|
||||||
if (this.minecraft.options.keySwapOffhand.isActiveAndMatches(InputConstants.getKey(p_97806_, p_97807_))) {
|
|
||||||
this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 40, ClickType.SWAP);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
if (this.minecraft.options.keyHotbarSlots[i].isActiveAndMatches(InputConstants.getKey(p_97806_, p_97807_))) {
|
|
||||||
this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, i, ClickType.SWAP);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void containerTick() {
|
|
||||||
for (var panel : panels) {
|
|
||||||
panel.tick();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -84,8 +84,8 @@ abstract class AbstractSlotPanel @JvmOverloads constructor(
|
|||||||
return screen.getTooltipFromItem(stack)
|
return screen.getTooltipFromItem(stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouse_x, mouse_y, flag)
|
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
||||||
renderRegular(stack, getItemStack())
|
renderRegular(stack, getItemStack())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ abstract class SquareButtonPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
PRESSED.render(stack, 0f, 0f, width, height)
|
PRESSED.render(stack, 0f, 0f, width, height)
|
||||||
} else if (isHovered && !isDisabled) {
|
} else if (isHovered && !isDisabled) {
|
||||||
@ -102,7 +102,7 @@ abstract class SquareButtonPanel(
|
|||||||
skinElement?.invoke()?.render(stack, 0f, 0f, width, height)
|
skinElement?.invoke()?.render(stack, 0f, 0f, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isDisabled) {
|
if (!isDisabled) {
|
||||||
if (!pressed) {
|
if (!pressed) {
|
||||||
minecraft.soundManager.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0f))
|
minecraft.soundManager.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0f))
|
||||||
@ -115,12 +115,12 @@ abstract class SquareButtonPanel(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isDisabled && pressed) {
|
if (!isDisabled && pressed) {
|
||||||
pressed = false
|
pressed = false
|
||||||
|
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
click(flag)
|
click(button)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,21 +221,21 @@ abstract class EnumSquareButtonPanel<T : Enum<T>>(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
check(!building) { "Still building this button!" }
|
check(!building) { "Still building this button!" }
|
||||||
super.innerRender(stack, mouse_x, mouse_y, flag)
|
super.innerRender(stack, mouseX, mouseY, partialTick)
|
||||||
val pair = checkNotNull(enumMapping[prop.get()]) { "HOW" }
|
val pair = checkNotNull(enumMapping[prop.get()]) { "HOW" }
|
||||||
pair.first.render(stack, 0f, 0f, width, height, pair.second)
|
pair.first.render(stack, 0f, 0f, width, height, pair.second)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
check(!building) { "Still building this button!" }
|
check(!building) { "Still building this button!" }
|
||||||
return super.mouseClickedInner(mouse_x, mouse_y, mouse_click_type)
|
return super.mouseClickedInner(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
check(!building) { "Still building this button!" }
|
check(!building) { "Still building this button!" }
|
||||||
return super.mouseReleasedInner(mouse_x, mouse_y, flag)
|
return super.mouseReleasedInner(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun click(clickButton: Int) {
|
override fun click(clickButton: Int) {
|
||||||
|
@ -23,7 +23,7 @@ open class CheckBoxPanel(
|
|||||||
) {
|
) {
|
||||||
open var checked = false
|
open var checked = false
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
CHECKBOX_CHECKED.render(stack)
|
CHECKBOX_CHECKED.render(stack)
|
||||||
} else {
|
} else {
|
||||||
@ -31,7 +31,7 @@ open class CheckBoxPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
checked = !checked
|
checked = !checked
|
||||||
minecraft.soundManager.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0f))
|
minecraft.soundManager.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0f))
|
||||||
return true
|
return true
|
||||||
@ -71,8 +71,8 @@ open class CheckBoxInputPanel(
|
|||||||
get() = widget.value
|
get() = widget.value
|
||||||
set(value) {}
|
set(value) {}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
super.mouseClickedInner(mouse_x, mouse_y, mouse_click_type)
|
super.mouseClickedInner(x, y, button)
|
||||||
widget.userInput(!checked)
|
widget.userInput(!checked)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -13,36 +13,25 @@ open class DraggableCanvasPanel @JvmOverloads constructor(
|
|||||||
screen, parent, x, y, width, height
|
screen, parent, x, y, width, height
|
||||||
) {
|
) {
|
||||||
protected var dragging = false
|
protected var dragging = false
|
||||||
protected var lastMouseX = 0.0
|
|
||||||
protected var lastMouseY = 0.0
|
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
dragging = true
|
dragging = true
|
||||||
lastMouseX = mouse_x
|
|
||||||
lastMouseY = mouse_y
|
|
||||||
trapMouseInput = true
|
trapMouseInput = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
dragging = false
|
dragging = false
|
||||||
trapMouseInput = false
|
trapMouseInput = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseDraggedInner(
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
mouse_x: Double,
|
|
||||||
mouse_y: Double,
|
|
||||||
flag: Int,
|
|
||||||
drag_x: Double,
|
|
||||||
drag_y: Double
|
|
||||||
): Boolean {
|
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
xOffset -= (lastMouseX - mouse_x).toFloat()
|
xOffset += xDelta.toFloat()
|
||||||
yOffset -= (lastMouseY - mouse_y).toFloat()
|
yOffset += yDelta.toFloat()
|
||||||
lastMouseX = mouse_x
|
|
||||||
lastMouseY = mouse_y
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ open class EditBoxPanel(
|
|||||||
widget?.setFocus(new)
|
widget?.setFocus(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, flag: Int): Boolean {
|
||||||
super.mouseClickedInner(mouse_x, mouse_y, flag)
|
super.mouseClickedInner(x, y, flag)
|
||||||
requestFocus()
|
requestFocus()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -194,8 +194,8 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
isHovered = false
|
isHovered = false
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onHovered() {}
|
protected open fun onHovered() {}
|
||||||
open fun onUnHovered() {}
|
protected open fun onUnHovered() {}
|
||||||
|
|
||||||
var isFocused = false
|
var isFocused = false
|
||||||
set(value) {
|
set(value) {
|
||||||
@ -244,20 +244,21 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onParent(child: EditablePanel) {
|
private fun onParent(child: EditablePanel) {
|
||||||
if (children.contains(child)) throw IllegalStateException("Already containing this child")
|
if (children.contains(child)) throw IllegalStateException("Already containing $child")
|
||||||
children.add(child)
|
children.add(child)
|
||||||
needsInvalidation = true
|
needsInvalidation = true
|
||||||
updateVisible()
|
updateVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUnParent(child: EditablePanel) {
|
private fun onUnParent(child: EditablePanel) {
|
||||||
if (!children.contains(child)) throw IllegalStateException("Already not containing this child")
|
val indexOf = children.indexOf(child)
|
||||||
children.remove(child)
|
if (indexOf == -1) throw IllegalStateException("Already not containing $child")
|
||||||
|
children.removeAt(indexOf)
|
||||||
needsInvalidation = true
|
needsInvalidation = true
|
||||||
updateVisible()
|
updateVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {}
|
protected open fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {}
|
||||||
protected open fun innerRenderTooltips(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float): Boolean {
|
protected open fun innerRenderTooltips(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -266,7 +267,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return visible && visibleAsChildren
|
return visible && visibleAsChildren
|
||||||
}
|
}
|
||||||
|
|
||||||
fun render(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float): Float {
|
fun render(poseStack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float): Float {
|
||||||
if (!isVisible()) {
|
if (!isVisible()) {
|
||||||
return 0f
|
return 0f
|
||||||
}
|
}
|
||||||
@ -285,10 +286,10 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
absoluteY = y
|
absoluteY = y
|
||||||
} else {
|
} else {
|
||||||
isHovered = parent.isHovered &&
|
isHovered = parent.isHovered &&
|
||||||
mouse_x >= absoluteX &&
|
mouseX >= absoluteX &&
|
||||||
mouse_x < absoluteX + width &&
|
mouseX < absoluteX + width &&
|
||||||
mouse_y >= absoluteY &&
|
mouseY >= absoluteY &&
|
||||||
mouse_y < absoluteY + height
|
mouseY < absoluteY + height
|
||||||
}
|
}
|
||||||
|
|
||||||
val scissor = this.scissor
|
val scissor = this.scissor
|
||||||
@ -304,10 +305,10 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
stack.pushPose()
|
poseStack.pushPose()
|
||||||
stack.translate(absoluteX.toDouble(), absoluteY.toDouble(), accumulatedDepth.toDouble())
|
poseStack.translate(absoluteX.toDouble(), absoluteY.toDouble(), accumulatedDepth.toDouble())
|
||||||
innerRender(stack, mouse_x, mouse_y, flag)
|
innerRender(poseStack, mouseX, mouseY, partialTick)
|
||||||
stack.popPose()
|
poseStack.popPose()
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.isVisible()) {
|
if (child.isVisible()) {
|
||||||
@ -316,7 +317,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
child.absoluteY = absoluteY + child.y + yOffset
|
child.absoluteY = absoluteY + child.y + yOffset
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
||||||
depth = max(depth, child.render(stack, mouse_x, mouse_y, flag))
|
depth = max(depth, child.render(poseStack, mouseX, mouseY, partialTick))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,11 +383,7 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun findRoot(): EditablePanel? {
|
fun findRoot(): EditablePanel? {
|
||||||
var parent = this.parent
|
var parent: EditablePanel? = this.parent ?: return null
|
||||||
|
|
||||||
if (parent == null) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
val parent2 = parent!!.parent
|
val parent2 = parent!!.parent
|
||||||
@ -665,9 +662,9 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
operator fun get(int: Int): EditablePanel? {
|
operator fun get(index: Int): EditablePanel? {
|
||||||
if (int < 0 || int >= children.size) return null
|
if (index < 0 || index >= children.size) return null
|
||||||
return children[int]
|
return children[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isTrappingMouseInput(): Boolean {
|
fun isTrappingMouseInput(): Boolean {
|
||||||
@ -684,27 +681,27 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseMoved(p_94758_: Double, p_94759_: Double) {
|
override fun mouseMoved(x: Double, y: Double) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
protected open fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun withinBounds(mouse_x: Double, mouse_y: Double): Boolean {
|
fun withinBounds(x: Double, y: Double): Boolean {
|
||||||
val pos: ScreenPos = localToScreen()
|
val pos: ScreenPos = localToScreen()
|
||||||
return pos.x <= mouse_x && pos.x + width > mouse_x && pos.y <= mouse_y && pos.y + height > mouse_y
|
return pos.x <= x && pos.x + width > x && pos.y <= y && pos.y + height > y
|
||||||
}
|
}
|
||||||
|
|
||||||
fun withinExtendedBounds(mouse_x: Double, mouse_y: Double): Boolean {
|
fun withinExtendedBounds(x: Double, y: Double): Boolean {
|
||||||
val pos: ScreenPos = localToScreen(boundingX, boundingY)
|
val pos: ScreenPos = localToScreen(boundingX, boundingY)
|
||||||
return pos.x <= mouse_x && pos.x + boundingWidth > mouse_x && pos.y <= mouse_y && pos.y + boundingHeight > mouse_y
|
return pos.x <= x && pos.x + boundingWidth > x && pos.y <= y && pos.y + boundingHeight > y
|
||||||
}
|
}
|
||||||
|
|
||||||
fun killFocusForEverythingExcept(eclusion: EditablePanel) {
|
fun killFocusForEverythingExcept(except: EditablePanel) {
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child !== eclusion) {
|
if (child !== except) {
|
||||||
child.killFocusForEverythingExceptInner()
|
child.killFocusForEverythingExceptInner()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -720,30 +717,30 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun mouseClicked(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
final override fun mouseClicked(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (trapMouseInput) return mouseClickedInner(mouse_x, mouse_y, flag)
|
if (trapMouseInput) return mouseClickedInner(x, y, button)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.mouseClickedChecked(mouse_x, mouse_y, flag)) {
|
if (child.mouseClickedChecked(x, y, button)) {
|
||||||
killFocusForEverythingExcept(child)
|
killFocusForEverythingExcept(child)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mouseClickedInner(mouse_x, mouse_y, flag)
|
return mouseClickedInner(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mouseClickedChecked(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
fun mouseClickedChecked(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (isTrappingMouseInput() || withinBounds(mouse_x, mouse_y)) {
|
if (isTrappingMouseInput() || withinBounds(x, y)) {
|
||||||
if (acceptMouseInput && parent == null) screen.popup(this)
|
if (acceptMouseInput && parent == null) screen.popup(this)
|
||||||
return mouseClicked(mouse_x, mouse_y, flag)
|
return mouseClicked(x, y, button)
|
||||||
} else if (withinExtendedBounds(mouse_x, mouse_y)) {
|
} else if (withinExtendedBounds(x, y)) {
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.mouseClickedChecked(mouse_x, mouse_y, flag)) {
|
if (child.mouseClickedChecked(x, y, button)) {
|
||||||
killFocusForEverythingExcept(child)
|
killFocusForEverythingExcept(child)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -757,32 +754,66 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
protected open fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun mouseReleased(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
final override fun mouseReleased(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (trapMouseInput) return mouseReleasedInner(mouse_x, mouse_y, flag)
|
if (trapMouseInput) return mouseReleasedInner(x, y, button)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.mouseReleasedChecked(mouse_x, mouse_y, flag)) {
|
if (child.mouseReleasedChecked(x, y, button)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mouseReleasedInner(mouse_x, mouse_y, flag)
|
return mouseReleasedInner(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mouseReleasedChecked(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
fun mouseReleasedChecked(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (isTrappingMouseInput() || withinBounds(mouse_x, mouse_y)) {
|
if (isTrappingMouseInput() || withinBounds(x, y)) {
|
||||||
return mouseReleased(mouse_x, mouse_y, flag)
|
return mouseReleased(x, y, button)
|
||||||
} else if (withinExtendedBounds(mouse_x, mouse_y)) {
|
} else if (withinExtendedBounds(x, y)) {
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.mouseReleasedChecked(mouse_x, mouse_y, flag)) {
|
if (child.mouseReleasedChecked(x, y, button)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
final override fun mouseDragged(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
|
if (trapMouseInput) return mouseDraggedInner(x, y, button, xDelta, yDelta)
|
||||||
|
|
||||||
|
for (child in children) {
|
||||||
|
if (child.mouseDraggedChecked(x, y, button, xDelta, yDelta)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mouseDraggedInner(x, y, button, xDelta, yDelta)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun mouseDraggedChecked(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
|
if (isTrappingMouseInput() || withinBounds(x, y)) {
|
||||||
|
return mouseDragged(x, y, button, xDelta, yDelta)
|
||||||
|
} else if (withinExtendedBounds(x, y)) {
|
||||||
|
for (child in children) {
|
||||||
|
if (child.mouseDraggedChecked(x, y, button, xDelta, yDelta)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -792,38 +823,32 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected open fun mouseDraggedInner(
|
protected open fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
mouse_x: Double,
|
|
||||||
mouse_y: Double,
|
|
||||||
flag: Int,
|
|
||||||
drag_x: Double,
|
|
||||||
drag_y: Double
|
|
||||||
): Boolean {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun mouseDragged(mouse_x: Double, mouse_y: Double, flag: Int, drag_x: Double, drag_y: Double): Boolean {
|
final override fun mouseScrolled(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (trapMouseInput) return mouseDraggedInner(mouse_x, mouse_y, flag, drag_x, drag_y)
|
if (trapMouseInput) return mouseScrolledInner(x, y, scroll)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.mouseDraggedChecked(mouse_x, mouse_y, flag, drag_x, drag_y)) {
|
if (child.mouseScrolledChecked(x, y, scroll)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mouseDraggedInner(mouse_x, mouse_y, flag, drag_x, drag_y)
|
return mouseScrolledInner(x, y, scroll)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mouseDraggedChecked(mouse_x: Double, mouse_y: Double, flag: Int, drag_x: Double, drag_y: Double): Boolean {
|
fun mouseScrolledChecked(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
|
|
||||||
if (isTrappingMouseInput() || withinBounds(mouse_x, mouse_y)) {
|
if (isTrappingMouseInput() || withinBounds(x, y)) {
|
||||||
return mouseDragged(mouse_x, mouse_y, flag, drag_x, drag_y)
|
return mouseScrolled(x, y, scroll)
|
||||||
} else if (withinExtendedBounds(mouse_x, mouse_y)) {
|
} else if (withinExtendedBounds(x, y)) {
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.mouseDraggedChecked(mouse_x, mouse_y, flag, drag_x, drag_y)) {
|
if (child.mouseScrolledChecked(x, y, scroll)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -832,53 +857,18 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun keyPressedInternal(key: Int, scancode: Int, mods: Int): Boolean {
|
||||||
protected open fun mouseScrolledInner(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
final override fun mouseScrolled(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
|
||||||
|
|
||||||
if (trapMouseInput) return mouseScrolledInner(mouse_x, mouse_y, scroll)
|
|
||||||
|
|
||||||
for (child in children) {
|
|
||||||
if (child.mouseScrolledChecked(mouse_x, mouse_y, scroll)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mouseScrolledInner(mouse_x, mouse_y, scroll)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun mouseScrolledChecked(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
|
||||||
|
|
||||||
if (isTrappingMouseInput() || withinBounds(mouse_x, mouse_y)) {
|
|
||||||
return mouseScrolled(mouse_x, mouse_y, scroll)
|
|
||||||
} else if (withinExtendedBounds(mouse_x, mouse_y)) {
|
|
||||||
for (child in children) {
|
|
||||||
if (child.mouseScrolledChecked(mouse_x, mouse_y, scroll)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun keyPressedInternal(p_94745_: Int, p_94746_: Int, p_94747_: Int): Boolean {
|
final override fun keyPressed(key: Int, scancode: Int, mods: Int): Boolean {
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
final override fun keyPressed(p_94745_: Int, p_94746_: Int, p_94747_: Int): Boolean {
|
|
||||||
if (!isVisible() || !acceptKeyboardInput) return false
|
if (!isVisible() || !acceptKeyboardInput) return false
|
||||||
if (!focusedAsParent) return false
|
if (!focusedAsParent) return false
|
||||||
|
|
||||||
if (isFocused) return keyPressedInternal(p_94745_, p_94746_, p_94747_)
|
if (isFocused) return keyPressedInternal(key, scancode, mods)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.keyPressed(p_94745_, p_94746_, p_94747_)) {
|
if (child.keyPressed(key, scancode, mods)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -886,18 +876,18 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun keyReleasedInternal(p_94750_: Int, p_94751_: Int, p_94752_: Int): Boolean {
|
protected open fun keyReleasedInternal(key: Int, scancode: Int, mods: Int): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun keyReleased(p_94750_: Int, p_94751_: Int, p_94752_: Int): Boolean {
|
final override fun keyReleased(key: Int, scancode: Int, mods: Int): Boolean {
|
||||||
if (!isVisible() || !acceptKeyboardInput) return false
|
if (!isVisible() || !acceptKeyboardInput) return false
|
||||||
if (!focusedAsParent) return false
|
if (!focusedAsParent) return false
|
||||||
|
|
||||||
if (isFocused) return keyReleasedInternal(p_94750_, p_94751_, p_94752_)
|
if (isFocused) return keyReleasedInternal(key, scancode, mods)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.keyReleased(p_94750_, p_94751_, p_94752_)) {
|
if (child.keyReleased(key, scancode, mods)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -905,18 +895,18 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
protected open fun charTypedInternal(p_94732_: Char, p_94733_: Int): Boolean {
|
protected open fun charTypedInternal(codepoint: Char, mods: Int): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun charTyped(p_94732_: Char, p_94733_: Int): Boolean {
|
final override fun charTyped(codepoint: Char, mods: Int): Boolean {
|
||||||
if (!isVisible() || !acceptKeyboardInput) return false
|
if (!isVisible() || !acceptKeyboardInput) return false
|
||||||
if (!focusedAsParent) return false
|
if (!focusedAsParent) return false
|
||||||
|
|
||||||
if (isFocused) return charTypedInternal(p_94732_, p_94733_)
|
if (isFocused) return charTypedInternal(codepoint, mods)
|
||||||
|
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
if (child.charTyped(p_94732_, p_94733_)) {
|
if (child.charTyped(codepoint, mods)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -924,19 +914,16 @@ open class EditablePanel @JvmOverloads constructor(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun changeFocus(p_94756_: Boolean): Boolean {
|
override fun changeFocus(state: Boolean): Boolean {
|
||||||
return if (!isVisible()) false else super.changeFocus(p_94756_)
|
return if (!isVisible()) false else super.changeFocus(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
final override fun isMouseOver(
|
final override fun isMouseOver(x: Double, y: Double): Boolean { // called to check whenever we are hovering at this
|
||||||
mouse_x: Double,
|
|
||||||
mouse_y: Double
|
|
||||||
): Boolean { // called to check whenever we are hovering at this
|
|
||||||
if (!isVisible() || !acceptMouseInput) return false
|
if (!isVisible() || !acceptMouseInput) return false
|
||||||
if (isTrappingMouseInput()) return true
|
if (isTrappingMouseInput()) return true
|
||||||
|
|
||||||
val pos = localToScreen()
|
val pos = localToScreen()
|
||||||
return mouse_x >= pos.x && mouse_x <= pos.x + width && mouse_y >= pos.y && mouse_y + height <= pos.y
|
return x >= pos.x && x <= pos.x + width && y >= pos.y && y + height <= pos.y
|
||||||
}
|
}
|
||||||
|
|
||||||
protected var tick = 0
|
protected var tick = 0
|
||||||
|
@ -19,7 +19,7 @@ open class FilterSlotPanel(
|
|||||||
return slot.get()
|
return slot.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (screen.menu.carried.isEmpty) {
|
if (screen.menu.carried.isEmpty) {
|
||||||
MenuNetworkChannel.sendToServer(ItemFilterSlotPacket(slot.networkID, ItemStack.EMPTY))
|
MenuNetworkChannel.sendToServer(ItemFilterSlotPacket(slot.networkID, ItemStack.EMPTY))
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,7 +69,7 @@ open class FramePanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (frameTabPosition == Position.TOP) {
|
if (frameTabPosition == Position.TOP) {
|
||||||
val width: Float
|
val width: Float
|
||||||
val height: Float
|
val height: Float
|
||||||
@ -114,7 +114,7 @@ open class FramePanel(
|
|||||||
onClose?.run()
|
onClose?.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, flag: Int): Boolean {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -199,56 +199,43 @@ open class FramePanel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected var dragging = false
|
protected var dragging = false
|
||||||
protected var dragMouseX = 0.0
|
|
||||||
protected var dragMouseY = 0.0
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setDockPadding(PADDING, PADDING_TOP, PADDING, PADDING)
|
setDockPadding(PADDING, PADDING_TOP, PADDING, PADDING)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
val (_, y1) = screenToLocal(mouse_x, mouse_y)
|
val (_, y1) = screenToLocal(x, y)
|
||||||
|
|
||||||
if (parent == null && y1 >= 0 && y1 <= 12) {
|
if (parent == null && y1 >= 0 && y1 <= 12) {
|
||||||
trapMouseInput = true
|
trapMouseInput = true
|
||||||
dragMouseX = mouse_x
|
|
||||||
dragMouseY = mouse_y
|
|
||||||
dragging = true
|
dragging = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.mouseClickedInner(mouse_x, mouse_y, flag)
|
return super.mouseClickedInner(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
trapMouseInput = false
|
trapMouseInput = false
|
||||||
dragging = false
|
dragging = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.mouseReleasedInner(mouse_x, mouse_y, flag)
|
return super.mouseReleasedInner(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseDraggedInner(
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
mouse_x: Double,
|
|
||||||
mouse_y: Double,
|
|
||||||
flag: Int,
|
|
||||||
drag_x: Double,
|
|
||||||
drag_y: Double
|
|
||||||
): Boolean {
|
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
val draggedX = mouse_x - dragMouseX
|
this.x += xDelta.toFloat()
|
||||||
val draggedY = mouse_y - dragMouseY
|
this.y += yDelta.toFloat()
|
||||||
dragMouseX = mouse_x
|
|
||||||
dragMouseY = mouse_y
|
|
||||||
setPos(x + draggedX, y + draggedY)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.mouseDraggedInner(mouse_x, mouse_y, flag, drag_x, drag_y)
|
return super.mouseDraggedInner(x, y, button, xDelta, yDelta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
// background
|
// background
|
||||||
// RenderSystem.disableDepthTest();
|
// RenderSystem.disableDepthTest();
|
||||||
val bgWidth = width - 4
|
val bgWidth = width - 4
|
||||||
|
@ -23,7 +23,7 @@ open class Label @JvmOverloads constructor(
|
|||||||
|
|
||||||
var color = RGBAColor.SLATE_GRAY
|
var color = RGBAColor.SLATE_GRAY
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
font.draw(stack, text, 0f, 0f, color.toInt())
|
font.draw(stack, text, 0f, 0f, color.toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,23 +89,27 @@ abstract class MinecraftWidgetPanel<T : AbstractWidget>(
|
|||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
getOrCreateWidget().render(stack, mouse_x.toInt(), mouse_y.toInt(), flag)
|
getOrCreateWidget().render(stack, mouseX.toInt(), mouseY.toInt(), partialTick)
|
||||||
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
RenderSystem.depthFunc(GL11.GL_ALWAYS)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun charTypedInternal(p_94732_: Char, p_94733_: Int) = getOrCreateWidget().charTyped(p_94732_, p_94733_)
|
override fun charTypedInternal(codepoint: Char, mods: Int) = getOrCreateWidget().charTyped(codepoint, mods)
|
||||||
override fun keyPressedInternal(p_94745_: Int, p_94746_: Int, p_94747_: Int) = getOrCreateWidget().keyPressed(p_94745_, p_94746_, p_94747_)
|
override fun keyPressedInternal(key: Int, scancode: Int, mods: Int) = getOrCreateWidget().keyPressed(
|
||||||
override fun keyReleasedInternal(p_94750_: Int, p_94751_: Int, p_94752_: Int) = getOrCreateWidget().keyReleased(p_94750_, p_94751_, p_94752_)
|
key,
|
||||||
|
scancode,
|
||||||
|
mods
|
||||||
|
)
|
||||||
|
override fun keyReleasedInternal(key: Int, scancode: Int, mods: Int) = getOrCreateWidget().keyReleased(key, scancode, mods)
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
val (x1, y1) = screenToLocal(mouse_x, mouse_y)
|
val (x1, y1) = screenToLocal(x, y)
|
||||||
return getOrCreateWidget().mouseClicked(x1.toDouble(), y1.toDouble(), mouse_click_type)
|
return getOrCreateWidget().mouseClicked(x1.toDouble(), y1.toDouble(), button)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
val (x1, y1) = screenToLocal(mouse_x, mouse_y)
|
val (x1, y1) = screenToLocal(x, y)
|
||||||
return getOrCreateWidget().mouseReleased(x1.toDouble(), y1.toDouble(), flag)
|
return getOrCreateWidget().mouseReleased(x1.toDouble(), y1.toDouble(), button)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ open class ScrollBarPanel(screen: MatteryScreen<*>, parent: EditablePanel?, x: F
|
|||||||
var isScrolling = false
|
var isScrolling = false
|
||||||
protected set
|
protected set
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
scroll_bar_button_press.render(stack, 0f, 0f)
|
scroll_bar_button_press.render(stack, 0f, 0f)
|
||||||
} else if (isHovered) {
|
} else if (isHovered) {
|
||||||
@ -26,14 +26,14 @@ open class ScrollBarPanel(screen: MatteryScreen<*>, parent: EditablePanel?, x: F
|
|||||||
|
|
||||||
protected var lastMouseY = 0.0
|
protected var lastMouseY = 0.0
|
||||||
|
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, flag: Int): Boolean {
|
||||||
isScrolling = true
|
isScrolling = true
|
||||||
trapMouseInput = true
|
trapMouseInput = true
|
||||||
lastMouseY = mouse_y
|
lastMouseY = y
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
isScrolling = false
|
isScrolling = false
|
||||||
trapMouseInput = false
|
trapMouseInput = false
|
||||||
@ -43,20 +43,20 @@ open class ScrollBarPanel(screen: MatteryScreen<*>, parent: EditablePanel?, x: F
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseScrolledInner(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
return this@ScrollBarPanel.mouseScrolledInner(mouse_x, mouse_y, scroll)
|
return this@ScrollBarPanel.mouseScrolledInner(x, y, scroll)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseDraggedInner(
|
override fun mouseDraggedInner(
|
||||||
mouse_x: Double,
|
x: Double,
|
||||||
mouse_y: Double,
|
y: Double,
|
||||||
flag: Int,
|
button: Int,
|
||||||
drag_x: Double,
|
xDelta: Double,
|
||||||
drag_y: Double
|
yDelta: Double
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (isScrolling) {
|
if (isScrolling) {
|
||||||
val diff = mouse_y - lastMouseY
|
val diff = y - lastMouseY
|
||||||
lastMouseY = mouse_y
|
lastMouseY = y
|
||||||
this@ScrollBarPanel.scroll = (scroll + diff / this@ScrollBarPanel.height).toFloat()
|
this@ScrollBarPanel.scroll = (scroll + diff / this@ScrollBarPanel.height).toFloat()
|
||||||
updateScrollBarPosition()
|
updateScrollBarPosition()
|
||||||
return true
|
return true
|
||||||
@ -125,13 +125,13 @@ open class ScrollBarPanel(screen: MatteryScreen<*>, parent: EditablePanel?, x: F
|
|||||||
}
|
}
|
||||||
|
|
||||||
// public is for emulating input from outside
|
// public is for emulating input from outside
|
||||||
public override fun mouseScrolledInner(mouse_x: Double, mouse_y: Double, scroll: Double): Boolean {
|
public override fun mouseScrolledInner(x: Double, y: Double, scroll: Double): Boolean {
|
||||||
this.scroll = (this.scroll - scroll * scrollMultiplier.get()).toFloat()
|
this.scroll = (this.scroll - scroll * scrollMultiplier.get()).toFloat()
|
||||||
updateScrollBarPosition()
|
updateScrollBarPosition()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
scroll_bar_body.render(stack, y = 2f, height = height - 4)
|
scroll_bar_body.render(stack, y = 2f, height = height - 4)
|
||||||
scroll_bar_top.render(stack)
|
scroll_bar_top.render(stack)
|
||||||
scroll_bar_bottom.render(stack, y = height - 2)
|
scroll_bar_bottom.render(stack, y = height - 2)
|
||||||
|
@ -21,24 +21,18 @@ class SlotPanel<T : MatterySlot>(
|
|||||||
width: Float = 18f,
|
width: Float = 18f,
|
||||||
height: Float = 18f
|
height: Float = 18f
|
||||||
) : AbstractSlotPanel(screen, parent, x, y, width, height) {
|
) : AbstractSlotPanel(screen, parent, x, y, width, height) {
|
||||||
override fun mouseClickedInner(mouse_x: Double, mouse_y: Double, mouse_click_type: Int): Boolean {
|
override fun mouseClickedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
screen.onSlotClicked(slot, mouse_click_type)
|
screen.returnSlot = slot
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseDraggedInner(
|
override fun mouseDraggedInner(x: Double, y: Double, button: Int, xDelta: Double, yDelta: Double): Boolean {
|
||||||
mouse_x: Double,
|
screen.returnSlot = slot
|
||||||
mouse_y: Double,
|
|
||||||
flag: Int,
|
|
||||||
drag_x: Double,
|
|
||||||
drag_y: Double
|
|
||||||
): Boolean {
|
|
||||||
screen.onSlotMouseDragged(slot, flag)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleasedInner(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {
|
override fun mouseReleasedInner(x: Double, y: Double, button: Int): Boolean {
|
||||||
screen.onMouseReleasedSlot(slot, mouse_x, mouse_y, flag, false)
|
screen.returnSlot = slot
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,8 +40,8 @@ class SlotPanel<T : MatterySlot>(
|
|||||||
return slot.item
|
return slot.item
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(@Nonnull stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(@Nonnull stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
renderSlotBackground(stack, mouse_x, mouse_y, flag)
|
renderSlotBackground(stack, mouseX, mouseY, partialTick)
|
||||||
|
|
||||||
var itemstack = slot.item
|
var itemstack = slot.item
|
||||||
val carried = screen.menu.carried
|
val carried = screen.menu.carried
|
||||||
|
@ -34,7 +34,7 @@ open class PowerGaugePanel @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
GAUGE_BACKGROUND.render(stack)
|
GAUGE_BACKGROUND.render(stack)
|
||||||
val height = this.height * widget.percentage()
|
val height = this.height * widget.percentage()
|
||||||
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height, winding = UVWindingOrder.U0_V1_U1_V0)
|
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height, winding = UVWindingOrder.U0_V1_U1_V0)
|
||||||
@ -73,7 +73,7 @@ open class MatterGaugePanel @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
GAUGE_BACKGROUND.render(stack)
|
GAUGE_BACKGROUND.render(stack)
|
||||||
val height = this.height * widget.percentage()
|
val height = this.height * widget.percentage()
|
||||||
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height, winding = UVWindingOrder.U0_V1_U1_V0)
|
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height, winding = UVWindingOrder.U0_V1_U1_V0)
|
||||||
@ -112,7 +112,7 @@ open class PatternGaugePanel @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
GAUGE_BACKGROUND.render(stack)
|
GAUGE_BACKGROUND.render(stack)
|
||||||
val height = this.height * widget.percentage()
|
val height = this.height * widget.percentage()
|
||||||
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height, winding = UVWindingOrder.U0_V1_U1_V0)
|
GAUGE_FOREGROUND.renderPartial(stack, y = this.height - height, height = height, winding = UVWindingOrder.U0_V1_U1_V0)
|
||||||
@ -169,7 +169,7 @@ open class ProgressGaugePanel @JvmOverloads constructor(
|
|||||||
return tooltip
|
return tooltip
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun innerRender(stack: PoseStack, mouse_x: Float, mouse_y: Float, flag: Float) {
|
override fun innerRender(stack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (widget.isStuck() && tick % 40 <= 20) {
|
if (widget.isStuck() && tick % 40 <= 20) {
|
||||||
RenderSystem.setShaderColor(0.75f, 0.4f, 0.4f, 1f)
|
RenderSystem.setShaderColor(0.75f, 0.4f, 0.4f, 1f)
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,35 @@ public-f net.minecraft.client.gui.screens.Screen f_96539_ # title
|
|||||||
public net.minecraft.server.MinecraftServer f_129744_ # storageSource
|
public net.minecraft.server.MinecraftServer f_129744_ # storageSource
|
||||||
|
|
||||||
# for accessing and setting from MatteryScreen class
|
# for accessing and setting from MatteryScreen class
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97724_ # lastQuickMoved
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_169600_
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97723_ # doubleclick
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_169605_
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97709_ # lastClickSlot
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_169602_
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97721_ # lastClickTime
|
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97722_ # lastClickButton
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97732_ # menu
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97719_ # skipNextRelease
|
public net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_169604_ # playerInventoryTitle
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97706_ # clickedSlot
|
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97710_ # isSplittingStack
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97706_ # clickedSlot
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97738_ # isQuickCrafting
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97707_ # snapbackEnd
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97718_ # quickCraftingButton
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97708_ # quickdropSlot
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97717_ # quickCraftingType
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97709_ # lastClickSlot
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97710_ # isSplittingStack
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97711_ # draggingItem
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97712_ # snapbackStartX
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97713_ # snapbackStartY
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97714_ # snapbackTime
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97715_ # snapbackItem
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97716_ # quickdropTime
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97717_ # quickCraftingType
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97718_ # quickCraftingButton
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97719_ # skipNextRelease
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97720_ # quickCraftingRemainder
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97721_ # lastClickTime
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97722_ # lastClickButton
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97723_ # doubleclick
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen f_97724_ # lastQuickMoved
|
||||||
|
|
||||||
# for overriding from MatteryScreen class
|
# for overriding from MatteryScreen class
|
||||||
# protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97744_ # findSlot (DD)Lnet/minecraft/world/inventory/Slot;
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97762_(I)V # checkHotbarMouseClicked
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97818_()V # recalculateQuickCraftRemaining
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97744_(DD)Lnet/minecraft/world/inventory/Slot; # findSlot
|
||||||
|
protected net.minecraft.client.gui.screens.inventory.AbstractContainerScreen m_97782_(Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V # renderFloatingItem
|
||||||
|
Loading…
Reference in New Issue
Block a user