From db0aeeabbdf96c2dfcee70b7b5f09fb8135f3926 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Thu, 19 Aug 2021 11:28:30 +0200 Subject: [PATCH] Shift --- .../volmit/iris/core/decrees/DecObject.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/com/volmit/iris/core/decrees/DecObject.java b/src/main/java/com/volmit/iris/core/decrees/DecObject.java index a70ab1703..f1adb831c 100644 --- a/src/main/java/com/volmit/iris/core/decrees/DecObject.java +++ b/src/main/java/com/volmit/iris/core/decrees/DecObject.java @@ -341,4 +341,30 @@ public class DecObject implements DecreeExecutor { sender().playSound(Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f); sender().sendMessage(C.GREEN + "Successfully object to saved: " + dimension.getLoadKey() + "/objects/" + name); } + + @Decree(description = "Shift a selection in your looking direction", aliases = "-") + public void shift( + @Param(description = "The amount to shift by", defaultValue = "1") + int amount + ){ + if (!WandSVC.isHoldingWand(player())) { + sender().sendMessage("Hold your wand."); + return; + } + + Location[] b = WandSVC.getCuboid(player().getInventory().getItemInMainHand()); + Location a1 = b[0].clone(); + Location a2 = b[1].clone(); + Direction d = Direction.closest(player().getLocation().getDirection()).reverse(); + a1.add(d.toVector().multiply(amount)); + a2.add(d.toVector().multiply(amount)); + Cuboid cursor = new Cuboid(a1, a2); + b[0] = cursor.getLowerNE(); + b[1] = cursor.getUpperSW(); + player().getInventory().setItemInMainHand(WandSVC.createWand(b[0], b[1])); + player().updateInventory(); + sender().playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f); + } + + }