Skip to content

Commit

Permalink
Added Chisel
Browse files Browse the repository at this point in the history
Added Electric Explosive tools
Added Electric Shearer
Added Bad Omen potion
Added Notch apple craft
  • Loading branch information
Bunnky committed Nov 4, 2024
1 parent a7d8478 commit c8f2132
Show file tree
Hide file tree
Showing 8 changed files with 497 additions and 7 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,31 @@

>[!IMPORTANT]
> Some items have configuration options for Admins. I highly suggest looking over the `items.yml` once installed to see what kind of options are available. Since IDoE might not suit every server, be sure to configure the plugin to meet your specific needs!
## Special thanks to the people who made suggestions!
<details>
<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]
> - **hellex7769** - "What would be nice is to have a machine that can strip all wood types for automating other machines." [Electric Log Stripper]
> - **energized36** - "Add Electric Smokers and Blast Furnaces. (We have normal Electric Furnaces, why are Smokers and Blast Furnaces not a thing?)" [Electric Blast Furnace & Electric Smoker]
> - **nyctophilio01** - "Add a obsidian boat to extra utilities, crafted like a oak boat but use obsidian and 1 electric motor; this item would be used to traverse over lava eazy" [Lava Boat]
> - **cromecloridethecheese** - "Electric cable, that could damage players and mobs that touch it when powered. Recipe could be energy connector surrounded with chains." [Electric Cable]
> - **TheBusyBiscuit** - "An electric machine that automatically shears sheep in a small radius." [Electric Shearer]
> - **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]
</details>
## Items
### Tools
Expand All @@ -35,6 +43,10 @@
- **Magnetoid**: An offhand device that attracts nearby items to itself, similarly to the Infused Magnet. Configurable radius.
- **Trim Vault**: A crafted block that players can place and break to obtain a Trim item. Includes Netherite Smithing template.
- **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.
- **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 @@ -48,6 +60,7 @@ Idols are powerful, combined versions of Slimefun talismans that apply the same
- **Electric Blast Furnace**: An electric version of the Blast Furnace.
- **Electric Log Stripper**: Transforms logs into stripped wood.
- **Electric Smoker**: An electric version of the Smoker.
- **Electric Shearer**: A machine that automatically shears sheep nearby. Range: 4
- **Player Hopper**: A convenient drop-off point for players to store items easily. Standing on top of the Player Hopper will pull items out of your inventory, excluding armor and offhand items.
- **Supply Hopper**: A convenient pickup point for players to retrieve items easily. Standing under the Supply Hopper will put items from the hopper into your inventory.
- **Electric Cable**: A cable that deals damage to players and mobs upon contact when powered.
Expand Down
59 changes: 59 additions & 0 deletions src/main/java/me/bunnky/idreamofeasy/slimefun/items/Chisel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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.attributes.Rechargeable;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.libraries.dough.protection.Interaction;
import me.bunnky.idreamofeasy.utils.ChiselConverter;
import me.bunnky.idreamofeasy.utils.IDOEUtility;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;

import java.util.Optional;

