-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
1.21.4 discovey recipe invalid packet #303
Comments
I really don't know what that code is doing. You are using some library and haven't said what it is. I've run I am going to need code that I can run to look at this further. |
sorry the guy who wrote this disappeared awhile ago, when i first looked at it after seeing the crash stack trace i guess i skimmed it and just assumed it was mostly bukkit api my bad
this is the only function that adds to vanilla_recipes private void loadVanillaRecipe(String recipe_name, ItemStack result, HashMap<Character, RecipeItem> dictionary) {
NamespacedKey recipe_key = new NamespacedKey(plugin, recipe_name);
// TODO really sloppy, only works with one ingredient shapeless
if (config.contains(recipe_name + ".shapeless")) {
ShapelessRecipe recipe = new ShapelessRecipe(recipe_key, result);
ArrayList<RecipeItem> dict_items = new ArrayList<>(dictionary.values());
ItemStack itemStack = dict_items.get(0).getItemStack(1);
recipe.addIngredient(config.getInt(recipe_name + ".shapeless"), itemStack);
addRecipe(recipe, recipe_key);
return;
}
if (result.getType() == Material.AIR)
return;
ShapedRecipe recipe = new ShapedRecipe(recipe_key, result);
// Add 1, 2 or 3 lines.
try {
if (config.getString(recipe_name + ".recipe.shape.bottom") != null) {
recipe.shape(config.getString(recipe_name + ".recipe.shape.top"), config.getString(recipe_name + ".recipe.shape.middle"),
config.getString(recipe_name + ".recipe.shape.bottom"));
} else if (config.getString(recipe_name + ".recipe.shape.middle") != null) {
recipe.shape(config.getString(recipe_name + ".recipe.shape.top"), config.getString(recipe_name + ".recipe.shape.middle"));
} else {
recipe.shape(config.getString(recipe_name + ".recipe.shape.top"));
}
} catch (Exception e) {
MvndiCrafting.getInstance().getLogger().info("Error loading vanilla recipe " + recipe_name);
}
for (Character c : dictionary.keySet()) {
try {
recipe.setIngredient(c, dictionary.get(c).getRecipeChoice());
} catch (Exception e) {
MvndiCrafting.getInstance().getLogger().info("Error loading vanilla recipe ingrediant " + dictionary.get(c).getID() + " in " + recipe_name);
}
}
this.vanilla_recipes.add(recipe_key);
addRecipe(recipe, recipe_key);
} addRecipe on the last line is private void addRecipe(Recipe recipe, NamespacedKey key) {
if (Bukkit.getServer().getRecipe(key) != null)
Bukkit.getServer().removeRecipe(key);
Bukkit.getServer().addRecipe(recipe);
} it reads from a config that looks like gunpowder:
category: Parts
item:
type: minecraft
id: gunpowder
quantity: 1
recipe:
shape:
top: " R "
middle: "RDR"
bottom: " R "
R:
type: minecraft
id: redstone
D:
type: minecraft
id: charcoal |
Stack trace
Plugin and Datapack List
player gets kicked and cant join server
no datapacks
Actions to reproduce (if known)
this is the method in our plugin that causes out (if the discover recipes line is commented out then players can join)
Folia version
This server is running Folia version 1.21.4-DEV-dev/1.21.4@d4bc338 (2024-12-05T04:54:20Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
Other
it doesnt happen on bb4fb5334e7f7231c86c6ef9951d3eb24db9e6ea
The text was updated successfully, but these errors were encountered: