Skip to content

Commit f60e31a

Browse files
Add block entity ids in 1.20.3->.5 conversion (#3837)
1 parent 8c4ff7e commit f60e31a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/BlockItemPacketRewriter1_20_5.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,12 @@ private void updateDisplay(final UserConnection connection, final StructuredData
13401340
}
13411341
}
13421342

1343+
private void addBlockEntityId(final CompoundTag tag, final String id) {
1344+
if (!tag.contains("id")) {
1345+
tag.putString("id", id);
1346+
}
1347+
}
1348+
13431349
private void updateBlockEntityTag(final UserConnection connection, @Nullable final StructuredDataContainer data, final CompoundTag tag) {
13441350
if (tag == null) {
13451351
return;
@@ -1354,6 +1360,7 @@ private void updateBlockEntityTag(final UserConnection connection, @Nullable fin
13541360
final ListTag<CompoundTag> beesTag = tag.getListTag("Bees", CompoundTag.class);
13551361
if (beesTag != null) {
13561362
updateBees(data, beesTag);
1363+
addBlockEntityId(tag, "beehive");
13571364
}
13581365

13591366
final ListTag<StringTag> sherdsTag = tag.getListTag("sherds", StringTag.class);
@@ -1369,11 +1376,13 @@ private void updateBlockEntityTag(final UserConnection connection, @Nullable fin
13691376
toMappedItemId(rightSherd),
13701377
toMappedItemId(frontSherd)
13711378
));
1379+
addBlockEntityId(tag, "decorated_pot");
13721380
}
13731381

13741382
final StringTag noteBlockSoundTag = tag.getStringTag("note_block_sound");
13751383
if (noteBlockSoundTag != null) {
13761384
data.set(StructuredDataKey.NOTE_BLOCK_SOUND, noteBlockSoundTag.getValue());
1385+
addBlockEntityId(tag, "player_head");
13771386
}
13781387

13791388
final StringTag lootTableTag = tag.getStringTag("LootTable");
@@ -1424,6 +1433,7 @@ private void updateBlockEntityTag(final UserConnection connection, @Nullable fin
14241433
}).filter(Objects::nonNull).toArray(BannerPatternLayer[]::new);
14251434
tag.remove("Patterns");
14261435
tag.put("patterns", patternsTag);
1436+
addBlockEntityId(tag, "banner");
14271437

14281438
if (data != null) {
14291439
data.set(StructuredDataKey.BANNER_PATTERNS, layers);

0 commit comments

Comments
 (0)