欢迎光临邯郸市启明碳素有限公司官网!
数十年专业石墨电极生产厂家
全国咨询热线:15226959268
联系我们
邯郸市启明碳素有限公司
电话:0310-7823970
手机:15226959268
邮箱:
地址 :河北邯郸市临漳县小平营工业区
联系人:景(经理)
您的位置: 首页>>新闻中心>>行业新闻
行业新闻

【游戏开发】我的世界成瘾项目电炉中手动更换石墨电极

时间:2023-06-19 09:06:08 点击:451次

前言

解压缩怀旧的 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}}]