Skip to content

Commit

Permalink
fix(vein-mining): no drops when enabled auto_collection
Browse files Browse the repository at this point in the history
  • Loading branch information
PFiS1737 committed Jun 11, 2024
1 parent fd49069 commit cd04c67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/wrapper/block/BlockDrops.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class BlockDrops {
const identifier = removeMinecraftNamespace(blockTypeId)
const drops = BlockDefinition[identifier]?.drops

if (!drops) throw new Error(`Block ${identifier} has not been supportive.`)
if (!drops) throw new Error(`Block ${identifier} has not been supported.`)

this.blockTypeId = blockTypeId
this.drops = drops
Expand Down Expand Up @@ -131,7 +131,7 @@ export class BlockDrops {
if (withSilkTouch) {
return this.blockItem.getResult()
}
if (withFortune !== undefined && this.fortuneRule) {
if (withFortune !== 0 && this.fortuneRule) {
const level = withFortune

switch (this.fortuneRule) {
Expand Down
6 changes: 3 additions & 3 deletions src/script/vein-mining/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ export const setupListener = () =>
if (playerOption.getItemVal("auto_collection")) {
each(result.drops, (drop) => {
if (drop.xp) totalXp += drop.xp
totalItems.push(drop.itemId, drop.amount)
totalItems.push(drop)
})
} else {
result.spawnDrops()
}
}

if (playerOption.getItemVal("auto_collection")) {
each(totalItems, (item) =>
player.inventory.addItem(new ItemStack(item.itemId, item.amount))
each(totalItems, ({ itemId, amount }) =>
player.inventory.addItem(new ItemStack(itemId, amount))
)
player.addExperience(totalXp)
}
Expand Down

0 comments on commit cd04c67

Please sign in to comment.