Jump to content

[Forge 1.10.2] How to get time of of an entity (breeding time, dropping items time...)?


Recommended Posts

Posted

Here are a couple of "time" variables from the Entity class along with a few sub-classes

  • Entity::ticksExisted (public)
    • The age of the Entity
  • EntityLivingBase::hurtTime (public)
    • The amount of time an entity should render as hurt (red tint after being attacked)
  • EntityLivingBase::deathTime (public)
    • The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world
  • EntityAnimal::inLove (private & Getter-less)
    • The amount of time that an animal will be able to mate after being given breeding items

For the inLove variable in EntityAnimal, you will need to use Reflection to "unlock" it, and store that reference somewhere (as Reflection is relatively costly to do over and over again)

"dropping items time", is an unfamiliar term. A few mods out there, like Botania, adds Shedding, but that functionality does not exist in Vanilla Minecraft, nor base Forge.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted
4 hours ago, Matryoshika said:

Here are a couple of "time" variables from the Entity class along with a few sub-classes

  • Entity::ticksExisted (public)
    • The age of the Entity
  • EntityLivingBase::hurtTime (public)
    • The amount of time an entity should render as hurt (red tint after being attacked)
  • EntityLivingBase::deathTime (public)
    • The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world
  • EntityAnimal::inLove (private & Getter-less)
    • The amount of time that an animal will be able to mate after being given breeding items

For the inLove variable in EntityAnimal, you will need to use Reflection to "unlock" it, and store that reference somewhere (as Reflection is relatively costly to do over and over again)

"dropping items time", is an unfamiliar term. A few mods out there, like Botania, adds Shedding, but that functionality does not exist in Vanilla Minecraft, nor base Forge.

 Thanks!

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.