mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 20:52:22 +00:00
* Some code improve readability for botany.ceramic package * Code improvement for botany.core package * Code improvement for botany.craftgui package * Fixed TextJustification from all code files * Code improvement for botany.farm package * Code improvement for botany.flower * Code improvement for root botany package Code improvement for botany.network package Code improvement for botany.proxypackage * Code improvement for botany.gargdening package Added missed localization for Soil Meter * Code improvement for botany.genetic package * Code improvement for botany.items package * Removed "// TODO fix deprecated" comment * Reformatted code by Forestry format settings * Reformat code with new format settings
57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package binnie.botany.ceramic;
|
|
|
|
import net.minecraft.inventory.InventoryCrafting;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.crafting.IRecipe;
|
|
import net.minecraft.util.NonNullList;
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.common.ForgeHooks;
|
|
|
|
import binnie.Binnie;
|
|
import binnie.botany.Botany;
|
|
import binnie.botany.api.IFlower;
|
|
|
|
public class PigmentRecipe implements IRecipe {
|
|
@Override
|
|
public boolean matches(InventoryCrafting crafting, World world) {
|
|
return !getCraftingResult(crafting).isEmpty();
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getRecipeOutput() {
|
|
return ItemStack.EMPTY;
|
|
}
|
|
|
|
@Override
|
|
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
|
int n = 0;
|
|
ItemStack stack = ItemStack.EMPTY;
|
|
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
|
ItemStack stackInSlot = crafting.getStackInSlot(i);
|
|
if (!stackInSlot.isEmpty()) {
|
|
if (++n > 1) {
|
|
return ItemStack.EMPTY;
|
|
}
|
|
if (Binnie.GENETICS.getFlowerRoot().isMember(stackInSlot)) {
|
|
IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stackInSlot);
|
|
if (flower != null && flower.getAge() >= 1) {
|
|
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return stack;
|
|
}
|
|
|
|
@Override
|
|
public int getRecipeSize() {
|
|
return 1;
|
|
}
|
|
|
|
@Override
|
|
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
|
|
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
|
}
|
|
}
|