Skip to content

Commit

Permalink
feat: support 1.21.x stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lete114 committed Jun 19, 2024
1 parent d29da1e commit 3b6de60
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lint:fix": "eslint --fix src && prettier --check --write src"
},
"devDependencies": {
"@minecraft/server": "1.11.0-beta.1.20.80-stable",
"@minecraft/server": "1.11.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-typescript": "^11.1.2",
"@types/fs-extra": "^11.0.1",
Expand Down
17 changes: 5 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/behavior_pack/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"description": "pack.description",
"name": "pack.name",
"uuid": "90ce7a3b-8477-49cf-9d35-7e56b27f7e9c",
"version": [1, 0, 3],
"min_engine_version": [1, 20, 80]
"version": [1, 0, 4],
"min_engine_version": [1, 21, 0]
},
"modules": [
{
"description": "JavaScript module code",
"language": "javascript",
"type": "script",
"uuid": "c947417b-7bc9-4c35-85dc-2eafc2579200",
"version": [1, 0, 3],
"version": [1, 0, 4],
"entry": "scripts/main.js"
}
],
Expand All @@ -25,7 +25,7 @@
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.11.0-beta"
"version": "1.11.0"
}
]
}
8 changes: 4 additions & 4 deletions src/behavior_pack/scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ world.afterEvents.playerBreakBlock.subscribe(async (e) => {
*/
// eslint-disable-next-line max-statements
async function digOre(player: Player, dimension: Dimension, location: Vector3, blockTypeId: string) {
const equipmentInventory = player.getComponent(EntityEquippableComponent.componentId)
const equipmentInventory = player.getComponent(EntityEquippableComponent.componentId) as EntityEquippableComponent
if (!equipmentInventory) return

const mainHand = equipmentInventory.getEquipmentSlot(EquipmentSlot.Mainhand)
Expand All @@ -50,14 +50,14 @@ async function digOre(player: Player, dimension: Dimension, location: Vector3, b
const pickaxe = pickaxe_level[currentSlotItem.typeId as keyof typeof pickaxe_level]

// The player is not stalking or not holding an axe, one of the conditions is not met will end directly
if (!player.isSneaking || !currentSlotItem?.typeId.endsWith('_pickaxe')) return
if (!player.isSneaking || !currentSlotItem.hasTag('is_pickaxe')) return

const survivalPlayer = isSurvivalPlayer(dimension, player)

if (survivalPlayer) mainHand.lockMode = ItemLockMode.slot

const itemDurability = currentSlotItem.getComponent(ItemDurabilityComponent.componentId)
const enchantments = currentSlotItem.getComponent(ItemEnchantableComponent.componentId)
const itemDurability = currentSlotItem.getComponent(ItemDurabilityComponent.componentId) as ItemDurabilityComponent
const enchantments = currentSlotItem.getComponent(ItemEnchantableComponent.componentId) as ItemEnchantableComponent

if (!enchantments || !itemDurability) return

Expand Down
4 changes: 2 additions & 2 deletions src/behavior_pack/texts/en_US.lang
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pack.name=One Click Dig Ore v1.0.3
pack.description=Minecraft Bedrock Edition One Click Dig Ore mods
pack.name=One Click Dig Ore v1.0.4
pack.description=Chain mining with one click to make mining easier
4 changes: 2 additions & 2 deletions src/behavior_pack/texts/zh_CN.lang
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pack.name=一键挖矿 v1.0.3
pack.description=我的世界基岩版一键挖矿模组
pack.name=一键挖矿 v1.0.4
pack.description=一键连锁采矿,让采矿更轻松

0 comments on commit 3b6de60

Please sign in to comment.