MDT模组工厂制作

我们知道,高级物资是由低级物资经过工厂加工而来的,所以可想而知工厂的重要性

教程部分
小硅 -> 普通工厂/GenericCrafter

siliconSmelter = new GenericCrafter("silicon-smelter"){{
requirements(Category.crafting, with(Items.copper, 30, Items.lead, 25));
craftEffect = Fx.smeltsmoke;
outputItem = new ItemStack(Items.silicon, 1);
craftTime = 40f;
size = 2;
hasPower = true;
hasLiquids = false;
drawer = new DrawSmelter(Color.valueOf("ffef99"));
consumes.items(with(Items.coal, 1, Items.sand, 2));
consumes.power(0.50f);
}};
public DrawSmelter(Color flameColor){
this.flameColor = flameColor;
}
json
{
"type": "GenericCrafter",
"name": "json-siliconSmelter",
"category": "crafting",
"requirements": [
"copper/30","lead/25"
],
"outputItem": "silicon/1",
"craftTime": 40.00,
"size": 2,
"hasPower": true,
"hasLiquids": false,
"drawer": {
"type": "DrawSmelter",
"flameColor": "ffef99"
},
"consumes": {
"items": {
"items": [
"coal/1","sand/2"
]
},
"power": 0.50
}
}
属性解释
outputItem: 输出单种类物品
craftTime: 制作时间
hasPower: 能否拥有能量(游戏自带初始化,一般不填,但是在工厂里几乎全要填)
hasLiquid: 能否拥有液体(同上)
drawer: 添加贴图(?)

大硅 -> 属性工厂/AttributeCrafter

siliconCrucible = new AttributeCrafter("silicon-crucible"){{
requirements(Category.crafting, with(Items.titanium, 120, Items.metaglass, 80, Items.plastanium, 35, Items.silicon, 60));
craftEffect = Fx.smeltsmoke;
outputItem = new ItemStack(Items.silicon, 8);
craftTime = 90f;
size = 3;
hasPower = true;
hasLiquids = false;
itemCapacity = 30;
boostScale = 0.15f;
drawer = new DrawSmelter(Color.valueOf("ffef99"));
consumes.items(with(Items.coal, 4, Items.sand, 6, Items.pyratite, 1));
consumes.power(4f);
}};
public DrawSmelter(Color flameColor){
this.flameColor = flameColor;
}
json
{
"type": "AttributeCrafter",
"name": "json-siliconCrucible",
"category": "crafting",
"requirements": [
"titanium/120","metaglass/80","plastanium/35","silicon/60"
],
"outputItem": "silicon/8",
"craftTime": 90.00,
"size": 3,
"hasPower": true,
"hasLiquids": false,
"itemCapacity": 30,
"boostScale": 0.15,
"drawer": {
"type": "DrawSmelter",
"flameColor": "ffef99"
},
"consumes": {
"items": {
"items": [
"coal/4","sand/6","pyratite/1"
]
},
"power": 4.00
}
}
属性解释
itemCapacity: 物品容量
boostScale: 增益倍率(?)

冷冻液混合器 -> 液体转换器/LiquidConverter

cryofluidMixer = new LiquidConverter("cryofluid-mixer"){{
requirements(Category.crafting, with(Items.lead, 65, Items.silicon, 40, Items.titanium, 60));
outputLiquid = new LiquidStack(Liquids.cryofluid, 0.2f);
craftTime = 120f;
size = 2;
hasPower = true;
hasItems = true;
hasLiquids = true;
rotate = false;
solid = true;
outputsLiquid = true;
drawer = new DrawMixer();
consumes.power(1f);
consumes.item(Items.titanium);
consumes.liquid(Liquids.water, 0.2f);
}};
json
{
"type": "LiquidConverter",
"name": "json-cryofluidMixer",
"category": "crafting",
"requirements": [
"lead/65","silicon/40","titanium/60"
],
"outputLiquid": "cryofluid/0.2",
"craftTime": 120.00,
"size": 2,
"hasPower": true,
"hasItems": true,
"hasLiquids": true,
"rotate": false,
"solid": true,
"outputsLiquid": true,
"drawer": "DrawMixer",
"consumes": {
"power": 1.00,
"item": "titanium",
"liquid": "water/0.2"
}
}
属性解释
outputLiquid: 输出液体
hasItems: 能否拥有物品(同hasPower)
rotate: 是否可旋转(同上)
solid: 是否为固体(同上)

分离机 -> 分离机/Separator

separator = new Separator("separator"){{
requirements(Category.crafting, with(Items.copper, 30, Items.titanium, 25));
results = with(
Items.copper, 5,
Items.lead, 3,
Items.graphite, 2,
Items.titanium, 2
);
hasPower = true;
craftTime = 35f;
size = 2;
consumes.power(1.1f);
consumes.liquid(Liquids.slag, 4f / 60f);
}};
json
{
"type": "Separator",
"name": "json-separator",
"category": "crafting",
"requirements": [
"copper/30","titanium/25"
],
"results": [
"copper/5","lead/3","graphite/2","titanium/2"
],
"hasPower": true,
"craftTime": 35.00,
"size": 2,
"consumes": {
"power": 1.10,
"liquid": "slag/0.067"
}
}
属性解释
results: 每个产出物品概率(而非数量)

焚烧炉 -> 焚烧炉/Incinerator

incinerator = new Incinerator("incinerator"){{
requirements(Category.crafting, with(Items.graphite, 5, Items.lead, 15));
health = 90;
consumes.power(0.50f);
}};
json
{
"type": "Incinerator",
"name": "json-incinerator",
"category": "crafting",
"requirements": [
"graphite/5","lead/15"
],
"health": 90.00,
"consumes": {
"power": 0.50
}
}
无可讲

分类部分
全方块可用
hasPower: boolean
hasLiquid: boolean
hasItems: boolean

GenericCrafter
outputItem: ItemStack
@nullable outputItems: ItemStack[]
输出多类物品
@nullable outputLiquid: LiquidStack
输出液体

AttributeCrafter
拓展 GenericCrafter
boostScale: float
maxBoost: float
最大倍率

LiquidConverter
拓展 GenericCrafter

Separator
results: ItemStack[]

Incinerator

其他
@nullable
java修饰符,意为可以为空
资源
https://1565619256.lanzoui.com/b016oabjc
密码:4pji