Skip to content
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

KubeJS broke pig ai #921

Open
KostromDan opened this issue Oct 31, 2024 · 3 comments
Open

KubeJS broke pig ai #921

KostromDan opened this issue Oct 31, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@KostromDan
Copy link

KostromDan commented Oct 31, 2024

Minecraft Version

1.19.2

KubeJS Version

kubejs-forge-1902.6.2-build.73

Rhino Version

rhino-forge-1902.2.3-build.284

Architectury Version

architectury-6.6.92-forge

Forge/Fabric Version

43.4.4

Describe your issue

This is the most cursed bug I've ever had to debug...

I just spent 10 hours finding the cause and creating a minimal reproducible mod list:

Minimal reproducible mod list:

architectury-6.6.92-forge
blueprint-1.19.2-6.2.0
FarmersDelight-1.19.2-1.2.4
kubejs-forge-1902.6.2-build.73
rhino-forge-1902.2.3-build.284

Add this script in server scripts:

ServerEvents.recipes(event => {
//Yes it's empty
})

If we remove at least one item from the list above, including the script, the bug stops happening.
Trigger of bug is any ServerEvents.recipes, even empty. Without it it wouldn't happen.

Bug:
Pigs start following the player if they hold minecraft:air (empty) in at least one hand.
We can succesfuly multiply pigs with empty hand.
Also, we can successfully feed a baby pig with an empty hand.

Reason:
https://github.com/team-abnormals/blueprint/blob/1.19.x/src/main/java/com/teamabnormals/blueprint/core/Blueprint.java#L201
https://github.com/vectorwing/FarmersDelight/blob/1.19/src/main/java/vectorwing/farmersdelight/common/CommonSetup.java#L124

I think KubeJS somehow breaks one of these mods, causing it to add Null as Pig.FOOD_ITEMS instead of the intended item.
Null is then interpreted as minecraft:air(empty hand). So bug starts to happen.

Crash report/logs

No response

@KostromDan KostromDan added the bug Something isn't working label Oct 31, 2024
@KostromDan
Copy link
Author

KostromDan commented Oct 31, 2024

Tried to do some prints.

LOGGER.info(Arrays.toString(Ingredient.of(BlueprintItemTags.PIG_FOOD).getItems()));

Problem is KubeJS replaces [1 barrier] with [] in BlueprintItemTags.PIG_FOOD
So [] starts working as minecraft:air.

@KostromDan
Copy link
Author

tmp solution:

ServerEvents.tags('item', event => {
    event.add('blueprint:pig_food', 'minecraft:carrot')
})

@KostromDan
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant