机械动力机器数值分析
冬季救援整合包里面的应力相对来说获取困难。为了极致地利用应力以及做好机器匹配,我查阅了相关代码并对其进行了分析。由于本人代码水平也不是很好,也没有编写java的经验,难免有解读错误的地方,望大佬继续补充。
开始[edit | edit source]
1 基础[edit | edit source]
1秒是20gametick(20t)
2 粉碎轮[edit | edit source]
分析[edit | edit source]
粉碎轮速度相关的代码为
inventory.remainingTime = recipe.isPresent() ? recipe.get().getProcessingDuration() : 100;
crushingspeed = compound.getFloat("Speed");
float speed = crushingspeed * 4;
float processingSpeed =Mth.clamp((speed) / (!inventory.appliedRecipe ? Mth.log2(inventory.getStackInSlot(0).getCount()) : 1), .25f, 20);
inventory.remainingTime -= processingSpeed;
其中crushingspeed就是我们给的转速/12.5,这个速度取速度慢的轮,所以我们统一按两轮等速讨论
每次处理所需要的总进度如果配方有写就按配方,没有就是100(一般都是100)
首先看条件,假如已经吸入了物品(即不是掉落物形态),除数为log2(物品数量),否则按1
但实际上这个没啥用,因为我们都采用溜槽等方式直接跳过了吸入过程,去除了吸入所需时间,因此我们直接按着已吸入计算即可
clamp的作用是限定范围,高于最大值就等于最大值,小于最小值就等于最小值,这里的上下限是0.25和20
为了方便讨论,我们提出一个问题,假设我要总共处理a个物品,可用应力为定值b,单个机器单次处理y个,转速x,求处理总用时t
已知单个机器(两个粉碎轮)rpm为16,由此可以得可用机器数量k=b/16x
我们先假设clamp函数不起作用,不难列出如下公式
其中a,b,T=100为问题一开始就确立的定值,可操作变量为x,y
易得处理总时在一定的总应力下与转速无关,单个机器单次处理量越大处理总需时越小
在这个结论的基础上我们再讨论clamp函数的影响
易知单个机器处理初始速度为
另v分别等于0.25与20,我们可以得出,上方公式的适用范围
高于红线则降速到红线,低于蓝线则加速到蓝线
人话[edit | edit source]
在确定总应力下,处理耗时只与单次处理量有关
直接用智能溜槽喂64是最佳选择
粉碎轮转速调成1即可
单位时间产量与转速成正比,1速64堆叠下粉碎轮每秒可处理3.2个物品
3 辊压机[edit | edit source]
分析[edit | edit source]
public static final int CYCLE = 240;
prevRunningTicks = runningTicks;
runningTicks += (int) Mth.lerp(Mth.clamp(Math.abs(speed) / 512f, 0, 1), 1, 60);
if (prevRunningTicks < CYCLE / 2 && runningTicks >= CYCLE / 2)
runningTicks = CYCLE / 2;
if(runningTicks > CYCLE)
完成()
这里的speed就直接是转速了
lerp函数作用是将0-1小数等比放大到一定范围内
由于cycle很小,mc又按t计算,因此处理速度是阶跃的
观察易得其为两个120的阶跃进度,因此处理速度需要为120的因数才最好,用excel可轻松求出阶跃转速
人话[edit | edit source]
下表转速为最佳转速,自行选取即可
转速 | 增速 | 需时(tick) | 筛选 | 产量(每秒) |
1 | 1 | 240 | 120 | 0.083333333 |
9 | 2 | 120 | 0 | 0.166666667 |
18 | 3 | 80 | 20 | 0.25 |
27 | 4 | 60 | 20 | 0.333333333 |
35 | 5 | 48 | 18 | 0.416666667 |
44 | 6 | 40 | 16 | 0.5 |
53 | 7 | 36 | 16 | 0.555555556 |
61 | 8 | 30 | 12 | 0.666666667 |
70 | 9 | 28 | 13 | 0.714285714 |
79 | 10 | 24 | 10 | 0.833333333 |
87 | 11 | 22 | 10 | 0.909090909 |
96 | 12 | 20 | 9 | 1 |
113 | 14 | 18 | 8 | 1.111111111 |
122 | 15 | 16 | 7 | 1.25 |
148 | 18 | 14 | 6 | 1.428571429 |
165 | 20 | 12 | 5 | 1.666666667 |
200 | 24 | 10 | 4 | 2 |
252 | 30 | 8 | 3 | 2.5 |
4 鼓风机[edit | edit source]
分析[edit | edit source]
public final ConfigInt fanPushDistance = i(20, 5, "fanPushDistance", Comments.fanPushDistance);
public final ConfigInt fanRotationArgmax = i(256, 64, "fanRotationArgmax", Comments.rpm, Comments.fanRotationArgmax);
float distanceFactor = Math.min(speed / config.fanRotationArgmax.get(), 1);
float pushDistance = Mth.lerp(distanceFactor, 3, config.fanPushDistance.get());
这上面4是控制距离的,阅读易得距离k=speed/256*17+3
.
float sneakModifier = entity.isShiftKeyDown() ? 4096f : 512f;
float speed = Math.abs(source.getSpeed());
float acceleration = (float) (speed / sneakModifier / (entityDistance / maxDistance));
这3控制吹生物速度,没啥用
.
public final ConfigInt inWorldProcessingTime = i(150, 0, "inWorldProcessingTime", Comments.inWorldProcessingTime);
int timeModifierForStackSize = ((entity.getItem().getCount() - 1) / 16) + 1;
int processingTime = (int) (AllConfigs.SERVER.kinetics.inWorldProcessingTime.get() * timeModifierForStackSize) + 1;
int value = processing.getInt("Time") - 1;
processing.putInt("Time", value);
这堆是控制处理时间的,一叠物品的总处理时间是... ((数量-1)/16+1)*150... tick
将处理时间乘处理数量即为处理效率,使用excel轻松得
可见单堆物品数量越多,处理越快,最快速度为每秒1.73个物品
人话[edit | edit source]
鼓风机速度只影响吹风距离,一速够了
吹炼的物品堆满64一组,这样最快
5 搅拌器[edit | edit source]
分析[edit | edit source]
if (runningTicks != 20)
runningTicks++;
if ((!level.isClientSide || isVirtual()) && runningTicks == 20) {
上面说明搅拌机从睡觉转换到工作需要预热一秒
.
float recipeSpeed = 1;
int t = ((ProcessingRecipe<?>) currentRecipe).getProcessingDuration();
recipeSpeed = t / 100f;
processingTicks = Mth.clamp((Mth.log2((int) (512 / speed))) * Mth.ceil(recipeSpeed * 15) + 1, 1, 512);
processingTicks--;
上面是搅拌机工作代码,每个从头开始处理的配方配方需要log2(int(512/转速))*15 tick 的时间
由于这里有个int,因此搅拌机也是阶跃的,这时就可以用excel处理了
人话[edit | edit source]
搅拌机最好连续工作,避免暖机问题
下表为最佳转速,自行选取
转速 | 产量(每秒) | 筛选 |
32 | 0.333333333 | #VALUE! |
33 | 0.341277366 | 0.007944033 |
35 | 0.35019938 | 0.008922014 |
37 | 0.360317539 | 0.010118159 |
40 | 0.371923928 | 0.011606388 |
43 | 0.385419768 | 0.013495841 |
47 | 0.401373328 | 0.015953559 |
52 | 0.420619836 | 0.019246508 |
57 | 0.444444444 | 0.023824609 |
65 | 0.474942916 | 0.030498472 |
74 | 0.515803743 | 0.040860827 |
86 | 0.574235411 | 0.058431668 |
103 | 0.666666667 | 0.092431256 |
129 | 0.841239671 | 0.174573005 |
171 | 1.333333333 | 0.492093662 |
6 动力锯[edit | edit source]
分析[edit | edit source]
int time = 50;
time = ((CuttingRecipe) recipe).getProcessingDuration();
inventory.remainingTime = time * Math.max(1, (inserted.getCount() / 5));
float processingSpeed = Mth.clamp(Math.abs(getSpeed()) / 24, 1, 128);
inventory.remainingTime -= processingSpeed;
任意单个物品处理时间50,处理速度为 转速/24,转速低于24按24算
由于时间与处理速度相差小,阶跃影响大,因此使用excel分析阶跃
转速 | 产量 | 应力性价比 | 筛选 |
1 | 0.4 | 40 | #VALUE! |
25 | 0.416667 | 1.666667 | 0.016667 |
26 | 0.425532 | 1.636661 | 0.008865 |
27 | 0.444444 | 1.646091 | 0.018913 |
28 | 0.465116 | 1.66113 | 0.020672 |
29 | 0.47619 | 1.642036 | 0.011074 |
30 | 0.5 | 1.666667 | 0.02381 |
31 | 0.512821 | 1.65426 | 0.012821 |
32 | 0.526316 | 1.644737 | 0.013495 |
33 | 0.540541 | 1.638002 | 0.014225 |
34 | 0.555556 | 1.633987 | 0.015015 |
35 | 0.571429 | 1.632653 | 0.015873 |
36 | 0.588235 | 1.633987 | 0.016807 |
37 | 0.606061 | 1.638002 | 0.017825 |
38 | 0.625 | 1.644737 | 0.018939 |
39 | 0.645161 | 1.65426 | 0.020161 |
40 | 0.666667 | 1.666667 | 0.021505 |
42 | 0.689655 | 1.642036 | 0.022989 |
43 | 0.714286 | 1.66113 | 0.024631 |
45 | 0.740741 | 1.646091 | 0.026455 |
47 | 0.769231 | 1.636661 | 0.02849 |
48 | 0.8 | 1.666667 | 0.030769 |
50 | 0.833333 | 1.666667 | 0.033333 |
53 | 0.869565 | 1.640689 | 0.036232 |
55 | 0.909091 | 1.652893 | 0.039526 |
58 | 0.952381 | 1.642036 | 0.04329 |
60 | 1 | 1.666667 | 0.047619 |
64 | 1.052632 | 1.644737 | 0.052632 |
67 | 1.111111 | 1.658375 | 0.05848 |
71 | 1.176471 | 1.657001 | 0.065359 |
75 | 1.25 | 1.666667 | 0.073529 |
80 | 1.333333 | 1.666667 | 0.083333 |
86 | 1.428571 | 1.66113 | 0.095238 |
93 | 1.538462 | 1.65426 | 0.10989 |
100 | 1.666667 | 1.666667 | 0.128205 |
110 | 1.818182 | 1.652893 | 0.151515 |
120 | 2 | 1.666667 | 0.181818 |
134 | 2.222222 | 1.658375 | 0.222222 |
150 | 2.5 | 1.666667 | 0.277778 |
172 | 2.857143 | 1.66113 | 0.357143 |
200 | 3.333333 | 1.666667 | 0.47619 |
240 | 4 | 1.666667 | 0.666667 |
PS:恕我能力低下,实在看不懂这个max有啥屁用,这不是只能输入一个么,那就只能是1啊,盲猜屎山代码
人话[edit | edit source]
锯子锯东西一速就行