Prevent manabean cross pollination from drops#67
Conversation
62328a2 to
7af4381
Compare
7af4381 to
0bbe798
Compare
Glease
left a comment
There was a problem hiding this comment.
the idea seems ok and the code does what you want, but IMO there are some technical ambiguity I'd like to clear up
in any case, thanks for rooting out and fixing this longstanding annoyance!
| public void visitFieldInsn(int opcode, String owner, String name, String desc) { | ||
| super.visitFieldInsn(opcode, owner, name, desc); | ||
|
|
||
| if (opcode != PUTFIELD || addedHeader) return; |
There was a problem hiding this comment.
do you mean to inject this block of code at the start of whole method?
There was a problem hiding this comment.
That's the idea, I tried roughly following your style in the other patches, but I can probably clean this up a bit more by just immediately injecting the instructions after the method visitor is created.
|
I see you already merged the patch, then i guess as a suggestion this seems to work too: Yamakaja@b6dccd3 |
|
the proper injection point for HEAD is to do it after super.visitCode() is called. I've done the shuffling and will soon 1) push the code 2) post an updated jar to curseforge |
|
I see, thanks for taking care of it! |
With this patch I intended to fix an issue where there is rather strong cross-pollination in golem-based mana bean farms, far beyond the level of normal (neighbor) cross-breeding.
This issue occurs due to how the AIHarvestCrops first breaks the block that it's trying to harvest, and then iterates through all nearby item entities in a 12x12x12 area to find the first plantable one. This means if there are already other mana beans on the ground from other harvests, they might be picked first over what should have been replanted. This patch addresses this issue specifically for mana beans, making sure that only mana beans of the same type are replanted when broken (This only applies to golems with order upgrade).
This patch is not comprehensively tested yet, I have it running in my personal environment, but some additional eyes might be helpful.