Posted September 12, 20232 yr I need to check the block on the server side but can't find isClientSide
September 12, 20232 yr Author more precisely, I need a condition for the method that works on the new version
September 12, 20232 yr depending on the context and location of the call, the method of obtaining it may differ significantly, but it is always Level example: the Player parameter is passed to a certain method public boolen anyMethod(ServerPlayer player, par1, par2) {...} you will receive the client side as follows player.getLevel.isClientSide server code is written in a block if (! player.getLevel.isClientSide){///} client code is written in a block if (player.getLevel.isClientSide){///} in some cases, the world can be passed directly to the method, but I don’t remember this in my practice in almost all cases I get the client side from LivingEntity.getLevel.isClientSide example 2: the client side is taken from the event public static void onPlayerJoin(EntityJoinLevelEvent event){ if(!event.getLevel().isClientSide()){ if(event.getEntity() instanceof ServerPlayer player){ val = event; RegisterPlayer registerPlayer = new RegisterPlayer(); registerPlayer.start(); SetupQuestCoreForPlayer setupQuestCoreForPlayer = new SetupQuestCoreForPlayer(); setupQuestCoreForPlayer.start(); } } here you can also get the client side via event.getEntity().getLevel().isClientSide() OR event.getLevel().isClientSide() sorry my ENGLISH is very bad loock this https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/CapsEvents.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/JoinLevel.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/LivingEntityDeath.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/event/LivingEntityHurt.java https://github.com/andreybadrey/forge/blob/master/src/main/java/com/bodryak/gmod/util/SyncScaner.java its help you!
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.