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:
@@ -6,6 +6,7 @@ import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.spell.Boulder;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.BlockUtils;
|
||||
import electroblob.wizardry.util.EntityUtils;
|
||||
import electroblob.wizardry.util.MagicDamage;
|
||||
import electroblob.wizardry.util.MagicDamage.DamageType;
|
||||
@@ -119,7 +120,8 @@ public class EntityBoulder extends EntityScaledConstruct {
|
||||
*/
|
||||
private boolean smashBlocks(List<BlockPos> blocks, boolean breakIfTooHard){
|
||||
|
||||
if(blocks.removeIf(p -> world.getBlockState(p).getBlock().getExplosionResistance(world, p, this, null) > 3)){
|
||||
if(blocks.removeIf(p -> world.getBlockState(p).getBlock().getExplosionResistance(world, p, this, null) > 3
|
||||
|| (!world.isRemote && !BlockUtils.canBreakBlock(getCaster(), world, p)))){
|
||||
// If any of the blocks were not breakable, the boulder is smashed
|
||||
if(breakIfTooHard){
|
||||
this.despawn();
|
||||
|
||||
Reference in New Issue
Block a user