Skip to content

Commit ece6cdc

Browse files
Add TwistingVinesPlantType
1 parent 0faadff commit ece6cdc

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-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
@@ -38,6 +38,8 @@ public final class AutoFarmPlantTypeManager
3838
new SweetBerryPlantType();
3939
public final TorchflowerPlantType torchflowerType =
4040
new TorchflowerPlantType();
41+
public final TwistingVinesPlantType twistingVinesType =
42+
new TwistingVinesPlantType();
4143
public final WeepingVinesPlantType weepingVinesType =
4244
new WeepingVinesPlantType();
4345
public final WheatPlantType wheatType = new WheatPlantType();
@@ -46,7 +48,7 @@ public final class AutoFarmPlantTypeManager
4648
bambooType, beetrootsType, cactusType, carrotsType, cocoaBeanType,
4749
glowBerryType, kelpType, melonType, netherWartType, pitcherPlantType,
4850
potatoesType, pumpkinType, sugarCaneType, sweetBerryPlantType,
49-
torchflowerType, weepingVinesType, wheatType);
51+
torchflowerType, twistingVinesType, weepingVinesType, wheatType);
5052

5153
public final ToggleAllPlantTypesSetting toggleAllSetting =
5254
new ToggleAllPlantTypesSetting("All plant types",
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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.minecraft.util.math.Direction;
16+
import net.wurstclient.WurstClient;
17+
import net.wurstclient.hacks.autofarm.AutoFarmPlantType;
18+
import net.wurstclient.settings.PlantTypeSetting;
19+
import net.wurstclient.util.BlockUtils;
20+
21+
public final class TwistingVinesPlantType extends AutoFarmPlantType
22+
{
23+
@Override
24+
public final boolean isReplantingSpot(BlockPos pos, BlockState state)
25+
{
26+
return (state.isOf(Blocks.TWISTING_VINES)
27+
|| state.isOf(Blocks.TWISTING_VINES_PLANT))
28+
&& hasPlantingSurface(pos);
29+
}
30+
31+
@Override
32+
public final boolean hasPlantingSurface(BlockPos pos)
33+
{
34+
BlockState floor = BlockUtils.getState(pos.down());
35+
return !floor.isOf(Blocks.TWISTING_VINES)
36+
&& !floor.isOf(Blocks.TWISTING_VINES_PLANT) && floor
37+
.isSideSolidFullSquare(WurstClient.MC.world, pos, Direction.UP);
38+
}
39+
40+
@Override
41+
public Item getSeedItem()
42+
{
43+
return Items.TWISTING_VINES;
44+
}
45+
46+
@Override
47+
public boolean shouldHarvestByMining(BlockPos pos, BlockState state)
48+
{
49+
return (state.isOf(Blocks.TWISTING_VINES)
50+
|| state.isOf(Blocks.TWISTING_VINES_PLANT))
51+
&& !isReplantingSpot(pos, state);
52+
}
53+
54+
@Override
55+
protected PlantTypeSetting createSetting()
56+
{
57+
return new PlantTypeSetting("Twisting Vines", Items.TWISTING_VINES,
58+
false, false);
59+
}
60+
}

0 commit comments

Comments
 (0)