Removed NEI Recipe Handlers (for now, because I was unhappy with them)

This commit is contained in:
Ellpeck 2015-09-23 18:21:57 +02:00
parent f0a17025c7
commit 9ad7a6e572
9 changed files with 0 additions and 921 deletions

View file

@ -1,168 +0,0 @@
/*
* This file ("CoffeeMachineRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.inventory.gui.GuiCoffeeMachine;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "actuallyadditions.coffee";
public CoffeeMachineRecipeHandler(){
super();
RecipeInfo.setGuiOffset(this.getGuiClass(), 35, 3);
}
public class CachedCoffee extends CachedRecipe{
public PositionedStack cup;
public PositionedStack coffeeBeans;
public PositionedStack result;
public PositionedStack ingredientStack;
public String extraText;
public int maxAmp;
public CachedCoffee(ItemCoffee.Ingredient ingredient){
this.cup = new PositionedStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), 45, 39);
this.coffeeBeans = new PositionedStack(new ItemStack(InitItems.itemCoffeeBean, ConfigIntValues.COFFEE_CACHE_USED_PER_ITEM.getValue()), 2, 39);
this.ingredientStack = new PositionedStack(ingredient.ingredient.copy(), 90, 21);
this.setupResult(ingredient);
this.extraText = ingredient.getExtraText();
this.maxAmp = ingredient.maxAmplifier;
}
public void setupResult(ItemCoffee.Ingredient ingredient){
ItemStack result = new ItemStack(InitItems.itemCoffee);
ItemCoffee.addEffectToStack(result, ingredient);
this.result = new PositionedStack(result.copy(), 45, 70);
}
@Override
public List<PositionedStack> getIngredients(){
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
list.add(this.ingredientStack);
list.add(this.cup);
list.add(this.coffeeBeans);
return list;
}
@Override
public PositionedStack getResult(){
return result;
}
}
@Override
public int recipiesPerPage(){
return 1;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(20, 39, 20, 16), NAME));
transferRects.add(new RecipeTransferRect(new Rectangle(64, 42, 23, 10), NAME));
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiCoffeeMachine.class;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == CoffeeMachineRecipeHandler.class){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingredient : ingredients){
arecipes.add(new CachedCoffee(ingredient));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingredient : ingredients){
if(result.getItem() instanceof ItemCoffee) arecipes.add(new CachedCoffee(ingredient));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingr : ingredients){
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient.copy(), ingredient)){
CachedCoffee theRecipe = new CachedCoffee(ingr);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredientStack), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEICoffeeMachine.png";
}
@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, 126, 88);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(20, 39, 126, 0, 21, 16, 48, 0);
drawProgressBar(63, 42, 125, 16, 24, 12, 48, 2);
CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe);
if(cache.extraText != null){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special") + ":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
if(cache.maxAmp > 0){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount") + ": " + cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

View file

@ -1,119 +0,0 @@
/*
* This file ("CompostRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.Collections;
public class CompostRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "actuallyadditions.compost";
public CompostRecipeHandler(){
super();
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
}
public class CachedCompostRecipe extends CachedRecipe{
public PositionedStack result;
public PositionedStack input;
public int chance;
public CachedCompostRecipe(ItemStack input, ItemStack result){
this.result = new PositionedStack(result, 67+32, 19);
this.input = new PositionedStack(input, 5+32, 19);
}
@Override
public PositionedStack getIngredient(){
return input;
}
@Override
public PositionedStack getResult(){
return result;
}
}
@Override
public int recipiesPerPage(){
return 2;
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return null;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(31+32, 18, 22, 16), NAME));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == CompostRecipeHandler.class){
arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue())));
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
if(NEIServerUtils.areStacksSameType(new ItemStack(InitItems.itemFertilizer), result)) arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue())));
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), ingredient)){
CachedCompostRecipe theRecipe = new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()));
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
arecipes.add(theRecipe);
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(32, 0, 0, 0, 96, 60);
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

View file

@ -1,190 +0,0 @@
/*
* This file ("CrusherRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.inventory.gui.GuiGrinder;
import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CrusherRecipeHandler extends TemplateRecipeHandler{
public static class CrusherDoubleRecipeHandler extends CrusherRecipeHandler{
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiGrinder.GuiGrinderDouble.class;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getName()));
transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getName()));
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1);
this.drawChanceString(66, 93, recipe);
}
}
public CrusherRecipeHandler(){
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
}
public class CachedCrush extends CachedRecipe{
public PositionedStack ingredient;
public PositionedStack resultOne;
public PositionedStack resultTwo;
public int secondChance;
public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance, CrusherRecipeHandler handler){
boolean isDouble = handler instanceof CrusherDoubleRecipeHandler;
in.stackSize = 1;
this.ingredient = new PositionedStack(in, isDouble ? 51 : 80, 21);
this.resultOne = new PositionedStack(resultOne, isDouble ? 38 : 66, 69);
if(resultTwo != null) this.resultTwo = new PositionedStack(resultTwo, isDouble ? 63 : 94, 69);
this.secondChance = secondChance;
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
@Override
public List<PositionedStack> getOtherStacks(){
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
if(this.resultTwo != null) list.add(this.resultTwo);
return list;
}
}
@Override
public int recipiesPerPage(){
return 1;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), this.getName()));
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiGrinder.class;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+this.getName()+".name");
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(this.getName()) && (getClass() == CrusherRecipeHandler.class || getClass() == CrusherDoubleRecipeHandler.class)){
ArrayList<CrusherRecipeManualRegistry.CrusherRecipe> recipes = CrusherRecipeManualRegistry.recipes;
for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){
arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<CrusherRecipeManualRegistry.CrusherRecipe> recipes = CrusherRecipeManualRegistry.recipes;
for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){
if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result))
arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<CrusherRecipeManualRegistry.CrusherRecipe> recipes = CrusherRecipeManualRegistry.recipes;
for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){
CachedCrush theRecipe = new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredient), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinder.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(60, 13, 60, 13, 56, 79);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(80, 40, 176, 0, 24, 23, 48, 1);
this.drawChanceString(118, 73, recipe);
}
@Override
public String getOverlayIdentifier(){
return this.getName();
}
protected String getName(){
return "actuallyadditions."+(this instanceof CrusherDoubleRecipeHandler ? "crushingDouble" : "crushing");
}
protected void drawChanceString(int x, int y, int recipe){
CachedCrush crush = (CachedCrush)this.arecipes.get(recipe);
if(crush.resultTwo != null){
int secondChance = crush.secondChance;
String secondString = secondChance+"%";
GuiDraw.drawString(secondString, x, y, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
}

View file

@ -1,138 +0,0 @@
/*
* This file ("FurnaceDoubleRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.inventory.gui.GuiFurnaceDouble;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "actuallyadditions.furnaceDouble";
public FurnaceDoubleRecipeHandler(){
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
}
public class CachedFurn extends CachedRecipe{
public PositionedStack ingredient;
public PositionedStack resultOne;
public CachedFurn(ItemStack in, ItemStack resultOne){
in.stackSize = 1;
this.ingredient = new PositionedStack(in, 51, 21);
this.resultOne = new PositionedStack(resultOne, 50, 69);
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiFurnaceDouble.class;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), NAME));
transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), NAME));
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER+":textures/gui/guiFurnaceDouble.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(46, 20, 46, 20, 84, 70);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1);
}
@Override
public int recipiesPerPage(){
return 1;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == FurnaceDoubleRecipeHandler.class){
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>)FurnaceRecipes.smelting().getSmeltingList();
for(Map.Entry<ItemStack, ItemStack> recipe : recipes.entrySet()){
arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue()));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@SuppressWarnings("unchecked")
@Override
public void loadCraftingRecipes(ItemStack result){
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>)FurnaceRecipes.smelting().getSmeltingList();
for(Map.Entry<ItemStack, ItemStack> recipe : recipes.entrySet()){
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue()));
}
}
@SuppressWarnings("unchecked")
@Override
public void loadUsageRecipes(ItemStack ingredient){
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>)FurnaceRecipes.smelting().getSmeltingList();
for(Map.Entry<ItemStack, ItemStack> recipe : recipes.entrySet()){
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)){
CachedFurn theRecipe = new CachedFurn(recipe.getKey(), recipe.getValue());
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredient), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

View file

@ -1,138 +0,0 @@
/*
* This file ("HairyBallRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
public class HairyBallRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "actuallyadditions.ballOfHair";
public HairyBallRecipeHandler(){
super();
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
}
public class CachedBallRecipe extends CachedRecipe{
public PositionedStack result;
public PositionedStack input;
public int chance;
public CachedBallRecipe(ItemStack input, ItemStack result, int chance){
this.result = new PositionedStack(result, 67+32, 19);
this.chance = chance;
this.input = new PositionedStack(input, 5+32, 19);
}
@Override
public PositionedStack getIngredient(){
return input;
}
@Override
public PositionedStack getResult(){
return result;
}
}
@Override
public int recipiesPerPage(){
return 2;
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return null;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(31+32, 18, 22, 16), NAME));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == HairyBallRecipeHandler.class){
ArrayList<HairyBallHandler.Return> recipes = HairyBallHandler.returns;
for(HairyBallHandler.Return recipe : recipes){
arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<HairyBallHandler.Return> recipes = HairyBallHandler.returns;
for(HairyBallHandler.Return recipe : recipes){
if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)) arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<HairyBallHandler.Return> recipes = HairyBallHandler.returns;
for(HairyBallHandler.Return recipe : recipes){
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.inputItem, ingredient)){
CachedBallRecipe theRecipe = new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(32, 0, 0, 0, 96, 60);
}
@Override
public void drawExtras(int rec){
CachedBallRecipe recipe = (CachedBallRecipe)this.arecipes.get(rec);
if(recipe.result != null){
int secondChance = recipe.chance;
String secondString = secondChance + "%";
GuiDraw.drawString(secondString, 65+32, 45, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

View file

@ -28,34 +28,6 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{
API.registerGuiOverlay(GuiCrafter.class, "crafting");
API.registerGuiOverlayHandler(GuiCrafter.class, new DefaultOverlayHandler(), "crafting");
CrusherRecipeHandler crusherRecipeHandler = new CrusherRecipeHandler();
API.registerRecipeHandler(crusherRecipeHandler);
API.registerUsageHandler(crusherRecipeHandler);
CrusherRecipeHandler.CrusherDoubleRecipeHandler crusherDoubleRecipeHandler = new CrusherRecipeHandler.CrusherDoubleRecipeHandler();
API.registerRecipeHandler(crusherDoubleRecipeHandler);
API.registerUsageHandler(crusherDoubleRecipeHandler);
FurnaceDoubleRecipeHandler furnaceDoubleRecipeHandler = new FurnaceDoubleRecipeHandler();
API.registerRecipeHandler(furnaceDoubleRecipeHandler);
API.registerUsageHandler(furnaceDoubleRecipeHandler);
HairyBallRecipeHandler ballRecipeHandler = new HairyBallRecipeHandler();
API.registerRecipeHandler(ballRecipeHandler);
API.registerUsageHandler(ballRecipeHandler);
TreasureChestRecipeHandler treasureRecipeHandler = new TreasureChestRecipeHandler();
API.registerRecipeHandler(treasureRecipeHandler);
API.registerUsageHandler(treasureRecipeHandler);
CompostRecipeHandler compostRecipeHandler = new CompostRecipeHandler();
API.registerRecipeHandler(compostRecipeHandler);
API.registerUsageHandler(compostRecipeHandler);
CoffeeMachineRecipeHandler coffeeMachineRecipeHandler = new CoffeeMachineRecipeHandler();
API.registerRecipeHandler(coffeeMachineRecipeHandler);
API.registerUsageHandler(coffeeMachineRecipeHandler);
API.hideItem(new ItemStack(InitBlocks.blockRice));
API.hideItem(new ItemStack(InitBlocks.blockCanola));
API.hideItem(new ItemStack(InitBlocks.blockFlax));

View file

@ -1,140 +0,0 @@
/*
* This file ("TreasureChestRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015 Ellpeck
*/
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
public class TreasureChestRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "actuallyadditions.treasureChest";
public TreasureChestRecipeHandler(){
super();
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
}
public class CachedTreasure extends CachedRecipe{
public PositionedStack result;
public PositionedStack input;
public int chance;
public int minAmount;
public int maxAmount;
public CachedTreasure(ItemStack input, ItemStack result, int chance, int minAmount, int maxAmount){
this.result = new PositionedStack(result, 67+32, 19);
this.chance = chance;
this.input = new PositionedStack(input, 5+32, 19);
this.minAmount = minAmount;
this.maxAmount = maxAmount;
}
@Override
public PositionedStack getIngredient(){
return input;
}
@Override
public PositionedStack getResult(){
return result;
}
}
@Override
public int recipiesPerPage(){
return 2;
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return null;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(31+32, 18, 22, 16), NAME));
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == TreasureChestRecipeHandler.class){
ArrayList<TreasureChestHandler.Return> recipes = TreasureChestHandler.returns;
for(TreasureChestHandler.Return recipe : recipes){
arecipes.add(new CachedTreasure(recipe.input, recipe.returnItem, recipe.itemWeight, recipe.minAmount, recipe.maxAmount));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<TreasureChestHandler.Return> recipes = TreasureChestHandler.returns;
for(TreasureChestHandler.Return recipe : recipes){
if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)) arecipes.add(new CachedTreasure(recipe.input, recipe.returnItem, recipe.itemWeight, recipe.minAmount, recipe.maxAmount));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<TreasureChestHandler.Return> recipes = TreasureChestHandler.returns;
for(TreasureChestHandler.Return recipe : recipes){
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){
CachedTreasure theRecipe = new CachedTreasure(recipe.input, recipe.returnItem, recipe.itemWeight, recipe.minAmount, recipe.maxAmount);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(32, 0, 0, 0, 96, 60);
}
@Override
public void drawExtras(int rec){
CachedTreasure recipe = (CachedTreasure)this.arecipes.get(rec);
if(recipe.result != null){
GuiDraw.drawString(recipe.minAmount+"-"+recipe.maxAmount+" "+StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".treasureChest.info")+" "+recipe.chance+"%", 65+10, 45, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB