NovaEngineering-Source / ModularMachinery-Community-Edition

Customize your machinery with more powerful features.
https://www.curseforge.com/minecraft/mc-mods/modularmachinery-community-edition
GNU General Public License v3.0
28 stars 12 forks source link

[SUGGESTION] Recipes based on BiomeID and DimID #31

Closed RenanVieira88 closed 11 months ago

RenanVieira88 commented 1 year ago

Title Self-explanatory

KasumiNova commented 12 months ago

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 ....");
    }
})
KasumiNova commented 11 months ago

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