use of WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray in project BloodMagic by WayofTime.
the class RenderAlchemyArray method render.
@Override
public void render(TileAlchemyArray alchemyArray, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
ItemStack inputStack = alchemyArray.getStackInSlot(0);
ItemStack catalystStack = alchemyArray.getStackInSlot(1);
int craftTime = alchemyArray.activeCounter;
AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack, catalystStack);
if (renderer == AlchemyArrayRecipeRegistry.DEFAULT_RENDERER) {
RecipeAlchemyArray recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArray(inputStack, catalystStack);
if (recipe != null)
renderer = new AlchemyCircleRenderer(recipe.getCircleTexture());
}
renderer.renderAt(alchemyArray, x, y, z, (craftTime > 0 ? craftTime + partialTicks : 0));
}
use of WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray in project BloodMagic by WayofTime.
the class TileAlchemyArray method attemptCraft.
public boolean attemptCraft() {
AlchemyArrayEffect effect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(this.getStackInSlot(0), this.getStackInSlot(1));
if (effect != null) {
if (arrayEffect == null) {
arrayEffect = effect;
key = effect.getKey();
} else {
String effectKey = effect.getKey();
if (effectKey.equals(key)) {
// Good! Moving on.
} else {
// Something has changed, therefore we have to move our stuffs.
// TODO: Add an AlchemyArrayEffect.onBreak(); ?
arrayEffect = effect;
key = effect.getKey();
}
}
} else {
RecipeAlchemyArray recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArray(getStackInSlot(0), getStackInSlot(1));
if (recipe == null)
return false;
AlchemyArrayEffect newEffect = new AlchemyArrayEffectCraftingNew(recipe);
if (arrayEffect == null) {
arrayEffect = newEffect;
key = newEffect.key;
} else if (!newEffect.key.equals(key)) {
arrayEffect = newEffect;
key = newEffect.key;
}
}
if (arrayEffect != null) {
isActive = true;
if (arrayEffect.update(this, this.activeCounter)) {
this.decrStackSize(0, 1);
this.decrStackSize(1, 1);
this.getWorld().setBlockToAir(getPos());
}
return true;
}
return false;
}
use of WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray in project BloodMagic by WayofTime.
the class BloodMagicRecipeRegistrar method addAlchemyArray.
@Override
public void addAlchemyArray(@Nonnull Ingredient input, @Nonnull Ingredient catalyst, @Nonnull ItemStack output, @Nullable ResourceLocation circleTexture) {
Preconditions.checkNotNull(input, "input cannot be null.");
Preconditions.checkNotNull(catalyst, "catalyst cannot be null.");
Preconditions.checkNotNull(output, "output cannot be null.");
alchemyArrayRecipes.add(new RecipeAlchemyArray(input, catalyst, output, circleTexture));
}
Aggregations