Exclude creepers from the want it need it effect

This commit is contained in:
Sollace 2023-05-05 21:12:21 +01:00
parent b372620a04
commit ccb636a674
2 changed files with 8 additions and 1 deletions

View file

@ -13,6 +13,9 @@ public class Config extends com.minelittlepony.common.util.settings.Config {
.addComment("whilst any ones left off are not permitted")
.addComment("An empty list disables whitelisting entirely.");
public final Setting<Set<String>> wantItNeedItEntityExcludelist = value("server", "wantItNeedItEntityExcludelist", (Set<String>)new HashSet<>(Set.of("minecraft:creeper")))
.addComment("A list of entity types that are immune to the want it need it spell's effects");
public final Setting<Boolean> enableCheats = value("server", "enableCheats", false)
.addComment("Allows use of the /race, /disguise, and /gravity commands");

View file

@ -8,6 +8,7 @@ import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.Affinity;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.WeaklyOwned;
import com.minelittlepony.unicopia.ability.magic.*;
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
@ -17,6 +18,7 @@ import com.minelittlepony.unicopia.entity.ai.DynamicTargetGoal;
import com.minelittlepony.unicopia.entity.ai.EatMuffinGoal;
import com.minelittlepony.unicopia.entity.ai.WantItTakeItGoal;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.ai.goal.*;
@ -115,7 +117,9 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned.Mutabl
DynamicTargetGoal targetter = new DynamicTargetGoal((MobEntity)entity);
targets.add(1, targetter);
goals.add(1, new WantItTakeItGoal((MobEntity)entity, targetter));
if (!Unicopia.getConfig().wantItNeedItEntityExcludelist.get().contains(EntityType.getId(entity.getType()).toString())) {
goals.add(1, new WantItTakeItGoal((MobEntity)entity, targetter));
}
if (entity.getType().getSpawnGroup() == SpawnGroup.MONSTER) {
goals.add(3, new BreakHeartGoal((MobEntity)entity, targetter));
}