KubeJS broke pig ai
KostromDan opened this issue ยท 3 comments
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
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.
tmp solution:
ServerEvents.tags('item', event => {
event.add('blueprint:pig_food', 'minecraft:carrot')
})
I think one of this broke tag:
https://github.com/search?q=repo%3AKubeJS-Mods%2FKubeJS+Items.BARRIER&type=code