Remove some alicorn amulet buffs and make is so passive entities run away from you when wearing it

This commit is contained in:
Sollace 2022-10-17 18:01:55 +02:00
parent 184a455c30
commit 6db7f313dd
3 changed files with 23 additions and 11 deletions

View file

@ -0,0 +1,11 @@
package com.minelittlepony.unicopia.entity;
import java.util.function.Predicate;
import com.minelittlepony.unicopia.item.UItems;
import net.minecraft.entity.LivingEntity;
public interface AmuletSelectors {
Predicate<LivingEntity> ALICORN_AMULET = UItems.ALICORN_AMULET::isApplicable;
}

View file

@ -20,18 +20,15 @@ import com.minelittlepony.unicopia.entity.ai.WantItTakeItGoal;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.ai.goal.ActiveTargetGoal;
import net.minecraft.entity.ai.goal.GoalSelector;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.SlimeEntity;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.mob.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
@ -120,14 +117,21 @@ public class Creature extends Living<LivingEntity> implements WeaklyOwned<Living
if (entity.getType().getSpawnGroup() == SpawnGroup.MONSTER) {
goals.add(3, new BreakHeartGoal((MobEntity)entity, targetter));
}
if (entity instanceof PigEntity) {
eatMuffinGoal = new EatMuffinGoal((MobEntity)entity, targetter);
if (entity instanceof PigEntity pig) {
eatMuffinGoal = new EatMuffinGoal(pig, targetter);
goals.add(3, eatMuffinGoal);
}
if (master.isPresent(getReferenceWorld())) {
initMinionAi();
}
if (entity instanceof CreeperEntity mob) {
goals.add(1, new FleeEntityGoal<>(mob, LivingEntity.class, 10, 1.5, 1.9, AmuletSelectors.ALICORN_AMULET));
}
if (entity instanceof PassiveEntity mob) {
goals.add(1, new FleeEntityGoal<>(mob, LivingEntity.class, 10, 1.1, 1.7, AmuletSelectors.ALICORN_AMULET));
}
}
private void initMinionAi() {

View file

@ -48,9 +48,6 @@ public class AlicornAmuletItem extends AmuletItem implements PlayerCharmTracker.
public AlicornAmuletItem(FabricItemSettings settings) {
super(settings, 0, new AmuletItem.ModifiersBuilder()
.add(EntityAttributes.GENERIC_ARMOR, 9000)
.add(EntityAttributes.GENERIC_ARMOR_TOUGHNESS, 9000)
.add(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, 9000)
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 100)
.add(EntityAttributes.GENERIC_ATTACK_KNOCKBACK, 20)
.build());