前言
解壓縮懷舊的 mc 并構建一個完全手動的世界。 期間做了很多手工邏輯流程設計,從反饋到修正檢查修復了一些bug,手動開發了一些補充功能,自己編譯的mod提前修復了已知問題等等,基本沒什么娛樂,主要是研究和研究創造,這個過程不亞于開發中的工作。
結果很好,這里有一些難點需要解決。
一、問題背景
MC全手工,電弧爐內無法更換石墨電極,量產更換頻率不低,亟待解決。
環境:mc1.16.3,嗜工程動物魔法精美儲物等。
解決后,積壓的幾萬礦石不到一天時間就消化完了,效率還是不錯的。
二、程序
最簡單的方法是根據其他人的模組開發模組。 必須構建新版本的開發環境。 沒時間上網也Q。這里官方給出一種基于添加數據包()的機制來解決。
3.簡介
簡而言之,請參閱 %E6%95%B0%E6%8D%AE%E5%8C%85,假設您已經知道如何添加數據包和激活功能。
四、療效第一
使用如圖的布局,另外一張是素材特寫
5、實現原理的核心:在電弧爐電極的外表放置一個小命令方塊,執行新縮減的功能。 代碼是硬編碼的,向下第5格是電弧爐的中心。 外設:放置一個定時器觸發紅石信號定時驅動。 這里使用了一個帶有動物魔法的沙漏,但它也可以用香草紅石中繼器來實現。 周邊:附件是人工放置石墨電極物品的裝置。 基本原理很簡單,放下一個物品,觸發壓力板,然后反向控制停止放置物品。 這里使用動物魔格盒來解決精度問題,也可以使用原來的投擲器。
核心邏輯:
1.創建兩個集成板,用于存儲中間數據和狀態。
2、環境監測,保證下方有電弧爐,配件有全耐用的石墨電極。
3、檢測23-25號電弧爐數據,測量是否有電極缺陷或損傷值是否小于(最大值)。
4. 如果有,更換或恢復耐久性,并淘汰 1 個完全耐久的電極。
5.執行1次替換設置結束狀態。 所有替換都需要重復執行。
6.代碼
細節暫時不解釋,如果有用,直接復制即可,有興趣的可以交流。
.
# init
scoreboard objectives add cmd_result dummy
scoreboard objectives add cmd_succ dummy
execute if block ~ ~1 ~ minecraft:air run kill @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}}]
execute if block ~ ~1 ~ minecraft:air run summon minecraft:item ~ ~1 ~ {Item:{id:"minecraft:torch",Count:1}}
execute if block ~ ~1 ~ minecraft:air run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ 0
# check
execute unless block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0}} run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ 2
execute unless entity @e[type=item,distance=..3,nbt={Item:{id:"immersiveengineering:graphite_electrode",Count:1b}}] run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ 2
execute as @e[type=item,distance=..3,nbt={Item:{id:"immersiveengineering:graphite_electrode",Count:1b}},limit=1] if data entity @s Item.tag.graphDmg unless data entity @s Item.tag{graphDmg:0} run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ 2
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 run data modify entity @e[type=item,distance=..3,nbt={Item:{id:"immersiveengineering:graphite_electrode",Count:1b}},limit=1] Age set value 0
#execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 run say init
#execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 2 run say uninit
# add 23
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 unless block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:23b}]} store success score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ run data modify block ~ ~-4 ~ inventory append value {Slot:23b,id:"immersiveengineering:graphite_electrode",Count:1b,Count:1b,tag:{graphDmg:0,Damage:0}}
# add 24
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 unless block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:24b}]} store success score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ run data modify block ~ ~-4 ~ inventory append value {Slot:24b,id:"immersiveengineering:graphite_electrode",Count:1b,Count:1b,tag:{graphDmg:0,Damage:0}}
# add 25
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 unless block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:25b}]} store success score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ run data modify block ~ ~-4 ~ inventory append value {Slot:25b,id:"immersiveengineering:graphite_electrode",Count:1b,Count:1b,tag:{graphDmg:0,Damage:0}}
# fix 23
# init dmg
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result 0
# get current dmg
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 if block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:23b}]} store result score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result run data get block ~ ~-4 ~ inventory[{Slot:23b}].tag.graphDmg
# modify
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 if block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:23b}]} if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result matches 95550.. store success score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ run data modify block ~ ~-4 ~ inventory[{Slot:23b}].tag.graphDmg set value 0
# end
# fix 24
# init dmg
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result 0
# get current dmg
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 if block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:24b}]} store result score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result run data get block ~ ~-4 ~ inventory[{Slot:24b}].tag.graphDmg
# modify
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 if block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:24b}]} if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result matches 95550.. store success score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ run data modify block ~ ~-4 ~ inventory[{Slot:24b}].tag.graphDmg set value 0
# end
# fix 25
# init dmg
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 run scoreboard players set @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result 0
# get current dmg
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 if block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:25b}]} store result score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result run data get block ~ ~-4 ~ inventory[{Slot:25b}].tag.graphDmg
# modify
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 if block ~ ~-4 ~ immersiveengineering:arc_furnace{offset:{X:0,Y:0,Z:0},inventory:[{Slot:25b}]} if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_result matches 95550.. store success score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ run data modify block ~ ~-4 ~ inventory[{Slot:25b}].tag.graphDmg set value 0
# end
# use one
execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 1 run kill @e[type=item,distance=..3,nbt={Item:{id:"immersiveengineering:graphite_electrode",Count:1b}},limit=1]
# clear
#execute if score @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}},limit=1] cmd_succ matches 0 run say "undo"
execute if block ~ ~1 ~ minecraft:air run kill @e[type=item,distance=..1,nbt={Item:{id:"minecraft:torch",Count:1b}}]