泛型
为什么需要泛型
在 ZenCode 哪里用到了泛型
使用泛型
泛型类
泛型方法
public expand <K, V> V[K] {
public getOptional(key as K) as V? {
return key in this ? this[key] : null;
}
}MCTag 泛型
最后更新于
import crafttweaker.api.tag.MCTag;
import crafttweaker.api.item.MCItemDefinition;
import crafttweaker.api.fluid.MCFluid;
import crafttweaker.api.entity.MCEntityType;
import crafttweaker.api.blocks.MCBlock;
MCTag<MCItemDefinition> // 物品标签
MCTag<MCFluid> // 流体标签
MCTag<MCEntityType> // 实体标签
MCTag<MCBlock> // 方块标签