mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 07:17:58 +01:00
Fixed ability cooldown not ticking when there is not ability in the slot. Fixes #366
This commit is contained in:
parent
bf5a29e8d5
commit
d4e3feacee
3 changed files with 17 additions and 6 deletions
|
@ -172,6 +172,16 @@ public class AbilityDispatcher implements Tickable, NbtSerialisable {
|
|||
}
|
||||
|
||||
public void tick() {
|
||||
Optional<Ability<?>> activeAbility = getActiveAbility();
|
||||
|
||||
if (activeAbility.isEmpty()) {
|
||||
if (warmup > 0) {
|
||||
warmup--;
|
||||
}
|
||||
if (cooldown > 0) {
|
||||
cooldown--;
|
||||
}
|
||||
}
|
||||
getActiveAbility().ifPresent(ability -> {
|
||||
if (warmup > 0) {
|
||||
warmup--;
|
||||
|
|
|
@ -23,8 +23,6 @@ class ManaRingSlot extends Slot {
|
|||
protected void renderContents(DrawContext context, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
|
||||
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(24.125, 24.75, 0);
|
||||
|
||||
|
|
|
@ -89,10 +89,15 @@ class Slot {
|
|||
bSwap &= abilities.isFilled(bSlot);
|
||||
}
|
||||
|
||||
int page = Unicopia.getConfig().hudPage.get();
|
||||
AbilityDispatcher.Stat stat = abilities.getStat(bSwap ? bSlot : aSlot);
|
||||
|
||||
if (stat.getAbility(Unicopia.getConfig().hudPage.get()).isEmpty()) {
|
||||
return;
|
||||
if (stat.getAbility(page).isEmpty()) {
|
||||
if (aSlot != AbilitySlot.PRIMARY
|
||||
|| (!abilities.getStat(AbilitySlot.SECONDARY).getAbility(page).isEmpty()
|
||||
&& !abilities.getStat(AbilitySlot.TERTIARY).getAbility(page).isEmpty())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
@ -104,8 +109,6 @@ class Slot {
|
|||
// background
|
||||
context.drawTexture(UHud.HUD_TEXTURE, 0, 0, backgroundU, backgroundV, size, size, 128, 128);
|
||||
|
||||
|
||||
|
||||
int iconPosition = ((size - iconSize + slotPadding + 1) / 2);
|
||||
int sz = iconSize - slotPadding;
|
||||
uHud.renderAbilityIcon(context, stat, iconPosition, iconPosition, sz, sz, sz, sz);
|
||||
|
|
Loading…
Reference in a new issue