mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-21 04:42:20 +00:00
Mekanism v8 support
This commit is contained in:
1 parent
34a6c92939
commit
3d71e17b66
33 files changed
+1429
-1133
No files matched your search
@@ -1,67 +1,43 @@
|
||||
package modtweaker2.mods.mekanism.util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.recipe.inputs.ChemicalPairInput;
|
||||
import mekanism.common.recipe.inputs.InfusionInput;
|
||||
import mekanism.common.recipe.machines.PressurizedRecipe;
|
||||
import mekanism.common.recipe.outputs.ChanceOutput;
|
||||
import mekanism.common.recipe.outputs.ChemicalPairOutput;
|
||||
import mekanism.common.recipe.outputs.PressurizedOutput;
|
||||
import modtweaker2.mods.mekanism.Mekanism;
|
||||
import mekanism.common.recipe.inputs.MachineInput;
|
||||
import mekanism.common.recipe.machines.CombinerRecipe;
|
||||
import mekanism.common.recipe.machines.CrusherRecipe;
|
||||
import mekanism.common.recipe.machines.CrystallizerRecipe;
|
||||
import mekanism.common.recipe.machines.MachineRecipe;
|
||||
import mekanism.common.recipe.outputs.ItemStackOutput;
|
||||
import mekanism.common.recipe.outputs.MachineOutput;
|
||||
import modtweaker2.helpers.LogHelper;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class AddMekanismRecipe extends BaseMapAddition {
|
||||
public AddMekanismRecipe(String str, Map map, Object key, Object recipe) {
|
||||
super(str.toLowerCase(), map, key, recipe);
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class AddMekanismRecipe extends BaseMapAddition<MachineInput, MachineRecipe> {
|
||||
public AddMekanismRecipe(String name, Map<MachineInput, MachineRecipe> map, Map<MachineInput, MachineRecipe> recipes) {
|
||||
super(name, map, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
if (Mekanism.v7) {
|
||||
if (recipe instanceof ItemStack)
|
||||
return "Adding " + description + " Recipe for : " + ((ItemStack) recipe).getDisplayName();
|
||||
else if (recipe instanceof FluidStack)
|
||||
return "Adding " + description + " Recipe for : " + ((FluidStack) recipe).getFluid().getLocalizedName();
|
||||
else if (recipe instanceof ChemicalPairInput)
|
||||
return "Adding " + description + " Recipe for : " + ((ChemicalPairInput) recipe).leftGas.getGas().getLocalizedName();
|
||||
else if (recipe instanceof ChanceOutput)
|
||||
return "Adding " + description + " Recipe for : " + ((ChanceOutput) recipe).primaryOutput.getDisplayName();
|
||||
else if (recipe instanceof GasStack)
|
||||
return "Adding " + description + " Recipe for : " + ((GasStack) recipe).getGas().getLocalizedName();
|
||||
else if (recipe instanceof PressurizedRecipe)
|
||||
return "Adding " + description + " Recipe for : " + ((PressurizedRecipe) recipe).getOutput().getItemOutput().getDisplayName();
|
||||
else if (recipe instanceof InfusionInput)
|
||||
return "Adding " + description + " Recipe for : " + ((InfusionInput) recipe).inputStack.getDisplayName();
|
||||
else
|
||||
return super.getRecipeInfo();
|
||||
}
|
||||
return "";
|
||||
|
||||
public AddMekanismRecipe(String name, Map<MachineInput, MachineRecipe> map, MachineRecipe recipe) {
|
||||
super(name, map);
|
||||
|
||||
recipes.put(recipe.getInput(), recipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
if (Mekanism.isV7()) {
|
||||
if (recipe instanceof ItemStack)
|
||||
return "Removing " + description + " Recipe for : " + ((ItemStack) recipe).getDisplayName();
|
||||
else if (recipe instanceof FluidStack)
|
||||
return "Removing " + description + " Recipe for : " + ((FluidStack) recipe).getFluid().getLocalizedName();
|
||||
else if (recipe instanceof ChemicalPairOutput)
|
||||
return "Removing " + description + " Recipe for : " + ((ChemicalPairOutput) recipe).leftGas.getGas().getLocalizedName();
|
||||
else if (recipe instanceof ChanceOutput)
|
||||
return "Removing " + description + " Recipe for : " + ((ChanceOutput) recipe).primaryOutput.getDisplayName();
|
||||
else if (recipe instanceof GasStack)
|
||||
return "Removing " + description + " Recipe for : " + ((GasStack) recipe).getGas().getLocalizedName();
|
||||
else if (recipe instanceof PressurizedOutput)
|
||||
return "Removing " + description + " Recipe for : " + ((PressurizedOutput) recipe).getItemOutput().getDisplayName();
|
||||
else if (recipe instanceof InfusionInput)
|
||||
return "Removing " + description + " Recipe for : " + ((InfusionInput) recipe).inputStack.getDisplayName();
|
||||
else
|
||||
return super.getRecipeInfo();
|
||||
}
|
||||
return "";
|
||||
protected String getRecipeInfo(Entry<MachineInput, MachineRecipe> recipe) {
|
||||
MachineRecipe machineRecipe = recipe.getValue();
|
||||
MachineOutput output = recipe.getValue().recipeOutput;
|
||||
|
||||
if(machineRecipe instanceof CombinerRecipe) {
|
||||
return LogHelper.getStackDescription(((ItemStackOutput)output).output);
|
||||
} else if (machineRecipe instanceof CrusherRecipe) {
|
||||
return LogHelper.getStackDescription(((ItemStackOutput)output).output);
|
||||
} else if (machineRecipe instanceof CrystallizerRecipe) {
|
||||
return LogHelper.getStackDescription(((ItemStackOutput)output).output);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user