diff --git a/pom.xml b/pom.xml index 4db698f..26563da 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 me.lucasgithuber ElementManipulation - 1.0.2 + MODIFIED 16 diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/ElementManipulation.java b/src/main/java/me/lucasgithuber/elementmanipulation/ElementManipulation.java index 02bacbf..a3ebd56 100644 --- a/src/main/java/me/lucasgithuber/elementmanipulation/ElementManipulation.java +++ b/src/main/java/me/lucasgithuber/elementmanipulation/ElementManipulation.java @@ -9,6 +9,7 @@ import me.lucasgithuber.elementmanipulation.misc.MiscItems; import me.lucasgithuber.elementmanipulation.utils.Categories; import net.kyori.adventure.text.minimessage.MiniMessage; +import me.lucasgithuber.elementmanipulation.drugs.Drugs; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import net.kyori.adventure.text.minimessage.tag.standard.StandardTags; import org.bstats.bukkit.Metrics; @@ -37,7 +38,7 @@ public void enable() { Materials.setup(this); Machines.setup(this); MiscItems.setup(this); - //Drugs.setup(this); + Drugs.setup(this); /*PortalCorners.setup(this);*/ new Metrics(this, 13718); } diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Alcohol.java b/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Alcohol.java new file mode 100644 index 0000000..6813445 --- /dev/null +++ b/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Alcohol.java @@ -0,0 +1,51 @@ +package me.lucasgithuber.elementmanipulation.drugs; + +import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent; +import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; +import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; +import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable; +import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; +import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import me.lucasgithuber.elementmanipulation.ElementManipulation; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import javax.annotation.Nonnull; + +public class Alcohol extends SimpleSlimefunItem implements NotPlaceable { + private final String durationsPath = "drugs.alcohol.effects-duration."; + private final String powersPath = "drugs.alcohol.effects-power."; + public Alcohol(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { + super(itemGroup, item, recipeType, recipe); + + } + + @Override + public void preRegister() { + addItemHandler(onUse()); + } + + @Nonnull + @Override + public ItemUseHandler getItemHandler() { + return PlayerRightClickEvent::cancel; + } + + @Nonnull + protected ItemUseHandler onUse() { + return e -> { + Player p = e.getPlayer(); + ItemStack itemStack = p.getInventory().getItemInMainHand(); + if (p.getGameMode() != GameMode.CREATIVE && itemStack.getAmount()>=1) { + itemStack.setAmount(itemStack.getAmount() - 1); + } + p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, ElementManipulation.config().getInt(durationsPath + "nausea") * 20, 2, false, false, false)); + p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, ElementManipulation.config().getInt(durationsPath + "regeneration") * 20, 0, false, false, false)); + + }; + } +} \ No newline at end of file diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Anesthesic.java b/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Anesthesic.java new file mode 100644 index 0000000..2a729cb --- /dev/null +++ b/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Anesthesic.java @@ -0,0 +1,51 @@ +package me.lucasgithuber.elementmanipulation.drugs; + +import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent; +import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; +import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; +import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable; +import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; +import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem; +import me.lucasgithuber.elementmanipulation.ElementManipulation; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import javax.annotation.Nonnull; + +public class Anesthesic extends SimpleSlimefunItem implements NotPlaceable { + private final String durationsPath = "drugs.anesthesic.effects-duration."; + private final String powersPath = "drugs.anesthesic.effects-power."; + public Anesthesic(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { + super(itemGroup, item, recipeType, recipe); + + } + + @Override + public void preRegister() { + addItemHandler(onUse()); + } + + @Nonnull + @Override + public ItemUseHandler getItemHandler() { + return PlayerRightClickEvent::cancel; + } + + @Nonnull + protected ItemUseHandler onUse() { + return e -> { + Player p = e.getPlayer(); + ItemStack itemStack = p.getInventory().getItemInMainHand(); + if (p.getGameMode() != GameMode.CREATIVE && itemStack.getAmount()>=16) { + itemStack.setAmount(itemStack.getAmount() - 16); + } + p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, ElementManipulation.config().getInt(durationsPath + "damage-resistance") * 20, 250, false, false, false)); + p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, ElementManipulation.config().getInt(durationsPath + "fire-resistance") * 20, 250, false, false, false)); + p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, ElementManipulation.config().getInt(durationsPath + "blindness") * 20, 1, false, false, false)); + }; + } +} \ No newline at end of file diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Drugs.java b/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Drugs.java index 75aac56..67d92cc 100644 --- a/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Drugs.java +++ b/src/main/java/me/lucasgithuber/elementmanipulation/drugs/Drugs.java @@ -4,9 +4,13 @@ import me.lucasgithuber.elementmanipulation.ElementManipulation; import me.lucasgithuber.elementmanipulation.machines.DrugsTable; import me.lucasgithuber.elementmanipulation.utils.Categories; +import me.lucasgithuber.elementmanipulation.misc.MiscItems; import net.md_5.bungee.api.ChatColor; import org.bukkit.Material; +import org.bukkit.Color; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import static me.lucasgithuber.elementmanipulation.elements.Elements.*; @@ -24,6 +28,20 @@ public class Drugs { ChatColor.WHITE +"Makes you feel good" ); + public static final SlimefunItemStack ALCOHOL = new SlimefunItemStack( + "EM_ALCOHOL", + Color.WHITE, + new PotionEffect(PotionEffectType.NIGHT_VISION, 2, 0), + ChatColor.of("#FFD78A") + "Alcohol", + ChatColor.of("#FFD78A") + "Makes you drunk", + ChatColor.of("#FFD78A") + "Makes emotional pain go away" + ); + public static final SlimefunItemStack ANESTHESIC = new SlimefunItemStack( + "EM_ANESTHESIC", + Material.END_ROD, + "&8anesthesic", + "&8Makes you feel nothing" + ); public static void setup(ElementManipulation em){ new Caffeine(Categories.DRUGS_CHEAT, CAFFEINE, DrugsTable.TYPE, new ItemStack[]{ null,null,null,OXYGEN,null,null, @@ -41,5 +59,21 @@ public static void setup(ElementManipulation em){ null,null,null,CARBON,null,null, null,null,null,HYDROGEN,NITROGEN,HYDROGEN }).register(em); + new Alcohol(Categories.DRUGS_CHEAT, ALCOHOL, DrugsTable.TYPE, new ItemStack[]{ + new ItemStack(Material.GLASS_BOTTLE),HYDROGEN,HYDROGEN,null,null,null, + HYDROGEN,CARBON,CARBON,OXYGEN,HYDROGEN,null, + null,HYDROGEN,HYDROGEN,null,null,null, + null,HYDROGEN,HYDROGEN,null,null,null, + HYDROGEN,CARBON,CARBON,OXYGEN,HYDROGEN,null, + null,HYDROGEN,HYDROGEN,null,null,null, + }).register(em); + new Anesthesic(Categories.DRUGS_CHEAT, ANESTHESIC, DrugsTable.TYPE, new ItemStack[]{ + MiscItems.SYRINGE,CARBON,NITROGEN,NITROGEN,CARBON,HYDROGEN, + HYDROGEN,CARBON,NITROGEN,NITROGEN,CARBON,HYDROGEN, + HYDROGEN,CARBON,NITROGEN,NITROGEN,CARBON,HYDROGEN, + HYDROGEN,CARBON,NITROGEN,NITROGEN,CARBON,HYDROGEN, + HYDROGEN,CARBON,NITROGEN,NITROGEN,CARBON,HYDROGEN, + HYDROGEN,CARBON,NITROGEN,NITROGEN,CARBON,HYDROGEN, + }).register(em); } } diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/machines/Deconstructor.java b/src/main/java/me/lucasgithuber/elementmanipulation/machines/Deconstructor.java index d4f05e6..20a9196 100644 --- a/src/main/java/me/lucasgithuber/elementmanipulation/machines/Deconstructor.java +++ b/src/main/java/me/lucasgithuber/elementmanipulation/machines/Deconstructor.java @@ -98,6 +98,7 @@ public void registerDefaultRecipes() { new CustomItemStack(Elements.SODIUM, 8), new CustomItemStack(Elements.CALCIUM, 8), new CustomItemStack(Elements.SILICON, 4), + new CustomItemStack(Elements.SULFUR, 4), }); registerRecipe(4, new ItemStack[] {new ItemStack(Material.EMERALD, 64)}, new ItemStack[] { diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/machines/Machines.java b/src/main/java/me/lucasgithuber/elementmanipulation/machines/Machines.java index 7f2d166..1d0830d 100644 --- a/src/main/java/me/lucasgithuber/elementmanipulation/machines/Machines.java +++ b/src/main/java/me/lucasgithuber/elementmanipulation/machines/Machines.java @@ -9,6 +9,7 @@ import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder; import me.lucasgithuber.elementmanipulation.ElementManipulation; import me.lucasgithuber.elementmanipulation.utils.Categories; +import me.lucasgithuber.elementmanipulation.misc.MiscItems; import net.kyori.adventure.platform.bukkit.BukkitComponentSerializer; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -84,11 +85,11 @@ SlimefunItems.REINFORCED_PLATE,new ItemStack(Material.GLASS),SlimefunItems.REINF SlimefunItems.REINFORCED_PLATE, new ItemStack(Material.GLASS), SlimefunItems.REINFORCED_PLATE, SlimefunItems.REINFORCED_PLATE, SlimefunItems.LARGE_CAPACITOR, SlimefunItems.REINFORCED_PLATE }).setProcessingSpeed(1).setCapacity(64).setEnergyConsumption(16); - /*new DrugsTable(Categories.MACHINES, DRUGS_TABLE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[]{ + new DrugsTable(Categories.MACHINES, DRUGS_TABLE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[]{ new ItemStack(Material.NETHER_STAR), MiscItems.CLEAR_GLASS_3,new ItemStack(Material.NETHER_STAR), SlimefunItems.REINFORCED_PLATE,SlimefunItems.CRAFTING_MOTOR,SlimefunItems.REINFORCED_PLATE, new ItemStack(Material.BLACK_CONCRETE),SlimefunItems.LARGE_CAPACITOR,new ItemStack(Material.BLACK_CONCRETE), - }, 4096).register(em);*/ + }, 4096).register(em); /*new PortalTable(Categories.MACHINES, PORTAL_TABLE, new ItemStack[] { * null , null , null, null, new ItemStack(Material.DARK_OAK_FENCE), null, diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/misc/MiscItems.java b/src/main/java/me/lucasgithuber/elementmanipulation/misc/MiscItems.java index 966754c..af4cb79 100644 --- a/src/main/java/me/lucasgithuber/elementmanipulation/misc/MiscItems.java +++ b/src/main/java/me/lucasgithuber/elementmanipulation/misc/MiscItems.java @@ -1,12 +1,17 @@ package me.lucasgithuber.elementmanipulation.misc; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; +import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.UnplaceableBlock; import me.lucasgithuber.elementmanipulation.ElementManipulation; import me.lucasgithuber.elementmanipulation.utils.Categories; +import me.lucasgithuber.elementmanipulation.items.Materials; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; + +import static me.lucasgithuber.elementmanipulation.elements.Elements.*; public class MiscItems { public static final SlimefunItemStack CLEAR_GLASS_1 = new SlimefunItemStack( @@ -31,6 +36,18 @@ public class MiscItems { "&fThis glass is so clear that it seems", "&fThere's nothing in your way" ); + public static final SlimefunItemStack SYRINGE = new SlimefunItemStack( + "EM_SYRINGE", + Material.END_ROD, + "&fSyringe", + "&fUsed to put anesthesics" + ); + public static final SlimefunItemStack RUBBER_PISTON = new SlimefunItemStack( + "EM_RUBBER_PISTON", + Material.BLACK_DYE, + "&7Rubber piston", + "&7Component of syringes" + ); public static void setup(ElementManipulation em){ new UnplaceableBlock(Categories.MISCELLANEOUS, CLEAR_GLASS_1, RecipeType.SMELTERY, new ItemStack[]{ new ItemStack(Material.GLASS_PANE), null, null, @@ -47,5 +64,16 @@ public static void setup(ElementManipulation em){ null, null, null, null, null, null }).register(em); + new SlimefunItem(Categories.MISCELLANEOUS, RUBBER_PISTON, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[]{ + SULFUR,SULFUR,SULFUR, + SULFUR,CARBON,SULFUR, + SULFUR,SULFUR,SULFUR, + }).register(em); + new UnplaceableBlock(Categories.MISCELLANEOUS, SYRINGE, RecipeType.SMELTERY, new ItemStack[]{ + SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET, + SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET, + SlimefunItems.PLASTIC_SHEET, RUBBER_PISTON, SlimefunItems.PLASTIC_SHEET + }).register(em); + } } diff --git a/src/main/java/me/lucasgithuber/elementmanipulation/utils/Categories.java b/src/main/java/me/lucasgithuber/elementmanipulation/utils/Categories.java index e948159..839532a 100644 --- a/src/main/java/me/lucasgithuber/elementmanipulation/utils/Categories.java +++ b/src/main/java/me/lucasgithuber/elementmanipulation/utils/Categories.java @@ -61,10 +61,10 @@ public class Categories { public static void setup(ElementManipulation em){ JUNCTION_CATEGORY.register(em); - /*DRUGS_CATEGORY.register(em);*/ + DRUGS_CATEGORY.register(em); MAIN.register(em); JUNCTION_CHEAT.register(em); - /*DRUGS_CHEAT.register(em);*/ + DRUGS_CHEAT.register(em); } }