Make fireballs, large fireballs and iceballs respect the playerBlockDamage config option

This commit is contained in:
Electroblob77
2020-03-17 22:44:30 +00:00
parent 9ed06c9a34
commit 5f21b565cd
3 changed files with 5 additions and 17 deletions
@@ -9,7 +9,6 @@ import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.potion.PotionEffect;
@@ -48,13 +47,7 @@ public class EntityIceball extends EntityMagicProjectile {
}else{
boolean flag = true;
if(this.getThrower() != null && this.getThrower() instanceof EntityLiving){
flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.getThrower());
}
if(flag){
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
BlockPos pos = rayTrace.getBlockPos();
@@ -3,6 +3,7 @@ package electroblob.wizardry.entity.projectile;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.projectile.EntityLargeFireball;
import net.minecraft.nbt.NBTTagCompound;
@@ -50,7 +51,7 @@ public class EntityLargeMagicFireball extends EntityMagicFireball {
protected void onImpact(RayTraceResult rayTrace){
if(!world.isRemote){
boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.thrower);
boolean flag = this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world);
this.world.newExplosion(null, this.posX, this.posY, this.posZ, getExplosionPower() * blastMultiplier, flag, flag);
}
@@ -6,9 +6,9 @@ import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.WizardryUtilities;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.init.Blocks;
@@ -84,13 +84,7 @@ public class EntityMagicFireball extends EntityMagicProjectile {
}else{
boolean flag = true;
if(this.getThrower() != null && this.getThrower() instanceof EntityLiving){
flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.getThrower());
}
if(flag){
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
BlockPos blockpos = rayTrace.getBlockPos().offset(rayTrace.sideHit);