![EasierCrafting](https://media.forgecdn.net/avatars/thumbnails/282/282/256/256/637288588396029855.png)
[Bug report]With customized lingering potion in the inventory, the crafting are all messed up
Neubulae opened this issue ยท 12 comments
No, that's my bug, not Mojangs. When you ask Mojangs code "Which type of potion is that", and give it something that isn't a potion, Mojang is perfectly right in answering "none". And a lingering potion of "nothing" also returns "none" - which is correct as well.
Now my problem is, if I'm checking if I can craft an arrow of slowness, and my ingredient is a lingering potion of slowness, I'm checking the potion and the arrow have the same type, but don't check if the ingredient type (potion) matches. Which doesn't matter as only potions have potion types. But when I'm checking if I can craft a brown dye of no potion type with a lingering potion of no potion type, and I'm omitting the check if the lingering potion is what the brown dye actually needs (cocoa beans), the code above still says "yes, that matches". So basically I'm allowing the lingering potion of nothing to imitate any other ingredient.
So what I need to do is "if the potion types match, don't just assume the item is a valid ingredient, instead, check the item as well".
I just uploaded a test version ("beta3") to CF, please tell me if you have any problems with it.
I just uploaded a test version ("beta3") to CF, please tell me if you have any problems with it.
Currently CF is experiencing a massive down here in China maybe due to some DDoS attack coming from China. I may or may not reach it but I'll try
Yes it does. That's because most recipes have a definition for them in form of a json file, which EasierCrafting picks up. Some other recipes - like tipped arrows or colored shulkers - are not in the json file, but are special-coded in the game itself. I made EasierCrafting recognize some of them, but that's a lot of work, and Suspicious Stew is one of them, which I didn't hardcode as I think it's rare enough to be used.
Also, as all types of Suspicious Stew have the same name, it'd be quite random which one you'd craft if you have more than one of the required flower types in your inventory.
Yes it does. That's because most recipes have a definition for them in form of a json file, which EasierCrafting picks up. Some other recipes - like tipped arrows or colored shulkers - are not in the json file, but are special-coded in the game itself. I made EasierCrafting recognize some of them, but that's a lot of work, and Suspicious Stew is one of them, which I didn't hardcode as I think it's rare enough to be used.
Also, as all types of Suspicious Stew have the same name, it'd be quite random which one you'd craft if you have more than one of the required flower types in your inventory.
Ah I see. Tho the stews themselves have special NBTs... well that's quite a hard work maybe?
Sorry, but can't reproduce. If you have arrows in your inventory as well, you should get the option of making arrows of , but only in the crafting grid, not in the 2x2 inventory crafting option.
This is exactly how it works for me (1.15.2). Can you add a screenshot, and possibly explain which item is which if it isn't obvious from the screenshot?
Sorry, but can't reproduce. If you have arrows in your inventory as well, you should get the option of making arrows of , but only in the crafting grid, not in the 2x2 inventory crafting option.
This is exactly how it works for me (1.15.2). Can you add a screenshot, and possibly explain which item is which if it isn't obvious from the screenshot?
try to reproduce with /give @s lingering_potion
Bug is in this code:
if (inventoryItem.getItem()!=Items.LINGERING_POTION)
return false;
Potion neededType = PotionUtil.getPotion(inventoryItem);
ItemStack[] possiblePotions = recipeComponent.getMatchingStacksClient();
for (ItemStack stack: possiblePotions) {
if (PotionUtil.getPotion(stack) == neededType)
return true;
}
return false;
This filters out ingredients that are potions, except lingering potions, then checks if the output has the same potion type as the input. This allows arrows with potion type XXX if I have a potion of type XXX.
But all other items have potion type "none", and the lingering potion has "none", so those items are counted as matching a lingering potion of nothing.
Bug is in this code:
if (inventoryItem.getItem()!=Items.LINGERING_POTION) return false; Potion neededType = PotionUtil.getPotion(inventoryItem); ItemStack[] possiblePotions = recipeComponent.getMatchingStacksClient(); for (ItemStack stack: possiblePotions) { if (PotionUtil.getPotion(stack) == neededType) return true; } return false;
This filters out ingredients that are potions, except lingering potions, then checks if the output has the same potion type as the input. This allows arrows with potion type XXX if I have a potion of type XXX.
But all other items have potion type "none", and the lingering potion has "none", so those items are counted as matching a lingering potion of nothing.
Wow, cool, should I blame Mojang for implementing every single item as potion type none?