Jump to content

[1.7.10] Can potions effects running out kill a player?


Recommended Posts

Hello guys, this isn't an easy one as I can't reproduce the error. So I'm not sure if it's something I'm doing wrong, or maybe other mod in the pack my Mod is on causing this issues.


I have an apple that apply many Vanilla Potions effects, and we heard already a few times people die when the effect runs out, or it says they die (Not sure what this mean) apparently they are like stuck in the "Die animation" and when they relog they didn't really die. (I'm downloading a Twitch VOD to see hoe exactly this happened)


So, for a start, this is the apple code. I think, but not sure, that maybe Health Boost maybe the issue. I have seen that when you change dimensions the extra hearts don't show anymore (Same for absorption)


    protected void onFoodEaten(ItemStack itemStack, World world, EntityPlayer player)
        if (!world.isRemote)
        	player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 19200, 0));
        	player.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 4800, 4)); //Absorption
        	player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 19200, 1));
        	player.addPotionEffect(new PotionEffect(Potion.resistance.id, 19200, 0));
        	player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 19200, 0));
        	player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 19200, 1));
        	player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 19200, 4)); //healthBoost
        	player.addPotionEffect(new PotionEffect(Potion.field_76443_y.id, 19200, 0)); //saturation
        	player.addPotionEffect(new PotionEffect(Potion.heal.id, 200, 0));



Link to comment
Share on other sites

Thanks diesieben07. Yes I guess I could do that and make my mod to print something on console each time a player dies, and if someone gets this dead again I can ask them to send me that. The problem will be that most likely they wont have a save of that log and not even a crash report.

But I like your idea to see what caused the dead.

This would be easier if I could reproduce it, but I have tested inside the pack, and only with my mod and nothing I can't get this dead to happen to me.


Thanks for the answer and the idea on how to see whats going on, gonna see how I can implement it.

Link to comment
Share on other sites

  • 4 weeks later...

Ok guys, so I got that code, so now when someone dies, you can see in chat what was the cause.


Back to the problem, here we can see a player "died" but not message pop up, so he technically didn't die. Anyone has any guess on what can be causing this. I'm almost sure it's some other Mod on the pack, but I dont know.


Here is the "death" showing no message, happening when the effects from my item run out.




This is how the chat looks like when someone dies.




The code that makes this to display


    public void onLivingDeath(LivingDeathEvent event) {
    	if (event.entityLiving.worldObj.isRemote)
    	if(event.entityLiving instanceof EntityPlayer)
    		System.out.println("A player died!");
			EntityPlayer thePlayer = (EntityPlayer) event.entityLiving;

				System.out.println("getSourceOfDamage: " + event.source.getSourceOfDamage());
				thePlayer.addChatComponentMessage(new ChatComponentText("Player died - Source of Damage: " + event.source.getSourceOfDamage()));
			else if(event.source.getDamageType()!=null)
				System.out.println("getDamageType: " + event.source.getDamageType());
				thePlayer.addChatComponentMessage(new ChatComponentText("Player died - Damage type: " + event.source.getDamageType()));
				thePlayer.addChatComponentMessage(new ChatComponentText("Player died with no extra details."));

				System.out.println("event.toString: " + event.toString());

				System.out.println("event.source.getClass: " + event.source.getClass());

    	}//END IF


Link to comment
Share on other sites

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.

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.


  • Create New...

Important Information

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