Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: PotionMeta is similar fix #934

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,20 @@ private static boolean equalsItemMeta(
}
}

if (itemMeta instanceof PotionMeta && sfitemMeta instanceof PotionMeta) {
return ((PotionMeta) itemMeta).getBasePotionType().equals(((PotionMeta) sfitemMeta).getBasePotionType());
if (itemMeta instanceof PotionMeta potionMeta && sfitemMeta instanceof PotionMeta sfPotionMeta) {
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20_5)) {
if (!potionMeta.hasBasePotionType() && !sfPotionMeta.hasBasePotionType()) {
return true;
}

return potionMeta.hasBasePotionType()
&& sfPotionMeta.hasBasePotionType()
&& potionMeta.getBasePotionType().equals(sfPotionMeta.getBasePotionType());
} else if (Slimefun.getMinecraftVersion().isMinecraftVersion(20, 2)) {
return potionMeta.getBasePotionType().equals(sfPotionMeta.getBasePotionType());
} else {
return potionMeta.getBasePotionData().equals(sfPotionMeta.getBasePotionData());
}
}

Debug.log(TestCase.CARGO_INPUT_TESTING, " All meta checked.");
Expand Down
Loading