From 914671c0dd72c314aa8882837d6db6297cbe3d64 Mon Sep 17 00:00:00 2001 From: BlueWeabo <76872108+BlueWeabo@users.noreply.github.com> Date: Mon, 23 Oct 2023 19:53:55 +0300 Subject: [PATCH] sketch gui - fix conflict --- src/main/java/gregtech/api/gui/GUIHost.java | 5 +- .../interfaces/IMultiBlockController.java | 4 - .../machine/MultiTileBasicMachine.java | 8 +- .../multiblock/base/Controller.java | 45 ++----- .../multiblock/base/MultiBlockPart.java | 8 +- .../ComplexParallelMachineGUIProvider.java | 2 +- .../common/gui/MachineGUIProvider.java | 125 ++++++++++++------ .../gregtech/common/gui/PartGUIProvider.java | 5 +- .../multiblock/AdvChemicalProcessor.java | 1 - 9 files changed, 114 insertions(+), 89 deletions(-) diff --git a/src/main/java/gregtech/api/gui/GUIHost.java b/src/main/java/gregtech/api/gui/GUIHost.java index 9d63151ebd6..bbb94317c47 100644 --- a/src/main/java/gregtech/api/gui/GUIHost.java +++ b/src/main/java/gregtech/api/gui/GUIHost.java @@ -4,13 +4,12 @@ import javax.annotation.Nonnull; -import com.gtnewhorizons.modularui.api.math.Size; +import net.minecraft.item.ItemStack; + import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import net.minecraft.item.ItemStack; - public interface GUIHost extends ITileWithModularUI { @Nonnull diff --git a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java index 4423b32d181..71052b0a586 100644 --- a/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java +++ b/src/main/java/gregtech/api/multitileentity/interfaces/IMultiBlockController.java @@ -8,12 +8,8 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraftforge.common.util.ForgeDirection; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - import gregtech.api.enums.InventoryType; import gregtech.api.gui.GUIHost; -import gregtech.api.gui.GUIProvider; import gregtech.api.logic.FluidInventoryLogic; import gregtech.api.logic.ItemInventoryLogic; import gregtech.api.logic.interfaces.FluidInventoryLogicHost; diff --git a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java index 4dc3e8fef9e..6442d296628 100644 --- a/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java +++ b/src/main/java/gregtech/api/multitileentity/machine/MultiTileBasicMachine.java @@ -53,8 +53,8 @@ import gregtech.client.GT_SoundLoop; import gregtech.common.gui.MachineGUIProvider; -public abstract class MultiTileBasicMachine
> - extends TickableMultiTileEntity implements IMultiTileMachine, ProcessingLogicHost
, PowerLogicHost, GUIHost { +public abstract class MultiTileBasicMachine
> extends TickableMultiTileEntity + implements IMultiTileMachine, ProcessingLogicHost
, PowerLogicHost, GUIHost {
protected static final int ACTIVE = B[0];
protected static final int TICKS_BETWEEN_RECIPE_CHECKS = 5 * TickTime.SECOND;
@@ -792,7 +792,8 @@ public GUIProvider> getGUI(@Nonnull UIBuildContext uiContext) {
@Override
public ItemStack getAsItem() {
- return MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID()).getItem(getMultiTileEntityID());
+ return MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID())
+ .getItem(getMultiTileEntityID());
}
@Override
@@ -800,5 +801,4 @@ public String getMachineName() {
return StatCollector.translateToLocal(getAsItem().getUnlocalizedName());
}
-
}
diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java
index cbec71b839b..42c4b9cbfe7 100644
--- a/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java
+++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/Controller.java
@@ -43,30 +43,20 @@
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.util.Vec3Impl;
-import com.gtnewhorizons.modularui.api.ModularUITextures;
-import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
-import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.screen.*;
-import com.gtnewhorizons.modularui.api.widget.IWidgetBuilder;
-import com.gtnewhorizons.modularui.api.widget.Widget;
-import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
-import com.gtnewhorizons.modularui.common.widget.MultiChildWidget;
-import com.gtnewhorizons.modularui.common.widget.TabButton;
-import com.gtnewhorizons.modularui.common.widget.TabContainer;
import cpw.mods.fml.common.network.NetworkRegistry;
import gregtech.api.enums.GT_Values.NBT;
import gregtech.api.enums.InventoryType;
import gregtech.api.enums.VoidingMode;
-import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.IDescribable;
import gregtech.api.interfaces.fluid.IFluidStore;
-import gregtech.api.interfaces.modularui.ControllerWithOptionalFeatures;
import gregtech.api.logic.ControllerFluidLogic;
import gregtech.api.logic.ControllerItemLogic;
import gregtech.api.logic.FluidInventoryLogic;
import gregtech.api.logic.ItemInventoryLogic;
import gregtech.api.logic.MuTEProcessingLogic;
+import gregtech.api.logic.PowerLogic;
import gregtech.api.multitileentity.enums.MultiTileCasingPurpose;
import gregtech.api.multitileentity.interfaces.IMultiBlockController;
import gregtech.api.multitileentity.interfaces.IMultiBlockPart;
@@ -77,10 +67,8 @@
import gregtech.api.net.GT_Packet_MultiTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.GT_Waila;
-import gregtech.common.tileentities.casings.upgrade.Inventory;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
@@ -88,8 +76,8 @@
* Multi Tile Entities - or MuTEs - don't have dedicated hatches, but their casings can become hatches.
*/
public abstract class Controller >
- extends MultiTileBasicMachine implements IAlignment, IMultiBlockController, IDescribable,
- IMTE_AddToolTips, ISurvivalConstructable {
+ extends MultiTileBasicMachine
+ implements IAlignment, IMultiBlockController, IDescribable, IMTE_AddToolTips, ISurvivalConstructable {
public static final String ALL_INVENTORIES_NAME = "all";
protected static final int AUTO_OUTPUT_FREQUENCY_TICK = 20;
@@ -867,6 +855,15 @@ public void changeItemInventoryDisplayName(@Nullable UUID id, @Nullable String d
// #endregion Item
+ // #region Energy
+
+ @Override
+ public PowerLogic getPowerLogic() {
+ return getPowerLogic(ForgeDirection.UNKNOWN);
+ }
+
+ // #endregion Energy
+
@Override
protected void updateSlots() {
controllerItemInput.getAllInventoryLogics()
@@ -887,24 +884,6 @@ public boolean useModularUI() {
return true;
}
- @Override
- public ModularWindow createWindow(UIBuildContext buildContext) {
- System.out.println("MultiBlockController::createWindow");
- if (!useModularUI()) return null;
-
- buildContext.setValidator(getValidator());
- final ModularWindow.Builder builder = ModularWindow.builder(getGUIWidth(), getGUIHeight());
- builder.setBackground(getGUITextureSet().getMainBackground());
- builder.setGuiTint(getGUIColorization());
- if (doesBindPlayerInventory()) {
- bindPlayerInventoryUI(builder, buildContext);
- }
- addUIWidgets(builder, buildContext);
- addTitleToUI(builder);
- addCoverTabs(builder, buildContext);
- return builder.build();
- }
-
@Override
public boolean hasGui(ForgeDirection side) {
return true;
diff --git a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java
index e352bf15ea0..d970f2b631c 100644
--- a/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java
+++ b/src/main/java/gregtech/api/multitileentity/multiblock/base/MultiBlockPart.java
@@ -27,7 +27,6 @@
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
-import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.ModularWindow.Builder;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.*;
@@ -699,14 +698,16 @@ public GUIProvider> getGUI(@Nonnull UIBuildContext uiContext) {
if (controller == null) return guiProvider;
if (!modeSelected(NOTHING, ENERGY_IN, ENERGY_OUT)) return guiProvider;
if (!canOpenControllerGui()) return guiProvider;
- if (uiContext.getPlayer().isSneaking()) return guiProvider;
+ if (uiContext.getPlayer()
+ .isSneaking()) return guiProvider;
GUIProvider> controllerGUI = controller.getGUI(uiContext);
return controllerGUI;
}
@Override
public ItemStack getAsItem() {
- return MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID()).getItem(getMultiTileEntityID());
+ return MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID())
+ .getItem(getMultiTileEntityID());
}
@Override
@@ -714,5 +715,4 @@ public String getMachineName() {
return StatCollector.translateToLocal(getAsItem().getUnlocalizedName());
}
-
}
diff --git a/src/main/java/gregtech/common/gui/ComplexParallelMachineGUIProvider.java b/src/main/java/gregtech/common/gui/ComplexParallelMachineGUIProvider.java
index f28b0c997c6..89b42c8500f 100644
--- a/src/main/java/gregtech/common/gui/ComplexParallelMachineGUIProvider.java
+++ b/src/main/java/gregtech/common/gui/ComplexParallelMachineGUIProvider.java
@@ -19,7 +19,7 @@ public class ComplexParallelMachineGUIProvider