Confirm crop seed selection before planting

This commit is contained in:
Tanner committed 2026-11-10 00:52:26 +00:00
1 parent 1a7bdb2be4
commit 46b0657bcf
4 files changed
+105 -21

No files matched your search

+20 -1
View File
@@ -1,7 +1,7 @@
import unittest
from munch import Munch
from minecraft.networking.modern import ClientTickEnd
from minecraft.networking.modern import ClientTickEnd, SetCarriedItemPacket
from minecraft.networking.packets import PacketBuffer
from mosfet.game import Game
@@ -46,6 +46,25 @@ class TestEatFood(unittest.TestCase):
self.assertEqual(buffer.get_writable(), bytes.fromhex(
'01ac0242b40000c1f00000'))
def test_force_select_item_resends_current_hotbar_slot(self):
connection = FakeConnection()
game = Game.__new__(Game)
seed = items.WHEAT_SEEDS_ID
game.g = Munch(
connection=connection,
inv={36: Slot(True, seed, 1)},
holding=seed,
holding_slot=0,
holding_hand=0,
inventory_state_ids={},
)
self.assertTrue(game.select_item([seed], force=True))
self.assertIsInstance(connection.packets[0][0], SetCarriedItemPacket)
self.assertEqual(connection.packets[0][0].slot, 0)
self.assertIsInstance(connection.packets[1][0], ClientTickEnd)
def test_game_use_item_sends_packet_and_tick_end(self):
connection = FakeConnection()
game = Game.__new__(Game)