[1.19.2] [Suggestion] Option to disable the "Wiki" book upon first joining world / server
aking4125 opened this issue ยท 2 comments
Hello,
I love the addition of the wiki book. Wish IC2 on 1.12.2 had this.
Would it be possible in a future update to add a config option to disable the "Wiki" book upon first joining the world/server? It would be useful only to have a clean start on some configured mod packs/servers. There is already a recipe for it too (though it is quite expensive).
There is no direct way to preven the wiki book from being added when joining for the first time, though as Speiger mentioned here (#506 (comment)), we do a nbt tag check when the player joins the world like this:
@SubscribeEvent
public void onPlayerLoggedIn(PlayerLoggedInEvent handler)
{
CompoundTag nbt = handler.getPlayer().getPersistentData().getCompound(Player.PERSISTED_NBT_TAG);
if(!nbt.getBoolean("ic2_wiki")) {
//Give Wiki
}
}
so you should be able to use a CraftTweaker script to just set that nbt tag using a PlayerLoggedInEvent with any priority higher than normal together with getPersistentData/updatePersistentData. Also you'd need to check that this runs server side I think as it needs a ServerPlayer
I do not know how exactly the persistentData is structured, but just for ease of use, Player.PERSISTED_NBT_TAG
has this value PlayerPersisted
. Also I don't know too much about CraftTweaker to directly assist you further then this.
Here are official example scripts in case they might help: https://github.com/CraftTweaker/CraftTweaker/tree/1.19/Common/src/main/resources/data/crafttweaker/scripts
and more specifically crafttweaker_forge_events.zs