|
| 1 | +/* |
| 2 | + * Copyright (c) 2014-2025 Wurst-Imperium and contributors. |
| 3 | + * |
| 4 | + * This source code is subject to the terms of the GNU General Public |
| 5 | + * License, version 3. If a copy of the GPL was not distributed with this |
| 6 | + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt |
| 7 | + */ |
| 8 | +package net.wurstclient.hacks.autofarm.plants; |
| 9 | + |
| 10 | +import net.minecraft.block.BlockState; |
| 11 | +import net.minecraft.block.Blocks; |
| 12 | +import net.minecraft.item.Item; |
| 13 | +import net.minecraft.item.Items; |
| 14 | +import net.minecraft.util.math.BlockPos; |
| 15 | +import net.wurstclient.hacks.autofarm.AutoFarmPlantType; |
| 16 | +import net.wurstclient.settings.CheckboxSetting; |
| 17 | +import net.wurstclient.util.BlockUtils; |
| 18 | + |
| 19 | +public final class TorchflowerPlantType extends AutoFarmPlantType |
| 20 | +{ |
| 21 | + @Override |
| 22 | + public final boolean isReplantingSpot(BlockPos pos, BlockState state) |
| 23 | + { |
| 24 | + return (state.isOf(Blocks.TORCHFLOWER) |
| 25 | + || state.isOf(Blocks.TORCHFLOWER_CROP)) && hasPlantingSurface(pos); |
| 26 | + } |
| 27 | + |
| 28 | + @Override |
| 29 | + public final boolean hasPlantingSurface(BlockPos pos) |
| 30 | + { |
| 31 | + return BlockUtils.getState(pos.down()).isOf(Blocks.FARMLAND); |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + public Item getSeedItem() |
| 36 | + { |
| 37 | + return Items.TORCHFLOWER_SEEDS; |
| 38 | + } |
| 39 | + |
| 40 | + @Override |
| 41 | + public boolean shouldHarvestByMining(BlockPos pos, BlockState state) |
| 42 | + { |
| 43 | + return state.isOf(Blocks.TORCHFLOWER); |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + protected CheckboxSetting createHarvestSetting() |
| 48 | + { |
| 49 | + return new CheckboxSetting("Harvest torchflowers", true); |
| 50 | + } |
| 51 | + |
| 52 | + @Override |
| 53 | + protected CheckboxSetting createReplantSetting() |
| 54 | + { |
| 55 | + return new CheckboxSetting("Replant torchflowers", true); |
| 56 | + } |
| 57 | +} |
0 commit comments