4141import net .minecraft .world .inventory .AbstractContainerMenu ;
4242import net .minecraft .world .inventory .Slot ;
4343import net .minecraft .world .item .ItemStack ;
44- import net .minecraft .world .item .Items ;
4544
4645public class VisitorHelper extends AbstractWidget {
4746 private static final Set <Visitor > activeVisitors = new HashSet <>();
@@ -56,7 +55,6 @@ public class VisitorHelper extends AbstractWidget {
5655 private static final int ICON_SIZE = 16 ;
5756 private static final int LINE_HEIGHT = 3 ;
5857 private static final int PADDING = 4 ;
59- private static final ItemStack BARRIER = new ItemStack (Items .BARRIER );
6058 private static final Object2LongMap <Component > copiedTimestamps = new Object2LongOpenHashMap <>();
6159
6260 // Used to prevent adding the visitor again after the player clicks accept or refuse.
@@ -154,14 +152,14 @@ private static void updateItems() {
154152 private static ItemStack getCachedItem (String itemName ) {
155153 String cleanName = ChatFormatting .stripFormatting (itemName );
156154 return cachedItems .computeIfAbsent (cleanName , name -> {
157- if (NEURepoManager .isLoading () || !ItemRepository .filesImported ()) return null ;
155+ if (NEURepoManager .isLoading () || !ItemRepository .filesImported ()) return ItemUtils . getNamedPlaceholder ( itemName ) ;
158156
159157 return NEURepoManager .getItemByName (itemName )
160158 .stream ()
161159 .findFirst ()
162160 .map (NEUItem ::getSkyblockItemId )
163161 .map (ItemRepository ::getItemStack )
164- .orElse ( BARRIER );
162+ .orElseGet (() -> ItemUtils . getNamedPlaceholder ( itemName ) );
165163 });
166164 }
167165
@@ -204,15 +202,13 @@ public void renderWidget(GuiGraphics context, int mouseX, int mouseY, float delt
204202 int yPosition = y + index * (LINE_HEIGHT + textRenderer .lineHeight );
205203
206204 ItemStack cachedStack = getCachedItem (itemName .getString ());
207- if (cachedStack != null ) {
208- context .pose ().pushMatrix ();
209- context .pose ().translate (iconX , yPosition + (float ) textRenderer .lineHeight / 2 - ICON_SIZE * 0.95f / 2 );
210- context .pose ().scale (0.95f , 0.95f );
211- context .renderItem (cachedStack , 0 , 0 );
212- context .pose ().popMatrix ();
213- }
205+ context .pose ().pushMatrix ();
206+ context .pose ().translate (iconX , yPosition + (float ) textRenderer .lineHeight / 2 - ICON_SIZE * 0.95f / 2 );
207+ context .pose ().scale (0.95f , 0.95f );
208+ context .renderItem (cachedStack , 0 , 0 );
209+ context .pose ().popMatrix ();
214210
215- MutableComponent name = cachedStack != null ? cachedStack .getHoverName (). copy () : itemName .copy ();
211+ MutableComponent name = cachedStack .getHoverName ().copy ();
216212 MutableComponent itemText = SkyblockerConfigManager .get ().farming .visitorHelper .showStacksInVisitorHelper && totalAmount >= 64
217213 ? name .append (" x" + (totalAmount / 64 ) + " stacks + " + (totalAmount % 64 ))
218214 : name .append (" x" + totalAmount );
0 commit comments