December 29, 20177 yr Steps for checking if an event is being fired: 1. Place this line of code in your event method: Log.info("check"); 2. Meet all the requirements in-game for the event to fire (i.e. be attacked by any other entity). 3. If [INFO] check doesn't show up on the console, you did NOT register your event. Or just simply use the debugger Edited December 29, 20177 yr by Differentiation
December 29, 20177 yr 2 minutes ago, Yario said: @DifferentiationIt's working wiht you in multiplayer with client-side mod only ? Please clarify.
December 29, 20177 yr 2 minutes ago, Yario said: @DifferentiationIt's working wiht you in multiplayer with client-side mod only ? Do you mean you want your mod only to run on Singleplayer and not on Multiplayer Servers?
December 29, 20177 yr Author Did the event fired with you in multiplayer in a server that havn't the mod on it?
December 29, 20177 yr Just now, Yario said: Did the event fired with you in multiplayer in a server that havn't the mod on it? I don't understand what you are trying to say
December 29, 20177 yr Server - no mod Client - has the mod subscribing to living attack event Client with mod connects to client without mod, will client receive the event I believe that is what the OP is asking.
December 29, 20177 yr "The LivingAttackEvent is a Forge event that fires whenever an EntityLivingBase attacks another EntityLivingBase"
December 29, 20177 yr 1 minute ago, Ugdhar said: Server - no mod Well what do you mean "server - no mod?"
December 29, 20177 yr OH! I see. If the server does not have the mod installed, nothing will work on the clients. The event in this case will NOT be fired. Edited December 29, 20177 yr by Differentiation
December 29, 20177 yr The LivingAttackEvent is fired by the server. If the mod is not present in the server, this event will not fire.
December 29, 20177 yr 1 minute ago, Yario said: Use the mod on client-side only and tell me if the event is fired It won't fire. This event is fired by the server-side.
December 29, 20177 yr If you do: @Override public void onAttack(LivingAttackEvent event) { if (event.getEntity().worldObj.isRemote) { ... } } nothing will happen...
December 29, 20177 yr Author I know I want to be able to have an event when "thePlayer" got hitten by another entity and be able to do something like: event.getEntity() all of this client-side.
December 29, 20177 yr Just now, Yario said: all of this client-side. What do you mean? You would have to send packets to the EntityPlayerMP's client. Simple
December 29, 20177 yr I'm not quite understanding what you're trying to ask. LivingAttackEvent will fire when you're in a Singleplayer world by yourself and Multiplayer server. Edited December 29, 20177 yr by Differentiation
December 29, 20177 yr Author @DifferentiationPlease read all the post and try to help me again because you are not helping me and you don't understand the problem. If you cannot understand please stop speak in this topic
December 29, 20177 yr 5 minutes ago, Yario said: @DifferentiationPlease read all the post and try to help me again because you are not helping me and you don't understand the problem. If you cannot understand please stop speak in this topic @SubscribeEvent public void onAttack(LivingAttackEvent event) { if (event.getEntity() instanceof EntityPlayer) { Entity attackerIn = event.getSource().getSourceOfDamage(); // this is your attacker instance, the entity attacking the target EntityPlayer targetIn = (EntityPlayer) event.getEntity(); // this is your target instance, the entity being attacked by the attacker /* * Here, you do whatever you want with your attacker and target. * You can make the target set on flame, add potion effects, etc. * Make sure you properly handle sides */ } } It's as simple as that, can't get any simpler, my friend, if you want lines to fire on the client, then send packets. Edited December 29, 20177 yr by Differentiation
December 29, 20177 yr Basically, the client does not know about damage unless the server tells it, so as far as I can tell, you cannot do what you are looking to do with only a client side mod.
December 29, 20177 yr Author I succefully get a DamageSource of the attack but DamageSource::getEntity() always return null. I saw that I needed to use EntityDamageSource but how can I convert DamageSource to EntityDamageSource ?
December 29, 20177 yr 2 minutes ago, Yario said: The client cannot know who attacked himself ? I honestly don't know, I haven't tried doing anything like this myself. I was just explaining what I believe Differentiation was trying to say to you since you said you didn't understand.
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.