Skip to content

Commit

Permalink
Remove useless stat patching
Browse files Browse the repository at this point in the history
  • Loading branch information
TelepathicGrunt committed Jun 23, 2024
1 parent 412c6ab commit 7d91194
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
21 changes: 0 additions & 21 deletions patches/net/minecraft/world/entity/LivingEntity.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,6 @@
this.lastHurtByPlayer = player;
} else {
this.lastHurtByPlayer = null;
@@ -1212,7 +_,7 @@
if (this instanceof ServerPlayer) {
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer)this, p_21016_, f, p_21017_, flag);
if (f1 > 0.0F && f1 < 3.4028235E37F) {
- ((ServerPlayer)this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(f1 * 10.0F));
+ ((ServerPlayer)this).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_BLOCKED_BY_SHIELD), Math.round(f1 * 10.0F));
}
}

@@ -1240,7 +_,7 @@

for (InteractionHand interactionhand : InteractionHand.values()) {
Expand Down Expand Up @@ -330,18 +321,6 @@
this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
}
}
@@ -1649,9 +_,9 @@
float f2 = f1 - p_21194_;
if (f2 > 0.0F && f2 < 3.4028235E37F) {
if (this instanceof ServerPlayer) {
- ((ServerPlayer)this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f2 * 10.0F));
+ ((ServerPlayer)this).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_RESISTED), Math.round(f2 * 10.0F));
} else if (p_21193_.getEntity() instanceof ServerPlayer) {
- ((ServerPlayer)p_21193_.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f2 * 10.0F));
+ ((ServerPlayer)p_21193_.getEntity()).awardStat(Stats.CUSTOM.get(Stats.DAMAGE_DEALT_RESISTED), Math.round(f2 * 10.0F));
}
}
}
@@ -1679,6 +_,8 @@

protected void actuallyHurt(DamageSource p_21240_, float p_21241_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ static void changeStatAward(final DynamicTest test, final RegistrationHelper reg
test.onGameTest(helper -> {
GameTestPlayer player = helper.makeTickingMockServerPlayerInLevel(GameType.SURVIVAL);
//Award a damage stat, which we are listening for in order to change the stat
player.awardStat(Stats.CUSTOM.get(Stats.DAMAGE_TAKEN), 100);
player.awardStat(Stats.DAMAGE_TAKEN, 100);
//Award an animal breed stat, which we are listining for in order to multiply the value
player.awardStat(Stats.CUSTOM.get(Stats.ANIMALS_BRED), 1);
player.awardStat(Stats.ANIMALS_BRED, 1);
ServerStatsCounter stats = player.level().getServer().getPlayerList().getPlayerStats(player);
//if our damage stat is changed to bell ring and our animal breed stat is multiplied by ten, the test passes
if (stats.getValue(Stats.CUSTOM.get(Stats.BELL_RING)) == 100 && stats.getValue(Stats.CUSTOM.get(Stats.ANIMALS_BRED)) == 10)
Expand Down

0 comments on commit 7d91194

Please sign in to comment.