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

Did requested changes

This commit is contained in:
Seggan 2020-10-04 14:42:50 -04:00
parent d9aceea4d6
commit 70be1c38d0
6 changed files with 37 additions and 9 deletions

View File

@ -56,7 +56,7 @@ public final class SlimefunItems {
public static final SlimefunItemStack REINFORCED_CLOTH = new SlimefunItemStack("REINFORCED_CLOTH", Material.PAPER, "&bReinforced Cloth", "", "&fThis cloth has been reinforced", "&fwith &bLead &fto protect against", "&fradioactive substances");
public static final SlimefunItemStack TIN_CAN = new SlimefunItemStack("CAN", HeadTexture.TIN_CAN, "&fTin Can");
public static final SlimefunItemStack NIGHT_VISION_GOGGLES = new SlimefunItemStack("NIGHT_VISION_GOGGLES", Material.LEATHER_HELMET, Color.BLACK, "&aNight Vision Goggles", "", "&9+ Night Vision");
public static final SlimefunItemStack CRASH_HELMET = new SlimefunItemStack("CRASH_HELMET", Material.IRON_HELMET, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra.");
public static final SlimefunItemStack ELYTRA_CAP = new SlimefunItemStack("CRASH_HELMET", Material.LEATHER_HELMET, Color.PURPLE, "&5Crash Helmet", "", "&7This helmet will protect you from", "&7crashing while flying elytra.");
public static final SlimefunItemStack FARMER_SHOES = new SlimefunItemStack("FARMER_SHOES", Material.LEATHER_BOOTS, Color.YELLOW, "&eFarmer Shoes", "", "&6&oPrevents you from trampling your Crops");
public static final SlimefunItemStack INFUSED_MAGNET = new SlimefunItemStack("INFUSED_MAGNET", HeadTexture.MAGNET, "&aInfused Magnet", "", "&fMagical infused Magnets", "&fattract nearby Items", "&fas long as it is somewhere in", "&fyour Inventory", "", "&7Hold &eShift&7 to pick up nearby Items");
public static final SlimefunItemStack RAG = new SlimefunItemStack("RAG", Material.PAPER, "&cRag", "", "&aLevel I - Medical Supply", "", "&fRestores 2 Hearts", "&fExtinguishes Fire", "", LoreBuilder.RIGHT_CLICK_TO_USE);

View File

@ -20,7 +20,7 @@ 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.CrashHelmetListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ElytraCapListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener;
@ -454,7 +454,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
new EntityInteractionListener(this);
new MobDropListener(this);
new VillagerTradingListener(this);
new CrashHelmetListener(this);
new ElytraCapListener(this);
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
new BeeListener(this);

View File

@ -0,0 +1,19 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.armor;
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;
import org.bukkit.inventory.ItemStack;
/**
* A class for the Elytra Cap.
*
* @author Seggan
*/
public class ElytraCap extends SlimefunItem {
public ElytraCap(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
}

View File

@ -1,7 +1,9 @@
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -10,9 +12,14 @@ import org.bukkit.inventory.ItemStack;
import javax.annotation.Nonnull;
public class CrashHelmetListener implements Listener {
/**
* The {@link Listener} for the {@link ElytraCap}.
*
* @author Seggan
*/
public class ElytraCapListener implements Listener {
public CrashHelmetListener(@Nonnull SlimefunPlugin plugin) {
public ElytraCapListener(@Nonnull SlimefunPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@ -26,8 +33,9 @@ public class CrashHelmetListener implements Listener {
if (p.isGliding()) {
ItemStack stack = p.getInventory().getHelmet();
SlimefunItem item = SlimefunItem.getByItem(stack);
if ((item != null) && (item.getID().equals("CRASH_HELMET"))) {
e.setDamage(0);
if (item instanceof ElytraCap) {
e.setCancelled(true);
p.playSound(p.getLocation(), Sound.BLOCK_STONE_HIT, 10, 1);
}
}
}

View File

@ -276,7 +276,7 @@ public final class ResearchSetup {
register("climbing_pick", 265, "Block Raider", 20, SlimefunItems.CLIMBING_PICK);
register("even_higher_tier_capacitors", 266, "Tier 3 Capacitors", 40, SlimefunItems.ENERGIZED_CAPACITOR);
register("caveman_talisman", 267, "Talisman of the Caveman", 20, SlimefunItems.TALISMAN_CAVEMAN);
register("crash_helmet", 268, "Crash Gear", 20, SlimefunItems.CRASH_HELMET);
register("crash_helmet", 268, "Crash Gear", 20, SlimefunItems.ELYTRA_CAP);
}
private static void register(String key, int id, String name, int defaultCost, ItemStack... items) {

View File

@ -5,6 +5,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.ElytraCap;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
@ -1016,7 +1017,7 @@ public final class SlimefunItemSetup {
new PotionEffect[] {new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 20)})
.register(plugin);
new SlimefunItem(categories.technicalGadgets, SlimefunItems.CRASH_HELMET, RecipeType.ARMOR_FORGE,
new ElytraCap(categories.technicalGadgets, SlimefunItems.ELYTRA_CAP, RecipeType.ARMOR_FORGE,
new ItemStack[]{new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), new ItemStack(Material.SLIME_BALL), new ItemStack(Material.LEATHER_HELMET), new ItemStack(Material.SLIME_BALL)})
.register(plugin);