From adf838e7ff067f64a6518cd659f55dd566306497 Mon Sep 17 00:00:00 2001 From: Harry Date: Mon, 28 Aug 2023 14:31:11 +0800 Subject: Crafting input hatches QoLs (#2200) * Fixes + Detect Inventory Slot Changes * support rename + check for updates * add back onChangeListener + fix npe * ICustomNameObject TileEntity * Fix NPEs * Use IInterfaceTerminalSupport * fix * register * dep * spotless * General Crafting Input Hatch QoL fixes (#2212) * feat: refactor naming && include circuit and catalyst in default name * feat: add 4 more slot to solve my ocd * fix: formatting * feat: migrate from 4x8 to 4x9 * spotlessApply (#2213) Co-authored-by: GitHub GTNH Actions <> * QoLs * 9 manual items * spotless * feat: open master GUI when used, without holding a data-stick (#2221) * fix destpos * optimize empty check * Fix error when fluidInventory.size() == 0 If the fluidInventory size is 0, there is no element to get. Add a check for it. * name in waila + fix int overflow * unnecssary super * update deps --------- Co-authored-by: Fox_white <39846845+foxwhite25@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Firenoo <49818773+firenoo@users.noreply.github.com> Co-authored-by: Martin Robertz --- .../api/metatileentity/BaseMetaTileEntity.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity') diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 882a94599e..1c403dcf7f 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -44,6 +44,7 @@ import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; import appeng.api.util.AECableType; import appeng.api.util.DimensionalCoord; +import appeng.helpers.ICustomNameObject; import appeng.me.helpers.AENetworkProxy; import appeng.me.helpers.IGridProxyable; import appeng.tile.TileEvent; @@ -87,7 +88,7 @@ import mcp.mobius.waila.api.IWailaDataAccessor; */ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable, IAlignmentProvider, IConstructableProvider, - IDebugableTileEntity, IGregtechWailaProvider, ICleanroomReceiver { + IDebugableTileEntity, IGregtechWailaProvider, ICleanroomReceiver, ICustomNameObject { private static final Field ENTITY_ITEM_HEALTH_FIELD = ReflectionHelper .findField(EntityItem.class, "health", "field_70291_e"); @@ -2446,4 +2447,20 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity public int[] getTimeStatistics() { return mTimeStatistics; } + + @Override + public String getCustomName() { + return getMetaTileEntity() instanceof ICustomNameObject customNameObject ? customNameObject.getCustomName() + : null; + } + + @Override + public boolean hasCustomName() { + return getMetaTileEntity() instanceof ICustomNameObject customNameObject && customNameObject.hasCustomName(); + } + + @Override + public void setCustomName(String name) { + if (getMetaTileEntity() instanceof ICustomNameObject customNameObject) customNameObject.setCustomName(name); + } } -- cgit