Make fireballs, large fireballs and iceballs respect the playerBlockDamage config option
This commit is contained in:
@@ -9,7 +9,6 @@ import electroblob.wizardry.util.MagicDamage.DamageType;
|
|||||||
import electroblob.wizardry.util.ParticleBuilder;
|
import electroblob.wizardry.util.ParticleBuilder;
|
||||||
import electroblob.wizardry.util.WizardryUtilities;
|
import electroblob.wizardry.util.WizardryUtilities;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
@@ -48,13 +47,7 @@ public class EntityIceball extends EntityMagicProjectile {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
boolean flag = true;
|
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
|
||||||
|
|
||||||
if(this.getThrower() != null && this.getThrower() instanceof EntityLiving){
|
|
||||||
flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.getThrower());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag){
|
|
||||||
|
|
||||||
BlockPos pos = rayTrace.getBlockPos();
|
BlockPos pos = rayTrace.getBlockPos();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package electroblob.wizardry.entity.projectile;
|
|||||||
import electroblob.wizardry.Wizardry;
|
import electroblob.wizardry.Wizardry;
|
||||||
import electroblob.wizardry.registry.Spells;
|
import electroblob.wizardry.registry.Spells;
|
||||||
import electroblob.wizardry.spell.Spell;
|
import electroblob.wizardry.spell.Spell;
|
||||||
|
import electroblob.wizardry.util.WizardryUtilities;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.projectile.EntityLargeFireball;
|
import net.minecraft.entity.projectile.EntityLargeFireball;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -50,7 +51,7 @@ public class EntityLargeMagicFireball extends EntityMagicFireball {
|
|||||||
protected void onImpact(RayTraceResult rayTrace){
|
protected void onImpact(RayTraceResult rayTrace){
|
||||||
|
|
||||||
if(!world.isRemote){
|
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);
|
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;
|
||||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||||
import electroblob.wizardry.util.ParticleBuilder;
|
import electroblob.wizardry.util.ParticleBuilder;
|
||||||
|
import electroblob.wizardry.util.WizardryUtilities;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.projectile.EntitySmallFireball;
|
import net.minecraft.entity.projectile.EntitySmallFireball;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -84,13 +84,7 @@ public class EntityMagicFireball extends EntityMagicProjectile {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
boolean flag = true;
|
if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){
|
||||||
|
|
||||||
if(this.getThrower() != null && this.getThrower() instanceof EntityLiving){
|
|
||||||
flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.getThrower());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(flag){
|
|
||||||
|
|
||||||
BlockPos blockpos = rayTrace.getBlockPos().offset(rayTrace.sideHit);
|
BlockPos blockpos = rayTrace.getBlockPos().offset(rayTrace.sideHit);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user