Fixed abilities not displaying the correct state when gravity is inverted and flight controls are inverted

This commit is contained in:
Sollace 2020-10-11 11:14:50 +02:00
parent 3024ebef0f
commit c83dedb0a4
4 changed files with 6 additions and 6 deletions

View file

@ -58,7 +58,7 @@ public interface Ability<T extends Hit> {
* The icon representing this ability on the UI and HUD. * The icon representing this ability on the UI and HUD.
* @return * @return
*/ */
default Identifier getIcon(Pony player) { default Identifier getIcon(Pony player, boolean swap) {
Identifier id = Abilities.REGISTRY.getId(this); Identifier id = Abilities.REGISTRY.getId(this);
return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + ".png"); return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + ".png");
} }

View file

@ -23,9 +23,9 @@ public class UnicornProjectileAbility implements Ability<Hit> {
* The icon representing this ability on the UI and HUD. * The icon representing this ability on the UI and HUD.
*/ */
@Override @Override
public Identifier getIcon(Pony player) { public Identifier getIcon(Pony player, boolean swap) {
Identifier id = Abilities.REGISTRY.getId(this); Identifier id = Abilities.REGISTRY.getId(this);
return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + (player.getEntity().isSneaking() ? "_focused" : "_unfocused") + ".png"); return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + (swap ? "_focused" : "_unfocused") + ".png");
} }
@Override @Override

View file

@ -34,9 +34,9 @@ public class UnicornTeleportAbility implements Ability<Pos> {
* The icon representing this ability on the UI and HUD. * The icon representing this ability on the UI and HUD.
*/ */
@Override @Override
public Identifier getIcon(Pony player) { public Identifier getIcon(Pony player, boolean swap) {
Identifier id = Abilities.REGISTRY.getId(this); Identifier id = Abilities.REGISTRY.getId(this);
return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + (player.getEntity().isSneaking() ? "_far" : "_near") + ".png"); return new Identifier(id.getNamespace(), "textures/gui/ability/" + id.getPath() + (swap ? "_far" : "_near") + ".png");
} }
@Override @Override

View file

@ -131,7 +131,7 @@ public class UHud extends DrawableHelper {
void renderAbilityIcon(MatrixStack matrices, AbilityDispatcher.Stat stat, int x, int y, int u, int v, int frameWidth, int frameHeight) { void renderAbilityIcon(MatrixStack matrices, AbilityDispatcher.Stat stat, int x, int y, int u, int v, int frameWidth, int frameHeight) {
stat.getAbility(KeyBindingsHandler.INSTANCE.page).ifPresent(ability -> { stat.getAbility(KeyBindingsHandler.INSTANCE.page).ifPresent(ability -> {
client.getTextureManager().bindTexture(ability.getIcon(Pony.of(client.player))); client.getTextureManager().bindTexture(ability.getIcon(Pony.of(client.player), client.options.keySneak.isPressed()));
drawTexture(matrices, x, y, 0, 0, frameWidth, frameHeight, u, v); drawTexture(matrices, x, y, 0, 0, frameWidth, frameHeight, u, v);
client.getTextureManager().bindTexture(HUD_TEXTURE); client.getTextureManager().bindTexture(HUD_TEXTURE);
}); });