Skip to content

Commit

Permalink
Merge pull request #164 from Dingsel/development
Browse files Browse the repository at this point in the history
Improved BlockPlacingFlowers.java
  • Loading branch information
bowser0000 authored Mar 25, 2024
2 parents ddd7196 + d2a1857 commit 4352446
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/main/java/me/Danker/features/BlockPlacingFlowers.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ public class BlockPlacingFlowers {
Blocks.double_plant
));

ArrayList<String> flowerWeapons = new ArrayList<>(Arrays.asList(
"Flower of Truth",
"Spirit Sceptre",
"Bouquet of Lies",
"Fire Freeze Staff"
));

@SubscribeEvent
public void onInteract(PlayerInteractEvent event) {
if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return;
Expand All @@ -30,22 +37,16 @@ public void onInteract(PlayerInteractEvent event) {

if (ModConfig.flowerWeapons && event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock();

if (flowerPlaceable.contains(block)) {
if (item.getDisplayName().contains("Flower of Truth")) {
event.setCanceled(true);
}
if (item.getDisplayName().contains("Spirit Sceptre")) {
event.setCanceled(true);
}
if (item.getDisplayName().contains("Bouquet of Lies")) {
event.setCanceled(true);
}
if (item.getDisplayName().contains("Fire Freeze Staff")) {
event.setCanceled(true);
Block blockUnder = Minecraft.getMinecraft().theWorld.getBlockState(event.pos.down().offset(event.face)).getBlock();

if (flowerPlaceable.contains(block) || flowerPlaceable.contains(blockUnder)) {
for (String weapon : flowerWeapons) {
if(item.getDisplayName().contains(weapon)){
event.setCanceled(true);
break;
}
}
}
}
}

}
}

0 comments on commit 4352446

Please sign in to comment.