Yet more minor tweaks and fixes

This commit is contained in:
Sollace 2021-02-19 20:04:14 +02:00
parent 12621518ba
commit 5c4034c218
5 changed files with 17 additions and 9 deletions

View file

@ -40,7 +40,7 @@ public class Creature extends Living<LivingEntity> {
targets.add(1, new WantItNeedItTargetGoal((MobEntity)entity)); targets.add(1, new WantItNeedItTargetGoal((MobEntity)entity));
goals.add(1, new WantItTakeItGoal((MobEntity)entity)); goals.add(1, new WantItTakeItGoal((MobEntity)entity));
if (entity.getType().getSpawnGroup() == SpawnGroup.MONSTER) { if (entity.getType().getSpawnGroup() == SpawnGroup.MONSTER) {
goals.add(2, new BreakHeartGoal((MobEntity)entity)); goals.add(3, new BreakHeartGoal((MobEntity)entity));
} }
} }

View file

@ -31,7 +31,11 @@ public class BreakHeartGoal extends Goal {
@Override @Override
public boolean canStart() { public boolean canStart() {
Optional<FloatingArtefactEntity> item = VecHelper.findInRange(mob, mob.world, mob.getPos(), 16, Optional<FloatingArtefactEntity> item = VecHelper.findInRange(mob, mob.world, mob.getPos(), 16,
e -> !e.removed && e instanceof FloatingArtefactEntity && ((FloatingArtefactEntity)e).getStack().getItem() == UItems.CRYSTAL_HEART) e -> !e.removed
&& e instanceof FloatingArtefactEntity
&& ((FloatingArtefactEntity)e).getStack().getItem() == UItems.CRYSTAL_HEART
&& mob.getVisibilityCache().canSee(e)
)
.stream() .stream()
.map(e -> (FloatingArtefactEntity)e) .map(e -> (FloatingArtefactEntity)e)
.sorted(Comparator.comparing((Entity e) -> mob.distanceTo(e))) .sorted(Comparator.comparing((Entity e) -> mob.distanceTo(e)))
@ -73,7 +77,7 @@ public class BreakHeartGoal extends Goal {
if (distance > reach && distance < 16) { if (distance > reach && distance < 16) {
speed = 1.23; speed = 1.23;
} else if (distance < 225) { } else if (distance < 225) {
speed = 0.6; speed = 1.6;
} }
mob.getNavigation().startMovingTo(target, speed); mob.getNavigation().startMovingTo(target, speed);

View file

@ -141,7 +141,12 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
if (ticksInAir++ > (level * 100)) { if (ticksInAir++ > (level * 100)) {
Bar mana = pony.getMagicalReserves().getMana(); Bar mana = pony.getMagicalReserves().getMana();
mana.add((float)-getHorizontalMotion(entity) * 20F / level); float cost = (float)-getHorizontalMotion(entity) * 20F / level;
if (entity.isSneaking()) {
cost /= 10;
}
mana.add(cost);
if (mana.getPercentFill() < 0.2) { if (mana.getPercentFill() < 0.2) {
pony.getMagicalReserves().getExertion().add(2); pony.getMagicalReserves().getExertion().add(2);
@ -237,8 +242,6 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
float bouncyness = EnchantmentHelper.getEquipmentLevel(UEnchantments.PADDED, player) * 6; float bouncyness = EnchantmentHelper.getEquipmentLevel(UEnchantments.PADDED, player) * 6;
System.out.println(bouncyness);
if (distance > 0) { if (distance > 0) {
wallHitCooldown = 30; wallHitCooldown = 30;

View file

@ -10,6 +10,7 @@ import com.minelittlepony.unicopia.entity.FloatingArtefactEntity.State;
import com.minelittlepony.unicopia.particle.FollowingParticleEffect; import com.minelittlepony.unicopia.particle.FollowingParticleEffect;
import com.minelittlepony.unicopia.particle.ParticleUtils; import com.minelittlepony.unicopia.particle.ParticleUtils;
import com.minelittlepony.unicopia.particle.UParticles; import com.minelittlepony.unicopia.particle.UParticles;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
import com.minelittlepony.unicopia.util.VecHelper; import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -19,7 +20,6 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Saddleable; import net.minecraft.entity.Saddleable;
import net.minecraft.entity.SpawnGroup; import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.SpawnReason; import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.TameableEntity; import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -59,7 +59,7 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art
if (world instanceof ServerWorld) { if (world instanceof ServerWorld) {
FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create((ServerWorld)world, context.getStack().getTag(), null, context.getPlayer(), blockPos, SpawnReason.SPAWN_EGG, true, true); FloatingArtefactEntity entity = UEntities.FLOATING_ARTEFACT.create((ServerWorld)world, context.getStack().getTag(), null, context.getPlayer(), blockPos, SpawnReason.SPAWN_EGG, false, true);
if (entity == null) { if (entity == null) {
return ActionResult.FAIL; return ActionResult.FAIL;
@ -137,13 +137,14 @@ public class CrystalHeartItem extends Item implements FloatingArtefactEntity.Art
} }
inputs.forEach(input -> { inputs.forEach(input -> {
input.damage(DamageSource.MAGIC, takes); input.damage(MagicalDamageSource.create("feed"), takes);
ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, entity, 0.2F), input, 1); ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, entity, 0.2F), input, 1);
}); });
outputs.forEach(output -> { outputs.forEach(output -> {
ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, output, 0.2F), entity, 1); ParticleUtils.spawnParticles(new FollowingParticleEffect(UParticles.HEALTH_DRAIN, output, 0.2F), entity, 1);
output.heal(gives); output.heal(gives);
}); });
entity.addSpin((int)gives);
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB