Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • 1.10.2 How to make mobs naturally regenerate health.
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
TheRPGAdventurer

1.10.2 How to make mobs naturally regenerate health.

By TheRPGAdventurer, July 15, 2017 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

TheRPGAdventurer    4

TheRPGAdventurer

TheRPGAdventurer    4

  • Dragon Slayer
  • TheRPGAdventurer
  • Members
  • 4
  • 642 posts
Posted July 15, 2017

My mob just won't regenerate health unless thrown with potions, how do I make it naturally regenerating health?

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted July 15, 2017
2 minutes ago, TheRPGAdventurer said:

My mob just won't regenerate health unless thrown with potions, how do I make it naturally regenerating health?

Override the update/updateEntity method and give it some health back every so often.

  • Quote

Share this post


Link to post
Share on other sites

TheRPGAdventurer    4

TheRPGAdventurer

TheRPGAdventurer    4

  • Dragon Slayer
  • TheRPGAdventurer
  • Members
  • 4
  • 642 posts
Posted July 15, 2017
Just now, Animefan8888 said:

Override the update/updateEntity method and give it some health back every so often.

what class in minecraft do I have to look for examples?

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted July 15, 2017
Just now, TheRPGAdventurer said:

what class in minecraft do I have to look for examples?

No Entity besides the Player and the Wither naturally regen as far as I know, so try those.

  • Quote

Share this post


Link to post
Share on other sites

hugo_the_dwarf    48

hugo_the_dwarf

hugo_the_dwarf    48

  • Diamond Finder
  • hugo_the_dwarf
  • Members
  • 48
  • 334 posts
Posted July 15, 2017

Can make your own with the EntityLivingUpdate Event and simply just use the Entity.Heal() command

I have various timers and the like in my mod attached via Capabilities so I can say "This entity can only heal after not being damaged fro 10 seconds"

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6671

diesieben07

diesieben07    6671

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6671
  • 45615 posts
Posted July 15, 2017
8 minutes ago, hugo_the_dwarf said:

Can make your own with the EntityLivingUpdate Event

Using the update event for your own entities is inefficient and not a good design choice.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • CanadaMan
      illegal wheat?

      By CanadaMan · Posted 10 minutes ago

    • CanadaMan
      illegal wheat?

      By CanadaMan · Posted 12 minutes ago

      Okay so I'm trying to join one of my friends modded server and it said that illegal state of wheat was stopping me from joining
    • MrNoodles75
      [1.14.3] send message to chat

      By MrNoodles75 · Posted 1 hour ago

      @Draco18s I have been figuring everything out since then, by going through the default code and getting information on how to do something
    • AntonBespoiasov
      attackEntityFrom() doesn't work. 1.12.2

      By AntonBespoiasov · Posted 1 hour ago

      public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { Entity entity = ModMath.getMouseOver(Minecraft.getMinecraft().getRenderPartialTicks(), 0); // Gets entity that entityLiving is looking at if (entity != null && entity instanceof EntityLiving) { ((EntityLiving)entity).attackEntityFrom(DamageSource.MAGIC, 2.0f); ((EntityLiving)entity).setRevengeTarget(entityLiving); } return stack; }   Using item that has the implementation of the method above doesn't damage entity. Debugging it showed that attackEntityFrom() is called, code within if statement is executed but entity isn't attacked. I looked into Minecraft's files that use attackEntityFrom() and observed that they just call attackEntityFrom(), just one line of code(I assume that something else that can affect entity attacking process was called before attackEntityFrom() in that files). How can I solve this problem? How can I deal damage to entity?
    • Draco18s
      How to start learning

      By Draco18s · Posted 2 hours ago

      Objects, inheritance, overriding, methods, variables, singletons, event driven design, and probably a bunch more.   "Learning how to search for answers" being a very valuable tool regardless of what language you're working with (for instance, I see and vote-to-close-as-duplicate "I got this error it said something about null references?" question on Stack Overflow about twice a day).
  • Topics

    • CanadaMan
      1
      illegal wheat?

      By CanadaMan
      Started 12 minutes ago

    • MrNoodles75
      17
      [1.14.3] send message to chat

      By MrNoodles75
      Started Monday at 08:19 PM

    • AntonBespoiasov
      0
      attackEntityFrom() doesn't work. 1.12.2

      By AntonBespoiasov
      Started 1 hour ago

    • Lordyammer
      1
      How to start learning

      By Lordyammer
      Started 3 hours ago

    • LorenzoPapi
      6
      [1.12.2]Double-part block breaking problem

      By LorenzoPapi
      Started Friday at 02:51 PM

  • Who's Online (See full list)

    • gendeathrow
    • tdude0317
    • AntonBespoiasov
    • ShetiPhian
    • CanadaMan
    • plugsmustard
    • Lea9ue
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • 1.10.2 How to make mobs naturally regenerate health.
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community