Fix upgraded and extended.
This commit is contained in:
parent
d676d231bd
commit
6a16d53d8e
@ -128,12 +128,14 @@ public class ItemStackAdapterInner19 extends ItemStackAdapterInner18
|
|||||||
boolean extended = potion.hasExtendedDuration();
|
boolean extended = potion.hasExtendedDuration();
|
||||||
boolean upgraded = (potion.getLevel() >= 2);
|
boolean upgraded = (potion.getLevel() >= 2);
|
||||||
|
|
||||||
// Try to avoid slow exceptions.
|
// This section serves two purposes:
|
||||||
// The same checks are done in the PotionData constructor.
|
// 1. Avoid slow exceptions over for invalid damage values.
|
||||||
|
// 2. Lenient upgrade to Minecraft 1.9. Keep what we can.
|
||||||
|
// If a potion was both upgraded and extended we keep the upgraded and remove the extended.
|
||||||
if (type == null) return null;
|
if (type == null) return null;
|
||||||
if (extended && ! type.isExtendable()) return null;
|
if (extended && ! type.isExtendable()) return null;
|
||||||
if (upgraded && ! type.isUpgradeable()) return null;
|
if (upgraded && ! type.isUpgradeable()) return null;
|
||||||
if (upgraded && extended) return null;
|
if (upgraded && extended) extended = false;
|
||||||
|
|
||||||
return new PotionData(type, extended, upgraded);
|
return new PotionData(type, extended, upgraded);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user