Reformat code

This commit is contained in:
Matsv 2019-01-27 13:01:24 +01:00
parent bf7ea31d35
commit 29f1f3ea7c
7 changed files with 192 additions and 192 deletions

View File

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