aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/BlockPlacingFlowers.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/features/BlockPlacingFlowers.java')
-rw-r--r--src/main/java/me/Danker/features/BlockPlacingFlowers.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/BlockPlacingFlowers.java b/src/main/java/me/Danker/features/BlockPlacingFlowers.java
new file mode 100644
index 0000000..580c010
--- /dev/null
+++ b/src/main/java/me/Danker/features/BlockPlacingFlowers.java
@@ -0,0 +1,45 @@
+package me.Danker.features;
+
+import me.Danker.commands.ToggleCommand;
+import me.Danker.utils.Utils;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class BlockPlacingFlowers {
+
+ ArrayList<Block> flowerPlaceable = new ArrayList<>(Arrays.asList(
+ Blocks.grass,
+ Blocks.dirt,
+ Blocks.flower_pot,
+ Blocks.tallgrass,
+ Blocks.double_plant
+ ));
+
+ @SubscribeEvent
+ public void onInteract(PlayerInteractEvent event) {
+ if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return;
+ ItemStack item = event.entityPlayer.getHeldItem();
+ if (item == null) return;
+
+ if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
+ Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock();
+
+ if (flowerPlaceable.contains(block)) {
+ if (ToggleCommand.flowerWeaponsToggled && item.getDisplayName().contains("Flower of Truth")) {
+ event.setCanceled(true);
+ }
+ if (ToggleCommand.flowerWeaponsToggled && item.getDisplayName().contains("Spirit Sceptre")) {
+ event.setCanceled(true);
+ }
+ }
+ }
+ }
+
+}