Add LevelMaintainerTerminal rework logic inside TileLevelMaintainer (#162)

* Use new interface terminal API

* Update dependencies.gradle

* feat: Update core hooks and integrations

* api: Add `LevelTerminalRegistry` functionality

* feat: Use `customName` to display in `GuiFluidLevelEmitter`

* feat: Rework scheduling and data storage in `TileLevelMaintainer` functionality

* feat: Add new item `LevelTerminal`

* feat: Support back navigation functionality

* feat: add back navigation in `LevelMaintainer` from terminal

* use `IGuiTooltipHandler` directly from ae2

include #160

* fix correct `InterfaceTerminalSupportedClassProvider` deprecation

* Implement new version of `InterfaceWireless` based on `InterfaceTerminal`

* Fix `LevelTerminal` data recursion and few in fixes gui

* Use `aeRenderItem` directly and fix `zIndex` in custom slots

* Fix rendering numbers bigger than 2.1G through `aeRenderItem`

* Fix fails on `getCraftingItem`

no root cause was found

* Fix add packet logging and try to not fail after receive corrupted packet

* Fix add logging around empty configuration

* Fix packet corruption and log invalid data

* Fix packet corruption with level emitters

* Correct handle overwrite packet

* Fix intercept dnd click from GT5 hook for `AppEngGuiHandler`

keyword `net.bdew.neiaddons.appeng.AppEngGuiHandler`

* update be+deps

* Update dependencies.gradle

* Update dependencies.gradle

* Fix `zIndexes` for compatability with `DuraDisplay`

* Update AE2 and fix compatability

* Change `ForgeDirection` side serialization to `byte`

* Fix tooltip zIndexes

* Rename all rest parts related to `Level terminal`

* Code cleanup after review

* Remove duplicated dependency declaration

---------

Co-authored-by: Firenoo <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-10-27 14:10:07 +02:00
1 parent 1515ebe33f
commit f5912ef2e3
80 files changed
+6169 -1785

No files matched your search

@@ -5,6 +5,9 @@ import java.util.Set;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
public final class FluidCraftAPI implements IFluidCraftAPI {
private static final FluidCraftAPI API = new FluidCraftAPI();
@@ -42,4 +45,9 @@ public final class FluidCraftAPI implements IFluidCraftAPI {
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
return blacklistedDispFluids.contains(fluid);
}
@Override
public ILevelTerminalRegistry levelTerminalRegistry() {
return LevelTerminalRegistry.instance();
}
}
@@ -2,6 +2,8 @@ package com.glodblock.github.api;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
@SuppressWarnings("unused")
public interface IFluidCraftAPI {
@@ -24,4 +26,9 @@ public interface IFluidCraftAPI {
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
*/
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
/**
* Get instance of `ILevelTerminalRegistry` to add new supported machines into terminal
*/
ILevelTerminalRegistry levelTerminalRegistry();
}
@@ -0,0 +1,8 @@
package com.glodblock.github.api;
import net.minecraftforge.common.util.ForgeDirection;
public interface ISide {
ForgeDirection getSide();
}
@@ -0,0 +1,20 @@
package com.glodblock.github.api.registries;
import java.util.Set;
import appeng.api.networking.IGridHost;
public interface ILevelTerminalRegistry {
void register(Class<? extends ILevelViewable> clazz);
void register(Class<? extends IGridHost> aeClass, ILevelViewableAdapter adapter);
Set<Class<? extends ILevelViewable>> getSupportedClasses();
boolean isAdopted(Class<? extends ILevelViewable> clazz);
Class<? extends IGridHost> getAdopted(Class<? extends ILevelViewable> clazz);
ILevelViewableAdapter getAdapter(Class<? extends ILevelViewable> clazz);
}
@@ -0,0 +1,53 @@
package com.glodblock.github.api.registries;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import com.glodblock.github.api.ISide;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.networking.IGridHost;
import appeng.api.util.DimensionalCoord;
import appeng.helpers.ICustomNameObject;
public interface ILevelViewable extends IGridHost, ISide, ISegmentedInventory, ICustomNameObject {
DimensionalCoord getLocation();
TileEntity getTile();
default long getSortValue() {
TileEntity te = getTile();
return ((long) te.zCoord << 24) ^ ((long) te.xCoord << 8) ^ te.yCoord;
}
default boolean shouldDisplay() {
return true;
}
/**
* Number of rows to expect. This is used with {@link #rowSize()} to determine how to render the slots.
*/
default int rows() {
return 1;
};
/**
* Number of slots per row.
*/
default int rowSize() {
return 1;
};
default ItemStack getSelfItemStack() {
return null;
}
/**
* "Target" Display representation
*/
default ItemStack getDisplayItemStack() {
return null;
}
}
@@ -0,0 +1,8 @@
package com.glodblock.github.api.registries;
import appeng.api.networking.IGridHost;
public interface ILevelViewableAdapter extends ILevelViewable {
ILevelViewable adapt(IGridHost gridHost);
}