public class Chisel extends SlimefunItem implements Rechargeable {

private final float cap;
private static final float COST = 2.5F;

public Chisel(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, float cap) {
super(itemGroup, item, recipeType, recipe);
this.cap = cap;
IDOEUtility.setGlow(item);

addItemHandler((ItemUseHandler) e -> {
e.cancel();

final Optional<Block> optional = e.getClickedBlock();
if (optional.isPresent()) {
final Block b = optional.get();

if (!(Slimefun.getProtectionManager().hasPermission(e.getPlayer(), b.getLocation(), Interaction.INTERACT_BLOCK))) {
return;
}

Material stoneCutterResult = ChiselConverter.convert(b.getType());

if (stoneCutterResult != b.getType() && removeItemCharge(e.getItem(), COST) && !BlockStorage.hasBlockInfo(b.getLocation())) {
b.setType(stoneCutterResult);

b.getWorld().playSound(b.getLocation(), Sound.BLOCK_SNIFFER_EGG_PLOP, 0.5F, 5.0F);
b.getWorld().spawnParticle(Particle.SCRAPE, b.getLocation().add(0.5, 0.5, 0.5), 5, 0.5, 0.5, 0.5, 0.1);
}
}
});
}

@Override
public float getMaxItemCharge(ItemStack itemStack) {
return cap;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package me.bunnky.idreamofeasy.slimefun.items;

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.Rechargeable;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.ExplosivePickaxe;
import me.bunnky.idreamofeasy.utils.IDOEUtility;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;


public class ElectricExplosivePickaxe extends ExplosivePickaxe implements Rechargeable {

private final float cap;
private static final float COST = 0.3F;

public ElectricExplosivePickaxe(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, float cap) {
super(itemGroup, item, recipeType, recipe);
IDOEUtility.setGlow(item);
this.cap = cap;
addItemHandler(onRightClick());
}

public ItemUseHandler onRightClick() {
return PlayerRightClickEvent::cancel;
}

@Override
public @NotNull ToolUseHandler getItemHandler() {
return (e, tool, fortune, drops) -> {
Player p = e.getPlayer();
ItemStack itemInHand = p.getInventory().getItemInMainHand();

if (!removeItemCharge(itemInHand, COST)) {
e.setCancelled(true);
return;
}

super.getItemHandler().onToolUse(e, tool, fortune, drops);
};
}

@Override
public float getMaxItemCharge(ItemStack itemStack) {
return cap;
}

@Override
protected boolean canBreak(@NotNull Player p, @NotNull Block b) {
ItemStack itemInHand = p.getInventory().getItemInMainHand();
return removeItemCharge(itemInHand, COST) && super.canBreak(p, b);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package me.bunnky.idreamofeasy.slimefun.items;

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.Rechargeable;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.ToolUseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.ExplosiveShovel;
import me.bunnky.idreamofeasy.utils.IDOEUtility;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;


public class ElectricExplosiveShovel extends ExplosiveShovel implements Rechargeable {

private final float cap;
private static final float COST = 0.3F;

public ElectricExplosiveShovel(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, float cap) {
super(itemGroup, item, recipeType, recipe);
IDOEUtility.setGlow(item);
this.cap = cap;
addItemHandler(onRightClick());
}

public ItemUseHandler onRightClick() {
return PlayerRightClickEvent::cancel;
}

@Override
public @NotNull ToolUseHandler getItemHandler() {
return (e, tool, fortune, drops) -> {
Player p = e.getPlayer();
ItemStack itemInHand = p.getInventory().getItemInMainHand();

if (!removeItemCharge(itemInHand, COST)) {
e.setCancelled(true);
return;
}

super.getItemHandler().onToolUse(e, tool, fortune, drops);
};
}

@Override
public float getMaxItemCharge(ItemStack itemStack) {
return cap;
}

@Override
protected boolean canBreak(@NotNull Player p, @NotNull Block b) {
ItemStack itemInHand = p.getInventory().getItemInMainHand();
return removeItemCharge(itemInHand, COST) && super.canBreak(p, b);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Damageable;
Expand Down Expand Up @@ -121,6 +122,7 @@ private void damage(Location loc, Entity entity) {
dir.setY(0.3);
entity.setVelocity(dir);

loc.getWorld().playSound(loc, Sound.ENTITY_ARROW_HIT, 0.5F, 5.0F);
loc.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, loc.add(0.5, 0.5, 0.5), 10, 0.3, 0.3, 0.3, 0.1);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package me.bunnky.idreamofeasy.slimefun.machines;

import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
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.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import me.bunnky.idreamofeasy.IDreamOfEasy;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Sheep;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;

public class ElectricShearer extends SlimefunItem implements EnergyNetComponent {
private final int cap;
private final int ecost;

public ElectricShearer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, int ecost, int cap, int range) {
super(itemGroup, item, recipeType, recipe);
this.cap = cap;
this.ecost = ecost;

addItemHandler(onRightClick());

addItemHandler(new BlockTicker() {
@Override
public boolean isSynchronized() {
return false;
}

@Override
public void tick(Block b, SlimefunItem sfItem, Config config) {
shearSheep(b.getLocation(), range);
}
});
}


private void shearSheep(Location loc, int range) {
Bukkit.getScheduler().runTask(IDreamOfEasy.getInstance(), () -> {
for (Entity entity : loc.getNearbyEntities(range, range, range)) {
if (entity.getType() == EntityType.SHEEP) {
if (entity.getLocation().distance(loc) <= range) {
Sheep sheep = (Sheep) entity;
if (!sheep.isSheared()) {
sheep.setSheared(true);

Material woolMaterial = Material.valueOf(sheep.getColor().name() + "_WOOL");
ItemStack wool = new ItemStack(woolMaterial, 1);

entity.getWorld().dropItemNaturally(entity.getLocation(), wool);

Location sheepLocation = sheep.getLocation();
sheep.getWorld().spawnParticle(Particle.CLOUD, sheepLocation, 20, 0.5, 0.5, 0.5, 0.1);
sheep.getWorld().playSound(sheepLocation, Sound.ENTITY_SHEEP_SHEAR, 1.0F, 1.0F);
}
}
}
}
});
}

public @Nonnull BlockUseHandler onRightClick() {
return PlayerRightClickEvent::cancel;
}

@Override
public @NotNull EnergyNetComponentType getEnergyComponentType() {
return EnergyNetComponentType.CONSUMER;
}

@Override
public int getCapacity() {
return this.cap;
}
}
Loading

0 comments on commit c8f2132

Please sign in to comment.