mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-16 18:54:54 +00:00
* Finalize, minor alloc reduction Also enable Jabel and generic injection * Update dependencies.gradle * Clean up Machine a bit * spotless more enhanced instanceof * Update ModuleMachine.java * More clen * WARN: Removed exception catching * Many, many tiny patches + birthday fix * Spotless * Spotless again * Fix getLow and clamp tolerance value * Revert event -> ignored on unused event parameters * Rename instanceof variables * Update Machine.java * Use StringBuilder * Cache getStack() * Oops, Jabel can't handle that * Spotless * Spotless again My IDE was fighting with it * Remove unused elements + scream test success
62 lines
1.6 KiB
Java
62 lines
1.6 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.world.World;
|
|
|
|
import binnie.Binnie;
|
|
import binnie.botany.Botany;
|
|
import binnie.botany.api.IFlower;
|
|
|
|
public class PigmentRecipe implements IRecipe {
|
|
|
|
protected ItemStack cached;
|
|
|
|
private final 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;
|
|
}
|
|
}
|