Skip to content

Commit

Permalink
Removed Enchanted Golden Apple
Browse files Browse the repository at this point in the history
Added Creative Transmitter/Capacitor/Generator
Added Electric Poison Extractor
Added Slime Meal
Added Alarm Clock
Some electric machines now show recipe inputs and outputs in the guide
Fixed a couple typos
  • Loading branch information
Bunnky committed Nov 8, 2024
1 parent c8f2132 commit 6f26cf5
Show file tree
Hide file tree
Showing 8 changed files with 404 additions and 23 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<summary><h2>Special thanks to the people who made suggestions!</h2></summary>
> - **inaxtrawetrust** - "A machine that stops Radiation damage in an area" [Radiation Absorber]
> - Note: This was also designed because of so many reports of Radiation griefing!
> - Note: This was also designed because of so many reports of Radiation griefing!
> - **林alguém林 有人** - "Biome finding compass a compass that points to the direction of a biome you choose on it, every biome has a different cost like xp or idk what item" [Biome Compass]
> - **Marvi444[Ger]** - "a player hopper. works like a normal hopper but it puts its items in your inventory instead when you stand under it" [Player Hopper],[Supply Hopper]
> - **JustAHuman** - "Create A Slime Totem of sorts that when constructed (if its a multiblock) or placed (if its a player head) inside of a slime chunk No slimes will spawn in it, could also have one that does the opposite and causes a chunk to spawn slimes" - [Mob Repeller]
> - Note: I haven't added the second part of the suggestion, however I've extended the idea to other mobs!
> - Note: I haven't added the second part of the suggestion, however I've extended the idea to other mobs!
> - **AverageUnusualUser** - "Shift + Right clicking while holding infused magnet will toggle "Shift" and "Always" mode, "shift" mode is the infused magnet we know, "always" mode will always attract nearby items without having to press shift as long as the infused magnet is in the inventory, or maybe made it into a separate item in a addon, could be usefull for clearing large area of items without having to slow down because of sneaking" [Magnetoid]
> - Note: The Magnetoid was designed previously by me for STB. It's functionality compared to the Infused Magnet was too good to not re-design!
> - Note: The Magnetoid was designed previously by me for STB. It's functionality compared to the Infused Magnet was too good to not re-design!
> - **deserdoo** - "Add a recipe for the 1.20 armor trims. Currently the only way to upgrade your armor to netherite is to find a netherite armor upgrade in a bastion chest. Add some way to craft the upgrade, maybe with magic stuff like a fire rune" [Trim Vault]
> - **oah** - "Ender talismans take up a ton of room in the enderchest, how about a 'multiEnderTalisman'?" [Idols]
> - **elitemastereric** - "A variant of the Industrial Miner, which targets all stone and dirt as well as ores. This would essentially allow it to act as a full quarry, which clears out an area until reaching bedrock." [Terrabore]
Expand All @@ -31,8 +31,13 @@
> - **kohlth** - "chisel: right click any block with pillar/chiseled forms to swap between its chiseled, pillar, smooth, and normal forms (basically a portable stone cutter?)" [Chisel]
> - **TheBusyBiscuit** - "An Electric Explosive Pickaxe that consumes power instead of durability." [Electric Explosive Pickaxe/Shovel]
> - **bird** - "Potion of Bad Omen: Drink to acquire one level of Bad Omen. Could even require an ominous banner to craft. Useful for when there is no/inaccessible outpost and patrols are hard to come by." [Bad Omen Potion]
> - Note: I did not use the Ominous Banner as an ingrediant due to complications with banner "designing" for recipe usage.
> - **punished_Garett** - "Make notch apple be craftable in advanced crafting table (multiblock: crafting table on dispenser)." [Enchanted Golden Apple]
> - Note: I did not use the Ominous Banner as an ingrediant due to complications with banner "designing" for recipe usage.
> - **BurningBrimstone** - ""Creative Energy Source", "Creative Transmitter", and "Creative Capacitor" Items retrieved from /sf cheat that give "infinite" energy, gps complexity, and energy storage. Would be useful for testing. (Infinite probably being a convenient power of 2)" [Creative Transmitter/Capacitor/Generator]
> - Note: The word "infinite" isn't actually infinite, like BurningBrimstone mentions. This is simply a java limit!
> - **TheBusyBiscuit** - "An Electric Poison Extractor. You insert a glass bottle and something poisonous to get a vial/potion of poison. That "something" could be one of the following: 1 Posionous Potato, 1 Pufferfish, 2 Spider Eyes, 8 Rotten Flesh, 4 Mushrooms?" [Electric Poison Extractor]
> - **Monster_Engineer** - "Slime Bonemeal - a slimeball surrounded by bonemeal, when thrown onto a slime will increase its size." [Slime Meal]
> - **TheBusyBiscuit** - "What about an alarm clock or a timer item which you can right click to set the alarm..." [Alarm Clock]
> - Note: There's alot more to this suggestion including reminder text and a placeable version. Those will come in the future!
</details>
## Items
Expand All @@ -45,8 +50,9 @@
- **Wister Shears**: The Wister Shears can shear certain mobs and efficiently clear leaves from trees, grass, and other foliage. When used on a mob, it provides unique drops based on the creature.
- **Chisel**: A tool to Chisel certain blocks, changing their form instantly. Mostly based off Stone cutter recipes.
- **Electric Pickaxe and Shovel**: Electric versions of the Explosive Pickaxe and Shovel. Stops working if there is no charge.
- **Slime Meal**: A Slime's favorite food! Use this on slimes to grow them instantly. Can be used to make super slimes.
- **Alarm Clock**: A simple timer that will "ding" when the set timer is up. Toggle alarm mode for continuous dings.
- **Bad Omen Potion**: A craftable potion that gives the Bad Omen effect. Useful if Pillager Outposts aren't reachable.
- **Enchanted Golden Apple**: A craftable Notch apple.
### Idols
Idols are powerful, combined versions of Slimefun talismans that apply the same effects as the talismans used to create them. They only work from your inventory—Ender Chest compatibility isn’t available yet! Idols are fireproof and never consumed.
- **Flameheart**: The Flameheart Idol provides benefits in combat and fire-related situations. When the player is in contact with lava or fire, there is a 20% chance to gain Fire Resistance for 10 seconds. Additionally, when attacked by non-player entities, the Flameheart Idol offers a 20% chance to grant Strength III for 10 seconds, and a 30% chance to grant Regeneration I for 5 seconds.
Expand All @@ -67,6 +73,10 @@ Idols are powerful, combined versions of Slimefun talismans that apply the same
- **Radiation Absorber**: Protect yourself from harmful radiation without the need of a Hazmat suit. This device absorbs radiation in a radius, granting players temporary immunity while powered.
- **Stack Dispenser**: A dispenser that tries to automatically dispenses items in stacks.
- **Mob Repellers**: Electric devices that prevent specific mobs from spawning in a chunk. Mobs include Bat, Creeper, Enderman, Skeleton, Slime, Spider, Witch, Zombie, and Zombie Villager.
### Admin/Cheated Items
- **Creative Transmitter**: A creative GPS transmitter that provides almost infinite complexity.
- **Creative Capacitor**: A creative capacitor that holds almost infinite energy.
- **Creative Generator**: A creative generator produces almost infinite energy.


