1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Some tweaks to the experimental bee wings

This commit is contained in:
TheBusyBiscuit 2020-11-10 01:04:15 +01:00
parent e5b2924bee
commit 97cbe72a91
3 changed files with 11 additions and 4 deletions

View File

@ -42,7 +42,7 @@ public class BeeWingsListener implements Listener {
ItemStack chestplate = player.getInventory().getChestplate();
if (wings.isItem(chestplate) && Slimefun.hasUnlocked(player, chestplate, true)) {
new BeeWingsTask(player).scheduleRepeating(0, 1);
new BeeWingsTask(player).scheduleRepeating(4, 1);
}
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.BeeWings;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeWingsListener;
@ -23,6 +24,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeWingsListe
*
*/
public class BeeWingsTask extends PlayerTask {
private static final int MIN_ALTITUDE = 4;
private Location lastLocation;
@ -38,7 +41,7 @@ public class BeeWingsTask extends PlayerTask {
int distanceToHighestBlock = (loc.getBlockY() - loc.getWorld().getHighestBlockYAt(loc, HeightMap.WORLD_SURFACE));
/*
* getDistanceToGround will only fire when playerDistanceToHighestBlock is negative
* getDistanceToGround will only fire when distanceToHighestBlock is negative
* (which happens when a player flies beneath an existing structure)
*/
if (distanceToHighestBlock < 0) {
@ -49,7 +52,7 @@ public class BeeWingsTask extends PlayerTask {
}
slowDown();
} else if (distanceToHighestBlock <= 6) {
} else if (distanceToHighestBlock <= MIN_ALTITUDE) {
slowDown();
}
}
@ -58,8 +61,11 @@ public class BeeWingsTask extends PlayerTask {
}
private void slowDown() {
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 40, 0));
SlimefunPlugin.getLocalization().sendMessage(p, "messages.bee-suit-slow-fall");
p.setGliding(false);
p.setFallDistance(0);
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 50, 0));
}
/**

View File

@ -132,6 +132,7 @@ messages:
no-tome-yourself: '&cYou cannot use the &4Tome of Knowledge &con yourself...'
multimeter: '&bStored Energy: &3%stored% &b/ &3%capacity%'
piglin-barter: '&4You cannot barter with piglins using Slimefun items'
bee-suit-slow-fall: '&eYour Bee Wings start to slowly bring you back down to the ground'
multi-tool:
mode-change: '&b%device% mode changed to: &9%mode%'