Skip to content

Commit

Permalink
remove generics from recipeviewer UI adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Dec 9, 2024
1 parent 7c800a7 commit 7474028
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.gregtechceu.gtceu.integration.emi;

import com.gregtechceu.gtceu.api.ui.component.UIComponents;
import com.gregtechceu.gtceu.api.ui.container.RootContainer;
import com.gregtechceu.gtceu.api.ui.container.UIContainers;
import com.gregtechceu.gtceu.api.ui.core.ParentUIComponent;
import com.gregtechceu.gtceu.api.ui.core.Sizing;
import com.gregtechceu.gtceu.api.ui.core.UIAdapter;
Expand All @@ -26,11 +29,11 @@
import java.util.function.Consumer;
import java.util.function.Function;

public class EMIUIAdapter<T extends ParentUIComponent> extends Widget implements ContainerEventHandler {
public class EMIUIAdapter extends Widget implements ContainerEventHandler {

public static final ScreenPosition LAYOUT = new ScreenPosition(-69, -69);

public final UIAdapter<T> adapter;
public final UIAdapter<RootContainer> adapter;

@Getter
private final Bounds bounds;
Expand All @@ -41,9 +44,9 @@ public class EMIUIAdapter<T extends ParentUIComponent> extends Widget implements
@Setter
private GuiEventListener focused;

public EMIUIAdapter(Bounds bounds, BiFunction<Sizing, Sizing, T> rootComponentMaker) {
public EMIUIAdapter(Bounds bounds) {
this.adapter = UIAdapter.createWithoutScreen(bounds.x(), bounds.y(), bounds.width(), bounds.height(),
rootComponentMaker);
UIContainers::root);
this.adapter.inspectorZOffset = 900;
this.bounds = bounds;

Expand All @@ -56,7 +59,7 @@ public void prepare() {
this.adapter.inflateAndMount();
}

public T rootComponent() {
public RootContainer rootComponent() {
return this.adapter.rootComponent;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.gregtechceu.gtceu.integration.jei;

import com.gregtechceu.gtceu.api.ui.core.ParentUIComponent;
import com.gregtechceu.gtceu.api.ui.core.Sizing;
import com.gregtechceu.gtceu.api.ui.container.RootContainer;
import com.gregtechceu.gtceu.api.ui.container.UIContainers;
import com.gregtechceu.gtceu.api.ui.core.UIAdapter;
import com.gregtechceu.gtceu.api.ui.util.ScissorStack;
import com.gregtechceu.gtceu.integration.xei.widgets.XEIWidgetComponent;
Expand All @@ -19,24 +19,23 @@
import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds;
import mezz.jei.api.gui.widgets.IRecipeWidget;

import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;

public class JEIUIAdapter<T extends ParentUIComponent> implements IRecipeWidget, GuiEventListener {
public class JEIUIAdapter implements IRecipeWidget, GuiEventListener {

public static final ScreenPosition LAYOUT = new ScreenPosition(-69, -69);

public final UIAdapter<T> adapter;
public final UIAdapter<RootContainer> adapter;

@Getter
private final ScreenPosition position;
@Getter
private final ScreenRectangle area;

public JEIUIAdapter(Rect2i bounds, BiFunction<Sizing, Sizing, T> rootComponentMaker) {
public JEIUIAdapter(Rect2i bounds) {
this.adapter = UIAdapter.createWithoutScreen(bounds.getX(), bounds.getY(), bounds.getWidth(),
bounds.getHeight(), rootComponentMaker);
bounds.getHeight(), UIContainers::root);
this.adapter.inspectorZOffset = 900;
this.position = new ScreenPosition(bounds.getX(), bounds.getY());
this.area = new ScreenRectangle(position, bounds.getWidth(), bounds.getHeight());
Expand All @@ -50,7 +49,7 @@ public void prepare() {
this.adapter.inflateAndMount();
}

public T rootComponent() {
public RootContainer rootComponent() {
return this.adapter.rootComponent;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gregtechceu.gtceu.integration.rei;

import com.gregtechceu.gtceu.api.ui.container.RootContainer;
import com.gregtechceu.gtceu.api.ui.container.UIContainers;
import com.gregtechceu.gtceu.api.ui.core.ParentUIComponent;
import com.gregtechceu.gtceu.api.ui.core.Sizing;
import com.gregtechceu.gtceu.api.ui.core.UIAdapter;
Expand All @@ -22,15 +24,15 @@
import java.util.function.Consumer;
import java.util.function.Function;

public class REIUIAdapter<T extends ParentUIComponent> extends Widget {
public class REIUIAdapter extends Widget {

public static final Point LAYOUT = new Point(-69, -69);

public final UIAdapter<T> adapter;
public final UIAdapter<RootContainer> adapter;

public REIUIAdapter(Rectangle bounds, BiFunction<Sizing, Sizing, T> rootComponentMaker) {
public REIUIAdapter(Rectangle bounds) {
this.adapter = UIAdapter.createWithoutScreen(bounds.x, bounds.y, bounds.width, bounds.height,
rootComponentMaker);
UIContainers::root);
this.adapter.inspectorZOffset = 900;

if (Minecraft.getInstance().screen != null) {
Expand All @@ -42,7 +44,7 @@ public void prepare() {
this.adapter.inflateAndMount();
}

public T rootComponent() {
public RootContainer rootComponent() {
return this.adapter.rootComponent;
}

Expand Down

0 comments on commit 7474028

Please sign in to comment.