#317 +Allow bats and hippos to walk on clouds without having to give them other pegasus abilities

Separate cloud interaction and ability to collect weather jars/use rainboom ability into two flags
This commit is contained in:
Sollace 2024-03-23 23:40:00 +00:00
parent a4fb5e7ae7
commit aa1973181f
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
7 changed files with 30 additions and 8 deletions

View file

@ -22,7 +22,7 @@ public interface EquineContext {
}
default boolean collidesWithClouds() {
return getCompositeRace().any(Race::canInteractWithClouds);
return getCompositeRace().canInteractWithClouds();
}
static EquineContext of(ShapeContext context) {

View file

@ -20,7 +20,7 @@ public interface EquinePredicates {
Predicate<Entity> BAT = physicalRaceMatches(Race.BAT::equals);
Predicate<Entity> CHANGELING = physicalRaceMatches(Race.CHANGELING::equals);
Predicate<Entity> RACE_INTERACT_WITH_CLOUDS = raceMatches(Race::canInteractWithClouds);
Predicate<Entity> RACE_CAN_INFLUENCE_WEATHER = raceMatches(Race::canInfluenceWeather);
Predicate<Entity> RAGING = IS_PLAYER.and(SpellType.RAGE::isOn);
Predicate<Entity> PLAYER_EARTH = IS_PLAYER.and(ofRace(Race.EARTH));
@ -28,7 +28,6 @@ public interface EquinePredicates {
Predicate<Entity> PLAYER_UNICORN = IS_PLAYER.and(raceMatches(Race::canCast));
Predicate<Entity> PLAYER_CHANGELING = IS_PLAYER.and(ofRace(Race.CHANGELING));
Predicate<Entity> PLAYER_KIRIN = IS_PLAYER.and(ofRace(Race.KIRIN));
Predicate<Entity> PLAYER_PEGASUS = IS_PLAYER.and(e -> ((PlayerEntity)e).getAbilities().creativeMode || RACE_INTERACT_WITH_CLOUDS.test(e));
Predicate<Entity> PLAYER_SEAPONY = IS_PLAYER.and(raceMatches(Race::isFish));
Predicate<Entity> PLAYER_CAN_USE_EARTH = IS_PLAYER.and(raceMatches(Race::canUseEarth));

View file

@ -108,9 +108,17 @@ public record Race (Supplier<Composite> compositeSupplier, Availability availabi
}
public boolean canInteractWithClouds() {
return canFly() && this != CHANGELING;
}
public boolean canInfluenceWeather() {
return canFly() && this != CHANGELING && this != BAT && this != HIPPOGRIFF;
}
public boolean hasPersistentWeatherMagic() {
return canInfluenceWeather();
}
public Identifier getId() {
return REGISTRY.getId(this);
}
@ -225,6 +233,18 @@ public record Race (Supplier<Composite> compositeSupplier, Availability availabi
return any(Race::canCast);
}
public boolean canInteractWithClouds() {
return any(Race::canInteractWithClouds);
}
public boolean canInfluenceWeather() {
return any(Race::canInfluenceWeather);
}
public boolean hasPersistentWeatherMagic() {
return any(Race::hasPersistentWeatherMagic);
}
public FlightType flightType() {
if (pseudo() == null) {
return physical().flightType();

View file

@ -35,7 +35,7 @@ public class PegasusCaptureStormAbility implements Ability<Hit> {
@Override
public boolean canUse(Race race) {
return race.canInteractWithClouds();
return race.canInfluenceWeather();
}
@Nullable

View file

@ -28,7 +28,7 @@ public class PegasusRainboomAbility implements Ability<Hit> {
@Override
public boolean canUse(Race race) {
return race.canInteractWithClouds();
return race.canInfluenceWeather();
}
@Nullable

View file

@ -160,7 +160,7 @@ public class ItemImpl implements Equine<ItemEntity> {
@Override
public boolean collidesWithClouds() {
return entity.getStack().isIn(UTags.FLOATS_ON_CLOUDS) || getSpecies().canInteractWithClouds();
return entity.getStack().isIn(UTags.FLOATS_ON_CLOUDS) || getSpecies().hasPersistentWeatherMagic();
}
@Override

View file

@ -39,8 +39,11 @@ public class FriendshipBraceletItem extends WearableItem implements DyeableItem,
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getStackInHand(hand);
if (!isSigned(stack) && (EquinePredicates.PLAYER_UNICORN.test(player) || EquinePredicates.PLAYER_PEGASUS.test(player)
|| AmuletSelectors.PEARL_NECKLACE.test(player))) {
if (!isSigned(stack) && (
EquinePredicates.PLAYER_UNICORN.test(player)
|| EquinePredicates.RACE_CAN_INFLUENCE_WEATHER.test(player)
|| AmuletSelectors.PEARL_NECKLACE.test(player)
)) {
player.setCurrentHand(hand);
ItemStack result = stack.copy();