fixed the aura recharge effect not fully charging a cache

Closes #225
This commit is contained in:
Ell 2021-12-23 13:12:54 +01:00
parent f5428adbc6
commit 5bf5b14fa8
2 changed files with 5 additions and 5 deletions

View file

@ -43,11 +43,10 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null); var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
if (extract) { if (extract) {
amount -= container.drainAura(amount, simulate); return container.drainAura(amount, simulate) > 0;
} else { } else {
amount -= container.storeAura(amount, simulate); return container.storeAura(amount, simulate) > 0;
} }
return amount <= 0;
} }
return false; return false;
} }

View file

@ -48,10 +48,11 @@ public class BlockEntityNatureAltar extends BlockEntityImpl implements ITickable
@Override @Override
protected boolean canExtract(ItemStack stack, int slot, int amount) { protected boolean canExtract(ItemStack stack, int slot, int amount) {
var cap = stack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null); var cap = stack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
if (cap != null) if (cap != null) {
return cap.storeAura(1, true) <= 0; return cap.storeAura(1, true) <= 0;
else } else {
return BlockEntityNatureAltar.this.getRecipeForInput(stack) == null; return BlockEntityNatureAltar.this.getRecipeForInput(stack) == null;
}
} }
}; };
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)