<commit_before>package mcjty.rftoolsdim.dimensions.dimlets.types;

import mcjty.lib.varia.Logging;
import mcjty.rftoolsdim.dimensions.DimensionInformation;
import mcjty.rftoolsdim.dimensions.dimlets.DimletKey;
import mcjty.rftoolsdim.dimensions.types.PatreonType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import org.apache.commons.lang3.tuple.Pair;

import java.util.List;
import java.util.Random;

public class PatreonDimletType implements IDimletType {

    @Override
    public String getName() {
        return "Patreon";
    }

    @Override
    public String getOpcode() {
        return "P";
    }

    @Override
    public String getTextureName() {
        return "patreonDimlet";
    }

    @Override
    public void setupFromConfig(Configuration cfg) {
    }

    @Override
    public boolean isModifier() {
        return false;
    }

    @Override
    public boolean isModifiedBy(DimletType type) {
        return false;
    }

    @Override
    public float getModifierCreateCostFactor(DimletType modifierType, DimletKey key) {
        return 1.0f;
    }

    @Override
    public float getModifierMaintainCostFactor(DimletType modifierType, DimletKey key) {
        return 1.0f;
    }

    @Override
    public float getModifierTickCostFactor(DimletType modifierType, DimletKey key) {
        return 1.0f;
    }

    @Override
    public boolean isInjectable(DimletKey key) {
        switch(key.getId()) {
        case "McJty":
        case "SickHippie":
        case "Nissenfeld":
        case "DarkCorvuz":
        case "TomWolf":
        case "Kenney":
            return true;
        default:
            Logging.logError("Unknown Patreon dimlet ID " + key.getId(), new RuntimeException());
            //$FALL-THROUGH$
        case "Lockesly":
        case "Puppeteer":
        case "Rouven":
        case "FireBall":
            return false;
        }
    }

    @Override
    public void inject(DimletKey key, DimensionInformation dimensionInformation) {
        if ("McJty".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_FIREWORKS);
        } else if ("SickHippie".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_SICKMOON);
            dimensionInformation.setPatreonBit(PatreonType.PATREON_SICKSUN);
        } else if ("Nissenfeld".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_RABBITMOON);
            dimensionInformation.setPatreonBit(PatreonType.PATREON_RABBITSUN);
        } else if ("Lockesly".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_PINKPILLARS);
        } else if ("Puppeteer".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_PUPPETEER);
        } else if ("Rouven".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_LAYEREDMETA);
        } else if ("FireBall".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_COLOREDPRISMS);
        } else if ("DarkCorvuz".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_DARKCORVUS);
        } else if ("TomWolf".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_TOMWOLF);
        } else if ("Kenney".equals(key.getId())) {
            dimensionInformation.setPatreonBit(PatreonType.PATREON_KENNEY);
        }
    }

    @Override
    public void constructDimension(List<Pair<DimletKey, List<DimletKey>>> dimlets, Random random, DimensionInformation dimensionInformation) {
        dimlets = DimensionInformation.extractType(DimletType.DIMLET_PATREON, dimlets);
        if (dimlets.isEmpty()) {
            return;
        }

        for (Pair<DimletKey, List<DimletKey>> dimlet : dimlets) {
            inject(dimlet.getKey(), dimensionInformation);
        }
    }<commit_msg>Use a switch statement instead of a bunch of ifs, and handle none matching<commit_after>package mcjty.rftoolsdim.dimensions.dimlets.types;

import mcjty.lib.varia.Logging;
import mcjty.rftoolsdim.dimensions.DimensionInformation;
import mcjty.rftoolsdim.dimensions.dimlets.DimletKey;
import mcjty.rftoolsdim.dimensions.types.PatreonType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import org.apache.commons.lang3.tuple.Pair;

import java.util.List;
import java.util.Random;

public class PatreonDimletType implements IDimletType {

    @Override
    public String getName() {
        return "Patreon";
    }

    @Override
    public String getOpcode() {
        return "P";
    }

    @Override
    public String getTextureName() {
        return "patreonDimlet";
    }

    @Override
    public void setupFromConfig(Configuration cfg) {
    }

    @Override
    public boolean isModifier() {
        return false;
    }

    @Override
    public boolean isModifiedBy(DimletType type) {
        return false;
    }

    @Override
    public float getModifierCreateCostFactor(DimletType modifierType, DimletKey key) {
        return 1.0f;
    }

    @Override
    public float getModifierMaintainCostFactor(DimletType modifierType, DimletKey key) {
        return 1.0f;
    }

    @Override
    public float getModifierTickCostFactor(DimletType modifierType, DimletKey key) {
        return 1.0f;
    }

    @Override
    public boolean isInjectable(DimletKey key) {
        switch(key.getId()) {
        case "McJty":
        case "SickHippie":
        case "Nissenfeld":
        case "DarkCorvuz":
        case "TomWolf":
        case "Kenney":
            return true;
        default:
            Logging.logError("Unknown Patreon dimlet ID " + key.getId(), new RuntimeException());
            //$FALL-THROUGH$
        case "Lockesly":
        case "Puppeteer":
        case "Rouven":
        case "FireBall":
            return false;
        }
    }

    @Override
    public void inject(DimletKey key, DimensionInformation dimensionInformation) {
        switch(key.getId()) {
        case "McJty":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_FIREWORKS);
            break;
        case "SickHippie":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_SICKMOON);
            dimensionInformation.setPatreonBit(PatreonType.PATREON_SICKSUN);
            break;
        case "Nissenfeld":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_RABBITMOON);
            dimensionInformation.setPatreonBit(PatreonType.PATREON_RABBITSUN);
            break;
        case "Lockesly":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_PINKPILLARS);
            break;
        case "Puppeteer":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_PUPPETEER);
            break;
        case "Rouven":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_LAYEREDMETA);
            break;
        case "FireBall":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_COLOREDPRISMS);
            break;
        case "DarkCorvuz":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_DARKCORVUS);
            break;
        case "TomWolf":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_TOMWOLF);
            break;
        case "Kenney":
            dimensionInformation.setPatreonBit(PatreonType.PATREON_KENNEY);
            break;
        default:
            Logging.logError("Unknown Patreon dimlet ID " + key.getId(), new RuntimeException());
        }
    }

    @Override
    public void constructDimension(List<Pair<DimletKey, List<DimletKey>>> dimlets, Random random, DimensionInformation dimensionInformation) {
        dimlets = DimensionInformation.extractType(DimletType.DIMLET_PATREON, dimlets);
        if (dimlets.isEmpty()) {
            return;
        }

        for (Pair<DimletKey, List<DimletKey>> dimlet : dimlets) {
            inject(dimlet.getKey(), dimensionInformation);
        }
    }
{'fraction_non_alphanumeric': 0.09377706297166893, 'fraction_numerical': 0.0017320301868118274, 'mean_word_length': 2.72706316274781, 'pattern_counts': {'":': 30, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4558370', 'n_tokens_mistral': 2512, 'n_tokens_neox': 2401, 'n_words': 419}