KubeJS Mystical Agriculture
This project addresses two main objectives: replacing the functionality of mystical customization and providing support for all recipe types from the Mystical Agriculture mod.
With this addon, you gain the ability to create awakening, enchanting, infusion, seed reprocessing, soul extraction, and soulium spawner recipes.
The modification includes startup events for working with crops and mob soul types, providing access to the corresponding registries. This allows you to add new crops and creature souls.
Creating Recipes
ServerEvents.recipes(event => {
const {awakening,enchanter,infusion,reprocessor,soul_extraction,soulium_spawner} = event.recipes.mysticalagriculture;
// awakening
awakening(
"minecraft:gold_ingot", // result
"minecraft:iron_ingot", // center item
[
Item.of("minecraft:yellow_dye",40), // may contain count
Item.of("minecraft:yellow_dye",40),
Item.of("minecraft:yellow_dye",40),
Item.of("minecraft:yellow_dye",40)
], // items in essence vessels
[
"#minecraft;flowers",
"#minecraft;flowers",
"#minecraft;flowers",
"#minecraft;flowers",
] // items on pedestals
);
// enchanting
enchanter(
"minecraft:sharpness", // resulting enchantment
[
Item.of("minecraft:flint",3),
Item.of("minecraft:iron_ingot",2)
] // array of 1-2 items, may contain count
);
// infusion
infusion(
"minecraft:emerald", // result
"minecraft:diamond", // center item
[
Item.of("minecraft:green_dye",4) // count is unwrapped into multiple items
] // items on pedestals
);
// reprocessing
reprocessor(
"minecraft:iron_ingot", // result
"minecraft:compass" // input item
);
// soul extraction
// constructor 1
soul_extraction(
{
type:"mysticalagriculture:blaze",
souls:30
}, // mob souls
"minecraft:magma_cream" // input item
);
// constructor 2
soul_extraction(
"mysticalagriculture:zombie", // mob soul type
0.5, // soul count
"minecraft:diamond" // input item
);
// soulium spawner
soulium_spawner(
[
{
entity:"minecraft:zombie",
weight:100
},
{
entity:"minecraft:iron_golem",
// default weight is 1
}
], // entities
[
Item.of("minecraft:emerald",4) // may contain count
] // input items
);
});
Adding Crops
In startup_scripts
MysticalAgricultureStartupEvents.crop(event => {
// here the crop registry is accessible as event.registry
/ methods
void register(Crop crop);
void registerTier(CropTier tier);
void registerType(CropType type);
List<Crop> getCrops();
Crop getCropById(ResourceLocation id);
Crop getCropByName(String name);
List<CropTier> getTiers();
CropTier getTierById(ResourceLocation id);
List<CropType> getTypes();
CropType getTypeById(ResourceLocation id);
/
// cannot unregister a crop but can disable them
// to register a crop you need a Crop object
const kubium = new Crop(
"kubejs:kubium", // crop identifier
"mysticalagriculture:5", // crop tier identifier or object
"mysticalagriculture:resource", // crop type identifier or object
new CropTextures(
"mysticalagriculture:block/flower_ingot",// flower texture
"mysticalagriculture:item/essence_ingot" // essence texture
// can set seed texture by passing an additional argument
), // textures
"#forge:ingots/kubium" // ingredient, this is a custom object used by mystical agriculture, must be a tag or item
);
const red = new Crop(
"kubejs:red",
CropTier.ONE,
CropType.RESOURCE,
CropTextures.DUST_CROP_TEXTURES,
16711680,// color in decimal
"minecraft:red_dye"
);
// after creating crops, register them
event.register(kubium);
red.setDisplayName(Text.ofString("RED").red());
event.register(red);
});