diff --git a/CHANGELOG.md b/CHANGELOG.md index 432179c2a..ce0d2d742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ * Compatibility mode status is now included in /sf versions * Added Nether Quartz Ore Crusher Recipe * Added a new language: Tagalog +* Added Magical Zombie Pills #### Changes * Coolant Cells now last twice as long diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java index 8dcb748c5..bb0a7e67b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java @@ -328,7 +328,7 @@ public final class SlimefunItems { public static final SlimefunItemStack ENDER_LUMP_2 = new SlimefunItemStack("ENDER_LUMP_2", Material.GOLD_NUGGET, "&5Ender Lump &7- &eII", "", "&c&oTier: II"); public static final SlimefunItemStack ENDER_LUMP_3 = new SlimefunItemStack("ENDER_LUMP_3", Material.GOLD_NUGGET, "&5Ender Lump &7- &eIII", "", "&c&oTier: III"); public static final SlimefunItemStack MAGICAL_BOOK_COVER = new SlimefunItemStack("MAGICAL_BOOK_COVER", Material.PAPER, "&6Magical Book Cover", "", "&a&oUsed for various Magic Books"); - public static final SlimefunItemStack MAGIC_PILLS = new SlimefunItemStack("MAGIC_PILLS", Material.NETHER_WART, "&cMagic Pills", "", "&a&oUsed to cure zombie villagers instantly"); + public static final SlimefunItemStack MAGICAL_ZOMBIE_PILLS = new SlimefunItemStack("MAGICAL_ZOMBIE_PILLS", Material.NETHER_WART, "&6Magical Zombie Pills", "", "&eRight Click &7a Zombified Villager to", "&7instantly cure it from its curse"); public static final SlimefunItemStack BASIC_CIRCUIT_BOARD = new SlimefunItemStack("BASIC_CIRCUIT_BOARD", Material.ACTIVATOR_RAIL, "&bBasic Circuit Board"); public static final SlimefunItemStack ADVANCED_CIRCUIT_BOARD = new SlimefunItemStack("ADVANCED_CIRCUIT_BOARD", Material.POWERED_RAIL, "&bAdvanced Circuit Board"); public static final SlimefunItemStack WHEAT_FLOUR = new SlimefunItemStack("WHEAT_FLOUR", Material.SUGAR, "&rWheat Flour"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicPills.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java similarity index 74% rename from src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicPills.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java index 3d30b3b9f..34f89f505 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicPills.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/MagicalZombiePills.java @@ -19,15 +19,18 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** * This {@link SlimefunItem} allows you to convert any {@link ZombieVillager} to * their {@link Villager} variant. It is also one of the very few utilisations of {@link EntityInteractHandler}. + * + * This item does not work on earlier versions than 1.14 as the {@link ZombieVillager} {@link EntityType} + * did not exist back then. * * @author Linox * * @see EntityInteractHandler * */ -public class MagicPills extends SimpleSlimefunItem { +public class MagicalZombiePills extends SimpleSlimefunItem { - public MagicPills(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) { + public MagicalZombiePills(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) { super(category, item, recipeType, recipe, recipeOutput); } @@ -40,14 +43,10 @@ public class MagicPills extends SimpleSlimefunItem { p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 1); ZombieVillager zombieVillager = (ZombieVillager) entity; - if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) { - zombieVillager.setConversionTime(1); - if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { - zombieVillager.setConversionPlayer(p); - } + zombieVillager.setConversionTime(1); - } else { - zombieVillager.setVillager(true); + if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { + zombieVillager.setConversionPlayer(p); } } }; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/PlayerInteractEntityListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/PlayerInteractEntityListener.java index fd8e98e7c..64e4a6d4e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/PlayerInteractEntityListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/PlayerInteractEntityListener.java @@ -29,19 +29,22 @@ public class PlayerInteractEntityListener implements Listener { @EventHandler public void onInteractEntity(PlayerInteractAtEntityEvent e) { - - if (!e.getRightClicked().isValid()) return; + if (!e.getRightClicked().isValid()) { + return; + } ItemStack itemStack; + if (e.getHand() == EquipmentSlot.OFF_HAND) { itemStack = e.getPlayer().getInventory().getItemInOffHand(); - } else { + } + else { itemStack = e.getPlayer().getInventory().getItemInMainHand(); } - SlimefunItem sfItem = SlimefunItem.getByItem(itemStack); - if (sfItem == null) return; - if (Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) { + SlimefunItem sfItem = SlimefunItem.getByItem(itemStack); + + if (sfItem != null && Slimefun.hasUnlocked(e.getPlayer(), sfItem, true)) { sfItem.callItemHandler(EntityInteractHandler.class, handler -> handler.onInteract(e.getPlayer(), e.getRightClicked(), itemStack, e.getHand() == EquipmentSlot.OFF_HAND)); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java index 320fef9c3..bfce072fb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/ResearchSetup.java @@ -265,7 +265,7 @@ public final class ResearchSetup { register("tree_growth_accelerator", 256, "Faster Trees", 18, SlimefunItems.TREE_GROWTH_ACCELERATOR); register("industrial_miner", 95, "Industrial Mining", 28, SlimefunItems.INDUSTRIAL_MINER); register("advanced_industrial_miner", 98, "Better Mining", 36, SlimefunItems.ADVANCED_INDUSTRIAL_MINER); - register("magic_pills", 257, "De-Zombification", 22, SlimefunItems.MAGIC_PILLS); + register("magical_zombie_pills", 257, "De-Zombification", 22, SlimefunItems.MAGICAL_ZOMBIE_PILLS); } private static void register(String key, int id, String name, int defaultCost, ItemStack... items) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 7c0c797e5..d4361de5f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -121,7 +121,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.magical.InfusedMa import io.github.thebusybiscuit.slimefun4.implementation.items.magical.KnowledgeFlask; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.KnowledgeTome; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.MagicEyeOfEnder; -import io.github.thebusybiscuit.slimefun4.implementation.items.magical.MagicPills; +import io.github.thebusybiscuit.slimefun4.implementation.items.magical.MagicalZombiePills; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.SoulboundItem; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.SoulboundRune; import io.github.thebusybiscuit.slimefun4.implementation.items.magical.StormStaff; @@ -779,17 +779,18 @@ public final class SlimefunItemSetup { new StormStaff(categories.magicalGadgets, SlimefunItems.STAFF_STORM, RecipeType.ANCIENT_ALTAR, new ItemStack[] {SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE}) .register(plugin); + + ItemStack weaknessPotion = new ItemStack(Material.POTION); + PotionMeta meta = (PotionMeta) weaknessPotion.getItemMeta(); + meta.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false)); + weaknessPotion.setItemMeta(meta); + + new MagicalZombiePills(categories.magicalGadgets, SlimefunItems.MAGICAL_ZOMBIE_PILLS, RecipeType.MAGIC_WORKBENCH, + new ItemStack[] {new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.APPLE), weaknessPotion, new ItemStack(Material.APPLE), new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT)}, + new CustomItem(SlimefunItems.MAGICAL_ZOMBIE_PILLS, 2)) + .register(plugin); } - ItemStack magicPillsRecipePotion = new ItemStack(Material.POTION); - PotionMeta meta = (PotionMeta) magicPillsRecipePotion.getItemMeta(); - meta.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false)); - magicPillsRecipePotion.setItemMeta(meta); - new MagicPills(categories.magicalGadgets, SlimefunItems.MAGIC_PILLS, RecipeType.MAGIC_WORKBENCH, - new ItemStack[] {new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.APPLE), magicPillsRecipePotion, new ItemStack(Material.APPLE), new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT)}, - new CustomItem(SlimefunItems.MAGIC_PILLS, 4)) - .register(plugin); - new SmeltersPickaxe(categories.tools, SlimefunItems.SMELTERS_PICKAXE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null}) .register(plugin); diff --git a/src/main/resources/languages/messages_en.yml b/src/main/resources/languages/messages_en.yml index eb1fb046c..e0a84ce44 100644 --- a/src/main/resources/languages/messages_en.yml +++ b/src/main/resources/languages/messages_en.yml @@ -327,6 +327,7 @@ languages: ja: 'Japanese' fa: 'Persian' th: 'Thai' + tl: 'Tagalog' ro: 'Romanian' bg: 'Bulgarian' ko: 'Korean' @@ -335,4 +336,3 @@ languages: mk: 'Macedonian' sr: 'Serbian' be: 'Belarusian' - tl: 'Tagalog' diff --git a/src/main/resources/languages/researches_en.yml b/src/main/resources/languages/researches_en.yml index 744c95ffd..72ec016c0 100644 --- a/src/main/resources/languages/researches_en.yml +++ b/src/main/resources/languages/researches_en.yml @@ -233,4 +233,4 @@ slimefun: tree_growth_accelerator: Faster Trees industrial_miner: Industrial Mining advanced_industrial_miner: Better Mining - magic_pills: De-Zombification \ No newline at end of file + magical_zombie_pills: De-Zombification \ No newline at end of file