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);
        }
    }

    @Override
    public String[] getInformation() {
        return new String[] { "Patreon dimlets are in honor of a player and add purely cosmetic features to dimensions" };
    }

    @Override
    public DimletKey attemptDimletCrafting(ItemStack stackController, ItemStack stackMemory, ItemStack stackEnergy, ItemStack stackEssence) {
        return null;
    }
}

@@ -2020,26 +2020,14 @@
     
-if (%22McJty%22.equals
+switch
 (key
@@ -2027,36 +2027,57 @@
 tch(key.getId())
-)
  %7B%0A
+        case %22McJty%22:%0A
             dime
@@ -2151,54 +2151,45 @@
     
-%7D else if (%22SickHippie%22.equals(key.getId())) %7B
+    break;%0A        case %22SickHippie%22:
 %0A   
@@ -2352,54 +2352,45 @@
     
-%7D else if (%22Nissenfeld%22.equals(key.getId())) %7B
+    break;%0A        case %22Nissenfeld%22:
 %0A   
@@ -2557,52 +2557,43 @@
     
-%7D else if (%22Lockesly%22.equals(key.getId())) %7B
+    break;%0A        case %22Lockesly%22:
 %0A   
@@ -2682,53 +2682,44 @@
     
-%7D else if (%22Puppeteer%22.equals(key.getId())) %7B
+    break;%0A        case %22Puppeteer%22:
 %0A   
@@ -2806,50 +2806,41 @@
     
-%7D else if (%22Rouven%22.equals(key.getId())) %7B
+    break;%0A        case %22Rouven%22:
 %0A   
@@ -2929,52 +2929,43 @@
     
-%7D else if (%22FireBall%22.equals(key.getId())) %7B
+    break;%0A        case %22FireBall%22:
 %0A   
@@ -3056,54 +3056,45 @@
     
-%7D else if (%22DarkCorvuz%22.equals(key.getId())) %7B
+    break;%0A        case %22DarkCorvuz%22:
 %0A   
@@ -3182,51 +3182,42 @@
     
-%7D else if (%22TomWolf%22.equals(key.getId())) %7B
+    break;%0A        case %22TomWolf%22:
 %0A   
@@ -3302,50 +3302,41 @@
     
-%7D else if (%22Kenney%22.equals(key.getId())) %7B
+    break;%0A        case %22Kenney%22:
 %0A   
@@ -3408,16 +3408,150 @@
 ENNEY);%0A
+            break;%0A        default:%0A            Logging.logError(%22Unknown Patreon dimlet ID %22 + key.getId(), new RuntimeException());%0A
         

Use a switch statement instead of a bunch of ifs, and handle none matching