## :headphones: Discord Support Server
Expand Down
137 changes: 137 additions & 0 deletions src/main/java/me/bunnky/idreamofeasy/slimefun/items/AlarmClock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package me.bunnky.idreamofeasy.slimefun.items;

import io.github.bakedlibs.dough.chat.ChatInput;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import me.bunnky.idreamofeasy.IDreamOfEasy;
import me.bunnky.idreamofeasy.utils.IDOEUtility;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;

import java.util.HashMap;
import java.util.UUID;

public class AlarmClock extends SlimefunItem {

private final HashMap<UUID, Long> playerTimers = new HashMap<>();
private final HashMap<UUID, Boolean> alarmMode = new HashMap<>();
private final HashMap<UUID, BukkitRunnable> alarmTasks = new HashMap<>();

public AlarmClock(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
IDOEUtility.setGlow(item);

addItemHandler(onUse());
}

private ItemUseHandler onUse() {
return e -> {
Player p = e.getPlayer();
UUID playerId = p.getUniqueId();
cancelAlarm(playerId);

if (p.isSneaking()) {
boolean isAlarmMode = alarmMode.getOrDefault(playerId, false);
alarmMode.put(playerId, !isAlarmMode);

if (!alarmMode.get(playerId)) {
cancelAlarm(playerId);
p.sendMessage("§cAlarm mode is now disabled.");
} else {
p.sendMessage("§aAlarm mode enabled.");
}
} else {
p.sendMessage("§aEnter timer length in seconds");

ChatInput.waitForPlayer(IDreamOfEasy.getInstance(), p, msg -> {
try {
long duration = Long.parseLong(msg) * 1000;
long endTime = System.currentTimeMillis() + duration;
playerTimers.put(playerId, endTime);
p.sendMessage("§eTimer set for §f" + duration / 1000 + "§es.");
startTimer(p);
} catch (NumberFormatException ex) {
p.sendMessage("§cInvalid input. Please enter a valid number in seconds.");
}
});
}
};
}

private void startTimer(Player player) {
UUID playerId = player.getUniqueId();

new BukkitRunnable() {
@Override
public void run() {
Long endTime = playerTimers.get(playerId);
if (endTime == null) {
return;
}

long remainingTime = endTime - System.currentTimeMillis();

if (remainingTime <= 0) {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0f, 2.0f);

Bukkit.getScheduler().runTaskLater(IDreamOfEasy.getInstance(), () -> {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0f, 1.5f);
}, 2L);

Bukkit.getScheduler().runTaskLater(IDreamOfEasy.getInstance(), () -> {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0f, 1.0f);
}, 4L);

playerTimers.remove(playerId);
this.cancel();
player.sendMessage("§eTime's up!");

if (alarmMode.getOrDefault(playerId, false)) {
startAlarmTask(player.getUniqueId());
}
}
}
}.runTaskTimer(IDreamOfEasy.getInstance(), 0, 0);
}

