mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +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() {
|
public void tick() {
|
||||||
|
Optional<Ability<?>> activeAbility = getActiveAbility();
|
||||||
|
|
||||||
|
if (activeAbility.isEmpty()) {
|
||||||
|
if (warmup > 0) {
|
||||||
|
warmup--;
|
||||||
|
}
|
||||||
|
if (cooldown > 0) {
|
||||||
|
cooldown--;
|
||||||
|
}
|
||||||
|
}
|
||||||
getActiveAbility().ifPresent(ability -> {
|
getActiveAbility().ifPresent(ability -> {
|
||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
warmup--;
|
warmup--;
|
||||||
|
|
|
@ -23,8 +23,6 @@ class ManaRingSlot extends Slot {
|
||||||
protected void renderContents(DrawContext context, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
protected void renderContents(DrawContext context, AbilityDispatcher abilities, boolean bSwap, float tickDelta) {
|
||||||
MatrixStack matrices = context.getMatrices();
|
MatrixStack matrices = context.getMatrices();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(24.125, 24.75, 0);
|
matrices.translate(24.125, 24.75, 0);
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,16 @@ class Slot {
|
||||||
bSwap &= abilities.isFilled(bSlot);
|
bSwap &= abilities.isFilled(bSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int page = Unicopia.getConfig().hudPage.get();
|
||||||
AbilityDispatcher.Stat stat = abilities.getStat(bSwap ? bSlot : aSlot);
|
AbilityDispatcher.Stat stat = abilities.getStat(bSwap ? bSlot : aSlot);
|
||||||
|
|
||||||
if (stat.getAbility(Unicopia.getConfig().hudPage.get()).isEmpty()) {
|
if (stat.getAbility(page).isEmpty()) {
|
||||||
|
if (aSlot != AbilitySlot.PRIMARY
|
||||||
|
|| (!abilities.getStat(AbilitySlot.SECONDARY).getAbility(page).isEmpty()
|
||||||
|
&& !abilities.getStat(AbilitySlot.TERTIARY).getAbility(page).isEmpty())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
|
@ -104,8 +109,6 @@ class Slot {
|
||||||
// background
|
// background
|
||||||
context.drawTexture(UHud.HUD_TEXTURE, 0, 0, backgroundU, backgroundV, size, size, 128, 128);
|
context.drawTexture(UHud.HUD_TEXTURE, 0, 0, backgroundU, backgroundV, size, size, 128, 128);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int iconPosition = ((size - iconSize + slotPadding + 1) / 2);
|
int iconPosition = ((size - iconSize + slotPadding + 1) / 2);
|
||||||
int sz = iconSize - slotPadding;
|
int sz = iconSize - slotPadding;
|
||||||
uHud.renderAbilityIcon(context, stat, iconPosition, iconPosition, sz, sz, sz, sz);
|
uHud.renderAbilityIcon(context, stat, iconPosition, iconPosition, sz, sz, sz, sz);
|
||||||
|
|
Loading…
Reference in a new issue