Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved BlockPlacingFlowers.java #164

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}
}
}

}
}
Loading