private void startAlarmTask(UUID playerId) {
BukkitRunnable alarmTask = new BukkitRunnable() {
@Override
public void run() {
if (alarmMode.getOrDefault(playerId, false)) {
Player player = Bukkit.getPlayer(playerId);
if (player != null) {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0f, 2.0f);

Bukkit.getScheduler().runTaskLater(IDreamOfEasy.getInstance(), () -> {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0f, 1.5f);
}, 2L);

Bukkit.getScheduler().runTaskLater(IDreamOfEasy.getInstance(), () -> {
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BELL, 1.0f, 1.0f);
}, 4L);

}
} else {
this.cancel();
}
}
};
alarmTask.runTaskTimer(IDreamOfEasy.getInstance(), 0, 10);
alarmTasks.put(playerId, alarmTask);
}

private void cancelAlarm(UUID playerId) {
BukkitRunnable task = alarmTasks.get(playerId);
if (task != null) {
task.cancel();
alarmTasks.remove(playerId);
}
}
}
41 changes: 41 additions & 0 deletions src/main/java/me/bunnky/idreamofeasy/slimefun/items/SlimeMeal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package me.bunnky.idreamofeasy.slimefun.items;

import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import me.bunnky.idreamofeasy.utils.IDOEUtility;
import org.bukkit.GameMode;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

