@@ -75,17 +75,23 @@ private static Optional<ResourceLocation> getResourcePackOverride(Object baseEnt
7575
7676 ResourceLocation id = AutoPopulateRegistry .getEntryId (baseEntry );
7777 if (id != null ) {
78+ String subDir = "" ;
79+ if (baseEntry instanceof GuideEntry ge && ge .displayId () != null && !ge .displayId ().equals (ge .id ())) {
80+ int colon = entryKey .indexOf (':' );
81+ if (colon > 0 ) subDir = entryKey .substring (0 , colon ) + "/" ;
82+ }
83+
7884 if (cacheKey instanceof String str && str .contains ("#" )) {
7985 String variantId = str .substring (str .indexOf ('#' ) + 1 ).replace (":" , "_" ).toLowerCase (Locale .ROOT );
80- ResourceLocation specificVariantLoc = new ResourceLocation (id .getNamespace (), "textures/fieldguide/entries/" + id .getPath () + "_" + variantId + (isPage ? "_page.png" : "_grid.png" ));
86+ ResourceLocation specificVariantLoc = new ResourceLocation (id .getNamespace (), "textures/fieldguide/entries/" + subDir + id .getPath () + "_" + variantId + (isPage ? "_page.png" : "_grid.png" ));
8187 if (Minecraft .getInstance ().getResourceManager ().getResource (specificVariantLoc ).isPresent ()) {
8288 OVERRIDE_CACHE .put (key , Optional .of (specificVariantLoc ));
8389 return Optional .of (specificVariantLoc );
8490 }
8591 }
8692
87- ResourceLocation specificLoc = new ResourceLocation (id .getNamespace (), "textures/fieldguide/entries/" + id .getPath () + (isPage ? "_page.png" : "_grid.png" ));
88- ResourceLocation defaultLoc = new ResourceLocation (id .getNamespace (), "textures/fieldguide/entries/" + id .getPath () + ".png" );
93+ ResourceLocation specificLoc = new ResourceLocation (id .getNamespace (), "textures/fieldguide/entries/" + subDir + id .getPath () + (isPage ? "_page.png" : "_grid.png" ));
94+ ResourceLocation defaultLoc = new ResourceLocation (id .getNamespace (), "textures/fieldguide/entries/" + subDir + id .getPath () + ".png" );
8995
9096 var resourceManager = Minecraft .getInstance ().getResourceManager ();
9197 if (resourceManager .getResource (specificLoc ).isPresent ()) {
@@ -391,6 +397,31 @@ public static void renderItem(GuiGraphics guiGraphics, Item item, int x, int y,
391397 });
392398 }
393399
400+ public static void renderItemStack (GuiGraphics guiGraphics , ItemStack stack , Object entry , int x , int y , float baseScale , boolean unlocked , boolean isPage , float bounceScale ) {
401+ int scaledSize = (int ) (baseScale * 2 );
402+
403+ renderWithCache (entry , entry , guiGraphics , x , y , scaledSize , scaledSize , unlocked , isPage , bounceScale , () -> {
404+ Lighting .setupForFlatItems ();
405+
406+ EntryVisual visual = ClientFieldGuideManager .getInstance ().getEntryVisual (stack .getItem ());
407+
408+ float clampedScale = 100f * getVisualScale (visual , isPage );
409+
410+ PoseStack pose = new PoseStack ();
411+ pose .scale (clampedScale , -clampedScale , 1.0f );
412+
413+ MultiBufferSource .BufferSource buffers = Minecraft .getInstance ().renderBuffers ().bufferSource ();
414+
415+ try {
416+ Minecraft .getInstance ().getItemRenderer ().renderStatic (stack , ItemDisplayContext .GUI , LightTexture .FULL_BRIGHT , OverlayTexture .NO_OVERLAY , pose , buffers , Minecraft .getInstance ().level , 0 );
417+ } catch (Exception e ) {
418+ Constants .LOG .error ("Failed to render item stack in Field Guide: {}" , BuiltInRegistries .ITEM .getKey (stack .getItem ()), e );
419+ } finally {
420+ buffers .endBatch ();
421+ }
422+ });
423+ }
424+
394425 public static void renderStructure (GuiGraphics guiGraphics , GuideEntry composite , int x , int y , int size , boolean unlocked , boolean isPage , float bounceScale ) {
395426 renderWithCache (composite , composite , guiGraphics , x , y , size , size , unlocked , isPage , bounceScale , () -> {
396427 setupFieldGuideBlockLighting ();
0 commit comments