1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 19:55:48 +00:00

Improved the computation of velocity.

This commit is contained in:
LinoxGH 2020-06-27 00:06:22 +03:00
parent f1aa8a08d0
commit 6334e251cb

View File

@ -95,19 +95,16 @@ public class ClimbingPick extends SimpleSlimefunItem<ItemUseHandler> implements
if (e.getClickedFace() == BlockFace.DOWN || e.getClickedFace() == BlockFace.UP) return;
if (!users.contains(p.getUniqueId())) {
Vector velocity = new Vector(1, 1, 1);
if (!getID().equals("TEST_CLIMBING_PICK")) {
velocity = p.getVelocity();
}
Material mat = block.getType();
Double launch = materialSpeeds.getValue().get(mat.name());
Vector velocity = new Vector(0, 0, 0);
if (launch != null) {
Integer efficiencyLevel = item.getEnchantments().get(Enchantment.DIG_SPEED);
if (efficiencyLevel != null){
launch += (efficiencyLevel * 0.2);
}
velocity = velocity.setY(velocity.getY() + launch);
velocity.setY(launch);
users.add(p.getUniqueId());
Bukkit.getScheduler().runTaskLaterAsynchronously(SlimefunPlugin.instance, () -> users.remove(p.getUniqueId()), 4L);