
格雷格·克罗普斯
格雷科技附属模组,允许使用作物种植材料
GregCrops
GregCrops 为 GregTech 材料添加了可种植的作物。主要面向整合包作者设计。
特性:
- 适用于任何材料——任何材料都可以轻松注册为作物
- 完全可配置的掉落物——你可以为作物添加任意物品掉落
- Java 和 KubeJS API——只需一行代码,即可通过附属模组或 KubeJS 添加新作物
工作原理
像种植原版作物一样,将材料的种子种在耕地上。它会经历 6 个生长阶段。成熟后即可收获,获得作物的掉落物和种子。
作物不允许使用骨粉催熟。
为材料添加作物
Java
@SubscribeEvent
public static void materialModification(PostMaterialEvent event) {
// 默认:成熟时掉落作物自身材料的粗矿(如果存在),否则会寻找其他掉落物(粉、锭等)
GTMaterials.Copper.setProperty(GregCropPropertyKeys.SEEDS, new SeedsProperty());
// 指定特定的掉落物标签前缀(此处为粉)
GTMaterials.Iron.setProperty(GregCropPropertyKeys.SEEDS, new SeedsProperty(TagPrefix.dust));
// 你也可以使用任何其他材料作为掉落物
GTMaterials.Aluminium.setProperty(GregCropPropertyKeys.SEEDS,
new SeedsProperty(TagPrefix.rawOre, GTMaterials.Bauxite));
// 你也可以直接使用物品 ID 指定任意其他物品
GTMaterials.Tin.setProperty(GregCropPropertyKeys.SEEDS,
new SeedsProperty('minecraft:gunpowder'));
}
KubeJS
const $TagPrefix = Java.loadClass('com.gregtechceu.gtceu.api.data.tag.TagPrefix');
GTCEuStartupEvents.materialModification(event => {
// GregCrops 将 SeedsProperty 和 GregCropPropertyKeys 暴露为全局变量
GTMaterials.Copper.setProperty(GregCropPropertyKeys.SEEDS, new SeedsProperty());
GTMaterials.Iron.setProperty(GregCropPropertyKeys.SEEDS, new SeedsProperty($TagPrefix.dust));
GTMaterials.Aluminium.setProperty(GregCropPropertyKeys.SEEDS,
new SeedsProperty($TagPrefix.rawOre, GTMaterials.Bauxite));
GTMaterials.Tin.setProperty(GregCropPropertyKeys.SEEDS,
new SeedsProperty('minecraft:gunpowder'));
});
覆盖现有作物
如果你想从头开始,有一个模组配置可以移除所有属性。
如果你不想从头开始,则必须先移除属性,再设置新属性,与其他任何 GTCEu 材料属性一样:
GTMaterials.Copper.removeProperty(GregCropPropertyKeys.SEEDS);
GTMaterials.Copper.setProperty(GregCropPropertyKeys.SEEDS, new SeedsProperty(TagPrefix.ingot));
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。