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

🐛 Use shears on glow berries #9

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/) and this

### Fixed

- Now uses shears on glow berries

### Security

## [1.0.11] - 2023-06-07
Expand Down
43 changes: 23 additions & 20 deletions src/main/java/com/natoboram/switcheroo/BlockSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import net.minecraft.block.BambooBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CaveVinesBodyBlock;
import net.minecraft.block.CaveVinesHeadBlock;
import net.minecraft.block.CobwebBlock;
import net.minecraft.block.CropBlock;
import net.minecraft.block.LeavesBlock;
Expand Down Expand Up @@ -81,8 +83,9 @@ public ActionResult interact(final PlayerEntity player, final World world, final
tools.add(stack);
} else {

// Use shears on cobwebs, leaves and plants
if (block instanceof CobwebBlock || block instanceof LeavesBlock || block instanceof PlantBlock)
// Use shears on glow berries, cobwebs, leaves and plants
if (block instanceof CaveVinesBodyBlock || block instanceof CaveVinesHeadBlock || block instanceof CobwebBlock
|| block instanceof LeavesBlock || block instanceof PlantBlock)
for (final ItemStack stack : inventory.main)
if (stack.getItem() instanceof ShearsItem)
tools.add(stack);
Expand Down Expand Up @@ -162,15 +165,15 @@ private boolean isBlacklisted(final Block block, final SwitcherooConfig config)

for (final String blacklisted : blacklist) {
switch (blacklisted.split(":").length) {
case 1:
if (id.toString().equals("minecraft:" + blacklisted))
return true;
break;
case 2:
default:
if (id.toString().equals(blacklisted))
return true;
break;
case 1:
if (id.toString().equals("minecraft:" + blacklisted))
return true;
break;
case 2:
default:
if (id.toString().equals(blacklisted))
return true;
break;
}
}

Expand All @@ -183,15 +186,15 @@ private boolean preferSilkTouch(final Block block, final SwitcherooConfig config

for (final String blockId : blocks) {
switch (blockId.split(":").length) {
case 1:
if (id.toString().equals("minecraft:" + blockId))
return true;
break;
case 2:
default:
if (id.toString().equals(blockId))
return true;
break;
case 1:
if (id.toString().equals("minecraft:" + blockId))
return true;
break;
case 2:
default:
if (id.toString().equals(blockId))
return true;
break;
}
}

Expand Down