Closed boon4681 closed 3 years ago
This is a datapack from a Thai branch. The author states that this is still an incomplete version and is ready to revise until it is complete with writing to complete.
อันที่จริงไม่แนะนำให้ datapack disable
มันส่งผลให้เกิดการ reload อัตโนมัติส่งผลให้แพ็คอื่นถูกรีการทำงานใหม่ไปด้วย
data\boon4681.auto.hoe\functions\init.mcfunction
มี tellraw @a ["",{"text":"Harvestable hoe"
แนะนำว่าถ้าใช้ ctc ก็ดีนะ จัดการได้ตามสะดวก อันนี้เป็นตัวอย่างคร่าวๆ
give @s diamond_hoe{tag:{ctc:{id: 'auto_hoe',from: 'boon4681:auto_hoe',traits: {'tool/tilling': 1b, 'gem/diamond': 1b}}}}
data\boon4681.auto.hoe\functions\run\run.mcfunction
-> execute as @a[tag=!global.ignore.gui]
as @s
หรอกเพราะมันทำงานที่ @a
อยู่แล้วไม่ต้องไปย้ำมันอีกรอบก็ได้อยากจะบอกว่า namespace objectives เนี่ยต้องเป็นอย่างใดอย่างนึงนะ ส่วนใหญ่แล้วเขาจะใช้ชื่อย่อกันเช่นชื่อพี่ EstEarth -> ee. เพราะว่ามันจำกัดแค่ 16 ตัวอักษร
scoreboard objectives add boon4681.active dummy
scoreboard objectives add du.has dummy
scoreboard objectives add du.max dummy
scoreboard objectives add du.cooldown dummy
scoreboard objectives add boon4681.calc_s0 dummy
scoreboard objectives add boon4681.item.id dummy
scoreboard objectives add iscrop dummy
data\minecraft\loot_tables\blocks\shulker_box.json
ใช้ไม่ตรงกับที่เขียนไว้นะ
↳ https://mc-datapacks.github.io/th/conventions/shulker_box_loot_table.html
setblock 29999977 0 29999977 shulker_box
คำสั่ง setblock ต้องเป็น yellow_shulker_box
ตามหัวข้อนี้
↳ https://mc-datapacks.github.io/th/tips/shulker_box_inventory_manipulation.html
data\boon4681.auto.hoe\functions\durability\save.mcfunction
data\boon4681.auto.hoe\functions\durability\savecool.mcfunction
เราสามารถลดความยาวของคำสั่งลงได้ จากการนำเงื่อนไขบางอย่างไปใส่ใน @s
ถ้าทำได้ ไฟล์อื่นๆใน datapack ของน้องก็ทำได้ซึ่งมีอีก
execute unless score @s[scores={du.cooldown=0,du.has=..0}] boon4681.item.id matches 0 run function boon4681.auto.hoe:durability/setsave_s0
execute unless score @s[scores={du.cooldown=1}] boon4681.item.id matches 0 run function boon4681.auto.hoe:run/calc_check
execute unless score @s[nbt={ActiveEffects:[{Id:32b}]},scores={du.cooldown=0}] boon4681.item.id matches 0 run function boon4681.auto.hoe:durability/setsave_s2
scoreboard players set @s[scores={du.has=..0}] boon4681.item.id 0
execute at @s[scores={boon4681.item.id=1}] positioned ~ ~ ~ run function boon4681.auto.hoe:break/breaking_1
execute at @s[scores={boon4681.item.id=1}] positioned ~ ~0.0625 ~ run function boon4681.auto.hoe:break/breaking_1
execute at @s[scores={boon4681.item.id=2}] positioned ~ ~ ~ run function boon4681.auto.hoe:break/breaking_2
execute at @s[scores={boon4681.item.id=2}] positioned ~ ~0.0625 ~ run function boon4681.auto.hoe:break/breaking_2
execute at @s[scores={boon4681.item.id=3}] positioned ~ ~ ~ run function boon4681.auto.hoe:break/breaking_3
execute at @s[scores={boon4681.item.id=3}] positioned ~ ~0.0625 ~ run function boon4681.auto.hoe:break/breaking_3
รู้หรือไม่: fake_player
ไม่ต้องใช้ namespace เพราะมันอยู่ในภาย objective namespace. "auto.hoe.activate" boon4681.active
แนะนำว่าการ loop อ่ะควรใช้แบบนี้แทนนะ
ย้าย "boon4681.auto.hoe:loop"
ไปใส่ใน load.json
แล้วลบไฟล์ tick.json
ออกเพราะไม่ใช้แล้ว
{
"values":[
"boon4681.auto.hoe:init",
"boon4681.auto.hoe:loop"
]
}
ในข้อเท็จจริงมันมีอยู่ว่า ไฟล์ tick.json
มันจะรันก่อนไฟล์ load เสมอ ไม่ค่อยดีเท่าก่อนที่จะให้มันทำงานโดยที่ยังไม่มีการเซ็ต score และอื่นๆให้เรียบร้อย
ต่อไปในไฟล์ "boon4681.auto.hoe:loop"
ให้เพิ่ม schedule function boon4681.auto.hoe:loop 1t
เท่านี้ก็ได้ loop 1 tick แล้ว
ในส่วนของ uninstall ให้ใช้ schedule clear boon4681.auto.hoe:loop
แทนที่ datapack disable
เมื่อทำแบบนี้แล้ว pack ก็จะไม่ทำงานใดๆต่อโดยไม่ต้อง datapack disable
แต่ถ้าใช้ tick.json
ต่อให้ลบทุกอย่างออก มันก็ยังคงทำงานตราบใดที่ไม่ datapack disable
พี่เลยแนะนำให้เราทำแบบนี้จะดีกว่า
✔️ = Followed 🔆 = Advised to use ❌ = Doesn't follow ☑️ = Not required/Skip
มีแต่ schedule clear
ไม่ลบ scoreboard
ด้วยล่ะ
minecraft\loot_tables\blocks\yellow_shulker_box.json
ตรง "name": "minecraft:shulker_box"
ยังไม่แก้
ไม่ forceload add 29999977 29999977
เดี๋ยว setblock
ไม่ติดนะ
boon4681\advancements\boon4681.auto.hoe.json
เอาคำว่า boon4681. ออกได้เลย
minecraft:stick{drop_contents:true}
ใช้เป็น air{drop_contents:1b}
แทนก็ได้ สั่นลงหน่อย ถ้าใช้ 1b
ให้เปลี่ยนที่ loot_tables
ด้วย
forceload
เอาไปใส่ในไฟล์ init
นะ เอาไว้ที่ tick แบบนั้นทำงานตลอดเวลาสิแหม
จะโพสต์ขึ้นเว็บไหม?
น้องสามารถใช้ป้ายที่มีอยู่ในหน้า certified banner บนหน้า github ได้เลย
Project Page: https://github.com/boon4681/Harvestable-hoe (testing upload will available on "planet minecraft" later)
This hoe can harvesting crops by it self but it have cooldown when out of valid