mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 22:44:34 +00:00
Merge branch 'master' of https://github.com/CrazyPants/EnderIO
This commit is contained in:
commit
9d08ef6b33
10 files changed
+147
-172
No files matched your search
@@ -43,10 +43,10 @@ public class ItemRecipes {
|
||||
|
||||
|
||||
ItemStack dspp = new ItemStack(EnderIO.blockDarkSteelPressurePlate);
|
||||
GameRegistry.addShapedRecipe(dspp, "ss ", 's', darkSteel);
|
||||
GameRegistry.addShapedRecipe(dspp, "ss", 's', darkSteel);
|
||||
|
||||
ItemStack dsppSilent = new ItemStack(EnderIO.blockDarkSteelPressurePlate, 1, 1);
|
||||
GameRegistry.addShapedRecipe(dsppSilent, " p ", " w ", 'p', dspp, 'w', Blocks.wool);
|
||||
GameRegistry.addShapedRecipe(dsppSilent, "p", "w", 'p', dspp, 'w', Blocks.wool);
|
||||
|
||||
//Soul Vessel
|
||||
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack(EnderIO.blockFusedQuartz,1,0));
|
||||
|
||||
@@ -4,17 +4,17 @@ import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
|
||||
import crazypants.enderio.machine.alloy.GuiAlloySmelter;
|
||||
import crazypants.enderio.machine.alloy.VanillaSmeltingRecipe;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.machine.recipe.IManyToOneRecipe;
|
||||
import crazypants.enderio.machine.recipe.IRecipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "enderio:textures/gui/alloySmelter.png";
|
||||
return "enderio:textures/gui/nei/alloySmelter.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,18 +87,26 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
if(recipe.isValidInput(0, ingredient)) {
|
||||
ItemStack output = recipe.getOutputs()[0].getOutput();
|
||||
AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output);
|
||||
res.setIngredientPermutation(res.input, ingredient);
|
||||
arecipes.add(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
drawProgressBar(98, 25, 176, 0, 22, 13, 48, 3);
|
||||
drawProgressBar(50, 25, 176, 0, 22, 13, 48, 3);
|
||||
drawProgressBar(51, 31, 166, 0, 22, 13, 48, 3);
|
||||
drawProgressBar(99, 31, 166, 0, 22, 13, 48, 3);
|
||||
AlloySmelterRecipe recipe = (AlloySmelterRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(energyString, 100, 50, 0xFFFFFFFF);
|
||||
GuiDraw.drawString(energyString, 100, 52, 0x808080, false);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
@@ -119,7 +127,6 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
private PositionedStack output;
|
||||
private int energy;
|
||||
|
||||
// Possible energy cost in the future?
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
@@ -137,20 +144,21 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
public AlloySmelterRecipe(int energy, RecipeInput[] ingredients, ItemStack result) {
|
||||
int recipeSize = ingredients.length;
|
||||
this.input = new ArrayList<PositionedStack>();
|
||||
int yOff = 8;
|
||||
if(recipeSize > 0) {
|
||||
this.input.add(new PositionedStack(getInputs(ingredients[0]), 49, 14 - yOff));
|
||||
this.input.add(new PositionedStack(getInputs(ingredients[0]), 50, 13));
|
||||
}
|
||||
if(recipeSize > 1) {
|
||||
this.input.add(new PositionedStack(getInputs(ingredients[1]), 73, 4 - yOff));
|
||||
this.input.add(new PositionedStack(getInputs(ingredients[1]), 75, 3));
|
||||
}
|
||||
if(recipeSize > 2) {
|
||||
this.input.add(new PositionedStack(getInputs(ingredients[2]), 98, 14 - yOff));
|
||||
this.input.add(new PositionedStack(getInputs(ingredients[2]), 99, 13));
|
||||
}
|
||||
if(result != null) {
|
||||
this.output = new PositionedStack(result, 74, 54 - yOff);
|
||||
this.output = new PositionedStack(result, 75, 42);
|
||||
}
|
||||
this.energy = energy;
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
@@ -15,6 +13,8 @@ import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import crazypants.enderio.machine.enchanter.EnchanterRecipe;
|
||||
@@ -57,12 +57,12 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
Map<Number, Number> enchants = EnchantmentHelper.getEnchantments(result);
|
||||
List<EnchanterRecipe> recipes = EnchanterRecipeManager.getInstance().getRecipes();
|
||||
|
||||
for(Number id : enchants.keySet()) {
|
||||
|
||||
for (Number id : enchants.keySet()) {
|
||||
if(id != null && id.intValue() >= 0 && id.intValue() < Enchantment.enchantmentsList.length) {
|
||||
Enchantment ench = Enchantment.enchantmentsList[id.intValue()];
|
||||
if(ench != null && ench.getName() != null) {
|
||||
|
||||
|
||||
for (EnchanterRecipe recipe : recipes) {
|
||||
if(recipe.isValid() && recipe.getEnchantment().getName().equals(ench.getName())) {
|
||||
EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1);
|
||||
@@ -71,18 +71,17 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment);
|
||||
arecipes.add(rec);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if(outputId.equals("EIOEnchanter") && getClass() == EnchanterRecipeHandler.class) {
|
||||
if(outputId.equals("EIOEnchanter") && getClass() == EnchanterRecipeHandler.class) {
|
||||
List<EnchanterRecipe> recipes = EnchanterRecipeManager.getInstance().getRecipes();
|
||||
for (EnchanterRecipe recipe : recipes) {
|
||||
if(recipe.isValid()) {
|
||||
@@ -102,25 +101,29 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
List<EnchanterRecipe> recipes = EnchanterRecipeManager.getInstance().getRecipes();
|
||||
for (EnchanterRecipe recipe : recipes) {
|
||||
if(recipe.isValid() && recipe.isInput(ingredient)) {
|
||||
if(recipe.isValid()) {
|
||||
EnchantmentData enchantment = new EnchantmentData(recipe.getEnchantment(), 1);
|
||||
ItemStack output = new ItemStack(Items.enchanted_book);
|
||||
Items.enchanted_book.addEnchantment(output, enchantment);
|
||||
EnchanterRecipeNEI rec = new EnchanterRecipeNEI(recipe, output, enchantment);
|
||||
arecipes.add(rec);
|
||||
if(rec.contains(rec.input, ingredient)) {
|
||||
rec.setIngredientPermutation(rec.input, ingredient);
|
||||
arecipes.add(rec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
public void drawExtras(int recipeIndex) {
|
||||
EnchanterRecipeNEI recipe = (EnchanterRecipeNEI) arecipes.get(recipeIndex);
|
||||
|
||||
GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, 0x808080, false);
|
||||
|
||||
int cost = TileEnchanter.getEnchantmentCost(recipe.recipe, 1);
|
||||
if(cost > 0) {
|
||||
String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(cost)});
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int sw = fr.getStringWidth(s);
|
||||
fr.drawStringWithShadow(s, 90 - (sw/2), 48, 8453920);
|
||||
String s = I18n.format("container.repair.cost", new Object[] { Integer.valueOf(cost) });
|
||||
GuiDraw.drawStringC(s, 83, 46, 0x80FF20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +144,10 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
private EnchantmentData enchData;
|
||||
private EnchanterRecipe recipe;
|
||||
|
||||
public String getEnchantName() {
|
||||
return StatCollector.translateToLocal(enchData.enchantmentobj.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, input);
|
||||
|
||||
@@ -3,7 +3,6 @@ package crazypants.enderio.nei;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.gas.GasUtil;
|
||||
import crazypants.enderio.config.Config;
|
||||
@@ -12,9 +11,9 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
API.registerRecipeHandler(new AlloySmelterRecipeHandler());
|
||||
API.registerRecipeHandler(new AlloySmelterRecipeHandler());
|
||||
API.registerUsageHandler(new AlloySmelterRecipeHandler());
|
||||
|
||||
|
||||
API.registerRecipeHandler(new SagMillRecipeHandler());
|
||||
API.registerUsageHandler(new SagMillRecipeHandler());
|
||||
|
||||
@@ -23,10 +22,10 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
|
||||
API.registerRecipeHandler(new EnchanterRecipeHandler());
|
||||
API.registerUsageHandler(new EnchanterRecipeHandler());
|
||||
|
||||
|
||||
API.registerRecipeHandler(new SliceAndSpliceRecipeHandler());
|
||||
API.registerUsageHandler(new SliceAndSpliceRecipeHandler());
|
||||
|
||||
|
||||
API.registerRecipeHandler(new SoulBinderRecipeHandler());
|
||||
API.registerUsageHandler(new SoulBinderRecipeHandler());
|
||||
|
||||
@@ -68,8 +67,7 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "0.0.1";
|
||||
return EnderIO.VERSION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
package crazypants.enderio.nei;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
@@ -25,7 +23,6 @@ import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.machine.recipe.Recipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.recipe.RecipeOutput;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -38,7 +35,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "enderio:textures/gui/crusher.png";
|
||||
return "enderio:textures/gui/nei/crusher.png";
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
@@ -57,7 +54,6 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
//Set this up later to show all alloy recipes
|
||||
transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(149, 32, 16, 16), "EnderIOSagMill", new Object[0]));
|
||||
}
|
||||
|
||||
@@ -93,24 +89,31 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
|
||||
List<Recipe> recipes = CrusherRecipeManager.getInstance().getRecipes();
|
||||
for (Recipe recipe : recipes) {
|
||||
if(recipe.isValidInput(0, ingredient)) {
|
||||
MillRecipe res = new MillRecipe(recipe.getEnergyRequired(), recipe.getInputs()[0], recipe.getOutputs());
|
||||
MillRecipe res = new MillRecipe(recipe.getEnergyRequired(), recipe.getInputs()[0], recipe.getOutputs());
|
||||
if(res.contains(res.input, ingredient)) {
|
||||
res.setIngredientPermutation(res.input, ingredient);
|
||||
arecipes.add(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 166, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
drawProgressBar(98, 33, 176, 0, 22, 13, 48, 3);
|
||||
drawProgressBar(50, 33, 176, 0, 22, 13, 48, 3);
|
||||
drawProgressBar(73, 20, 166, 0, 17, 24, 40, 1);
|
||||
drawProgressBar(136, 12, 166, 24, 4, 16, 160, 11);
|
||||
|
||||
MillRecipe recipe = (MillRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(energyString, 90, 22, 0xFFFFFFFF);
|
||||
GuiDraw.drawString(energyString, 96, 33, 0x808080, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,39 +123,14 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
if(chance > 0 && chance < 1) {
|
||||
int chanceInt = (int) (chance * 100);
|
||||
if(chanceInt == 0) {
|
||||
currenttip.add("Less than 1%");
|
||||
currenttip.add(EnumChatFormatting.GRAY + "Chance: <1%");
|
||||
} else {
|
||||
currenttip.add(chanceInt + "% Chance");
|
||||
currenttip.add(EnumChatFormatting.GRAY + "Chance: " + chanceInt + "%");
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public void renderIcon(IIcon icon, double x, double y, double width, double height, double zLevel) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
RenderUtil.bindItemTexture();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
float minU = icon.getMinU();
|
||||
float minV = icon.getMinV();
|
||||
float maxU = icon.getMaxU();
|
||||
float maxV = icon.getMaxV();
|
||||
tessellator.addVertexWithUV(x, y + height, zLevel, minU, maxV);
|
||||
tessellator.addVertexWithUV(x + width, y + height, zLevel, maxU, maxV);
|
||||
tessellator.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV);
|
||||
tessellator.addVertexWithUV(x, y + 0, zLevel, minU, minV);
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawProgressBar(int x, int y, int tx, int ty, int w, int h, float completion, int direction) {
|
||||
super.drawProgressBar(87 - 13, 37 - 16, 200, 0, 17, 24, completion, 1);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
List<ItemStack> result = new ArrayList<ItemStack>();
|
||||
result.add(input.getInput());
|
||||
@@ -165,8 +143,6 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Point offset = new Point(5, 11);
|
||||
|
||||
public class MillRecipe extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
protected int numTargetOuput;
|
||||
@@ -176,7 +152,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
private ArrayList<PositionedStack> otherOutputs;
|
||||
private float[] outputChance;
|
||||
private int energy;
|
||||
|
||||
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
@@ -220,20 +196,20 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
this.energy = energy;
|
||||
|
||||
input = new ArrayList<PositionedStack>(2);
|
||||
input.add(new PositionedStack(getInputs(ingredient), 80 - offset.x, 12 - offset.y));
|
||||
input.add(new PositionedStack(getInputs(ingredient), 74, 2));
|
||||
|
||||
input.add(new PositionedStack(getBalls(), 122 - offset.x, 23 - offset.y));
|
||||
input.add(new PositionedStack(getBalls(), 116, 12));
|
||||
|
||||
output = new PositionedStack(outputs[0].getOutput(), 49 - offset.x, 59 - offset.y);
|
||||
output = new PositionedStack(outputs[0].getOutput(), 43, 46);
|
||||
otherOutputs = new ArrayList<PositionedStack>();
|
||||
if(outputs.length > 1) {
|
||||
otherOutputs.add(new PositionedStack(outputs[1].getOutput(), 70 - offset.x, 59 - offset.y));
|
||||
otherOutputs.add(new PositionedStack(outputs[1].getOutput(), 64, 46));
|
||||
}
|
||||
if(outputs.length > 2) {
|
||||
otherOutputs.add(new PositionedStack(outputs[2].getOutput(), 91 - offset.x, 59 - offset.y));
|
||||
otherOutputs.add(new PositionedStack(outputs[2].getOutput(), 85, 46));
|
||||
}
|
||||
if(outputs.length > 3) {
|
||||
otherOutputs.add(new PositionedStack(outputs[3].getOutput(), 112 - offset.x, 59 - offset.y));
|
||||
otherOutputs.add(new PositionedStack(outputs[3].getOutput(), 106, 46));
|
||||
}
|
||||
|
||||
outputChance = new float[outputs.length];
|
||||
|
||||
@@ -5,10 +5,13 @@ import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
@@ -82,16 +85,26 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
for (IRecipe recipe : recipes) {
|
||||
if(recipe.isValidInput(0, ingredient)) {
|
||||
SliceAndSpliceRecipe res = new SliceAndSpliceRecipe(recipe);
|
||||
res.setIngredientPermutation(res.input, ingredient);
|
||||
arecipes.add(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(16, 0, 29, 11, 142, 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
drawProgressBar(90, 35, 177, 14, 23, 17, 120, 0);
|
||||
|
||||
SliceAndSpliceRecipe recipe = (SliceAndSpliceRecipe) arecipes.get(recipeIndex);
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(energyString, 100, 58, 0xFFFFFFFF);
|
||||
GuiDraw.drawString(energyString, 100, 57, 0x808080, false);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
@@ -130,7 +143,7 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
int recipeSize = recipe.getInputs().length;
|
||||
input = new ArrayList<PositionedStack>();
|
||||
int yOff = 11;
|
||||
int xOff = 5;
|
||||
int xOff = 13;
|
||||
|
||||
Point pos;
|
||||
for (RecipeInput recipeInput : recipe.getInputs()) {
|
||||
|
||||
@@ -2,35 +2,26 @@ package crazypants.enderio.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.IMachineRecipe;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.enchanter.EnchanterRecipe;
|
||||
import crazypants.enderio.machine.enchanter.EnchanterRecipeManager;
|
||||
import crazypants.enderio.machine.enchanter.GuiEnchanter;
|
||||
import crazypants.enderio.machine.enchanter.TileEnchanter;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.machine.soul.GuiSoulBinder;
|
||||
import crazypants.enderio.machine.soul.ISoulBinderRecipe;
|
||||
import crazypants.enderio.nei.EnchanterRecipeHandler.EnchanterRecipeNEI;
|
||||
|
||||
public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@@ -110,9 +101,9 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
for (IMachineRecipe recipe : recipes.values()) {
|
||||
if(recipe instanceof ISoulBinderRecipe) {
|
||||
ISoulBinderRecipe sbr = (ISoulBinderRecipe) recipe;
|
||||
if(sbr.getInputStack().isItemEqual(ingredient)) {
|
||||
arecipes.add(new SoulBinderRecipeNEI((ISoulBinderRecipe) recipe));
|
||||
SoulBinderRecipeNEI sbr = new SoulBinderRecipeNEI((ISoulBinderRecipe) recipe);
|
||||
if(sbr.contains(sbr.input, ingredient)) {
|
||||
arecipes.add(sbr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,36 +111,48 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(18, 0, 29, 11, 142, 65);
|
||||
}
|
||||
|
||||
// public List<ItemStack> getInputs(RecipeInput input) {
|
||||
// List<ItemStack> result = new ArrayList<ItemStack>();
|
||||
// result.add(input.getInput());
|
||||
// ItemStack[] equivs = input.getEquivelentInputs();
|
||||
// if(equivs != null && equivs.length > 0) {
|
||||
// result.addAll(Arrays.asList(equivs));
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
drawProgressBar(70, 23, 177, 14, 23, 17, 160, 0);
|
||||
|
||||
SoulBinderRecipeNEI recipe = (SoulBinderRecipeNEI) arecipes.get(recipeIndex);
|
||||
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawStringC(energyString, 83, 45, 0x808080, false);
|
||||
|
||||
int cost = recipe.getExperience();
|
||||
if(cost > 0) {
|
||||
String s = I18n.format("container.repair.cost", new Object[] { Integer.valueOf(cost) });
|
||||
GuiDraw.drawStringC(s, 83, 55, 0x80FF20);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ArrayList<PositionedStack> EMPTY_VIAL_OUTPUT = new ArrayList<PositionedStack>();
|
||||
static {
|
||||
EMPTY_VIAL_OUTPUT.add(new PositionedStack(new ItemStack(EnderIO.itemSoulVessel), 107, 23));
|
||||
EMPTY_VIAL_OUTPUT.add(new PositionedStack(new ItemStack(EnderIO.itemSoulVessel), 101, 23));
|
||||
}
|
||||
|
||||
public class SoulBinderRecipeNEI extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
private final ArrayList<PositionedStack> input = new ArrayList<PositionedStack>();
|
||||
|
||||
private final PositionedStack output;
|
||||
|
||||
private int energy;
|
||||
private int experience;
|
||||
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
|
||||
public int getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 20, input);
|
||||
@@ -166,18 +169,20 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
public SoulBinderRecipeNEI(ISoulBinderRecipe recipe) {
|
||||
this(recipe.getInputStack(), recipe.getOutputStack(), recipe.getEnergyRequired(), recipe.getSupportedSouls());
|
||||
this(recipe.getInputStack(), recipe.getOutputStack(), recipe.getEnergyRequired(), recipe.getExperienceRequired(), recipe.getSupportedSouls());
|
||||
}
|
||||
|
||||
public SoulBinderRecipeNEI(ItemStack inputStack, ItemStack result, int energy, List<String> list) {
|
||||
public SoulBinderRecipeNEI(ItemStack inputStack, ItemStack result, int energy, int experience, List<String> list) {
|
||||
|
||||
int yOff = 11;
|
||||
int xOff = 6;
|
||||
int xOff = 11;
|
||||
|
||||
input.add(new PositionedStack(getSoulVialInputs(list), 38 - xOff, 34 - yOff));
|
||||
input.add(new PositionedStack(inputStack, 60 - xOff, 34 - yOff));
|
||||
input.add(new PositionedStack(inputStack, 59 - xOff, 34 - yOff));
|
||||
output = new PositionedStack(result, 134 - xOff, 34 - yOff);
|
||||
|
||||
this.energy = energy;
|
||||
this.experience = experience;
|
||||
}
|
||||
|
||||
private List<ItemStack> getSoulVialInputs(List<String> mobs) {
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package crazypants.enderio.nei;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -28,7 +23,6 @@ import crazypants.enderio.machine.recipe.IRecipe;
|
||||
import crazypants.enderio.machine.recipe.RecipeInput;
|
||||
import crazypants.enderio.machine.still.GuiVat;
|
||||
import crazypants.enderio.machine.still.VatRecipeManager;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
@@ -124,12 +118,20 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
if(addRecipe) {
|
||||
FluidStack output = recipe.getOutputs()[0].getFluidOutput();
|
||||
InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output);
|
||||
res.setIngredientPermutation(res.inputs, ingredient);
|
||||
arecipes.add(res);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(22, 0, 27, 11, 123, 52);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipeIndex) {
|
||||
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex);
|
||||
@@ -142,24 +144,15 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
.renderGuiTank(rec.result, rec.result.amount, rec.result.amount, outTankBounds.x, outTankBounds.y, 0, outTankBounds.width, outTankBounds.height);
|
||||
}
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
String energyString = PowerDisplayUtil.formatPower(rec.energy) + " " + PowerDisplayUtil.abrevation();
|
||||
int width = fr.getStringWidth(energyString);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
int col = ColorUtil.getRGBA(0.75f, 1.0f, 1.0f, 1.0f);
|
||||
fr.drawString(energyString, 86 - width / 2, 55, col, true);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GuiDraw.drawStringC(energyString, 86, 54, 0x808080, false);
|
||||
|
||||
Fluid outputFluid = rec.result.getFluid();
|
||||
List<PositionedStack> stacks = rec.getIngredients();
|
||||
for (PositionedStack ps : stacks) {
|
||||
float mult = VatRecipeManager.getInstance().getMultiplierForInput(ps.item, outputFluid);
|
||||
String str = "x" + mult;
|
||||
fr.drawString(str, ps.relx + 8 - fr.getStringWidth(str) / 2, ps.rely + 19, ColorUtil.getRGB(Color.gray), false);
|
||||
|
||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, 0x808080, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,41 +188,16 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(index);
|
||||
if(in) {
|
||||
if(rec.inFluid != null && rec.inFluid.getFluid() != null) {
|
||||
list.add(rec.inFluid.getFluid().getLocalizedName());
|
||||
list.add(rec.inFluid.getFluid().getLocalizedName(rec.inFluid));
|
||||
}
|
||||
} else {
|
||||
if(rec.result != null && rec.result.getFluid() != null) {
|
||||
list.add(rec.result.getFluid().getLocalizedName());
|
||||
list.add(rec.result.getFluid().getLocalizedName(rec.result));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void renderIcon(IIcon icon, double x, double y, double width, double height, double zLevel) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
RenderUtil.bindItemTexture();
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
float minU = icon.getMinU();
|
||||
float minV = icon.getMinV();
|
||||
float maxU = icon.getMaxU();
|
||||
float maxV = icon.getMaxV();
|
||||
tessellator.addVertexWithUV(x, y + height, zLevel, minU, maxV);
|
||||
tessellator.addVertexWithUV(x + width, y + height, zLevel, maxU, maxV);
|
||||
tessellator.addVertexWithUV(x + width, y + 0, zLevel, maxU, minV);
|
||||
tessellator.addVertexWithUV(x, y + 0, zLevel, minU, minV);
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawProgressBar(int x, int y, int tx, int ty, int w, int h, float completion, int direction) {
|
||||
super.drawProgressBar(87 - 13, 37 - 16, 200, 0, 17, 24, completion, 1);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
List<ItemStack> result = new ArrayList<ItemStack>();
|
||||
result.add(input.getInput());
|
||||
|
||||
Reference in new issue
Block a user