mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 14:34:36 +00:00
Added a proper Pure Daisy recipe list.
This commit is contained in:
1 parent
442301946c
commit
00cebd4d2f
5 files changed
+138
-34
No files matched your search
@@ -41,6 +41,7 @@ import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.signature.BasicSignature;
|
||||
@@ -62,8 +63,9 @@ public final class BotaniaAPI {
|
||||
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
|
||||
|
||||
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
|
||||
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
|
||||
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<RecipePureDaisy>();
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
|
||||
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<RecipeElvenTrade>();
|
||||
public static List<RecipeBrew> brewRecipes = new ArrayList<RecipeBrew>();
|
||||
|
||||
@@ -237,6 +239,12 @@ public final class BotaniaAPI {
|
||||
petalRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
public static RecipePureDaisy registerPureDaisyRecipe(Object input, Block output, int outputMeta) {
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(input, output, outputMeta);
|
||||
pureDaisyRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Rune Altar
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Apr 17, 2015, 5:07:25 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.recipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class RecipePureDaisy {
|
||||
|
||||
Object input;
|
||||
Block output;
|
||||
int outputMeta;
|
||||
|
||||
public RecipePureDaisy(Object input, Block output, int outputMeta) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.outputMeta = outputMeta;
|
||||
|
||||
if(input != null && !(input instanceof String || input instanceof Block))
|
||||
throw new IllegalArgumentException("input must be an oredict String or a Block.");
|
||||
}
|
||||
|
||||
public boolean matches(World world, int x, int y, int z, SubTileEntity pureDaisy) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(input instanceof Block && block == input)
|
||||
return true;
|
||||
|
||||
ItemStack stack = new ItemStack(block, 1, world.getBlockMetadata(x, y, z));
|
||||
String oredict = (String) input;
|
||||
return isOreDict(stack, oredict);
|
||||
}
|
||||
|
||||
private boolean isOreDict(ItemStack stack, String entry) {
|
||||
for(ItemStack ostack : OreDictionary.getOres(entry)) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block was placed (and if the Pure Daisy should do particles and stuffs).
|
||||
* Should only place the block if world.isRemote, but should return true if it would've placed
|
||||
* it otherwise. You may return false to cancel the normal particles and do your own.
|
||||
*/
|
||||
public boolean set(World world, int x, int y, int z, SubTileEntity pureDaisy) {
|
||||
if(world.isRemote)
|
||||
world.setBlock(x, y, z, output, outputMeta, 1 | 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public Block getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public int getOutputMeta() {
|
||||
return outputMeta;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user