diff --git a/build.gradle b/build.gradle index 781c1d7..1d4b940 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ plugins { apply plugin: 'net.minecraftforge.gradle.forge' -version = "1.1.2" +version = "1.1.3" group= "ljfa.tntutils" archivesBaseName = "tnt_utilities-mc1.8.9" diff --git a/src/main/java/ljfa/tntutils/Config.java b/src/main/java/ljfa/tntutils/Config.java index 3829d43..8e467e5 100644 --- a/src/main/java/ljfa/tntutils/Config.java +++ b/src/main/java/ljfa/tntutils/Config.java @@ -39,6 +39,7 @@ public class Config { public static boolean disableEntityDamage; public static boolean disablePlayerDamage; + public static boolean disableItemDamage; public static boolean disableNPCDamage; public static void loadConfig(File file) { @@ -68,8 +69,9 @@ public static void loadValues() { disableCreeperBlockDamage = conf.get(CAT_BLOCKDMG, "disableCreeperBlockDamage", false, "\"Environmentally Friendly Creepers\": Makes creepers not destroy blocks").getBoolean(); spareTileEntities = conf.get(CAT_BLOCKDMG, "disableTileEntityDamage", false, "Makes explosions not destroy blocks with tile entities").getBoolean(); //---------------- - disableEntityDamage = conf.get(CAT_ENTDMG, "disableEntityDamage", false, "Disables explosion damage to all entities (also includes items, minecarts etc.)").getBoolean(); + disableEntityDamage = conf.get(CAT_ENTDMG, "disableEntityDamage", false, "Disables explosion damage to all entities (also includes minecarts, paintings etc.)").getBoolean(); disablePlayerDamage = conf.get(CAT_ENTDMG, "disablePlayerDamage", false, "Disables explosion damage to players").getBoolean(); + disableItemDamage = conf.get(CAT_ENTDMG, "disableItemDamage", false, "Disables explosion damage to items laying on the ground").getBoolean(); disableNPCDamage = conf.get(CAT_ENTDMG, "disableNPCDamage", false, "Disables explosion damage to animals and mobs").getBoolean(); //---------------- } diff --git a/src/main/java/ljfa/tntutils/handlers/ExplosionHandler.java b/src/main/java/ljfa/tntutils/handlers/ExplosionHandler.java index e80a1b5..5562f97 100644 --- a/src/main/java/ljfa/tntutils/handlers/ExplosionHandler.java +++ b/src/main/java/ljfa/tntutils/handlers/ExplosionHandler.java @@ -6,6 +6,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityMinecartTNT; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; @@ -42,13 +43,14 @@ public boolean test(BlockPos pos) { //Entity damage if(Config.disableEntityDamage) event.getAffectedEntities().clear(); - else if(Config.disablePlayerDamage || Config.disableNPCDamage || Config.preventChainExpl) { - //Remove certain from the list + else if(Config.disablePlayerDamage || Config.disableItemDamage || Config.disableNPCDamage || Config.preventChainExpl) { + //Remove configured entities from the list ListHelper.removeIf(event.getAffectedEntities(), new Predicate() { @Override public boolean test(Entity ent) { return (Config.disableNPCDamage && ent instanceof EntityLivingBase && !(ent instanceof EntityPlayer)) || (Config.disablePlayerDamage && ent instanceof EntityPlayer) + || (Config.disableItemDamage && ent instanceof EntityItem) || (Config.preventChainExpl && ent instanceof EntityMinecartTNT); } });