Skip to content

Commit 6607dc6

Browse files
committed
chore: implement recommended changes
1 parent 935a8a0 commit 6607dc6

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/main/java/meteordevelopment/meteorclient/systems/modules/player/BetterFarming.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import net.minecraft.core.Direction;
2525
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
2626
import net.minecraft.tags.BlockTags;
27+
import net.minecraft.util.ArrayListDeque;
2728
import net.minecraft.world.item.Item;
2829
import net.minecraft.world.level.block.Blocks;
2930
import net.minecraft.world.level.block.CropBlock;
@@ -79,7 +80,7 @@ public BetterFarming() {
7980
}
8081

8182
private Item placeItem = null;
82-
private final ArrayList<BlockPos> cropPlacements = new ArrayList<>();
83+
private final ArrayListDeque<BlockPos> cropPlacements = new ArrayListDeque<>();
8384
private int blockBreakCooldown = 0;
8485

8586
@EventHandler(priority = EventPriority.HIGH)
@@ -174,7 +175,7 @@ private void noBreakCaneBaseBreakEvent(StartBreakingBlockEvent event) {
174175
private void noBreakSupportingBlocksBreakEvent(StartBreakingBlockEvent event) {
175176
BlockPos blockPos = event.blockPos;
176177
BlockState blockState = mc.level.getBlockState(blockPos);
177-
BlockState bsAbove = mc.level.getBlockState(blockPos.offset(0, 1, 0));
178+
BlockState bsAbove = mc.level.getBlockState(blockPos.above());
178179

179180
if (!isSupportedBelowCrop(blockState) && isSupportedBelowCrop(bsAbove)) {
180181
event.cancel();
@@ -242,7 +243,7 @@ private void autoPlaceBreakEvent(StartBreakingBlockEvent event) {
242243
if (foundItem.isMainHand()) {
243244
blockBreakCooldown = 3;
244245
return;
245-
};
246+
}
246247

247248
mc.gameMode.handlePickItemFromBlock(event.blockPos, false);
248249

@@ -257,10 +258,10 @@ private void trampleSuppressionSendEvent(PacketEvent.Send event) {
257258

258259
ServerboundMovePlayerPacket packet = (ServerboundMovePlayerPacket) event.packet;
259260

260-
BlockPos blockPos = new BlockPos(
261-
(int) packet.getX(0d),
262-
(int) packet.getY(0d),
263-
(int) packet.getZ(0d)
261+
BlockPos blockPos = BlockPos.containing(
262+
packet.getX(0d),
263+
packet.getY(0d),
264+
packet.getZ(0d)
264265
);
265266

266267
// Only suppress fall if blocks beneath are farmland

0 commit comments

Comments
 (0)