Modular Machinery: Community Edition

Modular Machinery: Community Edition

239k Downloads

[SUGGESTION] Recipes based on BiomeID and DimID

RenanVieira88 opened this issue ยท 2 comments

commented

Title Self-explanatory

commented

You can use the RecipeCheckEvent:

import mods.modularmachinery.RecipeCheckEvent;

// RecipeBuilder...
.addCheckHandler(function(event as RecipeCheckEvent) {
    val ctrl = event.controller;
    val world = ctrl.world;
    // matches dimensionId... (Example: Overworld)
    if (!world.dimension != 0) {
        // Logic if does not match the dimension.
        event.setFailed("Cause by ....");
    }

    // matches dimensionName...(Example: world)
    if (!world.dimensionType.contains("world")) {
        // Logic if does not match the dimension.
        event.setFailed("Cause by ....");
    }

    val biome = world.getBiome(ctrl.pos);
    if (!biome.id.contains("biomeID")) {
        // Logic if does not match the biome.
        event.setFailed("Cause by ....");
    }
})
commented

This issue has gone unanswered for a long time, so please reopen it if you have a new issue.