MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / affectEntity

Method affectEntity

src/main/java/net/minecraft/potion/Potion.java:194–217  ·  view source on GitHub ↗
(Entity p_180793_1_, Entity p_180793_2_, EntityLivingBase entityLivingBaseIn, int p_180793_4_, double p_180793_5_)

Source from the content-addressed store, hash-verified

192 }
193
194 public void affectEntity(Entity p_180793_1_, Entity p_180793_2_, EntityLivingBase entityLivingBaseIn, int p_180793_4_, double p_180793_5_)
195 {
196 if ((this.id != heal.id || entityLivingBaseIn.isEntityUndead()) && (this.id != harm.id || !entityLivingBaseIn.isEntityUndead()))
197 {
198 if (this.id == harm.id && !entityLivingBaseIn.isEntityUndead() || this.id == heal.id && entityLivingBaseIn.isEntityUndead())
199 {
200 int j = (int)(p_180793_5_ * (double)(6 << p_180793_4_) + 0.5D);
201
202 if (p_180793_1_ == null)
203 {
204 entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)j);
205 }
206 else
207 {
208 entityLivingBaseIn.attackEntityFrom(DamageSource.causeIndirectMagicDamage(p_180793_1_, p_180793_2_), (float)j);
209 }
210 }
211 }
212 else
213 {
214 int i = (int)(p_180793_5_ * (double)(4 << p_180793_4_) + 0.5D);
215 entityLivingBaseIn.heal((float)i);
216 }
217 }
218
219 /**
220 * Returns true if the potion has an instant effect instead of a continuous one (eg Harming)

Callers 1

onImpactMethod · 0.80

Calls 4

isEntityUndeadMethod · 0.80
attackEntityFromMethod · 0.45
healMethod · 0.45

Tested by

no test coverage detected