Skip to content

Commit a2933e5

Browse files
committed
1.8.0
1 parent 16d38ac commit a2933e5

20 files changed

Lines changed: 285 additions & 38 deletions

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ body:
4242
label: Mod Version
4343
description: The version of the mod you were using
4444
options:
45+
- "1.8.0"
4546
- "1.7.5"
4647
- "1.7.3"
4748
- "1.7.2"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,7 @@ runs/
122122
!gradle-wrapper.jar
123123

124124
primers
125-
26.1-src
125+
26.1-src
126+
Mixed-Litter
127+
No-Mans-Land
128+
Gallery

CHANGELOG-LATEST.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
### Fixed
22

3-
- Simplified scan verification to fix issues with servers rejecting scans.
3+
- Fixed `alignment_icon` configuration not working.
4+
- Added an `autopopulate` strategy for paintings.
5+
- Added Panda variants.
6+
- Fixed Fox and Parrot variants in 1.20.
7+
- Backport various fixes from 1.21.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.8.0] - 2026-06-06
9+
10+
### Fixed
11+
12+
- Fixed `alignment_icon` configuration not working.
13+
- Added an `autopopulate` strategy for paintings.
14+
- Added Panda variants.
15+
- Fixed Fox and Parrot variants in 1.20.
16+
- Backport various fixes from 1.21.
17+
818
## [1.7.5] - 2026-05-05
919

1020
### Fixed

common/src/main/java/com/evandev/fieldguide/api/AutoPopulateRegistry.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ public class AutoPopulateRegistry {
116116
}
117117
return Collections.emptyList();
118118
});
119+
120+
register("paintings", (params, categoryId) -> getPaintingEntries(id -> true));
121+
register("mod_paintings", (modId, categoryId) -> getPaintingEntries(id -> id.getNamespace().equals(modId)));
119122
}
120123

121124
private static List<Object> getEntityStrategy(String strategy, ResourceLocation categoryId) {
@@ -183,6 +186,27 @@ public static String getEntryKey(Object obj) {
183186
return id != null ? id.toString() : "";
184187
}
185188

189+
public static List<Object> getPaintingEntries(Predicate<ResourceLocation> namespaceFilter) {
190+
ResourceLocation paintingEntityId = new ResourceLocation("minecraft", "painting");
191+
return BuiltInRegistries.PAINTING_VARIANT.stream()
192+
.filter(v -> namespaceFilter.test(BuiltInRegistries.PAINTING_VARIANT.getKey(v)))
193+
.sorted(Comparator.comparing(v -> BuiltInRegistries.PAINTING_VARIANT.getKey(v).toString()))
194+
.map(v -> (Object) new GuideEntry(
195+
BuiltInRegistries.PAINTING_VARIANT.getKey(v),
196+
paintingEntityId,
197+
null,
198+
EntryKind.NORMAL,
199+
false,
200+
false,
201+
null,
202+
null,
203+
null,
204+
null,
205+
EntryUnlockData.DEFAULT
206+
))
207+
.toList();
208+
}
209+
186210
public static List<Object> getAutoTrees(Predicate<ResourceLocation> namespaceFilter, ResourceLocation categoryId) {
187211
List<Object> results = new ArrayList<>();
188212

common/src/main/java/com/evandev/fieldguide/client/attribute/DefaultAttributeProvider.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.evandev.fieldguide.Constants;
44
import com.evandev.fieldguide.api.attribute.AttributeProvider;
55
import com.evandev.fieldguide.api.attribute.GuideAttribute;
6+
import com.evandev.fieldguide.client.ClientFieldGuideManager;
7+
import com.evandev.fieldguide.client.data.EntryVisual;
68
import net.minecraft.network.chat.Component;
79
import net.minecraft.resources.ResourceLocation;
810
import net.minecraft.world.entity.Entity;
@@ -34,6 +36,19 @@ public List<GuideAttribute> getAttributes(Object entry, @Nullable Entity rendere
3436
icon = Constants.PASSIVE_ICON;
3537
typeComponent = Component.translatable("fieldguide.alignment.passive");
3638
}
39+
40+
EntryVisual visual = ClientFieldGuideManager.getInstance().getEntryVisual(entry);
41+
if (visual != null && visual.alignmentIcon != null) {
42+
icon = visual.alignmentIcon;
43+
if (icon.equals(Constants.NEUTRAL_ICON)) {
44+
typeComponent = Component.translatable("fieldguide.alignment.neutral");
45+
} else if (icon.equals(Constants.HOSTILE_ICON)) {
46+
typeComponent = Component.translatable("fieldguide.alignment.hostile");
47+
} else if (icon.equals(Constants.PASSIVE_ICON)) {
48+
typeComponent = Component.translatable("fieldguide.alignment.passive");
49+
}
50+
}
51+
3752
attributes.add(GuideAttribute.of(icon, 0, 0, 9, 9, 9, 9, null, typeComponent));
3853

3954
// Health

common/src/main/java/com/evandev/fieldguide/client/gui/screens/FieldGuideCategoryScreen.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
3131
import net.minecraft.core.Registry;
3232
import net.minecraft.core.registries.Registries;
33+
import net.minecraft.nbt.CompoundTag;
34+
import net.minecraft.world.entity.decoration.Painting;
3335
import net.minecraft.network.chat.Component;
3436
import net.minecraft.resources.ResourceLocation;
3537
import net.minecraft.sounds.SoundEvent;
@@ -40,6 +42,7 @@
4042
import net.minecraft.world.entity.Mob;
4143
import net.minecraft.world.item.Item;
4244
import net.minecraft.world.item.ItemStack;
45+
import net.minecraft.world.item.Items;
4346
import net.minecraft.world.level.biome.Biome;
4447
import net.minecraft.world.level.block.Block;
4548
import org.jetbrains.annotations.NotNull;
@@ -744,6 +747,11 @@ private Entity getCachedEntity(Object entry) {
744747
Constants.LOG.error("Failed to create entity for guide: {}", type.getDescription().getString());
745748
}
746749
}
750+
if (entity instanceof Painting painting && entry instanceof GuideEntry ge) {
751+
CompoundTag variantTag = new CompoundTag();
752+
variantTag.putString("variant", ge.id().toString());
753+
Painting.loadVariant(variantTag).ifPresent(painting::setVariant);
754+
}
747755
}
748756
if (entity != null) entryCache.put(id, entity);
749757
}
@@ -870,7 +878,13 @@ private void renderEntryInGrid(GuiGraphics guiGraphics, Object entry, int x, int
870878
} else if (coreEntry instanceof Block block) {
871879
EntryRenderHelper.renderBlock(guiGraphics, block, x, y, 15.0F, unlocked, false, 1.0F);
872880
} else if (coreEntry instanceof Item item) {
873-
EntryRenderHelper.renderItem(guiGraphics, item, x, y, 20.0F, unlocked, false, 1.0F);
881+
if (entry instanceof GuideEntry ge && ge.displayId() != null && item == Items.PAINTING) {
882+
ItemStack paintingStack = new ItemStack(Items.PAINTING);
883+
paintingStack.getOrCreateTagElement("EntityTag").putString("variant", ge.id().toString());
884+
EntryRenderHelper.renderItemStack(guiGraphics, paintingStack, ge, x, y, 20.0F, unlocked, false, 1.0F);
885+
} else {
886+
EntryRenderHelper.renderItem(guiGraphics, item, x, y, 20.0F, unlocked, false, 1.0F);
887+
}
874888
}
875889
}
876890
}

