1717 * Checks iItemStacks.
1818 */
1919public interface ItemStackChecker {
20+ /**
21+ * NBT Key {@code BlockEntityTag} for {@link BlockItem BlockItems} containing block entities.
22+ */
23+ String BLOCK_ENTITY_TAG_KEY = "BlockEntityTag" ;
24+
2025 /**
2126 * Cached unluck singleton
2227 */
@@ -70,7 +75,7 @@ static ItemStack fakeStack(ItemStack original, boolean spoofCount) {
7075
7176 if (item instanceof BannerItem ) {
7277 // Lets dropping banners not be a surprising change, and for illager patrol leaders to have a proper banner.
73- cleanBanner (original .getSubNbt (BlockItem . BLOCK_STATE_TAG_KEY ), fakedStack );
78+ cleanBanner (original .getSubNbt (BLOCK_ENTITY_TAG_KEY ), fakedStack );
7479 }
7580
7681 if (item instanceof SkullItem ) {
@@ -167,7 +172,7 @@ static ItemStack inventoryStack(ItemStack stack) {
167172 boolean flag = true ;
168173 if (item instanceof BannerItem ) {
169174 flag = false ;
170- cleanBanner (stack .getSubNbt (BlockItem . BLOCK_STATE_TAG_KEY ), fake );
175+ cleanBanner (stack .getSubNbt (BLOCK_ENTITY_TAG_KEY ), fake );
171176 }
172177
173178 // Transfer SkullProperties.
@@ -181,9 +186,9 @@ static ItemStack inventoryStack(ItemStack stack) {
181186
182187 // Rewrite shulker items
183188 if (block instanceof ShulkerBoxBlock ) {
184- NbtCompound blockEntity = stack .getSubNbt (BlockItem . BLOCK_STATE_TAG_KEY );
189+ NbtCompound blockEntity = stack .getSubNbt (BLOCK_ENTITY_TAG_KEY );
185190 if (blockEntity != null ) {
186- NbtCompound fakeEntity = fake .getOrCreateSubNbt (BlockItem . BLOCK_STATE_TAG_KEY );
191+ NbtCompound fakeEntity = fake .getOrCreateSubNbt (BLOCK_ENTITY_TAG_KEY );
187192 if (blockEntity .contains ("LootTable" , NbtElement .STRING_TYPE )) {
188193 fakeEntity .put ("LootTable" , blockEntity .get ("LootTable" ));
189194 }
@@ -348,7 +353,7 @@ static void cleanBanner(NbtCompound blockEntity, ItemStack faked) {
348353 }
349354 }
350355 }
351- faked .getOrCreateSubNbt (BlockItem . BLOCK_STATE_TAG_KEY ).put ("Patterns" , fakePatterns );
356+ faked .getOrCreateSubNbt (BLOCK_ENTITY_TAG_KEY ).put ("Patterns" , fakePatterns );
352357 }
353358 }
354359}
0 commit comments