ENTITY_PLAYER_ATTACK_CRIT and ENTITY_PLAYER_ATTACK_STRONG occur when AttackCooldownProgress > 0.9f
. However, CROSSHAIR_ATTACK_INDICATOR_FULL_TEXTURE(crosshair_attack_indicator_full.png) only appears when AttackCooldownProgress >=1.0f
.
This bug may confuse new players and those who have switched from an old version of the game to a new one and are just learning about this combat system. Also, this bug gives an advantage to those who know about it.
I expected that crosshair_attack_indicator_full would appear at the moment when critical and strong damage would be available - this moment when AttackCooldownProgress > 0.9f
. However, it is not. crosshair_attack_indicator_full appears when AttackCooldownProgress >= 1.0f
.
Here are the steps to reproduce this bug:
Go to Minecraft.
Be sure that Attack indicator: Crosshair is enabled in video settings
And hit the entity between
AttackCooldownProgress > 0.9f
and<1.0f
(you can use a sword or any other item)And you will see that although a strong and critical attack is possible, at these moments the texture does not appear.
InGameHud.java
CROSSHAIR_ATTACK_INDICATOR_FULL_TEXTURE will appear if bl = true
(string 398). bl = true
if f >= 1.0
(string 392) Cooldown Progress >=1.0f
.PlayerEntity.java
ENTITY_PLAYER_ATTACK_SWEEP(string 1084), ENTITY_PLAYER_ATTACK_CRIT(string 1093) and ENTITY_PLAYER_ATTACK_STRONG(string 1098), will be executed if bl = h > 0.9f
(string 1034), variable h
contains information about CooldownProgress
Attachments
Comments 14
I expected that crosshair_attack_indicator_full would appear at the moment when critical and strong damage would be available - this moment when AttackCooldownProgress > 0.9f. However, it is not. crosshair_attack_indicator_full appears when AttackCooldownProgress >= 1.0f.
Here are the steps to reproduce this bug:
1. Go to Minecraft.
2. And hit the enitity between AttackCooldownProgress > 0.9f and <1.0f (you can use a sword or any other item)
3. And you will see that although a strong and critical attack is possible, at these moments the texture does not appear.
Sweep attacks and attack damage potential are two different mechanics. The plus sign may not be specifically designed to show that you can preform a sweep attack, but instead that your attack is fully charged (or as you call it, a "strong attack"), and will do maximum damage.
Preforming my own test using /tick commands to make it easier, attacking the mob right when the bar is full, but the plus sign isn't present, showed that the attack did less damage than the maximum possible damage (It wasn't a 'strong' attack in regards to the '+' icon). The sweep attack can be done much sooner, as it's not tied to the plus sign and whether or not it's present.
The wiki is not an official source, but to save myself the hastle of digging in the code, it's assumed that sweep attacks can be preformed much sooner at 84.8% of a charge rate, instead of full. (Edit: Code analysis provided)
Jiingy
Although your reasoning is very fascinating and I'm sure you spent a lot of time figuring out how it works, but you are wrong. And all your arguments are spoiled by the Minecraft code. Unfortunately, according to the rules, I cannot show this code, but you can generate it yourself and see for yourself in my words.
Code analysis is okay to share, here is the code which handles sweep attacks:
(from 1.20.2, not MojMappings, and trimmed for ease of reading)
public void attack(Entity target) {
if (target.isAttackable()) {
if (!target.handleAttack(this)) {
float f = (float)this.getAttributeValue(EntityAttributes.GENERIC_ATTACK_DAMAGE);
float g;
if (target instanceof LivingEntity) {
g = EnchantmentHelper.getAttackDamage(this.getMainHandStack(), ((LivingEntity)target).getGroup());
} else {
g = EnchantmentHelper.getAttackDamage(this.getMainHandStack(), EntityGroup.DEFAULT);
}
float h = this.getAttackCooldownProgress(0.5F);
f *= 0.2F + h * h * 0.8F;
g *= h;
this.resetLastAttackedTicks();
if (f > 0.0F || g > 0.0F) {
// 'bl' == Attack indicator fill check
boolean bl = h > 0.9F;
boolean bl2 = false;
int i = 0;
i += EnchantmentHelper.getKnockback(this);
if (this.isSprinting() && bl) {
this.getWorld().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F);
++i;
bl2 = true;
}
. . .
f += g;
boolean bl4 = false;
double d = (double)(this.horizontalSpeed - this.prevHorizontalSpeed);
if (bl && !bl3 && !bl2 && this.isOnGround() && d < (double)this.getMovementSpeed()) {
ItemStack itemStack = this.getStackInHand(Hand.MAIN_HAND);
if (itemStack.getItem() instanceof SwordItem) {
bl4 = true;
}
}
. . .
// Attack indicator fill is checked
if (bl4) {
float l = 1.0F + EnchantmentHelper.getSweepingMultiplier(this) * f;
for(LivingEntity livingEntity : this.getWorld().getNonSpectatingEntities(LivingEntity.class, target.getBoundingBox().expand(1.0, 0.25, 1.0))) {
if (livingEntity != this
&& livingEntity != target
&& !this.isTeammate(livingEntity)
&& (!(livingEntity instanceof ArmorStandEntity) || !((ArmorStandEntity)livingEntity).isMarker())
&& this.squaredDistanceTo(livingEntity) < 9.0) {
livingEntity.takeKnockback(
0.4F, (double)MathHelper.sin(this.getYaw() * (float) (Math.PI / 180.0)), (double)(-MathHelper.cos(this.getYaw() * (float) (Math.PI / 180.0)))
);
livingEntity.damage(this.getDamageSources().playerAttack(this), l);
}
}
this.getWorld().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F);
this.spawnSweepAttackParticles();
}
. . .
if (bl3) {
this.getWorld().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F);
this.addCritParticles(target);
}
. . .
}
}
}
}
}
And here is the code from renderCrosshair() InGameHud.java
. . .
RenderSystem.blendFuncSeparate(
GlStateManager.SrcFactor.ONE_MINUS_DST_COLOR, GlStateManager.DstFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO
);
int i = 15;
context.drawGuiTexture(CROSSHAIR_TEXTURE, (this.scaledWidth - 15) / 2, (this.scaledHeight - 15) / 2, 15, 15);
if (this.client.options.getAttackIndicator().getValue() == AttackIndicator.CROSSHAIR) {
// Attack indicator fill progress
float f = this.client.player.getAttackCooldownProgress(0.0F);
boolean bl = false;
// Progress is >= 1.0F
if (this.client.targetedEntity != null && this.client.targetedEntity instanceof LivingEntity && f >= 1.0F) {
bl = this.client.player.getAttackCooldownProgressPerTick() > 5.0F;
bl &= this.client.targetedEntity.isAlive();
}
int j = this.scaledHeight / 2 - 7 + 16;
int k = this.scaledWidth / 2 - 8;
if (bl) {
context.drawGuiTexture(CROSSHAIR_ATTACK_INDICATOR_FULL_TEXTURE, k, j, 16, 16);
} else if (f < 1.0F) {
int l = (int)(f * 17.0F);
context.drawGuiTexture(CROSSHAIR_ATTACK_INDICATOR_BACKGROUND_TEXTURE, k, j, 16, 4);
context.drawGuiTexture(CROSSHAIR_ATTACK_INDICATOR_PROGRESS_TEXTURE, 16, 4, 0, 0, k, j, l, 4);
}
}
RenderSystem.defaultBlendFunc();
}
. . .
You are right about what you described in the issue about how the plus icon doesn't show when the player is able to preform a sweep attack, but this all depends on whether or not the '+' icon is designed to show when the player can preform a sweep attack, or if it's intention is to show the player's potential attack damage is as high as it can be.
and why come up with some other icon to indicate the completeness of the scale. if the game when the scale is full, simply removes this scale, thereby showing that it is full.
Your argument makes absolutely no sense. The same logic I said before applies to the + that appears when hovering an entity, it indicates full charge, it does NOT indicate when critical/sweep/sprint-knockback attacks are possible. This is intended by Jeb, and is an intergral part of modern combat.
Furthering this, it is at specifically 84.8% cooldown that critical/sweep/sprint-knockback attacks become possible. This is WAI according to Jeb during 1.9's development, please mark this report as such.
Please don't avoid the question. As I already said, indicates full charge has already been implemented in minecraft (if we are holding a block and we have a full charge, the texture under the crosshair does not appear.). But crosshair_attack_indicator_full, as the name suggests, is an ATTACK indicator, NOT a CHARGE INDICATOR. Check out the code! Just because jeb did a lot in 1.9 doesn't mean he did everything (including textures). crosshair_attack_indicator_full Was made to help players in the new pvp 1.9 system.
Hi, could you please elaborate on this issue? What is the expected and observed behavior? Do you have any reliable repro steps?