From 26ba61097bf99aa050e5ad20849c75e59d8703f8 Mon Sep 17 00:00:00 2001 From: SquidDev Date: Thu, 27 Dec 2018 11:58:08 +0000 Subject: [PATCH] Move several methods out of the proxy Some methods act the same on both sides, and so can be in utility classes. Others are only needed on one side, and so do not really need to be part of the proxy. - Remove TurtleVisionCamera. It would be possible to add this back in the future, but for now it is unused and so should be removed. - Move frame info (cursor blink, current render frame) into a FrameInfo class. - Move record methods (name, playing a record) into a RecordUtil class. --- .../dan200/computercraft/ComputerCraft.java | 32 +--- .../computercraft/client/FrameInfo.java | 50 +++++++ .../client/gui/FixedWidthFontRenderer.java | 25 +++- .../client/gui/widgets/WidgetTerminal.java | 6 +- .../proxy/ComputerCraftProxyClient.java | 139 +----------------- .../client/render/ItemPocketRenderer.java | 5 +- .../client/render/PrintoutRenderer.java | 4 +- .../render/TileEntityMonitorRenderer.java | 14 +- .../render/TileEntityTurtleRenderer.java | 19 +-- .../proxy/ComputerCraftProxyServer.java | 36 ----- .../shared/media/items/RecordMedia.java | 4 +- .../peripheral/diskdrive/TileDiskDrive.java | 7 +- .../proxy/ComputerCraftProxyCommon.java | 88 +---------- .../shared/proxy/IComputerCraftProxy.java | 16 -- .../turtle/entity/TurtleVisionCamera.java | 116 --------------- .../computercraft/shared/util/RecordUtil.java | 49 ++++++ 16 files changed, 147 insertions(+), 463 deletions(-) create mode 100644 src/main/java/dan200/computercraft/client/FrameInfo.java delete mode 100644 src/main/java/dan200/computercraft/shared/turtle/entity/TurtleVisionCamera.java create mode 100644 src/main/java/dan200/computercraft/shared/util/RecordUtil.java diff --git a/src/main/java/dan200/computercraft/ComputerCraft.java b/src/main/java/dan200/computercraft/ComputerCraft.java index 14e78c882..38322b399 100644 --- a/src/main/java/dan200/computercraft/ComputerCraft.java +++ b/src/main/java/dan200/computercraft/ComputerCraft.java @@ -23,6 +23,7 @@ import dan200.computercraft.api.pocket.IPocketUpgrade; import dan200.computercraft.api.redstone.IBundledRedstoneProvider; import dan200.computercraft.api.turtle.ITurtleUpgrade; import dan200.computercraft.api.turtle.event.TurtleAction; +import dan200.computercraft.client.FrameInfo; import dan200.computercraft.core.apis.AddressPredicate; import dan200.computercraft.core.filesystem.ComboMount; import dan200.computercraft.core.filesystem.FileMount; @@ -61,6 +62,7 @@ import dan200.computercraft.shared.turtle.upgrades.*; import dan200.computercraft.shared.util.CreativeTabMain; import dan200.computercraft.shared.util.IDAssigner; import dan200.computercraft.shared.util.InventoryUtil; +import dan200.computercraft.shared.util.RecordUtil; import dan200.computercraft.shared.wired.CapabilityWiredElement; import dan200.computercraft.shared.wired.WiredNode; import io.netty.buffer.Unpooled; @@ -498,36 +500,6 @@ public class ComputerCraft return "${version}"; } - public static boolean isClient() - { - return proxy.isClient(); - } - - public static boolean getGlobalCursorBlink() - { - return proxy.getGlobalCursorBlink(); - } - - public static long getRenderFrame() - { - return proxy.getRenderFrame(); - } - - public static Object getFixedWidthFontRenderer() - { - return proxy.getFixedWidthFontRenderer(); - } - - public static void playRecord( SoundEvent record, String recordInfo, World world, BlockPos pos ) - { - proxy.playRecord( record, recordInfo, world, pos ); - } - - public static String getRecordInfo( @Nonnull ItemStack recordStack ) - { - return proxy.getRecordInfo( recordStack ); - } - public static void openDiskDriveGUI( EntityPlayer player, TileDiskDrive drive ) { BlockPos pos = drive.getPos(); diff --git a/src/main/java/dan200/computercraft/client/FrameInfo.java b/src/main/java/dan200/computercraft/client/FrameInfo.java new file mode 100644 index 000000000..c28b26f33 --- /dev/null +++ b/src/main/java/dan200/computercraft/client/FrameInfo.java @@ -0,0 +1,50 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2018. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ + +package dan200.computercraft.client; + +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class FrameInfo +{ + private static FrameInfo instance; + + public static FrameInfo instance() + { + if( instance != null ) return instance; + return instance = new FrameInfo(); + } + + private int tick; + private long renderFrame; + + private FrameInfo() + { + } + + public boolean getGlobalCursorBlink() + { + return (tick / 8) % 2 == 0; + } + + public long getRenderFrame() + { + return renderFrame; + } + + @SubscribeEvent + public void onTick( TickEvent.ClientTickEvent event ) + { + if( event.phase == TickEvent.Phase.START ) tick++; + } + + @SubscribeEvent + public void onRenderTick( TickEvent.RenderTickEvent event ) + { + if( event.phase == TickEvent.Phase.START ) renderFrame++; + } +} diff --git a/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java b/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java index 28c33a3d1..83ef29c13 100644 --- a/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java +++ b/src/main/java/dan200/computercraft/client/gui/FixedWidthFontRenderer.java @@ -8,6 +8,7 @@ package dan200.computercraft.client.gui; import dan200.computercraft.core.terminal.TextBuffer; import dan200.computercraft.shared.util.Palette; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; @@ -20,17 +21,25 @@ import java.util.Arrays; public class FixedWidthFontRenderer { - private static ResourceLocation font = new ResourceLocation( "computercraft", "textures/gui/term_font.png" ); - public static ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/term_background.png" ); + private static final ResourceLocation FONT = new ResourceLocation( "computercraft", "textures/gui/term_font.png" ); + public static final ResourceLocation BACKGROUND = new ResourceLocation( "computercraft", "textures/gui/term_background.png" ); - public static int FONT_HEIGHT = 9; - public static int FONT_WIDTH = 6; + public static final int FONT_HEIGHT = 9; + public static final int FONT_WIDTH = 6; + + private static FixedWidthFontRenderer instance; + + public static FixedWidthFontRenderer instance() + { + if( instance != null ) return instance; + return instance = new FixedWidthFontRenderer(); + } private TextureManager m_textureManager; - public FixedWidthFontRenderer( TextureManager textureManager ) + private FixedWidthFontRenderer() { - m_textureManager = textureManager; + m_textureManager = Minecraft.getMinecraft().getTextureManager(); } private static void greyscaleify( double[] rgb ) @@ -157,7 +166,7 @@ public class FixedWidthFontRenderer if( backgroundColour != null ) { // Bind the background texture - m_textureManager.bindTexture( background ); + m_textureManager.bindTexture( BACKGROUND ); // Draw the quads drawStringBackgroundPart( x, y, backgroundColour, leftMarginSize, rightMarginSize, greyScale, p ); @@ -185,7 +194,7 @@ public class FixedWidthFontRenderer public void bindFont() { - m_textureManager.bindTexture( font ); + m_textureManager.bindTexture( FONT ); GlStateManager.glTexParameteri( GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP ); } } diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java b/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java index 15de0eede..364c5f7fb 100644 --- a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java +++ b/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java @@ -6,7 +6,7 @@ package dan200.computercraft.client.gui.widgets; -import dan200.computercraft.ComputerCraft; +import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.TextBuffer; @@ -387,8 +387,8 @@ public class WidgetTerminal extends Widget // Get the data from the terminal first // Unfortunately we have to keep the lock for the whole of drawing, so the text doesn't change under us. - FixedWidthFontRenderer fontRenderer = (FixedWidthFontRenderer) ComputerCraft.getFixedWidthFontRenderer(); - boolean tblink = m_focus && terminal.getCursorBlink() && ComputerCraft.getGlobalCursorBlink(); + FixedWidthFontRenderer fontRenderer = FixedWidthFontRenderer.instance(); + boolean tblink = m_focus && terminal.getCursorBlink() && FrameInfo.instance().getGlobalCursorBlink(); int tw = terminal.getWidth(); int th = terminal.getHeight(); int tx = terminal.getCursorX(); diff --git a/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java b/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java index 91cac5d9c..11d3dba95 100644 --- a/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java +++ b/src/main/java/dan200/computercraft/client/proxy/ComputerCraftProxyClient.java @@ -7,6 +7,7 @@ package dan200.computercraft.client.proxy; import dan200.computercraft.ComputerCraft; +import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.gui.*; import dan200.computercraft.client.render.*; import dan200.computercraft.shared.command.CommandCopy; @@ -28,7 +29,6 @@ import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer; import dan200.computercraft.shared.pocket.items.ItemPocketComputer; import dan200.computercraft.shared.proxy.ComputerCraftProxyCommon; import dan200.computercraft.shared.turtle.blocks.TileTurtle; -import dan200.computercraft.shared.turtle.entity.TurtleVisionCamera; import dan200.computercraft.shared.util.Colour; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import net.minecraft.block.Block; @@ -52,15 +52,11 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.RenderHandEvent; -import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -73,18 +69,12 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon { private static Int2IntOpenHashMap lastCounts = new Int2IntOpenHashMap(); - private long m_tick; - private long m_renderFrame; - private FixedWidthFontRenderer m_fixedWidthFontRenderer; - // IComputerCraftProxy implementation @Override public void preInit() { super.preInit(); - m_tick = 0; - m_renderFrame = 0; // Setup client forge handlers registerForgeHandlers(); @@ -126,7 +116,6 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon // Load textures Minecraft mc = Minecraft.getMinecraft(); - m_fixedWidthFontRenderer = new FixedWidthFontRenderer( mc.getTextureManager() ); // Setup mc.getItemColors().registerItemColorHandler( new DiskColorHandler( ComputerCraft.Items.disk ), ComputerCraft.Items.disk ); @@ -191,45 +180,6 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon } ); } - @Override - public boolean isClient() - { - return true; - } - - @Override - public boolean getGlobalCursorBlink() - { - return (m_tick / 8) % 2 == 0; - } - - @Override - public long getRenderFrame() - { - return m_renderFrame; - } - - @Override - public Object getFixedWidthFontRenderer() - { - return m_fixedWidthFontRenderer; - } - - @Override - public String getRecordInfo( @Nonnull ItemStack recordStack ) - { - List info = new ArrayList<>( 1 ); - recordStack.getItem().addInformation( recordStack, null, info, ITooltipFlag.TooltipFlags.NORMAL ); - if( info.size() > 0 ) - { - return info.get( 0 ); - } - else - { - return super.getRecordInfo( recordStack ); - } - } - @Override public Object getDiskDriveGUI( InventoryPlayer inventory, TileDiskDrive drive ) { @@ -402,98 +352,15 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon private void registerForgeHandlers() { - ForgeHandlers handlers = new ForgeHandlers(); - MinecraftForge.EVENT_BUS.register( handlers ); + MinecraftForge.EVENT_BUS.register( new ForgeHandlers() ); MinecraftForge.EVENT_BUS.register( new RenderOverlayCable() ); MinecraftForge.EVENT_BUS.register( new ItemPocketRenderer() ); MinecraftForge.EVENT_BUS.register( new ItemPrintoutRenderer() ); + MinecraftForge.EVENT_BUS.register( FrameInfo.instance() ); } public class ForgeHandlers { - public ForgeHandlers() - { - } - - @SubscribeEvent - public void onRenderHand( RenderHandEvent event ) - { - // Don't draw the player arm when in turtle vision - Minecraft mc = Minecraft.getMinecraft(); - if( mc.getRenderViewEntity() instanceof TurtleVisionCamera ) - { - event.setCanceled( true ); - } - } - - @SubscribeEvent - public void onRenderPlayer( RenderPlayerEvent.Pre event ) - { - Minecraft mc = Minecraft.getMinecraft(); - if( event.getEntityPlayer().isUser() && mc.getRenderViewEntity() instanceof TurtleVisionCamera ) - { - // HACK: Force the 'livingPlayer' variable to the player, this ensures the entity is drawn - //event.getRenderer().getRenderManager().livingPlayer = event.getEntityPlayer(); - } - } - - @SubscribeEvent - public void onRenderPlayer( RenderPlayerEvent.Post event ) - { - Minecraft mc = Minecraft.getMinecraft(); - if( event.getEntityPlayer().isUser() && mc.getRenderViewEntity() instanceof TurtleVisionCamera ) - { - // HACK: Restore the 'livingPlayer' variable to what it was before the RenderPlayerEvent.Pre hack - //event.getRenderer().getRenderManager().livingPlayer = mc.getRenderViewEntity(); - } - } - - @SubscribeEvent - public void onPreRenderGameOverlay( RenderGameOverlayEvent.Pre event ) - { - Minecraft mc = Minecraft.getMinecraft(); - if( mc.getRenderViewEntity() instanceof TurtleVisionCamera ) - { - switch( event.getType() ) - { - case HELMET: - case PORTAL: - //case CROSSHAIRS: - case BOSSHEALTH: - case ARMOR: - case HEALTH: - case FOOD: - case AIR: - case HOTBAR: - case EXPERIENCE: - case HEALTHMOUNT: - case JUMPBAR: - { - event.setCanceled( true ); - break; - } - } - } - } - - @SubscribeEvent - public void onTick( TickEvent.ClientTickEvent event ) - { - if( event.phase == TickEvent.Phase.START ) - { - m_tick++; - } - } - - @SubscribeEvent - public void onRenderTick( TickEvent.RenderTickEvent event ) - { - if( event.phase == TickEvent.Phase.START ) - { - m_renderFrame++; - } - } - @SubscribeEvent public void onWorldUnload( WorldEvent.Unload event ) { diff --git a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java b/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java index a596f0ea8..cfb31bb65 100644 --- a/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/ItemPocketRenderer.java @@ -2,6 +2,7 @@ package dan200.computercraft.client.render; import dan200.computercraft.ComputerCraft; +import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.TextBuffer; @@ -153,7 +154,7 @@ public class ItemPocketRenderer int startX = (max - width) / 2 + margin; int startY = (max - height) / 2 + margin; - FixedWidthFontRenderer fontRenderer = (FixedWidthFontRenderer) ComputerCraft.getFixedWidthFontRenderer(); + FixedWidthFontRenderer fontRenderer = FixedWidthFontRenderer.instance(); boolean greyscale = !computer.isColour(); Palette palette = terminal.getPalette(); @@ -171,7 +172,7 @@ public class ItemPocketRenderer // And render the cursor; int tx = terminal.getCursorX(), ty = terminal.getCursorY(); - if( terminal.getCursorBlink() && ComputerCraft.getGlobalCursorBlink() && + if( terminal.getCursorBlink() && FrameInfo.instance().getGlobalCursorBlink() && tx >= 0 && ty >= 0 && tx < tw && ty < th ) { TextBuffer cursorColour = new TextBuffer( "0123456789abcdef".charAt( terminal.getTextColour() ), 1 ); diff --git a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java b/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java index 11dc14f4f..2bab8a63e 100644 --- a/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/PrintoutRenderer.java @@ -55,7 +55,7 @@ public class PrintoutRenderer public static void drawText( int x, int y, int start, TextBuffer[] text, TextBuffer[] colours ) { - FixedWidthFontRenderer fontRenderer = (FixedWidthFontRenderer) ComputerCraft.getFixedWidthFontRenderer(); + FixedWidthFontRenderer fontRenderer = FixedWidthFontRenderer.instance(); for( int line = 0; line < LINES_PER_PAGE && line < text.length; ++line ) { @@ -69,7 +69,7 @@ public class PrintoutRenderer GlStateManager.enableBlend(); GlStateManager.enableTexture2D(); - FixedWidthFontRenderer fontRenderer = (FixedWidthFontRenderer) ComputerCraft.getFixedWidthFontRenderer(); + FixedWidthFontRenderer fontRenderer = FixedWidthFontRenderer.instance(); for( int line = 0; line < LINES_PER_PAGE && line < text.length; ++line ) { diff --git a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java index def409921..f87f9aeab 100644 --- a/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java +++ b/src/main/java/dan200/computercraft/client/render/TileEntityMonitorRenderer.java @@ -6,7 +6,7 @@ package dan200.computercraft.client.render; -import dan200.computercraft.ComputerCraft; +import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.gui.FixedWidthFontRenderer; import dan200.computercraft.core.terminal.Terminal; import dan200.computercraft.core.terminal.TextBuffer; @@ -53,7 +53,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer m_armor; - - public TurtleVisionCamera( World world, ITurtleAccess turtle ) - { - super( world ); - m_turtle = turtle; - m_armor = new ArrayList<>(); - applyPos(); - } - - public ITurtleAccess getTurtle() - { - return m_turtle; - } - - @Override - public float getEyeHeight() - { - return 0.0f; - } - - @Nonnull - @Override - public EnumHandSide getPrimaryHand() - { - return EnumHandSide.RIGHT; - } - - @Override - public void onUpdate() - { - m_turtle = ((TurtleBrain) m_turtle).getFutureSelf(); - applyPos(); - } - - private void applyPos() - { - Vec3d prevPos = m_turtle.getVisualPosition( 0.0f ); - this.lastTickPosX = this.prevPosX = prevPos.x; - this.lastTickPosY = this.prevPosY = prevPos.y; - this.lastTickPosZ = this.prevPosZ = prevPos.z; - this.prevRotationPitch = 0.0f; - this.prevRotationYaw = m_turtle.getVisualYaw( 0.0f ); - this.prevCameraPitch = 0.0f; - - Vec3d pos = m_turtle.getVisualPosition( 1.0f ); - this.posX = pos.x; - this.posY = pos.y; - this.posZ = pos.z; - this.rotationPitch = 0.0f; - this.rotationYaw = m_turtle.getVisualYaw( 1.0f ); - this.cameraPitch = 0.0f; - - float yawDifference = this.rotationYaw - this.prevRotationYaw; - if( yawDifference > 180.0f ) - { - this.prevRotationYaw += 360.0f; - } - else if( yawDifference < -180.0f ) - { - this.prevRotationYaw -= 360.0f; - } - } - - // EntityLivingBase overrides: - - @Nonnull - @Override - public ItemStack getHeldItem( EnumHand hand ) - { - return ItemStack.EMPTY; - } - - @Override - public void setItemStackToSlot( @Nonnull EntityEquipmentSlot slot, @Nonnull ItemStack stack ) - { - } - - @Nonnull - @Override - public ItemStack getItemStackFromSlot( @Nonnull EntityEquipmentSlot slot ) - { - return ItemStack.EMPTY; - } - - @Nonnull - @Override - public Iterable getArmorInventoryList() - { - return m_armor; - } -} diff --git a/src/main/java/dan200/computercraft/shared/util/RecordUtil.java b/src/main/java/dan200/computercraft/shared/util/RecordUtil.java new file mode 100644 index 000000000..5aadb6ee8 --- /dev/null +++ b/src/main/java/dan200/computercraft/shared/util/RecordUtil.java @@ -0,0 +1,49 @@ +/* + * This file is part of ComputerCraft - http://www.computercraft.info + * Copyright Daniel Ratcliffe, 2011-2018. Do not distribute without permission. + * Send enquiries to dratcliffe@gmail.com + */ + +package dan200.computercraft.shared.util; + +import dan200.computercraft.ComputerCraft; +import dan200.computercraft.shared.network.ComputerCraftPacket; +import net.minecraft.item.Item; +import net.minecraft.item.ItemRecord; +import net.minecraft.item.ItemStack; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.network.NetworkRegistry; + +import javax.annotation.Nonnull; + +public class RecordUtil +{ + public static void playRecord( SoundEvent record, String recordInfo, World world, BlockPos pos ) + { + ComputerCraftPacket packet = new ComputerCraftPacket(); + packet.m_packetType = ComputerCraftPacket.PlayRecord; + if( record != null ) + { + packet.m_dataInt = new int[] { pos.getX(), pos.getY(), pos.getZ(), SoundEvent.REGISTRY.getIDForObject( record ) }; + packet.m_dataString = new String[] { recordInfo }; + } + else + { + packet.m_dataInt = new int[] { pos.getX(), pos.getY(), pos.getZ() }; + } + + NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint( world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64 ); + ComputerCraft.sendToAllAround( packet, point ); + } + + public static String getRecordInfo( @Nonnull ItemStack recordStack ) + { + Item item = recordStack.getItem(); + if( !(item instanceof ItemRecord) ) return null; + + ItemRecord record = (ItemRecord) item; + return StringUtil.translateToLocal( record.displayName ); + } +}