3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Reformat code

Dieser Commit ist enthalten in:
Matsv 2019-01-27 13:01:24 +01:00
Ursprung bf7ea31d35
Commit 29f1f3ea7c
7 geänderte Dateien mit 192 neuen und 192 gelöschten Zeilen

Datei anzeigen

@ -195,7 +195,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
Item[] items = wrapper.get(Type.ITEM_ARRAY, 0); Item[] items = wrapper.get(Type.ITEM_ARRAY, 0);
for (int i = 0; i < items.length; i++) for (int i = 0; i < items.length; i++)
items[i] = handleItemToClient(items[i]); items[i] = handleItemToClient(items[i]);
wrapper.set(Type.ITEM_ARRAY,0, items); wrapper.set(Type.ITEM_ARRAY, 0, items);
} }
}); });
} }
@ -638,10 +638,10 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
if (enchantmentEntry instanceof CompoundTag) { if (enchantmentEntry instanceof CompoundTag) {
CompoundTag enchEntry = new CompoundTag(""); CompoundTag enchEntry = new CompoundTag("");
String newId = (String) ((CompoundTag) enchantmentEntry).get("id").getValue(); String newId = (String) ((CompoundTag) enchantmentEntry).get("id").getValue();
if(enchantmentMappings.containsKey(newId)){ if (enchantmentMappings.containsKey(newId)) {
lore.add(new StringTag("", enchantmentMappings.get(newId))); lore.add(new StringTag("", enchantmentMappings.get(newId)));
noMapped.add(enchantmentEntry); noMapped.add(enchantmentEntry);
}else{ } else {
Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId); Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId);
if (oldId == null && newId.startsWith("viaversion:legacy/")) { if (oldId == null && newId.startsWith("viaversion:legacy/")) {
oldId = Short.valueOf(newId.substring(18)); oldId = Short.valueOf(newId.substring(18));
@ -661,20 +661,20 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
tag.put(noMapped); tag.put(noMapped);
tag.put(ench); tag.put(ench);
if(!lore.isEmpty()){ if (!lore.isEmpty()) {
CompoundTag display = tag.get("display"); CompoundTag display = tag.get("display");
if (display==null) { if (display == null) {
tag.put(display = new CompoundTag("display")); tag.put(display = new CompoundTag("display"));
tag.put(new ByteTag(NBT_TAG_NAME + "|noDisplay")); tag.put(new ByteTag(NBT_TAG_NAME + "|noDisplay"));
} }
ListTag loreTag = display.get("Lore"); ListTag loreTag = display.get("Lore");
if (loreTag==null){ if (loreTag == null) {
display.put(loreTag = new ListTag("Lore", StringTag.class)); display.put(loreTag = new ListTag("Lore", StringTag.class));
} }
ListTag oldLore = new ListTag(NBT_TAG_NAME + "|OldLore", StringTag.class); ListTag oldLore = new ListTag(NBT_TAG_NAME + "|OldLore", StringTag.class);
Iterator<Tag> iterator = lore.iterator(); Iterator<Tag> iterator = lore.iterator();
while(iterator.hasNext()){ while (iterator.hasNext()) {
oldLore.add(iterator.next().clone()); oldLore.add(iterator.next().clone());
} }
display.put(oldLore); display.put(oldLore);
@ -692,10 +692,10 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
if (enchantmentEntry instanceof CompoundTag) { if (enchantmentEntry instanceof CompoundTag) {
CompoundTag enchEntry = new CompoundTag(""); CompoundTag enchEntry = new CompoundTag("");
String newId = (String) ((CompoundTag) enchantmentEntry).get("id").getValue(); String newId = (String) ((CompoundTag) enchantmentEntry).get("id").getValue();
if(enchantmentMappings.containsKey(newId)){ if (enchantmentMappings.containsKey(newId)) {
lore.add(new StringTag("", enchantmentMappings.get(newId))); lore.add(new StringTag("", enchantmentMappings.get(newId)));
noMapped.add(enchantmentEntry); noMapped.add(enchantmentEntry);
}else{ } else {
Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId); Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId);
if (oldId == null && newId.startsWith("viaversion:legacy/")) { if (oldId == null && newId.startsWith("viaversion:legacy/")) {
oldId = Short.valueOf(newId.substring(18)); oldId = Short.valueOf(newId.substring(18));
@ -715,20 +715,20 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
tag.put(noMapped); tag.put(noMapped);
tag.put(newStoredEnch); tag.put(newStoredEnch);
if(!lore.isEmpty()){ if (!lore.isEmpty()) {
CompoundTag display = tag.get("display"); CompoundTag display = tag.get("display");
if (display==null) { if (display == null) {
tag.put(display = new CompoundTag("display")); tag.put(display = new CompoundTag("display"));
tag.put(new ByteTag(NBT_TAG_NAME + "|noDisplay")); tag.put(new ByteTag(NBT_TAG_NAME + "|noDisplay"));
} }
ListTag loreTag = display.get("Lore"); ListTag loreTag = display.get("Lore");
if (loreTag==null){ if (loreTag == null) {
display.put(loreTag = new ListTag("Lore", StringTag.class)); display.put(loreTag = new ListTag("Lore", StringTag.class));
} }
ListTag oldLore = new ListTag(NBT_TAG_NAME + "|OldLore", StringTag.class); ListTag oldLore = new ListTag(NBT_TAG_NAME + "|OldLore", StringTag.class);
Iterator<Tag> iterator = lore.iterator(); Iterator<Tag> iterator = lore.iterator();
while(iterator.hasNext()){ while (iterator.hasNext()) {
oldLore.add(iterator.next().clone()); oldLore.add(iterator.next().clone());
} }
display.put(oldLore); display.put(oldLore);
@ -833,10 +833,10 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
// Display Name now uses JSON // Display Name now uses JSON
if (tag.get("display") instanceof CompoundTag) { if (tag.get("display") instanceof CompoundTag) {
CompoundTag display = tag.get("display"); CompoundTag display = tag.get("display");
if(tag.get(NBT_TAG_NAME + "|noDisplay") instanceof ByteTag){ if (tag.get(NBT_TAG_NAME + "|noDisplay") instanceof ByteTag) {
tag.remove("display"); tag.remove("display");
tag.remove(NBT_TAG_NAME + "|noDisplay"); tag.remove(NBT_TAG_NAME + "|noDisplay");
}else{ } else {
if (display.get("Name") instanceof StringTag) { if (display.get("Name") instanceof StringTag) {
StringTag name = display.get("Name"); StringTag name = display.get("Name");
display.put(new StringTag(NBT_TAG_NAME + "|Name", name.getValue())); display.put(new StringTag(NBT_TAG_NAME + "|Name", name.getValue()));
@ -846,12 +846,12 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
) )
); );
} }
if(display.get(NBT_TAG_NAME + "|OldLore") instanceof ListTag){ if (display.get(NBT_TAG_NAME + "|OldLore") instanceof ListTag) {
ListTag loreTag = new ListTag("Lore", StringTag.class); ListTag loreTag = new ListTag("Lore", StringTag.class);
ListTag oldLore = display.get(NBT_TAG_NAME + "|OldLore"); ListTag oldLore = display.get(NBT_TAG_NAME + "|OldLore");
Iterator<Tag> iterator = oldLore.iterator(); Iterator<Tag> iterator = oldLore.iterator();
while (iterator.hasNext()){ while (iterator.hasNext()) {
loreTag.add(iterator.next()); loreTag.add(iterator.next());
} }
display.remove("Lore"); display.remove("Lore");
@ -877,10 +877,10 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
enchantments.add(enchantmentEntry); enchantments.add(enchantmentEntry);
} }
} }
if(tag.get(NBT_TAG_NAME + "|Enchantments") instanceof ListTag){ if (tag.get(NBT_TAG_NAME + "|Enchantments") instanceof ListTag) {
ListTag noMapped = tag.get(NBT_TAG_NAME + "|Enchantments"); ListTag noMapped = tag.get(NBT_TAG_NAME + "|Enchantments");
Iterator<Tag> iterator = noMapped.iterator(); Iterator<Tag> iterator = noMapped.iterator();
while (iterator.hasNext()){ while (iterator.hasNext()) {
enchantments.add(iterator.next()); enchantments.add(iterator.next());
} }
} }
@ -905,10 +905,10 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
newStoredEnch.add(enchantmentEntry); newStoredEnch.add(enchantmentEntry);
} }
} }
if(tag.get(NBT_TAG_NAME + "|Enchantments") instanceof ListTag){ if (tag.get(NBT_TAG_NAME + "|Enchantments") instanceof ListTag) {
ListTag noMapped = tag.get(NBT_TAG_NAME + "|StoredEnchantments"); ListTag noMapped = tag.get(NBT_TAG_NAME + "|StoredEnchantments");
Iterator<Tag> iterator = noMapped.iterator(); Iterator<Tag> iterator = noMapped.iterator();
while (iterator.hasNext()){ while (iterator.hasNext()) {
newStoredEnch.add(iterator.next()); newStoredEnch.add(iterator.next());
} }
} }
@ -1018,7 +1018,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
} }
private void handleEnchantmentClient(Item item){ private void handleEnchantmentClient(Item item) {
} }
} }