mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-08 06:26:43 +01:00
Minor cleanup and documentation tweaks
This commit is contained in:
parent
2890bc3e07
commit
38e3693384
8 changed files with 24 additions and 12 deletions
|
@ -58,7 +58,6 @@ public interface Ability<T extends Hit> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The icon representing this ability on the UI and HUD.
|
* The icon representing this ability on the UI and HUD.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default Identifier getIcon(Pony player, boolean swap) {
|
default Identifier getIcon(Pony player, boolean swap) {
|
||||||
Identifier id = Abilities.REGISTRY.getId(this);
|
Identifier id = Abilities.REGISTRY.getId(this);
|
||||||
|
|
|
@ -25,8 +25,11 @@ import net.minecraft.util.TypedActionResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A magic casting ability for unicorns.
|
* Casts magic onto the user directly, or uses the item in the main hand slot.
|
||||||
* (only shields for now)
|
* <p>
|
||||||
|
* 1. If the player is holding nothing, defaults to toggling their equipped spell (currently only shield).
|
||||||
|
* 2. If the player is holding a gem, consumes it and casts whatever spell is contained within onto the user.
|
||||||
|
* 3. If the player is holding a amulet, charges it.
|
||||||
*/
|
*/
|
||||||
public class UnicornCastingAbility implements Ability<Hit> {
|
public class UnicornCastingAbility implements Ability<Hit> {
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,13 @@ import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A magic casting ability for unicorns.
|
* Fires a spell as a projectile.
|
||||||
* (only shields for now)
|
*
|
||||||
|
* 1. If the player is holding nothing, casts their equipped offensive spell (currently only vortex - inverse of shield)
|
||||||
|
* 2. If the player is holding a gem, consumes it and casts whatever spell is contained within onto a projectile.
|
||||||
*/
|
*/
|
||||||
public class UnicornProjectileAbility implements Ability<Hit> {
|
public class UnicornProjectileAbility implements Ability<Hit> {
|
||||||
|
|
||||||
/**
|
|
||||||
* The icon representing this ability on the UI and HUD.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier getIcon(Pony player, boolean swap) {
|
public Identifier getIcon(Pony player, boolean swap) {
|
||||||
Identifier id = Abilities.REGISTRY.getId(this);
|
Identifier id = Abilities.REGISTRY.getId(this);
|
||||||
|
|
|
@ -6,8 +6,9 @@ import com.minelittlepony.unicopia.ability.magic.spell.ProjectileSpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
import com.minelittlepony.unicopia.ability.magic.spell.Spell;
|
||||||
|
|
||||||
public interface SpellPredicate<T extends Spell> extends Predicate<Spell> {
|
public interface SpellPredicate<T extends Spell> extends Predicate<Spell> {
|
||||||
SpellPredicate<ProjectileSpell> IS_THROWN = s -> s instanceof ProjectileSpell;
|
SpellPredicate<Suppressable> CAN_SUPPRESS = s -> s instanceof Suppressable;
|
||||||
SpellPredicate<Suppressable> IS_SUPPRESSABLE = s -> s instanceof Suppressable;
|
|
||||||
|
SpellPredicate<ProjectileSpell> HAS_PROJECTILE_EVENTS = s -> s instanceof ProjectileSpell;
|
||||||
|
|
||||||
default boolean isOn(Caster<?> caster) {
|
default boolean isOn(Caster<?> caster) {
|
||||||
return caster.getSpellSlot().get(this, false).isPresent();
|
return caster.getSpellSlot().get(this, false).isPresent();
|
||||||
|
|
|
@ -28,6 +28,11 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shapeshifts the player.
|
||||||
|
* <p>
|
||||||
|
* Internal. Used by the changeling ability.
|
||||||
|
*/
|
||||||
public class DisguiseSpell extends AbstractSpell implements Suppressable, FlightType.Provider, PlayerDimensions.Provider, ProjectileImpactListener {
|
public class DisguiseSpell extends AbstractSpell implements Suppressable, FlightType.Provider, PlayerDimensions.Provider, ProjectileImpactListener {
|
||||||
|
|
||||||
private final Disguise disguise = new Disguise();
|
private final Disguise disguise = new Disguise();
|
||||||
|
|
|
@ -22,6 +22,11 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal.
|
||||||
|
* <p>
|
||||||
|
* Used by the Rainboom ability.
|
||||||
|
*/
|
||||||
public class JoustingSpell extends AbstractSpell {
|
public class JoustingSpell extends AbstractSpell {
|
||||||
|
|
||||||
private final int rad = 5;
|
private final int rad = 5;
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class RevealingSpell extends AbstractSpell {
|
||||||
}
|
}
|
||||||
|
|
||||||
source.findAllSpellsInRange(15).forEach(e -> {
|
source.findAllSpellsInRange(15).forEach(e -> {
|
||||||
e.getSpellSlot().get(SpellPredicate.IS_SUPPRESSABLE, false)
|
e.getSpellSlot().get(SpellPredicate.CAN_SUPPRESS, false)
|
||||||
.filter(spell -> spell.isVulnerable(source, this))
|
.filter(spell -> spell.isVulnerable(source, this))
|
||||||
.ifPresent(spell -> {
|
.ifPresent(spell -> {
|
||||||
spell.onSuppressed(source);
|
spell.onSuppressed(source);
|
||||||
|
|
|
@ -269,7 +269,7 @@ public class MagicProjectileEntity extends ThrownItemEntity implements Caster<Li
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void forEachDelegates(Consumer<ProjectileDelegate> consumer) {
|
protected void forEachDelegates(Consumer<ProjectileDelegate> consumer) {
|
||||||
getSpellSlot().get(SpellPredicate.IS_THROWN, true).ifPresent(consumer);
|
getSpellSlot().get(SpellPredicate.HAS_PROJECTILE_EVENTS, true).ifPresent(consumer);
|
||||||
if (getItem().getItem() instanceof ProjectileDelegate) {
|
if (getItem().getItem() instanceof ProjectileDelegate) {
|
||||||
consumer.accept(((ProjectileDelegate)getItem().getItem()));
|
consumer.accept(((ProjectileDelegate)getItem().getItem()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue