Skip to content

Commit d0290d1

Browse files
Add PitcherPlantPlantType
1 parent 89e222f commit d0290d1

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public final class AutoFarmPlantTypeManager
2727
public final KelpPlantType kelpType = new KelpPlantType();
2828
public final MelonPlantType melonType = new MelonPlantType();
2929
public final NetherWartPlantType netherWartType = new NetherWartPlantType();
30+
public final PitcherPlantPlantType pitcherPlantType =
31+
new PitcherPlantPlantType();
3032
public final PotatoesPlantType potatoesType = new PotatoesPlantType();
3133
public final PumpkinPlantType pumpkinType = new PumpkinPlantType();
3234
public final SugarCanePlantType sugarCaneType = new SugarCanePlantType();
@@ -36,10 +38,11 @@ public final class AutoFarmPlantTypeManager
3638
new TorchflowerPlantType();
3739
public final WheatPlantType wheatType = new WheatPlantType();
3840

39-
public final List<AutoFarmPlantType> plantTypes = List.of(amethystType,
40-
bambooType, beetrootsType, cactusType, carrotsType, cocoaBeanType,
41-
kelpType, melonType, netherWartType, potatoesType, pumpkinType,
42-
sugarCaneType, sweetBerryPlantType, torchflowerType, wheatType);
41+
public final List<AutoFarmPlantType> plantTypes =
42+
List.of(amethystType, bambooType, beetrootsType, cactusType,
43+
carrotsType, cocoaBeanType, kelpType, melonType, netherWartType,
44+
pitcherPlantType, potatoesType, pumpkinType, sugarCaneType,
45+
sweetBerryPlantType, torchflowerType, wheatType);
4346

4447
public AutoFarmPlantType getReplantingSpotType(BlockPos pos)
4548
{
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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.block.PitcherCropBlock;
13+
import net.minecraft.block.enums.DoubleBlockHalf;
14+
import net.minecraft.item.Item;
15+
import net.minecraft.item.Items;
16+
import net.minecraft.util.math.BlockPos;
17+
import net.wurstclient.hacks.autofarm.AutoFarmPlantType;
18+
import net.wurstclient.settings.CheckboxSetting;
19+
import net.wurstclient.util.BlockUtils;
20+
21+
public final class PitcherPlantPlantType extends AutoFarmPlantType
22+
{
23+
@Override
24+
public final boolean isReplantingSpot(BlockPos pos, BlockState state)
25+
{
26+
return state.isOf(Blocks.PITCHER_CROP)
27+
&& state.get(PitcherCropBlock.HALF) == DoubleBlockHalf.LOWER
28+
&& hasPlantingSurface(pos);
29+
}
30+
31+
@Override
32+
public final boolean hasPlantingSurface(BlockPos pos)
33+
{
34+
return BlockUtils.getState(pos.down()).isOf(Blocks.FARMLAND);
35+
}
36+
37+
@Override
38+
public Item getSeedItem()
39+
{
40+
return Items.PITCHER_POD;
41+
}
42+
43+
@Override
44+
public boolean shouldHarvestByMining(BlockPos pos, BlockState state)
45+
{
46+
// field_43240 is MAX_AGE
47+
return state.isOf(Blocks.PITCHER_CROP)
48+
&& state.get(PitcherCropBlock.AGE) >= PitcherCropBlock.field_43240;
49+
}
50+
51+
@Override
52+
protected CheckboxSetting createHarvestSetting()
53+
{
54+
return new CheckboxSetting("Harvest pitcher plants", true);
55+
}
56+
57+
@Override
58+
protected CheckboxSetting createReplantSetting()
59+
{
60+
return new CheckboxSetting("Replant pitcher plants", true);
61+
}
62+
}

0 commit comments

Comments
 (0)