Fix Dark Matter Focus bug closes #71

This commit is contained in:
John Yorke committed 2021-11-28 12:54:13 -04:00
1 parent 7f4f5fce5c
commit 574c3cd80d
2 files changed
+15 -11

No files matched your search

@@ -2,6 +2,7 @@ package taintedmagic.common.entities;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@@ -37,12 +38,12 @@ public class EntityDarkMatter extends EntityEldritchOrb {
protected void onImpact (final MovingObjectPosition mop) {
if (!worldObj.isRemote && getThrower() != null) {
final double expand = 1.5D + enlarge * 0.5D;
System.out.println(expand);
final List<EntityLivingBase> list =
final List<Entity> entities =
worldObj.getEntitiesWithinAABBExcludingEntity(getThrower(), boundingBox.expand(expand, expand, expand));
for (final EntityLivingBase entity : list) {
if (mop.entityHit != null) {
for (final Entity e : entities) {
if (e instanceof EntityLivingBase) {
final EntityLivingBase entity = (EntityLivingBase) e;
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()), dmg);
if (corrosive) {
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 160, 1));
@@ -95,16 +95,19 @@ public class EntityDiffusion extends EntityThrowable {
@Override
protected void onImpact (final MovingObjectPosition mop) {
if (!worldObj.isRemote && getThrower() != null) {
final List<EntityLivingBase> entities =
final List<Entity> entities =
worldObj.getEntitiesWithinAABBExcludingEntity(getThrower(), boundingBox.expand(1.0D, 1.0D, 1.0D));
for (final EntityLivingBase entity : entities) {
if (mop.entityHit != null) {
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()), dmg);
if (corrosive) {
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 40, 1));
for (final Entity e : entities) {
if (e instanceof EntityLivingBase) {
final EntityLivingBase entity = (EntityLivingBase) e;
if (mop.entityHit != null) {
entity.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this, getThrower()), dmg);
if (corrosive) {
entity.addPotionEffect(new PotionEffect(Potion.wither.id, 40, 1));
}
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 40, 1));
}
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 40, 1));
}
}
worldObj.setEntityState(this, (byte) 16);