public class SlimeMeal extends SlimefunItem {

public SlimeMeal(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
addItemHandler(onUse());
IDOEUtility.setGlow(item);
}

private ItemUseHandler onUse() {
return e -> {
PlayerInteractEvent event = e.getInteractEvent();
Player p = event.getPlayer();
Entity entity = p.getTargetEntity(5);

if (entity != null && entity.getType() == EntityType.SLIME) {
Slime slime = (Slime) entity;
int newSize = Math.min(slime.getSize() + 1, 20);
slime.setSize(newSize);
if (p.getGameMode() == GameMode.SURVIVAL) {
event.getItem().setAmount(event.getItem().getAmount() - 1);
}
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotHopperable;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import org.bukkit.Bukkit;
import org.bukkit.Material;
Expand All @@ -16,7 +17,7 @@
/*
An efficient furnace that uses electricity to blast ores and materials into refined items quickly.
*/
public class ElectricBlastFurnace extends AContainer implements NotHopperable {
public class ElectricBlastFurnace extends AContainer implements NotHopperable, RecipeDisplayItem {

public ElectricBlastFurnace(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotHopperable;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
Expand All @@ -12,7 +13,7 @@
Transforms logs into stripped wood, enhancing your building options.
*/

public class ElectricLogStripper extends AContainer implements NotHopperable {
public class ElectricLogStripper extends AContainer implements NotHopperable, RecipeDisplayItem {

public ElectricLogStripper(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package me.bunnky.idreamofeasy.slimefun.machines;

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.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class ElectricPoisonExtractor extends AContainer implements RecipeDisplayItem {

public ElectricPoisonExtractor(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
}

@Override
protected void registerDefaultRecipes() {
registerRecipe(4, new ItemStack[] { new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.POISONOUS_POTATO) }, new ItemStack[] { createPoisonPotion(PotionType.STRONG_POISON) });
registerRecipe(6, new ItemStack[] { new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.PUFFERFISH) }, new ItemStack[] { createPoisonPotion(PotionType.LONG_POISON) });
registerRecipe(6, new ItemStack[] { new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.SPIDER_EYE, 2) }, new ItemStack[] { createPoisonPotion(PotionType.POISON) });
registerRecipe(8, new ItemStack[] { new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.ROTTEN_FLESH, 8) }, new ItemStack[] { createPoisonPotion(PotionType.POISON) });
registerRecipe(4, new ItemStack[] { new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.RED_MUSHROOM, 4) }, new ItemStack[] { createPoisonPotion(PotionType.POISON) });
registerRecipe(4, new ItemStack[] { new ItemStack(Material.GLASS_BOTTLE), new ItemStack(Material.BROWN_MUSHROOM, 4) }, new ItemStack[] { createPoisonPotion(PotionType.POISON) });
}

private ItemStack createPoisonPotion(PotionType type) {
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();

if (potionMeta != null) {
switch (type) {
case LONG_POISON:
potionMeta.setBasePotionType(PotionType.LONG_POISON);
break;
case STRONG_POISON:
potionMeta.setBasePotionType(PotionType.STRONG_POISON);
break;
default:
potionMeta.setBasePotionType(PotionType.POISON);
break;
}

potion.setItemMeta(potionMeta);
}

return potion;
}

@Override
public List<ItemStack> getDisplayRecipes() {
List<ItemStack> displayRecipes = new ArrayList<>(recipes.size() * 2);

for (MachineRecipe recipe : recipes) {
displayRecipes.add(recipe.getInput()[recipe.getInput().length - 1]);
displayRecipes.add(recipe.getOutput()[0]);
}

return displayRecipes;
}

@Override
public ItemStack getProgressBar() {
return createPoisonPotion(PotionType.POISON);
}

@Override
public @NotNull String getMachineIdentifier() {
return "IDOE_ELECTRIC_POISON_EXTRACTOR";
}
}
Loading

0 comments on commit 6f26cf5

Please sign in to comment.