mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Merge pull request #2598 from Slimefun/feature/bee-armor
Added Bee Armor
This commit is contained in:
commit
498da0e00a
@ -301,56 +301,70 @@ public final class SlimefunItems {
|
||||
|
||||
public static final SlimefunItemStack BOOTS_OF_THE_STOMPER = new SlimefunItemStack("BOOTS_OF_THE_STOMPER", Material.LEATHER_BOOTS, Color.AQUA, "&bBoots of the Stomper", "", "&9All Fall Damage you receive", "&9will be applied to nearby Mobs/Players", "", "&9+ No Fall Damage");
|
||||
|
||||
public static final SlimefunItemStack BEE_HELMET = new SlimefunItemStack("BEE_HELMET", Material.GOLDEN_HELMET, "&e&lBee Helmet", " ", "&e&oNOT THE BEES");
|
||||
public static final SlimefunItemStack BEE_WINGS = new SlimefunItemStack("BEE_WINGS", Material.ELYTRA, "&e&lBee Wings", " ", "&e&oFly Like a Bee", " ", "&9Activates Slow falling", "&9When approaching the ground", " ");
|
||||
public static final SlimefunItemStack BEE_LEGGINGS = new SlimefunItemStack("BEE_LEGGINGS", Material.GOLDEN_LEGGINGS, "&e&lBee Leggings", " ", "&e&oBee like a Bee");
|
||||
public static final SlimefunItemStack BEE_BOOTS = new SlimefunItemStack("BEE_BOOTS", Material.GOLDEN_BOOTS, "&e&lBee Boots", "", "&e&oNever have trouble taking off again", "", "&9+ Jump Boost", "&9+ No Fall Damage");
|
||||
|
||||
static {
|
||||
Map<Enchantment, Integer> cactus = new HashMap<>();
|
||||
cactus.put(Enchantment.THORNS, 3);
|
||||
cactus.put(Enchantment.DURABILITY, 6);
|
||||
Map<Enchantment, Integer> cactusEnchs = new HashMap<>();
|
||||
cactusEnchs.put(Enchantment.THORNS, 3);
|
||||
cactusEnchs.put(Enchantment.DURABILITY, 6);
|
||||
|
||||
CACTUS_HELMET.addUnsafeEnchantments(cactus);
|
||||
CACTUS_CHESTPLATE.addUnsafeEnchantments(cactus);
|
||||
CACTUS_LEGGINGS.addUnsafeEnchantments(cactus);
|
||||
CACTUS_BOOTS.addUnsafeEnchantments(cactus);
|
||||
CACTUS_HELMET.addUnsafeEnchantments(cactusEnchs);
|
||||
CACTUS_CHESTPLATE.addUnsafeEnchantments(cactusEnchs);
|
||||
CACTUS_LEGGINGS.addUnsafeEnchantments(cactusEnchs);
|
||||
CACTUS_BOOTS.addUnsafeEnchantments(cactusEnchs);
|
||||
|
||||
Map<Enchantment, Integer> damascus = new HashMap<>();
|
||||
damascus.put(Enchantment.DURABILITY, 5);
|
||||
damascus.put(Enchantment.PROTECTION_ENVIRONMENTAL, 5);
|
||||
Map<Enchantment, Integer> damascusEnchs = new HashMap<>();
|
||||
damascusEnchs.put(Enchantment.DURABILITY, 5);
|
||||
damascusEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 5);
|
||||
|
||||
DAMASCUS_STEEL_HELMET.addUnsafeEnchantments(damascus);
|
||||
DAMASCUS_STEEL_CHESTPLATE.addUnsafeEnchantments(damascus);
|
||||
DAMASCUS_STEEL_LEGGINGS.addUnsafeEnchantments(damascus);
|
||||
DAMASCUS_STEEL_BOOTS.addUnsafeEnchantments(damascus);
|
||||
DAMASCUS_STEEL_HELMET.addUnsafeEnchantments(damascusEnchs);
|
||||
DAMASCUS_STEEL_CHESTPLATE.addUnsafeEnchantments(damascusEnchs);
|
||||
DAMASCUS_STEEL_LEGGINGS.addUnsafeEnchantments(damascusEnchs);
|
||||
DAMASCUS_STEEL_BOOTS.addUnsafeEnchantments(damascusEnchs);
|
||||
|
||||
Map<Enchantment, Integer> reinforced = new HashMap<>();
|
||||
reinforced.put(Enchantment.DURABILITY, 9);
|
||||
reinforced.put(Enchantment.PROTECTION_ENVIRONMENTAL, 9);
|
||||
Map<Enchantment, Integer> reinforcedEnchs = new HashMap<>();
|
||||
reinforcedEnchs.put(Enchantment.DURABILITY, 9);
|
||||
reinforcedEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 9);
|
||||
|
||||
REINFORCED_ALLOY_HELMET.addUnsafeEnchantments(reinforced);
|
||||
REINFORCED_ALLOY_CHESTPLATE.addUnsafeEnchantments(reinforced);
|
||||
REINFORCED_ALLOY_LEGGINGS.addUnsafeEnchantments(reinforced);
|
||||
REINFORCED_ALLOY_BOOTS.addUnsafeEnchantments(reinforced);
|
||||
REINFORCED_ALLOY_HELMET.addUnsafeEnchantments(reinforcedEnchs);
|
||||
REINFORCED_ALLOY_CHESTPLATE.addUnsafeEnchantments(reinforcedEnchs);
|
||||
REINFORCED_ALLOY_LEGGINGS.addUnsafeEnchantments(reinforcedEnchs);
|
||||
REINFORCED_ALLOY_BOOTS.addUnsafeEnchantments(reinforcedEnchs);
|
||||
|
||||
Map<Enchantment, Integer> gilded = new HashMap<>();
|
||||
gilded.put(Enchantment.DURABILITY, 6);
|
||||
gilded.put(Enchantment.PROTECTION_ENVIRONMENTAL, 8);
|
||||
Map<Enchantment, Integer> gildedEnchs = new HashMap<>();
|
||||
gildedEnchs.put(Enchantment.DURABILITY, 6);
|
||||
gildedEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 8);
|
||||
|
||||
GILDED_IRON_HELMET.addUnsafeEnchantments(gilded);
|
||||
GILDED_IRON_CHESTPLATE.addUnsafeEnchantments(gilded);
|
||||
GILDED_IRON_LEGGINGS.addUnsafeEnchantments(gilded);
|
||||
GILDED_IRON_BOOTS.addUnsafeEnchantments(gilded);
|
||||
GILDED_IRON_HELMET.addUnsafeEnchantments(gildedEnchs);
|
||||
GILDED_IRON_CHESTPLATE.addUnsafeEnchantments(gildedEnchs);
|
||||
GILDED_IRON_LEGGINGS.addUnsafeEnchantments(gildedEnchs);
|
||||
GILDED_IRON_BOOTS.addUnsafeEnchantments(gildedEnchs);
|
||||
|
||||
GOLDEN_HELMET_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||
GOLDEN_CHESTPLATE_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||
GOLDEN_LEGGINGS_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||
GOLDEN_BOOTS_12K.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||
|
||||
Map<Enchantment, Integer> slime = new HashMap<>();
|
||||
slime.put(Enchantment.DURABILITY, 4);
|
||||
slime.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
|
||||
Map<Enchantment, Integer> slimeEnchs = new HashMap<>();
|
||||
slimeEnchs.put(Enchantment.DURABILITY, 4);
|
||||
slimeEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
|
||||
|
||||
SLIME_HELMET_STEEL.addUnsafeEnchantments(slime);
|
||||
SLIME_CHESTPLATE_STEEL.addUnsafeEnchantments(slime);
|
||||
SLIME_LEGGINGS_STEEL.addUnsafeEnchantments(slime);
|
||||
SLIME_BOOTS_STEEL.addUnsafeEnchantments(slime);
|
||||
SLIME_HELMET_STEEL.addUnsafeEnchantments(slimeEnchs);
|
||||
SLIME_CHESTPLATE_STEEL.addUnsafeEnchantments(slimeEnchs);
|
||||
SLIME_LEGGINGS_STEEL.addUnsafeEnchantments(slimeEnchs);
|
||||
SLIME_BOOTS_STEEL.addUnsafeEnchantments(slimeEnchs);
|
||||
|
||||
Map<Enchantment, Integer> beeEnchs = new HashMap<>();
|
||||
beeEnchs.put(Enchantment.DURABILITY, 4);
|
||||
beeEnchs.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
|
||||
|
||||
BEE_HELMET.addUnsafeEnchantments(beeEnchs);
|
||||
BEE_WINGS.addUnsafeEnchantments(beeEnchs);
|
||||
BEE_LEGGINGS.addUnsafeEnchantments(beeEnchs);
|
||||
BEE_BOOTS.addUnsafeEnchantments(beeEnchs);
|
||||
}
|
||||
|
||||
/* Magical components */
|
||||
|
@ -56,12 +56,14 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAlta
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.BeeWings;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GrapplingHook;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAxe;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeWingsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ButcherAndroidListener;
|
||||
@ -525,6 +527,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
// Bees were added in 1.15
|
||||
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
|
||||
new BeeListener(this);
|
||||
new BeeWingsListener(this, (BeeWings) SlimefunItems.BEE_WINGS.getItem());
|
||||
}
|
||||
|
||||
// Piglins were added in 1.16
|
||||
@ -592,7 +595,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
/**
|
||||
* This returns the global instance of {@link SlimefunPlugin}.
|
||||
* This may return null if the {@link Plugin} was disabled.
|
||||
*
|
||||
*
|
||||
* @return The {@link SlimefunPlugin} instance
|
||||
*/
|
||||
@Nullable
|
||||
@ -745,7 +748,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
/**
|
||||
* This returns our instance of the {@link SlimefunProfiler}, a tool that is used
|
||||
* to analyse performance and lag.
|
||||
*
|
||||
*
|
||||
* @return The {@link SlimefunProfiler}
|
||||
*/
|
||||
public static SlimefunProfiler getProfiler() {
|
||||
@ -764,7 +767,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
/**
|
||||
* This method returns whether this version of Slimefun was newly installed.
|
||||
* It will return true if this {@link Server} uses Slimefun for the very first time.
|
||||
*
|
||||
*
|
||||
* @return Whether this is a new installation of Slimefun
|
||||
*/
|
||||
public static boolean isNewlyInstalled() {
|
||||
|
@ -0,0 +1,19 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class BeeWings extends SlimefunItem {
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public BeeWings(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityToggleGlideEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.BeeWings;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.BeeWingsTask;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* This {@link Listener} is responsible for the slow falling effect given to the {@link Player}
|
||||
* when nearing the ground while using the {@link BeeWings}.
|
||||
*
|
||||
* @author beSnow
|
||||
* @author Linox
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see BeeWings
|
||||
* @see BeeWingsTask
|
||||
*
|
||||
*/
|
||||
public class BeeWingsListener implements Listener {
|
||||
|
||||
private final BeeWings wings;
|
||||
|
||||
public BeeWingsListener(@Nonnull SlimefunPlugin plugin, @Nonnull BeeWings wings) {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
this.wings = wings;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onApproachGround(EntityToggleGlideEvent e) {
|
||||
if (!e.isGliding() || wings.isDisabled() || !(e.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) e.getEntity();
|
||||
ItemStack chestplate = player.getInventory().getChestplate();
|
||||
|
||||
if (wings.isItem(chestplate) && Slimefun.hasUnlocked(player, chestplate, true)) {
|
||||
new BeeWingsTask(player).scheduleRepeating(3, 1);
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Bat;
|
||||
@ -21,16 +20,17 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
import org.bukkit.event.entity.PlayerLeashEntityEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.entity.PlayerLeashEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GrapplingHook;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
|
||||
/**
|
||||
* This {@link Listener} is responsible for the mechanics behind the {@link GrapplingHook}.
|
||||
@ -55,13 +55,9 @@ public class GrapplingHookListener implements Listener {
|
||||
this.grapplingHook = grapplingHook;
|
||||
}
|
||||
|
||||
private boolean isEnabled() {
|
||||
return grapplingHook != null && !grapplingHook.isDisabled();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onArrowHitEntity(EntityDamageByEntityEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,7 +68,7 @@ public class GrapplingHookListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onArrowHitSurface(ProjectileHitEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -85,7 +81,7 @@ public class GrapplingHookListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onArrowHitHanging(HangingBreakByEntityEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -97,7 +93,7 @@ public class GrapplingHookListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,7 +104,7 @@ public class GrapplingHookListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerKickEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,7 +115,7 @@ public class GrapplingHookListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onFallDamage(EntityDamageEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -130,7 +126,7 @@ public class GrapplingHookListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPortalEnter(EntityPortalEnterEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -142,7 +138,7 @@ public class GrapplingHookListener implements Listener {
|
||||
// Fixing Issue #2351
|
||||
@EventHandler
|
||||
public void onLeash(PlayerLeashEntityEvent e) {
|
||||
if (!isEnabled()) {
|
||||
if (grapplingHook.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -26,7 +27,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
* This {@link Listener} is responsible for handling all boots provided by
|
||||
* Slimefun, such as the {@link StomperBoots} or any {@link SlimefunArmorPiece} that
|
||||
* is a pair of boots and needs to listen to an {@link EntityDamageEvent}.
|
||||
*
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
* @author Walshy
|
||||
*
|
||||
@ -69,6 +70,9 @@ public class SlimefunBootsListener implements Listener {
|
||||
if (boots instanceof StomperBoots) {
|
||||
e.setCancelled(true);
|
||||
((StomperBoots) boots).stomp(e);
|
||||
} else if (boots.getId().equals("BEE_BOOTS")) {
|
||||
e.setCancelled(true);
|
||||
e.getEntity().getWorld().playSound(e.getEntity().getLocation(), Sound.BLOCK_HONEY_BLOCK_FALL, 1f, 2f);
|
||||
} else if (boots.getId().equals("SLIME_BOOTS") || boots.getId().equals("SLIME_STEEL_BOOTS")) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class VampireBladeListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onDamage(EntityDamageByEntityEvent e) {
|
||||
if (blade == null || blade.isDisabled()) {
|
||||
if (blade.isDisabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
/**
|
||||
* This static setup class is used to register all default implementations of
|
||||
* {@link Research} on startup.
|
||||
*
|
||||
*
|
||||
* @see Research
|
||||
* @see SlimefunItems
|
||||
*
|
||||
@ -279,6 +279,7 @@ public final class ResearchSetup {
|
||||
register("caveman_talisman", 267, "Talisman of the Caveman", 20, SlimefunItems.TALISMAN_CAVEMAN);
|
||||
register("elytra_cap", 268, "Crash Gear", 20, SlimefunItems.ELYTRA_CAP);
|
||||
register("energy_connectors", 269, "Wired Connections", 12, SlimefunItems.ENERGY_CONNECTOR);
|
||||
register("bee_armor", 270, "Bee Armor", 24, SlimefunItems.BEE_HELMET, SlimefunItems.BEE_WINGS, SlimefunItems.BEE_LEGGINGS, SlimefunItems.BEE_BOOTS);
|
||||
}
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
|
@ -127,6 +127,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.gps.GPSTransmitte
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.gps.PersonalActivationPlate;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.gps.Teleporter;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.gps.TeleporterPylon;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.BeeWings;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.InfernalBonemeal;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.InfusedHopper;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.InfusedMagnet;
|
||||
@ -2522,8 +2523,29 @@ public final class SlimefunItemSetup {
|
||||
new TapeMeasure(categories.usefulItems, SlimefunItems.TAPE_MEASURE, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), new ItemStack(Material.STRING), new ItemStack(Material.YELLOW_DYE), SlimefunItems.GILDED_IRON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON})
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
|
||||
|
||||
MinecraftVersion minecraftVersion = SlimefunPlugin.getMinecraftVersion();
|
||||
|
||||
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
|
||||
new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_HELMET, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[]{SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK), null, null, null})
|
||||
.register(plugin);
|
||||
|
||||
new BeeWings(categories.magicalArmor, SlimefunItems.BEE_WINGS, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[]{SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.ELYTRA), new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK)})
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_LEGGINGS, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[]{SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK)})
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunArmorPiece(categories.magicalArmor, SlimefunItems.BEE_BOOTS, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[]{null, null, null, SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), null, new ItemStack(Material.HONEY_BLOCK)},
|
||||
new PotionEffect[]{new PotionEffect(PotionEffectType.JUMP, 300, 2)})
|
||||
.register(plugin);
|
||||
}
|
||||
|
||||
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
|
||||
new StrangeNetherGoo(categories.magicalResources, SlimefunItems.STRANGE_NETHER_GOO, RecipeType.BARTER_DROP,
|
||||
new ItemStack[] {null, null, null, null, new CustomItem(HeadTexture.PIGLIN_HEAD.getAsItemStack(), "&fPiglin"), null, null, null, null})
|
||||
.register(plugin);
|
||||
@ -2561,4 +2583,4 @@ public final class SlimefunItemSetup {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.tasks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.bukkit.HeightMap;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
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;
|
||||
|
||||
/**
|
||||
* This {@link PlayerTask} is responsible for the repeating checks for our {@link BeeWings}.
|
||||
*
|
||||
* @author beSnow
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see BeeWings
|
||||
* @see BeeWingsListener
|
||||
*
|
||||
*/
|
||||
public class BeeWingsTask extends AbstractPlayerTask {
|
||||
|
||||
private static final int MIN_ALTITUDE = 4;
|
||||
|
||||
private Location lastLocation;
|
||||
|
||||
public BeeWingsTask(@Nonnull Player p) {
|
||||
super(p);
|
||||
lastLocation = p.getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void executeTask() {
|
||||
if (p.getLocation().getY() < lastLocation.getY()) {
|
||||
Location loc = p.getLocation();
|
||||
int distanceToHighestBlock = (loc.getBlockY() - loc.getWorld().getHighestBlockYAt(loc, HeightMap.WORLD_SURFACE));
|
||||
|
||||
/*
|
||||
* getDistanceToGround will only fire when distanceToHighestBlock is negative
|
||||
* (which happens when a player flies beneath an existing structure)
|
||||
*/
|
||||
if (distanceToHighestBlock < 0) {
|
||||
int distanceToGround = getDistanceToGround(loc.getBlock(), 6);
|
||||
|
||||
if (distanceToGround < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
slowDown();
|
||||
} else if (distanceToHighestBlock <= MIN_ALTITUDE) {
|
||||
slowDown();
|
||||
}
|
||||
}
|
||||
|
||||
lastLocation = p.getLocation();
|
||||
}
|
||||
|
||||
private void slowDown() {
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.bee-suit-slow-fall");
|
||||
|
||||
p.setFallDistance(0);
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 60, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the distance of the given {@link Block} from the ground.
|
||||
*
|
||||
* @param b
|
||||
* The {@link Block} to calculate from.
|
||||
* @param limit
|
||||
* The limit of {@link Block blocks} to check under the given {@link Block b}.
|
||||
*
|
||||
*/
|
||||
private int getDistanceToGround(@Nonnull Block b, int limit) {
|
||||
for (int i = 1; i <= limit; i++) {
|
||||
Block relative = b.getRelative(0, -i, 0);
|
||||
|
||||
if (relative.getType().isSolid()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValid() {
|
||||
// The task is only valid as long as the Player is alive and gliding
|
||||
if (!p.isOnline() || !p.isValid() || p.isDead() || !p.isGliding() || p.hasPotionEffect(PotionEffectType.SLOW_FALLING)) {
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -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 will help you to get back to the ground safe and slow'
|
||||
|
||||
multi-tool:
|
||||
mode-change: '&b%device% mode changed to: &9%mode%'
|
||||
|
@ -246,3 +246,4 @@ slimefun:
|
||||
iron_golem_assembler: Automated Iron Golems
|
||||
villager_rune: Reset Villager Trades
|
||||
elytra_cap: Crash Gear
|
||||
bee_armor: Bee Armor
|
||||
|
Loading…
Reference in New Issue
Block a user