Skip to content

Commit ddbdbdb

Browse files
committed
Cleanup code to reproduce the original tag
Signed-off-by: Florian Reuth <git@florianreuth.de>
1 parent 28b4998 commit ddbdbdb

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

common/src/main/java/com/viaversion/viarewind/protocol/v1_9to1_8/rewriter/BlockItemPacketRewriter1_9.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public Item handleItemToClient(UserConnection connection, Item item) {
292292
tag.put("display", display = new CompoundTag());
293293
}
294294
display.put("color", new IntTag(0x737373)); // Gray
295-
tag.put(nbtTagName() + "|elytra_color", new ByteTag(true));
295+
tag.put(nbtTagName() + "|noDisplay", new ByteTag(true));
296296
}
297297

298298
// Makes the fake banner for a shield brown if it has no banner patterns
@@ -304,7 +304,7 @@ public Item handleItemToClient(UserConnection connection, Item item) {
304304
if (tag == null) {
305305
item.setTag(tag = new CompoundTag());
306306
}
307-
tag.put(nbtTagName() + "|shield_color", new ByteTag(true));
307+
tag.put(nbtTagName() + "|noData", new ByteTag(true));
308308
}
309309
}
310310

@@ -318,19 +318,6 @@ public Item handleItemToServer(UserConnection connection, Item item) {
318318

319319
CompoundTag tag = item.tag();
320320

321-
// Removes the gray color code from the fake leather armor for an elytra
322-
if (tag != null && tag.remove(nbtTagName() + "|elytra_color") != null) {
323-
final CompoundTag display = tag.getCompoundTag("display");
324-
if (display != null) {
325-
display.remove("color");
326-
}
327-
}
328-
329-
// Restores the original data of a shield whose banner color was changed to brown
330-
if (tag != null && tag.remove(nbtTagName() + "|shield_color") != null) {
331-
item.setData((short) 0);
332-
}
333-
334321
enchantmentRewriter.handleToServer(item);
335322

336323
if (item.identifier() == 383 && item.data() != 0) { // Spawn eggs
@@ -363,6 +350,9 @@ public Item handleItemToServer(UserConnection connection, Item item) {
363350
if (tag == null) {
364351
return item;
365352
}
353+
if (tag.remove(nbtTagName() + "|noData") != null) {
354+
item.setData((short) 0);
355+
}
366356
final Tag noDisplayTag = tag.remove(nbtTagName() + "|noDisplay");
367357
if (noDisplayTag != null) {
368358
tag.remove("display");

0 commit comments

Comments
 (0)