From 8acafaa22ea5f74a05fb0156e504c3ea9b06ec64 Mon Sep 17 00:00:00 2001 From: Patbox <39821509+Patbox@users.noreply.github.com> Date: Tue, 11 Jun 2024 23:14:15 +0200 Subject: [PATCH] Bug fixes --- gradle.properties | 2 +- .../core/api/item/PolymerItemUtils.java | 1 + .../impl/client/InternalClientRegistry.java | 18 +++--------------- .../EntityTrackerUpdateS2CPacketMixin.java | 10 ++++++---- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/gradle.properties b/gradle.properties index 584eab34..502e05d0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ fabric_version=0.100.0+1.20.6 maven_group = eu.pb4 -mod_version = 0.8.3 +mod_version = 0.8.4 minecraft_version_supported = ">=1.20.5-" diff --git a/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java b/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java index 71957865..8888d171 100644 --- a/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java +++ b/polymer-core/src/main/java/eu/pb4/polymer/core/api/item/PolymerItemUtils.java @@ -105,6 +105,7 @@ public final class PolymerItemUtils { DataComponentTypes.STORED_ENCHANTMENTS, DataComponentTypes.POTION_CONTENTS, DataComponentTypes.CUSTOM_NAME, + DataComponentTypes.CONTAINER, }; @SuppressWarnings("rawtypes") private static final List HIDEABLE_TOOLTIPS = List.of( diff --git a/polymer-core/src/main/java/eu/pb4/polymer/core/impl/client/InternalClientRegistry.java b/polymer-core/src/main/java/eu/pb4/polymer/core/impl/client/InternalClientRegistry.java index 79ec07c6..f70d2e1e 100644 --- a/polymer-core/src/main/java/eu/pb4/polymer/core/impl/client/InternalClientRegistry.java +++ b/polymer-core/src/main/java/eu/pb4/polymer/core/impl/client/InternalClientRegistry.java @@ -341,22 +341,10 @@ public static void clearTabs(Predicate removePredicate) ITEM_GROUPS.removeIf(removePredicate); CreativeInventoryScreenAccessor.setSelectedTab(ItemGroups.getDefaultTab()); - if (CompatStatus.FABRIC_ITEM_GROUP) { - try { - var f1 = CreativeInventoryScreen.class.getDeclaredField("fabric_currentPage"); - f1.setAccessible(true); - f1.setInt(null, 0); - } catch (Throwable e) { - if (PolymerImpl.LOG_MORE_ERRORS) { - PolymerImpl.LOGGER.error("Failed to change item group page (FABRIC)!", e); - } - } - } - - if (CompatStatus.QUILT_ITEM_GROUP) { + if (CompatStatus.FABRIC_ITEM_GROUP || CompatStatus.QUILT_ITEM_GROUP) { try { for (var f1 : CreativeInventoryScreen.class.getDeclaredFields()) { - if (f1.getName().contains("quilt$currentPage")) { + if (f1.getName().contains("currentPage")) { f1.setAccessible(true); f1.setInt(null, 0); break; @@ -364,7 +352,7 @@ public static void clearTabs(Predicate removePredicate) } } catch (Throwable e) { if (PolymerImpl.LOG_MORE_ERRORS) { - PolymerImpl.LOGGER.error("Failed to change item group page (QUILT)!", e); + PolymerImpl.LOGGER.error("Failed to change item group page (FABRIC / QUILT)!", e); } } } diff --git a/polymer-core/src/main/java/eu/pb4/polymer/core/mixin/entity/EntityTrackerUpdateS2CPacketMixin.java b/polymer-core/src/main/java/eu/pb4/polymer/core/mixin/entity/EntityTrackerUpdateS2CPacketMixin.java index 44dff0dd..ab5fd2cd 100644 --- a/polymer-core/src/main/java/eu/pb4/polymer/core/mixin/entity/EntityTrackerUpdateS2CPacketMixin.java +++ b/polymer-core/src/main/java/eu/pb4/polymer/core/mixin/entity/EntityTrackerUpdateS2CPacketMixin.java @@ -66,11 +66,13 @@ public class EntityTrackerUpdateS2CPacketMixin implements EntityTrackerUpdateS2C var legalTrackedData = InternalEntityHelpers.getExampleTrackedDataOfEntityType((polymerEntity.getPolymerEntityType(player))); - if (!mod.isEmpty() && legalTrackedData != null && legalTrackedData.length > 0) { + if (!mod.isEmpty() && legalTrackedData != null && legalTrackedData.length != 0) { for (var entry : mod) { - var x = legalTrackedData[entry.id()]; - if (x != null && x.getData().dataType() == entry.handler()) { - entries.add(entry); + if (entry.id() < legalTrackedData.length) { + var x = legalTrackedData[entry.id()]; + if (x != null && x.getData().dataType() == entry.handler()) { + entries.add(entry); + } } } } else {