Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ dependencies {
jarJar(modApi(forge.configuration.get()))

// Math Parser
jarJar(implementation(libs.mxparser.get()))
additionalRuntimeClasspath(libs.mxparser.get())
jarJar(implementation(libs.evalEx.get()))
additionalRuntimeClasspath(libs.evalEx.get())

// Mixin (& Extras)
annotationProcessor(variantOf(libs.mixin) { classifier("processor") })
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ lombok = "8.14"
jetbrains-annotations = "26.0.1"
renderNurse = "0.0.12"
mixin = "0.8.7"
mxparser = "6.1.0"
evalEx = "3.6.0"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
minecraftForge = { module = "net.minecraftforge:forge", version.ref = "minecraftForge" }
jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" }
renderNurse = { module = "net.neoforged:render-nurse", version.ref = "renderNurse" }
mixin = { module = "org.spongepowered:mixin", version.ref = "mixin" }
mxparser = { module = "org.mariuszgromada.math:MathParser.org-mXparser", version.ref = "mxparser" }
evalEx = { module = "com.ezylang:EvalEx", version.ref = "evalEx" }

[plugins]
modDevGradle = { id = "net.neoforged.moddev.legacyforge", version.ref = "modDevGradle" }
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/gregtechceu/gtceu/GTCEu.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import me.shedaniel.rei.api.client.REIRuntime;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.mariuszgromada.math.mxparser.License;

import java.nio.file.Path;

Expand All @@ -33,10 +32,6 @@ public class GTCEu {
public static final String NAME = "GregTechCEu";
public static final Logger LOGGER = LogManager.getLogger(NAME);

static {
License.iConfirmNonCommercialUse("GTCEu");
}

public static final Path GTCEU_FOLDER = getGameDir().resolve("gtceu");

public GTCEu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI;
import com.gregtechceu.gtceu.client.TooltipsHandler;
import com.gregtechceu.gtceu.common.valueprovider.*;
import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidEntryList;
import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidStackList;
import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidTagList;
import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidEntryHandler;
import com.gregtechceu.gtceu.integration.xei.widgets.GTRecipeWidget;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidEntryList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidStackList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidTagList;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.fluid.CycleFluidEntryHandler;
import com.gregtechceu.gtceu.integration.recipeviewer.widgets.GTRecipeWidget;
import com.gregtechceu.gtceu.utils.GTMath;

import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import com.gregtechceu.gtceu.core.mixins.IngredientAccessor;
import com.gregtechceu.gtceu.core.mixins.TagValueAccessor;
import com.gregtechceu.gtceu.core.mixins.forge.IntersectionIngredientAccessor;
import com.gregtechceu.gtceu.integration.xei.entry.item.ItemEntryList;
import com.gregtechceu.gtceu.integration.xei.entry.item.ItemStackList;
import com.gregtechceu.gtceu.integration.xei.entry.item.ItemTagList;
import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler;
import com.gregtechceu.gtceu.integration.xei.widgets.GTRecipeWidget;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.item.ItemEntryList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.item.ItemStackList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.item.ItemTagList;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.item.CycleItemEntryHandler;
import com.gregtechceu.gtceu.integration.recipeviewer.widgets.GTRecipeWidget;
import com.gregtechceu.gtceu.utils.*;

import com.lowdragmc.lowdraglib.gui.widget.Widget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.data.recipe.CustomTags;
import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo;
import com.gregtechceu.gtceu.integration.xei.widgets.GTOreByProduct;
import com.gregtechceu.gtceu.integration.recipeviewer.widgets.GTOreByProduct;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.gregtechceu.gtceu.utils.memoization.GTMemoizer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate;
import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.item.CycleItemEntryHandler;

import com.lowdragmc.lowdraglib.client.scene.WorldSceneRenderer;
import com.lowdragmc.lowdraglib.client.utils.RenderUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.gregtechceu.gtceu.api.gui.widget;

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.integration.xei.entry.item.ItemEntryList;
import com.gregtechceu.gtceu.integration.xei.entry.item.ItemStackList;
import com.gregtechceu.gtceu.integration.xei.entry.item.ItemTagList;
import com.gregtechceu.gtceu.integration.xei.handlers.item.CycleItemEntryHandler;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.item.ItemEntryList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.item.ItemStackList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.item.ItemTagList;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.item.CycleItemEntryHandler;

import com.lowdragmc.lowdraglib.gui.editor.annotation.LDLRegister;
import com.lowdragmc.lowdraglib.gui.editor.configurator.ConfiguratorGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank;
import com.gregtechceu.gtceu.api.transfer.fluid.IFluidHandlerModifiable;
import com.gregtechceu.gtceu.client.TooltipsHandler;
import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidEntryList;
import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidStackList;
import com.gregtechceu.gtceu.integration.xei.entry.fluid.FluidTagList;
import com.gregtechceu.gtceu.integration.xei.handlers.fluid.CycleFluidEntryHandler;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidEntryList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidStackList;
import com.gregtechceu.gtceu.integration.recipeviewer.entry.fluid.FluidTagList;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.fluid.CycleFluidEntryHandler;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.gregtechceu.gtceu.utils.GTUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.gregtechceu.gtceu.api.mui.base.drawable.IKey;
import com.gregtechceu.gtceu.api.mui.drawable.UITexture;
import com.gregtechceu.gtceu.api.mui.factory.PosGuiData;
import com.gregtechceu.gtceu.api.mui.value.sync.DoubleSyncValue;
import com.gregtechceu.gtceu.api.mui.value.sync.FluidSlotSyncHandler;
import com.gregtechceu.gtceu.api.mui.value.sync.PanelSyncManager;
import com.gregtechceu.gtceu.api.mui.widgets.ProgressWidget;
Expand Down Expand Up @@ -327,6 +328,9 @@ public ModularPanel buildUI(PosGuiData data, PanelSyncManager syncManager, UISet
UITexture progressTexture = isHighPressure() ? GTGuiTextures.PROGRESS_BAR_BOILER_EMPTY_STEEL :
GTGuiTextures.PROGRESS_BAR_BOILER_EMPTY_BRONZE;

DoubleSyncValue tempPercentage = syncManager.getOrCreateSyncHandler("tempPercentage", DoubleSyncValue.class,
() -> new DoubleSyncValue(this::getTemperaturePercent));

panel.child(new Row()
.top(12)
.left(50)
Expand All @@ -347,7 +351,7 @@ public ModularPanel buildUI(PosGuiData data, PanelSyncManager syncManager, UISet
.texture(progressTexture,
GTGuiTextures.PROGRESS_BAR_BOILER_HEAT, 54)
.size(14, 54)
.progress(this::getTemperaturePercent)
.value(tempPercentage)
.direction(ProgressWidget.Direction.UP)
.tooltipAutoUpdate(true)
.tooltipBuilder((r) -> r.addLine(IKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* With the difference, that the method from this interface also works on server
* side.
* </p>
* Synced panels must be created with {@link PanelSyncManager#panel(String, PanelSyncHandler.IPanelBuilder, boolean)}.
* Synced panels must be created with
* {@link PanelSyncManager#syncedPanel(String, boolean, PanelSyncHandler.IPanelBuilder)}.
* If the panel does not contain any synced widgets, a simple panel handler using
* {@link #simple(ModularPanel, SecondaryPanel.IPanelBuilder, boolean)}
* is likely what you need.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public interface IUIHolder<T extends GuiData> {
@OnlyIn(Dist.CLIENT)
default ModularScreen createScreen(T data, ModularPanel mainPanel) {
GTCEu.LOGGER
.warn("IGuiHolder.createScreen() should be overridden to pass your own mod id to the ModularScreen. " +
"In future versions this method must be overridden or else it will crash!");
.warn("IGuiHolder.createScreen() should be overridden to pass your own mod id to the ModularScreen." +
" In future versions this method must be overridden or else it will crash!");
return new ModularScreen(GTCEu.MOD_ID, mainPanel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.gregtechceu.gtceu.api.mui.base.widget.IWidget;
import com.gregtechceu.gtceu.api.mui.utils.Rectangle;
import com.gregtechceu.gtceu.client.mui.screen.ModularScreen;
import com.gregtechceu.gtceu.integration.xei.handlers.GhostIngredientSlot;
import com.gregtechceu.gtceu.integration.recipeviewer.handlers.GhostIngredientSlot;

import org.jetbrains.annotations.ApiStatus;

Expand All @@ -13,33 +13,33 @@
* This class can be safely interacted with even when JEI/HEI is not installed.
*/
@ApiStatus.NonExtendable
public interface XeiSettings {
public interface RecipeViewerSettings {

/**
* Force XEI to be enabled
* Force recipe viewer to be enabled
*/
void forceEnabled();
void enable();

/**
* Force XEI to be disabled
* Force recipe viewer to be disabled
*/
void forceDisabled();
void disable();

/**
* Only enabled XEI in synced GUIs
* Only enable the recipe viewer in synced GUIs
*/
void defaultXei();
void defaultState();

/**
* Checks if XEI is enabled for a given screen
* Checks if the recipe viewer is enabled for a given screen
*
* @param screen modular screen
* @return true if xei is enabled
* @return true if the recipe viewer is enabled
*/
boolean isEnabled(ModularScreen screen);

/**
* Adds an exclusion zone. XEI will always try to avoid exclusion zones. <br>
* Adds an exclusion zone. Recipe viewers will always try to avoid exclusion zones. <br>
* <b>If a widgets wishes to have an exclusion zone it should use {@link #addExclusionArea(IWidget)}!</b>
*
* @param area exclusion area
Expand All @@ -54,7 +54,7 @@ public interface XeiSettings {
void removeExclusionArea(Rectangle area);

/**
* Adds an exclusion zone of a widget. XEI will always try to avoid exclusion zones. <br>
* Adds an exclusion zone of a widget. Recipe viewers will always try to avoid exclusion zones. <br>
* Useful when a widget is outside its panel.
*
* @param area widget
Expand All @@ -69,32 +69,32 @@ public interface XeiSettings {
void removeExclusionArea(IWidget area);

/**
* Adds a XEI ghost slot. Ghost slots can display an ingredient, but the ingredient does not really exist.
* By calling this method users will be able to drag ingredients from JEI into the slot.
* Adds a recipe viewer ghost slot. Ghost slots can display an ingredient, but the ingredient does not really exist.
* By calling this method users will be able to drag ingredients from recipe viewers into the slot.
*
* @param slot slot widget
* @param <W> slot widget type
*/
<W extends IWidget & GhostIngredientSlot<?>> void addGhostIngredientSlot(W slot);

/**
* Removes a XEI ghost slot.
* Removes a recipe viewer ghost slot.
*
* @param slot slot widget
* @param <W> slot widget type
*/
<W extends IWidget & GhostIngredientSlot<?>> void removeGhostIngredientSlot(W slot);

XeiSettings DUMMY = new XeiSettings() {
RecipeViewerSettings DUMMY = new RecipeViewerSettings() {

@Override
public void forceEnabled() {}
public void enable() {}

@Override
public void forceDisabled() {}
public void disable() {}

@Override
public void defaultXei() {}
public void defaultState() {}

@Override
public boolean isEnabled(ModularScreen screen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* A gui element which can transform its children f.e. a scrollable list.
*/
public interface IViewport {
public interface IViewport extends IWidget {

/**
* Apply shifts of this viewport.
Expand All @@ -26,7 +26,11 @@ default void transformChildren(IViewportStack stack) {}
* @param x x position
* @param y y position
*/
void getWidgetsAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y);
default void getWidgetsAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y) {
if (hasChildren()) {
getChildrenAt(this, stack, widgets, x, y);
}
}

/**
* Gathers all children at a position. Transformations from this viewport are not applied.
Expand All @@ -37,7 +41,11 @@ default void transformChildren(IViewportStack stack) {}
* @param x x position
* @param y y position
*/
default void getSelfAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y) {}
default void getSelfAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y) {
if (isInside(stack, x, y)) {
widgets.add(this, stack, getAdditionalHoverInfo(stack, x, y));
}
}

/**
* Called during drawing twice (before children are drawn). Once with transformation of this viewport and once
Expand Down Expand Up @@ -73,7 +81,7 @@ static void getChildrenAt(IWidget parent, IViewportStack stack, HoveredWidgetLis
stack.pushMatrix();
child.transform(stack);
if (child.isInside(stack, x, y)) {
widgetList.add(child, stack.peek(), child.getAdditionalHoverInfo(stack, x, y));
widgetList.add(child, stack, child.getAdditionalHoverInfo(stack, x, y));
}
if (child.hasChildren()) {
getChildrenAt(child, stack, widgetList, x, y);
Expand Down Expand Up @@ -119,6 +127,4 @@ static boolean forEachChild(IViewportStack stack, IWidget parent, Predicate<IWid
}
return true;
}

IViewport EMPTY = (viewports, widgets, x, y) -> {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.gregtechceu.gtceu.client.mui.screen.viewport.TransformationMatrix;

import com.mojang.blaze3d.vertex.PoseStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.joml.Vector3f;
Expand All @@ -12,6 +13,7 @@
* This handles all viewports in a GUI. Also keeps track of a matrix stack used for rendering and
* user interaction.
*/
@ApiStatus.NonExtendable
public interface IViewportStack {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gregtechceu.gtceu.api.mui.base.widget;

import com.gregtechceu.gtceu.api.mui.base.layout.IViewport;
import com.gregtechceu.gtceu.api.mui.base.layout.IViewportStack;
import com.gregtechceu.gtceu.api.mui.utils.HoveredWidgetList;
import com.gregtechceu.gtceu.api.mui.widget.DraggableWidget;
import com.gregtechceu.gtceu.api.mui.widget.WidgetTree;
import com.gregtechceu.gtceu.api.mui.widget.sizer.Area;
Expand All @@ -18,12 +16,13 @@
*
* @see DraggableWidget
*/
public interface IDraggable extends IViewport {
public interface IDraggable {

/**
* Gets called every frame after everything else is rendered.
* Is only called when {@link #isMoving()} is true.
* Translate to the mouse pos and draw with {@link WidgetTree#drawTree(IWidget, ModularGuiContext)}.
* Translate to the mouse pos and draw with
* {@link WidgetTree#drawTree(IWidget, ModularGuiContext, boolean, boolean)}.
*
* @param graphics
* @param partialTicks difference from last from
Expand Down Expand Up @@ -66,7 +65,4 @@ default boolean canDropHere(int x, int y, @Nullable IWidget widget) {
void setMoving(boolean moving);

void transform(IViewportStack viewportStack);

@Override
default void getWidgetsAt(IViewportStack stack, HoveredWidgetList widgets, int x, int y) {}
}
Loading