Skip to content

Commit aee2dda

Browse files
committed
Fix hiding default components
1 parent 44d8e2f commit aee2dda

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/versions.html
6-
minecraft_version=1.21.6-pre3
7-
yarn_mappings=1.21.6-pre3+build.1
6+
minecraft_version=1.21.7
7+
yarn_mappings=1.21.7+build.1
88
loader_version=0.16.14
99

1010
#Fabric api
11-
fabric_version=0.126.0+1.21.6
11+
fabric_version=0.128.2+1.21.7
1212

1313
# Mod Properties
14-
mod_version = 1.10.0+1.21.6
14+
mod_version = 1.10.1+1.21.7
1515
maven_group = eu.pb4
1616
archives_base_name = sgui
1717

src/main/java/eu/pb4/sgui/api/elements/AnimatedGuiElementBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,10 @@ public ItemStack asStack() {
444444
var copy = itemStack.copy();
445445
if (this.noTooltips) {
446446
copy.set(DataComponentTypes.TOOLTIP_DISPLAY, new TooltipDisplayComponent(true, ReferenceSortedSets.emptySet()));
447-
} else {
447+
} else if (this.hideComponentTooltips) {
448448
var comp = TooltipDisplayComponent.DEFAULT;
449449
for (var entry : this.itemStack.getComponents()) {
450-
if (entry.value() instanceof TooltipAppender && entry.type() != DataComponentTypes.LORE) {
450+
if (entry.type() != DataComponentTypes.ITEM_NAME && entry.type() != DataComponentTypes.CUSTOM_NAME && entry.type() != DataComponentTypes.LORE) {
451451
comp = comp.with(entry.type(), true);
452452
}
453453
}

src/main/java/eu/pb4/sgui/api/elements/GuiElementBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,10 @@ public ItemStack asStack() {
459459
var copy = itemStack.copy();
460460
if (this.noTooltips) {
461461
copy.set(DataComponentTypes.TOOLTIP_DISPLAY, new TooltipDisplayComponent(true, ReferenceSortedSets.emptySet()));
462-
} else {
462+
} else if (this.hideComponentTooltips) {
463463
var comp = TooltipDisplayComponent.DEFAULT;
464464
for (var entry : this.itemStack.getComponents()) {
465-
if (entry.value() instanceof TooltipAppender && entry.type() != DataComponentTypes.LORE) {
465+
if (entry.type() != DataComponentTypes.ITEM_NAME && entry.type() != DataComponentTypes.CUSTOM_NAME && entry.type() != DataComponentTypes.LORE) {
466466
comp = comp.with(entry.type(), true);
467467
}
468468
}

src/testmod/java/eu/pb4/sgui/testmod/SGuiTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ public void onClose() {
274274
};
275275

276276
gui.setSlot(0, new GuiElementBuilder(Items.BARRIER, 8).setCallback((x, y, z) -> gui.close()));
277+
gui.setSlot(2, new GuiElementBuilder(Items.IRON_AXE).hideDefaultTooltip());
277278
gui.setSlot(6, new GuiElementBuilder(Items.BARRIER, 9).setCallback((x, y, z) -> gui.onClose()));
278279

279280
gui.setTitle(Text.literal("Close gui to test switching"));

0 commit comments

Comments
 (0)