Skip to content

Commit

Permalink
sketch gui - fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueWeabo committed Dec 27, 2023
1 parent bfb06f3 commit 914671c
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 89 deletions.
5 changes: 2 additions & 3 deletions src/main/java/gregtech/api/gui/GUIHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
import gregtech.client.GT_SoundLoop;
import gregtech.common.gui.MachineGUIProvider;

public abstract class MultiTileBasicMachine<P extends MuTEProcessingLogic<P>>
extends TickableMultiTileEntity implements IMultiTileMachine, ProcessingLogicHost<P>, PowerLogicHost, GUIHost {
public abstract class MultiTileBasicMachine<P extends MuTEProcessingLogic<P>> extends TickableMultiTileEntity
implements IMultiTileMachine, ProcessingLogicHost<P>, PowerLogicHost, GUIHost {

protected static final int ACTIVE = B[0];
protected static final int TICKS_BETWEEN_RECIPE_CHECKS = 5 * TickTime.SECOND;
Expand Down Expand Up @@ -792,13 +792,13 @@ public GUIProvider<?> getGUI(@Nonnull UIBuildContext uiContext) {

@Override
public ItemStack getAsItem() {
return MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID()).getItem(getMultiTileEntityID());
return MultiTileEntityRegistry.getRegistry(getMultiTileEntityRegistryID())
.getItem(getMultiTileEntityID());
}

@Override
public String getMachineName() {
return StatCollector.translateToLocal(getAsItem().getUnlocalizedName());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -77,19 +67,17 @@
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;

/**
* Multi Tile Entities - or MuTEs - don't have dedicated hatches, but their casings can become hatches.
*/
public abstract class Controller<C extends Controller<C, P>, P extends MuTEProcessingLogic<P>>
extends MultiTileBasicMachine<P> implements IAlignment, IMultiBlockController, IDescribable,
IMTE_AddToolTips, ISurvivalConstructable {
extends MultiTileBasicMachine<P>
implements IAlignment, IMultiBlockController, IDescribable, IMTE_AddToolTips, ISurvivalConstructable {

public static final String ALL_INVENTORIES_NAME = "all";
protected static final int AUTO_OUTPUT_FREQUENCY_TICK = 20;
Expand Down Expand Up @@ -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()
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -699,20 +698,21 @@ 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
public String getMachineName() {
return StatCollector.translateToLocal(getAsItem().getUnlocalizedName());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ComplexParallelMachineGUIProvider<T extends GUIHost & ProcessingLog
public ComplexParallelMachineGUIProvider(@Nonnull T host) {
super(host);
}

@Override
protected void attachSynchHandlers(@Nonnull Builder builder, @Nonnull UIBuildContext uiContext) {

Expand Down
Loading

0 comments on commit 914671c

Please sign in to comment.