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();
|
Affinity getAffinity();
|
||||||
|
|
||||||
|
|
||||||
default boolean isEnemy(Affine other) {
|
default boolean isEnemy(Affine other) {
|
||||||
return !getAffinity().alignsWith(other.getAffinity());
|
return !getAffinity().alignsWith(other.getAffinity());
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ package com.minelittlepony.unicopia.entity.player;
|
||||||
*/
|
*/
|
||||||
public interface Motion {
|
public interface Motion {
|
||||||
/**
|
/**
|
||||||
* True is we're currently flying.
|
* True if we're currently flying.
|
||||||
*/
|
*/
|
||||||
boolean isFlying();
|
boolean isFlying();
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class Pony implements Caster<PlayerEntity>, Equine<PlayerEntity>, Transmi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Affinity getAffinity() {
|
public Affinity getAffinity() {
|
||||||
return Affinity.NEUTRAL;
|
return getSpecies().getAffinity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirty() {
|
public void setDirty() {
|
||||||
|
@ -384,12 +384,10 @@ public class Pony implements Caster<PlayerEntity>, Equine<PlayerEntity>, Transmi
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Text> trySleep(BlockPos pos) {
|
public Optional<Text> trySleep(BlockPos pos) {
|
||||||
|
return findAllSpellsInRange(10)
|
||||||
if (findAllSpellsInRange(10).filter(p -> p instanceof Pony).map(Pony.class::cast).map(Pony::getSpecies).anyMatch(r -> r.isEnemy(getSpecies()))) {
|
.filter(p -> p instanceof Pony && ((Pony)p).isEnemy(this))
|
||||||
return Optional.of(new TranslatableText("block.unicopia.bed.not_safe"));
|
.findFirst()
|
||||||
}
|
.map(p -> new TranslatableText("block.unicopia.bed.not_safe"));
|
||||||
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEat(ItemStack stack) {
|
public void onEat(ItemStack stack) {
|
||||||
|
|
Loading…
Reference in a new issue