(window, slotPopulationFactor)
| 146 | } |
| 147 | |
| 148 | async function createRandomLayout (window, slotPopulationFactor) { |
| 149 | await bot.test.becomeCreative() |
| 150 | |
| 151 | for (let slot = 0; slot < window.inventoryStart; slot++) { |
| 152 | if (Math.random() < slotPopulationFactor) { |
| 153 | const randomItem = getRandomStackableItem() |
| 154 | const item = bot.registry.itemsByName[randomItem] |
| 155 | bot.chat(`/give ${bot.username} ${item.name} ${Math.ceil(Math.random() * item.stackSize)}`) |
| 156 | await onceWithCleanup(window, 'updateSlot', { |
| 157 | timeout: 5000, |
| 158 | checkCondition: (slot, oldItem, newItem) => slot === window.hotbarStart && newItem?.name === item.name |
| 159 | }) |
| 160 | |
| 161 | // await bot.clickWindow(slot, 0, 2) |
| 162 | await bot.moveSlotItem(window.hotbarStart, slot) |
| 163 | await bot.test.wait(100) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | await bot.test.becomeSurvival() |
| 168 | } |
| 169 | |
| 170 | async function testMouseClick (window, clicks) { |
| 171 | let iterations = 0 |
no test coverage detected
searching dependent graphs…