Merge pull request #609 from Tonius/the-nei-thing

Added recipe handler for crafting floating special flowers
This commit is contained in:
Lizbeth Rika committed 2015-02-26 16:45:25 +00:00
commit e3e160bd3c
3 files changed
+93

No files matched your search

@@ -18,6 +18,9 @@ public class NEIBotaniaConfig implements IConfigureNEI {
@Override
public void loadConfig() {
API.registerRecipeHandler(new RecipeHandlerFloatingFlowers());
API.registerUsageHandler(new RecipeHandlerFloatingFlowers());
API.registerRecipeHandler(new RecipeHandlerPetalApothecary());
API.registerUsageHandler(new RecipeHandlerPetalApothecary());
@@ -0,0 +1,89 @@
package vazkii.botania.client.integration.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.common.block.BlockFloatingSpecialFlower;
import vazkii.botania.common.block.BlockSpecialFlower;
import vazkii.botania.common.block.ModBlocks;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class RecipeHandlerFloatingFlowers extends TemplateRecipeHandler {
public class CachedFloatingFlowerRecipe extends CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public CachedFloatingFlowerRecipe(ItemStack floatingFlower,
ItemStack specialFlower, ItemStack output) {
this.inputs.add(new PositionedStack(floatingFlower, 25, 6));
this.inputs.add(new PositionedStack(specialFlower, 43, 6));
this.output = new PositionedStack(output, 119, 24);
this.output.setMaxSize(1);
}
@Override
public List<PositionedStack> getIngredients() {
return this.getCycledIngredients(cycleticks / 20, this.inputs);
}
@Override
public PositionedStack getResult() {
return this.output;
}
}
@Override
public String getRecipeName() {
return StatCollector.translateToLocal("botania.nei.floatingFlowers");
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
"crafting"));
}
@Override
public String getGuiTexture() {
return "textures/gui/container/crafting_table.png";
}
@Override
public void loadCraftingRecipes(ItemStack result) {
if (Block.getBlockFromItem(result.getItem()) instanceof BlockFloatingSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower,
1, OreDictionary.WILDCARD_VALUE);
ItemStack specialFlower = new ItemStack(ModBlocks.specialFlower);
specialFlower.setTagCompound((NBTTagCompound) result
.getTagCompound().copy());
this.arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
specialFlower, result.copy()));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
if (Block.getBlockFromItem(ingredient.getItem()) instanceof BlockSpecialFlower) {
ItemStack floatingFlower = new ItemStack(ModBlocks.floatingFlower,
1, OreDictionary.WILDCARD_VALUE);
ItemStack result = new ItemStack(ModBlocks.floatingSpecialFlower);
result.setTagCompound((NBTTagCompound) ingredient.getTagCompound()
.copy());
this.arecipes.add(new CachedFloatingFlowerRecipe(floatingFlower,
ingredient.copy(), result));
}
}
}
@@ -89,6 +89,7 @@ botaniamisc.hasCosmetic=&oHas Cosmetic Override: &r%s
# NEI INTEGRATION
botania.nei.brewery=Botanical Brewery
botania.nei.elvenTrade=Elven Trade
botania.nei.floatingFlowers=Floating Flower Crafting
botania.nei.manaPool=Mana Infusion
botania.nei.petalApothecary=Petal Apothecary
botania.nei.runicAltar=Runic Altar