Skip to content

Commit 75d8f68

Browse files
authored
Merge pull request #4687 from ZacSharp/pr/1.19.4/fixSilentlibCrash
Calculate item hash only if needed
2 parents a9f40fb + 783777a commit 75d8f68

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/launch/java/baritone/launch/mixins/MixinItemStack.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ private void recalculateHash() {
4545
baritoneHash = item == null ? -1 : item.hashCode() + getDamageValue();
4646
}
4747

48-
@Inject(
49-
method = "<init>*",
50-
at = @At("RETURN")
51-
)
52-
private void onInit(CallbackInfo ci) {
53-
recalculateHash();
54-
}
55-
5648
@Inject(
5749
method = "setDamageValue",
5850
at = @At("TAIL")
@@ -63,7 +55,8 @@ private void onItemDamageSet(CallbackInfo ci) {
6355

6456
@Override
6557
public int getBaritoneHash() {
66-
// TODO: figure out why <init> mixin not working, was 0 for some reason
58+
// cannot do this in an init mixin because silentlib likes creating new
59+
// items in getDamageValue, which we call in recalculateHash
6760
if (baritoneHash == 0) recalculateHash();
6861
return baritoneHash;
6962
}

0 commit comments

Comments
 (0)