Productive Bees

Productive Bees

10M Downloads

[1.16.5] Gene recipe crafting disrupts Polymorph behavior

TheIllusiveC4 opened this issue ยท 1 comments

commented

Versions:

  • Productive Bees: 1.16.5-0.6.5
  • Polymorph: 1.16.5-0.24
  • Forge: 35.1.36

Observed Behavior:
When attempting to use Polymorph's recipe toggle feature while installed with Productive Bees, the button will either disappear after several crafts or not appear at all. No further attempts nor switching the recipe inputs can bring the button up again.

Expected Behavior:
The recipe toggle feature from Polymorph should still appear and function normally while installed with Productive Bees.

Steps to Reproduce:

  1. Create an environment where a recipe conflict exists
  2. Use a Crafting Table to place the ingredients for the recipe conflict
  3. If the button appears, take out the ingredients and replace them multiple times.
  4. The button disappears and is no longer reachable.

Further Information:
For context, I am the Polymorph developer so I can answer questions or concerns about the issue from my end. This was the original issue as presented to me, where a user found the conflict between our mods: illusivesoulworks/polymorph#50

I believe the source of the problem, as stated in the title, stems from the CombineGeneRecipe crafting code here:

public boolean matches(CraftingInventory inv, World worldIn) {
// Valid if inv contains 1 honey treat and any number of genes
// genes must not be mutually exclusive (2 levels of the same attribute are not allowed)
Pair<String, Integer> addedGene = null;
for(int j = 0; j < inv.getSizeInventory(); ++j) {
ItemStack itemstack = inv.getStackInSlot(j);
if (!itemstack.isEmpty()) {
if (itemstack.getItem().equals(ModItems.GENE.get())) {
String attribute = Gene.getAttributeName(itemstack);
if (addedGene == null) {
addedGene = Pair.of(attribute, Gene.getValue(itemstack));
}
else if (!addedGene.getFirst().equals(attribute) || !addedGene.getSecond().equals(Gene.getValue(itemstack)) || Gene.getPurity(itemstack) == 100) {
return false;
}
} else {
return false;
}
}
}
return true;

This code will return true whenever it doesn't find an invalid item. However, that means that the recipe will match empty crafting states where there are no ingredients at all. This should probably be changed so that it will only return true if it has found the required number of items necessary to be considered a match for the recipe.

commented

Good catch, I've made the change. Thanks for reporting.