ScriptAPI v1.20.60の主な変更点
バージョンの更新
- @minecraft/server 1.9.0-beta 追加
- @minecraft/server 1.8.0 追加
エンチャント関連の変更
- ItemEnchantableComponent 追加
→ ItemEnchantsComponentから名称変更された。 コンポーネントIDはminecraft:enchantable
- EnchantmentListが削除 → メソッド等はコンポーネント側に移動
getEnchantments(): Enchantment[]
追加- Enchantment class → interface
- EnchantmentSlotクラスは削除された
ItemStackにエンチャントを付与する例:
1const enchantable = itemStack.getComponent("minecraft:enchantable"); 2enchantable.addEnchantment({ type: "unbreaking", level: 3 });
ChatSendEventの変更
sendToTargets
削除get/setTargets()
削除readonly targets?: Player[]
追加
デフォルトでtargetsはundefined → ターゲット指定はできなくなった模様
チャットを非表示にしたままイベントだけ流す のようなこともできない
→ mojang-minecraftを使って全チャットを非表示にするアドオン作ったのでご自由にどーぞ https://github.com/tutinoko2048/OriginalChatDisabler
EntityProjectileComponent 追加
コンポーネントID: minecraft:projectile
ビヘイビア側で設定できるほぼ全ての値を変更できる
shoot(velocity: Vector3, options?: ProjectileShootOptions)
エンティティを発射できる。
見ている方向に雪玉を飛ばす例:
1const spawnLocation = Vector.add(player.getHeadLocation(), player.getViewDirection()); 2const snowball = player.dimension.spawnEntity("minecraft:snowball", spawnLocation); 3const projectile = snowball.getComponent("minecraft:projectile"); 4const velocity = Vector.multiply(player.getViewDirection(), 5); 5projectile.shoot(velocity);
PlayerPlaceBlockBeforeEvent
itemStack
削除permutationBeingPlaced: BlockPermutation
追加
System
runJob()
,clearJob()
追加
ジェネレーターを使用して重たいループ処理を実行できる
https://x.com/tutinoko_kusaa/status/1743077319001223322
ItemStack Dynamic Property
アイテムにDynamicPropertyを保存できるようになった
それに伴いItemStackに関連メソッドが追加
その他
-
WorldAfterEventsのプロパティ名変更
dataDrivenEntityTriggerEvent → dataDrivenEntityTrigger
ex)world.afterEvents.dataDrivenEntityTrigger.subscribe()
-
Player.spawnParticle()
追加 -
Player.eatItem()
追加 -
ItemDurabilityComponentの変更
getDamageRange()
→getDamageChanceRange()
-
Block.matches(blockName, states)
追加 -
Block.setWaterlogged(isWaterlogged: boolean)
追加
Block.isWaterloggedはreadonlyになった -
BlockPistonComponentの変更
getAttachedBlocks(): Vector3[]
→Block[]
getAttachedBlocksLocations()
追加state: BlockPistonState
追加- → 代わりにピストンの状態を示す
is○○
は削除された
-
Dimension.findClosestBiome(pos, biomeToFind, options): Vector3 | undefined
追加
近くの指定したバイオームの座標を返す -
WeatherChangeBeforeEvent 追加
キャンセル可能。 -
ContainerSlot.typeId
アイテムがない時に参照するとエラーを吐くようになった -
ConfainerSlot.hasItem(): boolean
追加
アイテムがスロットに存在するかを返す
Edit on Github