Block protection compat overhaul

- Unifies all block protection checks into helper methods in BlockUtils which trigger all the necessary forge events and vanilla methods
- Implements these checks in all the appropriate places and removes calls to EntityUtils#canDamageBlocks(...) where they are no longer needed
- Changes the mine spell to respect the config settings in line with the rest of the spells
- Fixes earthquake not respecting the settings at all
- Adds a separate config option for dispenser block damage and updates the description for the existing settings to reflect the changes
This commit is contained in:
Electroblob77
2020-09-23 00:57:55 +01:00
parent f49ef7594d
commit 2f91573284
22 changed files with 238 additions and 86 deletions
@@ -54,7 +54,7 @@ public class IceAge extends SpellAreaEffect {
if(target instanceof EntityLiving){
if(((BlockStatue)WizardryBlocks.ice_statue).convertToStatue((EntityLiving)target,
(int)(getProperty(FREEZE_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))){
caster, (int)(getProperty(FREEZE_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)))){
target.playSound(WizardrySounds.MISC_FREEZE, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
}
}else if(target instanceof EntityPlayer){
@@ -113,7 +113,8 @@ public class IceAge extends SpellAreaEffect {
double dist = origin.distanceTo(new Vec3d(origin.x + i, y, origin.z + j));
// Randomised with weighting so that the nearer the block the more likely it is to be snowed.
if(y != -1 && world.rand.nextInt((int)(dist * 2) + 1) < radius && dist < radius){
if(y != -1 && world.rand.nextInt((int)(dist * 2) + 1) < radius && dist < radius
&& BlockUtils.canPlaceBlock(caster, world, pos)){
BlockUtils.freeze(world, pos.down(), true);
}
}