More efficent order

Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
Joshua Castle 2024-03-10 20:24:49 -07:00
parent 9f1f7bf4f0
commit b712a0cd6b
No known key found for this signature in database
GPG Key ID: 7ECA1A2FC38ABA9F
1 changed files with 2 additions and 2 deletions

View File

@ -46,21 +46,21 @@ public class JavaClientboundRecipesTranslator extends PacketTranslator<Clientbou
recipesPacket.getUnlockedRecipes().addAll(getBedrockRecipes(session, packet.getAlreadyKnownRecipes()));
}
case ADD -> {
recipesPacket.setAction(UnlockedRecipesPacket.ActionType.NEWLY_UNLOCKED);
List<String> recipes = getBedrockRecipes(session, packet.getRecipes());
if (recipes.isEmpty()) {
// Sending an empty list here packet will crash the client as of 1.20.60
return;
}
recipesPacket.setAction(UnlockedRecipesPacket.ActionType.NEWLY_UNLOCKED);
recipesPacket.getUnlockedRecipes().addAll(recipes);
}
case REMOVE -> {
recipesPacket.setAction(UnlockedRecipesPacket.ActionType.REMOVE_UNLOCKED);
List<String> recipes = getBedrockRecipes(session, packet.getRecipes());
if (recipes.isEmpty()) {
// Sending an empty list here will crash the client as of 1.20.60
return;
}
recipesPacket.setAction(UnlockedRecipesPacket.ActionType.REMOVE_UNLOCKED);
recipesPacket.getUnlockedRecipes().addAll(getBedrockRecipes(session, packet.getRecipes()));
}
}