From 3bca487dbcf708378e7bd4a30781ab75406143b8 Mon Sep 17 00:00:00 2001 From: B1G-FUNGUS Date: Fri, 1 Oct 2021 20:05:27 -0700 Subject: [PATCH] HEROBRINE (prototype) so scary! --- .../top/penowl/quidproquo/QuidProQuo.java | 1 + .../quidproquo/rituals/HerobrineRitual.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/main/java/top/penowl/quidproquo/rituals/HerobrineRitual.java diff --git a/src/main/java/top/penowl/quidproquo/QuidProQuo.java b/src/main/java/top/penowl/quidproquo/QuidProQuo.java index 778a2e0..16036e7 100644 --- a/src/main/java/top/penowl/quidproquo/QuidProQuo.java +++ b/src/main/java/top/penowl/quidproquo/QuidProQuo.java @@ -43,6 +43,7 @@ public class QuidProQuo extends JavaPlugin { rituals.add(new FillerRitual()); rituals.add(new LavaRitual()); rituals.add(new HitRitual()); + rituals.add(new HerobrineRitual()); // run ritual setup scripts for (Ritual ritual : rituals) { diff --git a/src/main/java/top/penowl/quidproquo/rituals/HerobrineRitual.java b/src/main/java/top/penowl/quidproquo/rituals/HerobrineRitual.java new file mode 100644 index 0000000..f3fb5b4 --- /dev/null +++ b/src/main/java/top/penowl/quidproquo/rituals/HerobrineRitual.java @@ -0,0 +1,46 @@ +package top.penowl.quidproquo.rituals; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.EntityType; + +import top.penowl.quidproquo.Ritual; + +public class HerobrineRitual extends Ritual { + + @Override + public void setup() { + addIngredient(Material.WHEAT, 64); + addIngredient(Material.DIAMOND, 2); + health = 10; + name = "herobrine"; + backfire = 0.5; + } + @Override + public void execute(Player caster, Player target, Location location) { + Location targetLocation = target.getLocation(); + double targX = targetLocation.getX(); + double targY = targetLocation.getY(); + double targZ = targetLocation.getZ(); + World world = targetLocation.getWorld(); + boolean foundSpawnLoc = false; + Location spawnLoc; + for(int direction = 0; direction < 16; direction ++) { + double rads = Math.toRadians(direction * 24); + double testX = targX + 20 * Math.sin(rads); + double testZ = targY + 20 * Math.cos(rads); + if((new Location(world, testX, targY, testZ).getBlock().getType() == Material.AIR) && + (new Location(world, testX, targY + 1, testZ).getBlock().getType() == Material.AIR)) { + spawnLoc = new Location(world, testX, targY, testZ); + foundSpawnLoc = true; + world.spawnEntity(spawnLoc, EntityType.ZOMBIE); + break; + } + } + if(foundSpawnLoc == false) + world.spawnEntity(new Location(world, targX, targY, targZ), EntityType.ZOMBIE); + } + +}