Skip to content

Update Declare Recipes packet and add packet for unlock recipes#589

Closed
BL19 wants to merge 1 commit into
retrooper:2.0from
BL19:2.0
Closed

Update Declare Recipes packet and add packet for unlock recipes#589
BL19 wants to merge 1 commit into
retrooper:2.0from
BL19:2.0

Conversation

@BL19

@BL19 BL19 commented Jun 7, 2023

Copy link
Copy Markdown

It adds the packet for unlocking recipes and updates the packet for declaring recipes to contain the CraftingBookCategory.

Tested on: 1.19.3 & 1.19.4

@retrooper

retrooper commented Jun 11, 2023

Copy link
Copy Markdown
Owner

Thank you for this PR. Will look into using this PR to complete the recipe wrappers and also update them to 1.20.

private final int width;
private final int height;
private final @NotNull String group;
private CraftingBookCategory category;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private CraftingBookCategory category;
private final CraftingBookCategory category;

private final @NotNull String group;
private final @NotNull Ingredient[] ingredients;
private final ItemStack result;
private CraftingBookCategory category;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private CraftingBookCategory category;
private final CraftingBookCategory category;

return result;
}

public CraftingBookCategory getCategory() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the @Nullable annotation not needed?

private final ItemStack result;

public ShapedRecipeData(final int width, final int height, final @NotNull String group, final @NotNull Ingredient[] ingredients, final ItemStack result) {
public ShapedRecipeData(final int width, final int height, final @NotNull String group, final @NotNull CraftingBookCategory category, final @NotNull Ingredient[] ingredients, final ItemStack result) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the CraftingBookCategory version-specific? If yes, please make a second constructor

super(packetType);
}

RecipeBookAction action;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add private final everywhere

import com.github.retrooper.packetevents.wrapper.PacketWrapper;

public class WrapperPlayServerUnlockRecipes extends PacketWrapper<WrapperPlayServerUnlockRecipes> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

recipeIds[i] = readString();
}

if(action == RecipeBookAction.INIT) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(action == RecipeBookAction.INIT) {
if (action == RecipeBookAction.INIT) {

writeString(recipeId);
}

if(action == RecipeBookAction.INIT) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(action == RecipeBookAction.INIT) {
if (action == RecipeBookAction.INIT) {

@NoJokeFNA

Copy link
Copy Markdown
Contributor

Hold up, I just saw the "WrapperPlayServerUnlockRecipes" class. It's definetly not cross-version and a duplicate of #382

@BL19

BL19 commented Jan 4, 2025

Copy link
Copy Markdown
Author

Closing since I don't really have time to fix this and have no use for it anymore. Might open a new PR if I need this again.

@BL19 BL19 closed this Jan 4, 2025
@BL19 BL19 deleted the 2.0 branch January 4, 2025 12:02
@BL19 BL19 restored the 2.0 branch January 4, 2025 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants