Skip to content

Commit

Permalink
✨ Use brush on suspicious blocks (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
NatoBoram authored May 26, 2024
1 parent 810a1a7 commit 15d562e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/) and this
### Added

- Now uses shears on vines
- Now uses brush on suspicious blocks

### Changed

Expand Down
13 changes: 11 additions & 2 deletions src/main/java/com/natoboram/switcheroo/BlockSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.block.BambooBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BrushableBlock;
import net.minecraft.block.CaveVinesBodyBlock;
import net.minecraft.block.CaveVinesHeadBlock;
import net.minecraft.block.CobwebBlock;
Expand All @@ -26,6 +27,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.AxeItem;
import net.minecraft.item.BrushItem;
import net.minecraft.item.HoeItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -77,8 +79,15 @@ public ActionResult interact(final PlayerEntity player, final World world, final
final ArrayList<ItemStack> tools = new ArrayList<ItemStack>();
final PlayerInventory inventory = player.getInventory();

// Use hoe on crops
if (block instanceof CropBlock) {
if (block instanceof BrushableBlock) {

// Use brush on suspicious blocks
for (final ItemStack stack : inventory.main)
if (stack.getItem() instanceof BrushItem)
tools.add(stack);
} else if (block instanceof CropBlock) {

// Use hoe on crops
for (final ItemStack stack : inventory.main)
if (stack.getItem() instanceof HoeItem)
tools.add(stack);
Expand Down

0 comments on commit 15d562e

Please sign in to comment.