Unchecked attempt at fixing 1.8 compat issues

This commit is contained in:
Rammelkast committed 2020-08-04 10:16:21 +02:00
1 parent 7caf7376ba
commit a59a4baf28
5 files changed
+26 -13

No files matched your search

@@ -227,10 +227,12 @@ public final class Utilities {
}
public static boolean isHalfblock(Block block) {
BoundingBox box = block.getBoundingBox();
double height = box.getMaxY() - box.getMinY();
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
return true;
if (!VersionUtil.isBountifulUpdate()) {
BoundingBox box = block.getBoundingBox();
double height = box.getMaxY() - box.getMinY();
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
return true;
}
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW;
}
@@ -134,4 +134,16 @@ public class VersionUtil {
return effect.getType().equals(PotionEffectType.LEVITATION);
}
public static int getPotionLevel(Player player, PotionEffectType type) {
if (isBountifulUpdate()) {
for (PotionEffect effect : player.getActivePotionEffects())
if (effect.getType() == type)
return effect.getAmplifier() + 1;
return 0;
}
if (player.hasPotionEffect(PotionEffectType.JUMP))
return player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1;
return 0;
}
}