use of WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectCraftingNew 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;
}
Aggregations