mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-21 04:05:48 +00:00
Added Bee Armor (and all the things to make it function)
This commit is contained in:
parent
886121e226
commit
f0f134ea72
@ -0,0 +1,48 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class BeeWingListener implements Listener {
|
||||
|
||||
public BeeWingListener(SlimefunPlugin plugin) {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onApproachGround(PlayerMoveEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
ItemStack helmet = e.getPlayer().getInventory().getChestplate();
|
||||
if (!SlimefunUtils.isItemSimilar(helmet, SlimefunItems.BEE_WINGS, true) && !Slimefun.hasUnlocked(e.getPlayer(), helmet, true)) return;
|
||||
if (!player.isGliding()) return;
|
||||
if (getDistanceToGround(player) == 0) return; //More accurate than Entity#isOnGround()
|
||||
|
||||
if (getDistanceToGround(player) <= 6)
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 30, 0));
|
||||
}
|
||||
|
||||
private static int getDistanceToGround(Entity e) {
|
||||
Location loc = e.getLocation().clone();
|
||||
double y = loc.getBlockY();
|
||||
int distance = 0;
|
||||
for (double i = y; i >= 0; i--) {
|
||||
loc.setY(i);
|
||||
if (loc.getBlock().getType().isSolid()) break;
|
||||
distance++;
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
@ -64,6 +61,15 @@ public class SlimefunBootsListener implements Listener {
|
||||
cancelledEvents.put("SLIME_BOOTS", e -> e.getCause() == DamageCause.FALL);
|
||||
|
||||
cancelledEvents.put("SLIME_STEEL_BOOTS", e -> e.getCause() == DamageCause.FALL);
|
||||
|
||||
cancelledEvents.put("BEE_BOOTS", e -> {
|
||||
if (e.getCause() == DamageCause.FALL) {
|
||||
e.getEntity().getWorld().playSound(e.getEntity().getLocation(), Sound.BLOCK_HONEY_BLOCK_FALL, 1f, 2f);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private void stomp(EntityDamageEvent e) {
|
||||
|
@ -257,6 +257,7 @@ public final class ResearchSetup {
|
||||
register("kelp_cookie", 254, "Tasty Kelp", 4, SlimefunItems.KELP_COOKIE);
|
||||
register("makeshift_smeltery", 255, "Improvised Smeltery", 6, SlimefunItems.MAKESHIFT_SMELTERY);
|
||||
register("tree_growth_accelerator", 256, "Faster Trees", 18, SlimefunItems.TREE_GROWTH_ACCELERATOR);
|
||||
register("bee_armor", 257, "Bee Armor", 24, SlimefunItems.BEE_HELMET, SlimefunItems.BEE_WINGS, SlimefunItems.BEE_LEGGINGS, SlimefunItems.BEE_BOOTS);
|
||||
}
|
||||
|
||||
private static void register(String key, int id, String name, int defaultCost, ItemStack... items) {
|
||||
|
@ -3352,6 +3352,23 @@ public final class SlimefunItemSetup {
|
||||
new WitherAssembler(categories.electricity, SlimefunItems.WITHER_ASSEMBLER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.NETHER_STAR), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBONADO_EDGED_CAPACITOR})
|
||||
.register(plugin);
|
||||
|
||||
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 SlimefunItem(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);
|
||||
}
|
||||
|
||||
private static void registerArmorSet(Category category, ItemStack baseComponent, ItemStack[] items, String idSyntax, boolean vanilla, SlimefunAddon addon) {
|
||||
|
@ -26,9 +26,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
/**
|
||||
* This class holds a static references to every {@link SlimefunItemStack}
|
||||
* found in Slimefun.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*/
|
||||
public final class SlimefunItems {
|
||||
|
||||
@ -267,6 +266,11 @@ 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);
|
||||
@ -317,6 +321,15 @@ public final class SlimefunItems {
|
||||
SLIME_CHESTPLATE_STEEL.addUnsafeEnchantments(slime);
|
||||
SLIME_LEGGINGS_STEEL.addUnsafeEnchantments(slime);
|
||||
SLIME_BOOTS_STEEL.addUnsafeEnchantments(slime);
|
||||
|
||||
Map<Enchantment, Integer> bee = new HashMap<>();
|
||||
bee.put(Enchantment.DURABILITY, 4);
|
||||
bee.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
|
||||
|
||||
BEE_HELMET.addUnsafeEnchantments(bee);
|
||||
BEE_WINGS.addUnsafeEnchantments(bee);
|
||||
BEE_LEGGINGS.addUnsafeEnchantments(bee);
|
||||
BEE_BOOTS.addUnsafeEnchantments(bee);
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
@ -9,6 +9,7 @@ import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
@ -48,37 +49,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.food.Cooler;
|
||||
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.BlockListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.resources.GEOResourcesSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.PostSetup;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
|
||||
@ -237,6 +207,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
new FireworksListener(this);
|
||||
new WitherListener(this);
|
||||
new IronGolemListener(this);
|
||||
new BeeWingListener(this);
|
||||
|
||||
// Item-specific Listeners
|
||||
new VampireBladeListener(this, (VampireBlade) SlimefunItems.BLADE_OF_VAMPIRES.getItem());
|
||||
|
Loading…
Reference in New Issue
Block a user