From 5b9c8585100b0ef0ede02d4bff4dc7ab4e8f838e Mon Sep 17 00:00:00 2001 From: B1G-FUNGUS Date: Fri, 1 Oct 2021 23:14:51 -0700 Subject: [PATCH] Added the Hard Penor ritual Can only be created around caster. Snore. --- .../quidproquo/rituals/HardPenorRitual.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java b/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java index 1b0ab49..2ecb63b 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java @@ -1,8 +1,9 @@ package top.penowl.quidproquo.rituals; -//TODO MAKE COBBLESTONE PENOR THAT ONLY SPAWNS AROUND CASTER +//TODO TEST import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import top.penowl.quidproquo.Ritual; @@ -18,7 +19,35 @@ public class HardPenorRitual extends Ritual { @Override public void execute(Player caster, Player target, Location location) { - + Block shaft = caster.getLocation().getBlock(); + Block ball1 = shaft.getRelative(2, -1, 0); + Block ball2 = shaft.getRelative(-2,-1,0); + //TODO USE ELEGANT MATHEMATICS INSTEAD OF SCUFFED IF STATEMENTS + for(int d = 0; d < 8; d ++) { + int x = 0; + if(d < 3) x = 1; + if(d > 4) x = -1; + int z = 0; + if(d % 3 == 0) z = 1; + if(d % 3 == 1) z = -1; + for(int y = 0; y < 5; y++) { + Block changingBlock = shaft.getRelative(x,y,z); + if(changingBlock.getType() == Material.AIR) + changingBlock.setType(Material.COBBLESTONE); + } + } + for(int x = 0; x < 3; x ++) { + for(int y = 0; y < 3; y ++) { + for(int z = 0; z < 3; z ++) { + Block changingBlock1 = ball1.getRelative(x,y,z); + Block changingBlock2 = ball2.getRelative(x,y,z); + if(changingBlock1.getType() == Material.AIR) + changingBlock1.setType(Material.COBBLESTONE); + if(changingBlock2.getType() == Material.AIR) + changingBlock1.setType(Material.COBBLESTONE); + } + } + } } -} +} \ No newline at end of file