Better Farming module (crop farming improvements)#6417
Conversation
|
no break for the bottom block of cactus & the log where cocoa beans is attached could be good too |
Oh true, good idea. Maybe budding amethyst too (although that can just be done in No Interact) |
|
I added a new setting: no break supporting blocks. When this is on, blocks that are holding a crop cannot be broken, which also extends to cocoa. Also cactus is now counted as a cane block. |
| } | ||
|
|
||
| private boolean checkForCocoa(BlockPos blockPos) { | ||
| Direction[] checkDirections = { |
There was a problem hiding this comment.
Can be replaced with Direction.BY_2D_DATA
| if (foundItem.isMainHand()) { | ||
| blockBreakCooldown = 3; | ||
| return; | ||
| }; |
|
|
||
| private void trampleSuppressionSendEvent(PacketEvent.Send event) { | ||
| if (mc.player == null) return; | ||
| if (!(event.packet instanceof ServerboundMovePlayerPacket) |
There was a problem hiding this comment.
instance of IServerboundMovePlayerPacket p
|
|
||
| ServerboundMovePlayerPacket packet = (ServerboundMovePlayerPacket) event.packet; | ||
|
|
||
| BlockPos blockPos = new BlockPos( |
There was a problem hiding this comment.
BlockPos.containing?
| private void noBreakSupportingBlocksBreakEvent(StartBreakingBlockEvent event) { | ||
| BlockPos blockPos = event.blockPos; | ||
| BlockState blockState = mc.level.getBlockState(blockPos); | ||
| BlockState bsAbove = mc.level.getBlockState(blockPos.offset(0, 1, 0)); |
|
|
||
| for (Direction direction : checkDirections) { | ||
| // Check block at blockPos offset by the direction normal vector. | ||
| BlockState bsCheck = mc.level.getBlockState(blockPos.offset(direction.getUnitVec3i())); |
There was a problem hiding this comment.
blockPos.relative(direction)
| } | ||
|
|
||
| private Item placeItem = null; | ||
| private final ArrayList<BlockPos> cropPlacements = new ArrayList<>(); |
There was a problem hiding this comment.
ArrayDeque/ArrayListDeque will be better because you call removeFirst on it
Type of change
Description
This adds a new module, named Better Farming, which adds couple of utilities related to crop farming.
Firstly, the module will attempt to replace a harvested crop automatically, granted the player has its seed in their inventory.
Secondly, using the same method as NoFall, but changing it to work only when above farmland, it suppresses crop trampling, allowing the player to jump on the crops without them trampling.
Then, it will also prevent the player from harvesting crops that are not yet ripe.
Lastly, for sugar cane and bamboo, it will prevent the player from breaking the bottom block.
All of these should help players maintain sizable manual crop farms. All listed behaviours can be toggled in the settings.
How Has This Been Tested?
https://youtu.be/VH0yt58lyZs
Checklist: