|
| 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