KubeJS

KubeJS

69M Downloads

Unable to collapse spawn eggs into a REI category, if Insepcio is installed

SplendidAlakey opened this issue ยท 3 comments

commented

Minecraft Version

1.19.2

KubeJS Version

1902.6.0-build.142

Rhino Version

1902.2.2-build.268

Architectury Version

6.5.85

Forge/Fabric Version

Quilt 0.18.10 or Fabric 0.14.21

Describe your issue

I'm unable to group spawn eggs together in REI, if Inspecio is installed. Could be affecting other items, but I can only confirm the issue to be present with the eggs.

  1. Create the following KubeJS script in kubejs/client_scripts:
// priority: 9

REIEvents.groupEntries((event) => {
	
// Group spawn eggs together
	
	event.groupItems("kubejs:rei_groups/spawn_eggs", "Spawn Eggs", [
		'/spawn_egg/'
	]);
	
});
  1. Run the game and look at spawn eggs in REI - they aren't grouped together
  2. Remove Inspecio and launch the game again - now the eggs are grouped up

This happens even if spawn egg tooltips are disabled in the config.

To reproduce this on Fabric, you can install Advanced Tooltips.

Initially reported to Inspecio, but also reporting here, as based on the logs it has something to do with KubeJS specifically, unless I'm reading it wrong.

Crash report/logs

https://gist.github.com/SplendidAlakey/16ef59aa89fb590c6d9ddbbff09fee30

commented

This is weird. The REI log says the group does exist, but its very clearly not grouping. Advanced Tooltips has one mixin into the spawn egg item class that adds the image of the mob, which i wouldnt think affects it...

It also seems to do weird stuff to tipped arrows (which it also mixins to for the same purpose, and notably has a weird rei hackaround in there)
image
This is grouping by the regex /arrow/. Only regular, glowing and poison are actually grouped.

commented

Disabling that mixin fixes the issue. Makes me thing it might be an issue with REI not handling those special image tooltips properly.

commented

Workaround for now:

REIEvents.groupEntries((event) => {
  const $VanillaEntryTypes = Java.loadClass('me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes') // This cannot be initialized outside of the event due to REI being weird and relying on class loading order.

  event.registry.group("kubejs:rei_groups/spawn_eggs", "Spawn Eggs", $VanillaEntryTypes.ITEM, item => item.value.id.contains('spawn_egg'))
})

It is a lot uglier than I thought it would be. This is mainly caused by #703, and isn't helped by rhino thinking an ArrowFunction is a List not a Predicate