Skip to content

Comments

Prevent manabean cross pollination from drops#67

Merged
Glease merged 1 commit intoGlease:masterfrom
Yamakaja:fix/ManaBeanPollination
Jan 10, 2026
Merged

Prevent manabean cross pollination from drops#67
Glease merged 1 commit intoGlease:masterfrom
Yamakaja:fix/ManaBeanPollination

Conversation

@Yamakaja
Copy link
Contributor

@Yamakaja Yamakaja commented Jan 9, 2026

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.

@Yamakaja Yamakaja force-pushed the fix/ManaBeanPollination branch from 62328a2 to 7af4381 Compare January 9, 2026 21:57
@Yamakaja Yamakaja force-pushed the fix/ManaBeanPollination branch from 7af4381 to 0bbe798 Compare January 9, 2026 21:59
Copy link
Owner

@Glease Glease left a comment

Choose a reason for hiding this comment

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

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;
Copy link
Owner

Choose a reason for hiding this comment

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

do you mean to inject this block of code at the start of whole method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Owner

Choose a reason for hiding this comment

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

dont worry. I can fix it myself.

@Glease Glease merged commit 20d1b25 into Glease:master Jan 10, 2026
1 check passed
@Yamakaja
Copy link
Contributor Author

I see you already merged the patch, then i guess as a suggestion this seems to work too: Yamakaja@b6dccd3

@Glease
Copy link
Owner

Glease commented Jan 10, 2026

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

@Yamakaja
Copy link
Contributor Author

I see, thanks for taking care of it!

Glease added a commit that referenced this pull request Jan 10, 2026
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.

2 participants