Skip to content

Commit 89e222f

Browse files
Add TorchflowerPlantType
1 parent ac0d3df commit 89e222f

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

src/main/java/net/wurstclient/hacks/autofarm/AutoFarmPlantTypeManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ public final class AutoFarmPlantTypeManager
3232
public final SugarCanePlantType sugarCaneType = new SugarCanePlantType();
3333
public final SweetBerryPlantType sweetBerryPlantType =
3434
new SweetBerryPlantType();
35+
public final TorchflowerPlantType torchflowerType =
36+
new TorchflowerPlantType();
3537
public final WheatPlantType wheatType = new WheatPlantType();
3638

3739
public final List<AutoFarmPlantType> plantTypes = List.of(amethystType,
3840
bambooType, beetrootsType, cactusType, carrotsType, cocoaBeanType,
3941
kelpType, melonType, netherWartType, potatoesType, pumpkinType,
40-
sugarCaneType, sweetBerryPlantType, wheatType);
42+
sugarCaneType, sweetBerryPlantType, torchflowerType, wheatType);
4143

4244
public AutoFarmPlantType getReplantingSpotType(BlockPos pos)
4345
{
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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

Comments
 (0)