Jump to content

Recommended Posts

Posted (edited)
@OnlyIn(Dist.CLIENT)
        @SubscribeEvent
        public static void onPreRenderPlayer(final RenderPlayerEvent.Pre event) {
				
            System.out.println("on client: " + player.level.isNight());
        }


 @Override
        public void onArmorTick(ItemStack stack, World world, PlayerEntity player) {
            System.out.println("on server: " + player.level.isNight());
        }

I want to know if it's day or night

 

 

 

On the server, this is valid

but client,invalid

 


[12十二月2021 12:43:55.102] [Render thread/INFO] [STDOUT/]: [ocean.chinacraft.common.item.armor.SilkNightArmor$RenderNightArmor:onPreRenderPlayer:79]: on client: false
[12十二月2021 12:43:55.118] [Render thread/INFO] [STDOUT/]: [ocean.chinacraft.common.item.armor.SilkNightArmor$RenderNightArmor:onPreRenderPlayer:79]: on client: false

 


[12:45:31] [Server thread/INFO] [STDOUT/]: [ocean.chinacraft.common.item.armor.SilkNightArmor$NightArmor:onArmorTick:61]: on server: true
[12:45:31] [Server thread/INFO] [STDOUT/]: [ocean.chinacraft.common.item.armor.SilkNightArmor$NightArmor:onArmorTick:61]: on server: true
[12:45:31] [Server thread/INFO] [STDOUT/]: [ocean.chinacraft.common.item.armor.SilkNightArmor$NightArmor:onArmorTick:61]: on server: true

Edited by Spring

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.