common/src/main/java/com/evandev/fieldguide/client/gui/screens/FieldGuideEntryScreen.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import net.minecraft.world.entity.EntityType;
5151
import net.minecraft.world.entity.LivingEntity;
5252
import net.minecraft.world.entity.Mob;
53+
import net.minecraft.world.entity.decoration.Painting;
5354
import net.minecraft.world.item.Item;
5455
import net.minecraft.world.item.ItemStack;
5556
import net.minecraft.world.item.Items;
@@ -321,6 +322,11 @@ private void setupEntityPreview() {
321322
this.renderedEntity = type.create(this.minecraft.level);
322323
} catch (Exception ignored) {
323324
}
325+
if (this.renderedEntity instanceof Painting painting && entry instanceof GuideEntry ge) {
326+
CompoundTag variantTag = new CompoundTag();
327+
variantTag.putString("variant", ge.id().toString());
328+
Painting.loadVariant(variantTag).ifPresent(painting::setVariant);
329+
}
324330
}
325331

326332
if (this.renderedEntity != null) {
@@ -606,7 +612,13 @@ public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, flo
606612
}
607613
} else if (renderEntry instanceof Item item) {
608614
if (!hideEntity) {
609-
EntryRenderHelper.renderItem(guiGraphics, item, xPos, yPos, 60.0F, unlocked, true, bounce);
615+
if (entry instanceof GuideEntry ge && ge.displayId() != null && item == Items.PAINTING) {
616+
ItemStack paintingStack = new ItemStack(Items.PAINTING);
617+
paintingStack.getOrCreateTagElement("EntityTag").putString("variant", ge.id().toString());
618+
EntryRenderHelper.renderItemStack(guiGraphics, paintingStack, ge, xPos, yPos, 60.0F, unlocked, true, bounce);
619+
} else {
620+
EntryRenderHelper.renderItem(guiGraphics, item, xPos, yPos, 60.0F, unlocked, true, bounce);
621+
}
610622
}
611623
}
612624

common/src/main/java/com/evandev/fieldguide/client/gui/util/EntryRenderHelper.java

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

common/src/main/java/com/evandev/fieldguide/client/gui/util/IconCacheManager.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,15 @@ public static void clearCache() {
7272
PENDING_GENERATIONS.clear();
7373
MAIN_THREAD_TASKS.clear();
7474

75-
CompletableFuture.runAsync(() -> {
76-
if (Files.exists(CACHE_DIR)) {
77-
try (Stream<Path> walk = Files.walk(CACHE_DIR)) {
78-
walk.sorted(Comparator.reverseOrder())
79-
.map(Path::toFile)
80-
.forEach(File::delete);
81-
} catch (IOException e) {
82-
Constants.LOG.error("Failed to delete icon cache directory", e);
83-
}
75+
if (Files.exists(CACHE_DIR)) {
76+
try (Stream<Path> walk = Files.walk(CACHE_DIR)) {
77+
walk.sorted(Comparator.reverseOrder())
78+
.map(Path::toFile)
79+
.forEach(File::delete);
80+
} catch (IOException e) {
81+
Constants.LOG.error("Failed to delete icon cache directory", e);
8482
}
85-
}, IO_EXECUTOR);
83+
}
8684
}
8785

8886
public static Optional<ResourceLocation> getOrGenerateIcon(Object baseEntry, Object cacheKey, boolean isPage, Runnable renderAction) {

0 commit comments

Comments
 (0)