3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Change the formatting a bit. merged #421

Dieser Commit ist enthalten in:
Matsv 2016-06-25 13:22:18 +02:00
Ursprung 8677c632df
Commit 8ccd772105

Datei anzeigen

@ -245,10 +245,10 @@ public class ItemRewriter {
public static String potionNameFromDamage(short damage) { public static String potionNameFromDamage(short damage) {
String cached = POTION_ID_TO_NAME.get((int) damage); String cached = POTION_ID_TO_NAME.get((int) damage);
if(cached != null) { if (cached != null) {
return cached; return cached;
} }
if(damage == 0) { if (damage == 0) {
return "water"; return "water";
} }
@ -262,37 +262,78 @@ public class ItemRewriter {
String id; String id;
switch (effect) { switch (effect) {
case 1: id="regeneration"; break; case 1:
case 2: id="swiftness"; break; id = "regeneration";
case 3: id="fire_resistance"; canEnhance = false; break; break;
case 4: id="poison"; break; case 2:
case 5: id="healing"; canExtend = false; break; id = "swiftness";
case 6: id="night_vision"; canEnhance = false; break; break;
case 3:
id = "fire_resistance";
canEnhance = false;
break;
case 4:
id = "poison";
break;
case 5:
id = "healing";
canExtend = false;
break;
case 6:
id = "night_vision";
canEnhance = false;
break;
case 8: id="weakness"; canEnhance = false; break; case 8:
case 9: id="strength"; break; id = "weakness";
case 10: id="slowness"; canEnhance = false; break; canEnhance = false;
case 11: id="leaping"; break; break;
case 12: id="harming"; canExtend=false; break; case 9:
case 13: id="water_breathing"; canEnhance = false; break; id = "strength";
case 14: id="invisibility"; canEnhance = false; break; break;
case 10:
id = "slowness";
canEnhance = false;
break;
case 11:
id = "leaping";
break;
case 12:
id = "harming";
canExtend = false;
break;
case 13:
id = "water_breathing";
canEnhance = false;
break;
case 14:
id = "invisibility";
canEnhance = false;
break;
default: default:
canEnhance = false; canExtend = false; canEnhance = false;
canExtend = false;
switch (name) { switch (name) {
case 0: id="mundane"; break; case 0:
case 16: id="awkward"; break; id = "mundane";
case 32: id="thick"; break; break;
default: id="empty"; case 16:
id = "awkward";
break;
case 32:
id = "thick";
break;
default:
id = "empty";
} }
} }
if(effect > 0) { if (effect > 0) {
if(canEnhance && enhanced) { if (canEnhance && enhanced) {
id = "strong_" + id; id = "strong_" + id;
} } else if (canExtend && extended) {
else if(canExtend && extended) {
id = "long_" + id; id = "long_" + id;
} }
} }
@ -304,11 +345,11 @@ public class ItemRewriter {
if (oldID >= 16384) { if (oldID >= 16384) {
oldID -= 8192; oldID -= 8192;
} }
if(POTION_INDEX.containsKey(oldID)) { if (POTION_INDEX.containsKey(oldID)) {
return POTION_INDEX.get(oldID); return POTION_INDEX.get(oldID);
} }
oldID = POTION_NAME_TO_ID.get(potionNameFromDamage((short)oldID)); oldID = POTION_NAME_TO_ID.get(potionNameFromDamage((short) oldID));
return POTION_INDEX.containsKey(oldID) ? POTION_INDEX.get(oldID) : 0; return POTION_INDEX.containsKey(oldID) ? POTION_INDEX.get(oldID) : 0;
} }