Snownee / Jade

Minecraft mod that shows what you are looking at. (Hwyla fork)

Home Page:https://www.curseforge.com/minecraft/mc-mods/jade

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Plugin] Hidding Container Items in the Tooltip

Corgam opened this issue · comments

Mod loader

Forge

Minecraft version

1.20.1

Mod version

11.6.3

Modloader version

Forge 47.1.0

Modpack info

No response

If bug:

  • Can you reproduce this issue with relevant mods only?

If bug: The latest.log file

No response

Issue description

Hi, I am currently implementing the Jade compatibility in my mod,
and I was wondering if it is possible to hide the container's contents inside the Tooltip. I don't want them to render twice :)

Untitled

You can implement an IServerExtensionProvider:

public class HideItemsProvider implements IServerExtensionProvider<HopperBlockEntity, ItemStack> {

	public static final ResourceLocation UID = new ResourceLocation("debug:hide_items");

	@Override
	public ResourceLocation getUid() {
		return UID;
	}

	@Override
	@Nullable
	public List<ViewGroup<ItemStack>> getGroups(ServerPlayer player, ServerLevel world, HopperBlockEntity target, boolean showDetails) {
		return List.of();
	}

}

and register it:

@Override
public void register(IWailaCommonRegistration registration) {
	registration.registerItemStorage(new HideItemsProvider(), HopperBlockEntity.class);
}

Thank you, works exactly as I wanted! :)