mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-17 02:55:13 +00:00
* Added missing ru_RU localization * Fixed first letter * Rename Binnie.Language to short Binnie.I18N Removed some unused methods, classes. Removed some hardcod strings, replaced it on i18n Moved pigment colors of blocks and items to tooltips
60 lines
1.3 KiB
Java
60 lines
1.3 KiB
Java
package binnie.botany.ceramic;
|
|
|
|
import binnie.Binnie;
|
|
import binnie.botany.Botany;
|
|
import binnie.botany.api.IFlower;
|
|
import net.minecraft.inventory.InventoryCrafting;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.crafting.IRecipe;
|
|
import net.minecraft.world.World;
|
|
|
|
public class PigmentRecipe implements IRecipe {
|
|
protected ItemStack cached;
|
|
|
|
private ItemStack unknown;
|
|
|
|
public PigmentRecipe() {
|
|
unknown = null;
|
|
}
|
|
|
|
@Override
|
|
public boolean matches(InventoryCrafting crafting, World world) {
|
|
return getCraftingResult(crafting) != null;
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getRecipeOutput() {
|
|
if (cached != null) {
|
|
return cached;
|
|
}
|
|
return unknown;
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
|
int n = 0;
|
|
ItemStack stack = null;
|
|
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
|
if (crafting.getStackInSlot(i) != null) {
|
|
if (++n > 1) {
|
|
return null;
|
|
}
|
|
if (!Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
|
continue;
|
|
}
|
|
|
|
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
|
if (flower.getAge() >= 1) {
|
|
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
|
}
|
|
}
|
|
}
|
|
return stack;
|
|
}
|
|
|
|
@Override
|
|
public int getRecipeSize() {
|
|
return 1;
|
|
}
|
|
}
|