mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
Some minor touchups, and use the race's affinity for the player's caster
This commit is contained in:
parent
05dc1aa132
commit
02dc0affcb
3 changed files with 6 additions and 9 deletions
|
@ -12,7 +12,6 @@ public interface Affine {
|
|||
*/
|
||||
Affinity getAffinity();
|
||||
|
||||
|
||||
default boolean isEnemy(Affine other) {
|
||||
return !getAffinity().alignsWith(other.getAffinity());
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package com.minelittlepony.unicopia.entity.player;
|
|||
*/
|
||||
public interface Motion {
|
||||
/**
|
||||
* True is we're currently flying.
|
||||
* True if we're currently flying.
|
||||
*/
|
||||
boolean isFlying();
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ public class Pony implements Caster<PlayerEntity>, Equine<PlayerEntity>, Transmi
|
|||
|
||||
@Override
|
||||
public Affinity getAffinity() {
|
||||
return Affinity.NEUTRAL;
|
||||
return getSpecies().getAffinity();
|
||||
}
|
||||
|
||||
public void setDirty() {
|
||||
|
@ -384,12 +384,10 @@ public class Pony implements Caster<PlayerEntity>, Equine<PlayerEntity>, Transmi
|
|||
}
|
||||
|
||||
public Optional<Text> trySleep(BlockPos pos) {
|
||||
|
||||
if (findAllSpellsInRange(10).filter(p -> p instanceof Pony).map(Pony.class::cast).map(Pony::getSpecies).anyMatch(r -> r.isEnemy(getSpecies()))) {
|
||||
return Optional.of(new TranslatableText("block.unicopia.bed.not_safe"));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
return findAllSpellsInRange(10)
|
||||
.filter(p -> p instanceof Pony && ((Pony)p).isEnemy(this))
|
||||
.findFirst()
|
||||
.map(p -> new TranslatableText("block.unicopia.bed.not_safe"));
|
||||
}
|
||||
|
||||
public void onEat(ItemStack stack) {
|
||||
|
|
Loading…
Reference in a new issue