Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Ranger entities #2545

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.entity.living;
package org.spongepowered.api.entity;

import org.spongepowered.api.entity.projectile.Projectile;

/**
* An {@link Agent} who has AI explicitly to attack other entities with {@link Projectile}s.
*/
public interface Ranger extends Agent {
public interface Ranger extends Entity {

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.ai.goal.Goal;
import org.spongepowered.api.entity.ai.goal.GoalBuilder;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;
import org.spongepowered.api.util.Ticks;

/**
* An {@link Goal} which uses the ranging aspect of the Ranger to attack
* the target.
*/
public interface RangedAttackAgainstAgentGoal extends Goal<Ranger> {
public interface RangedAttackAgainstAgentGoal extends Goal<RangedAgent> {

/**
* Creates a new {@link Builder} to build a new {@link RangedAttackAgainstAgentGoal}.
Expand Down Expand Up @@ -72,7 +72,7 @@ static Builder builder() {
Ticks delayBetweenAttacks();

/**
* The time, in ticks, this {@link Ranger} will wait before attacking
* The time, in ticks, this {@link RangedAgent} will wait before attacking
* again.
*
* @param delay The delay, in ticks
Expand All @@ -81,15 +81,15 @@ static Builder builder() {
RangedAttackAgainstAgentGoal setDelayBetweenAttacks(Ticks delay);

/**
* Gets the radius of which the owning {@link Ranger} will attempt to
* Gets the radius of which the owning {@link RangedAgent} will attempt to
* attack a targeted {@link Entity}.
*
* @return The radius of which the owning entity will attempt to attack
*/
float attackRadius();

/**
* Sets the radius of which the owning {@link Ranger} will attempt to
* Sets the radius of which the owning {@link RangedAgent} will attempt to
* attack a targeted {@link Entity}.
*
* @param radius The radius of which the owning entity will attempt to
Expand All @@ -98,7 +98,7 @@ static Builder builder() {
*/
RangedAttackAgainstAgentGoal setAttackRadius(float radius);

interface Builder extends GoalBuilder<Ranger, RangedAttackAgainstAgentGoal, Builder> {
interface Builder extends GoalBuilder<RangedAgent, RangedAttackAgainstAgentGoal, Builder> {

Builder moveSpeed(double speed);

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/spongepowered/api/entity/living/Human.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/
package org.spongepowered.api.entity.living;

import org.spongepowered.api.entity.Ranger;

import java.util.UUID;

public interface Human extends Humanoid, PathfinderAgent, Ranger {
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/org/spongepowered/api/entity/living/RangedAgent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.entity.living;

import org.spongepowered.api.entity.Ranger;
import org.spongepowered.api.entity.projectile.Projectile;

/**
* An {@link Agent} who has AI explicitly to attack other entities with {@link Projectile}s.
*/
public interface RangedAgent extends Agent, Ranger {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.LlamaType;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;
import org.spongepowered.api.entity.living.animal.horse.PackHorse;

/**
* Represents a Llama. Llamas are unique in that
* they can be ridden by players, but not controlled by players. Likewise, they
* have colors and styles and can have storage "strength".
*/
public interface Llama extends PackHorse, Ranger {
public interface Llama extends PackHorse, RangedAgent {

/**
* {@link Keys#LLAMA_TYPE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import org.spongepowered.api.data.type.DyeColor;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.Hostile;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;
import org.spongepowered.api.util.Direction;

public interface Shulker extends Golem, Hostile, Ranger {
public interface Shulker extends Golem, Hostile, RangedAgent {

/**
* {@link Keys#DYE_COLOR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
*/
package org.spongepowered.api.entity.living.golem;

import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents a Snow Golem.
*/
public interface SnowGolem extends Golem, Ranger {
public interface SnowGolem extends Golem, RangedAgent {

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.living.Monster;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents a Blaze.
*/
public interface Blaze extends Monster, Aerial, Ranger {
public interface Blaze extends Monster, Aerial, RangedAgent {

/**
* {@link Keys#IS_AFLAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.living.Hostile;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents a Ghast.
*/
public interface Ghast extends Aerial, Hostile, Ranger {
public interface Ghast extends Aerial, Hostile, RangedAgent {

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.explosive.fused.FusedExplosive;
import org.spongepowered.api.entity.living.Monster;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents the Wither.
*/
public interface Wither extends Monster, Ranger, Boss, Aerial, FusedExplosive {
public interface Wither extends Monster, RangedAgent, Boss, Aerial, FusedExplosive {

/**
* {@link Keys#WITHER_TARGETS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Aerial;
import org.spongepowered.api.entity.explosive.EndCrystal;
import org.spongepowered.api.entity.living.Agent;
import org.spongepowered.api.entity.living.ComplexLiving;
import org.spongepowered.api.entity.living.Hostile;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;
import org.spongepowered.api.entity.living.monster.boss.Boss;
import org.spongepowered.api.entity.living.monster.boss.dragon.phase.DragonPhase;
import org.spongepowered.api.entity.living.monster.boss.dragon.phase.DragonPhaseManager;
Expand All @@ -41,7 +40,7 @@
/**
* Represents an Ender Dragon.
*/
public interface EnderDragon extends ComplexLiving<EnderDragonPart>, Boss, Agent, Hostile, Aerial, Ranger {
public interface EnderDragon extends ComplexLiving<EnderDragonPart>, Boss, Hostile, Aerial, RangedAgent {

/**
* {@link Keys#HEALING_CRYSTAL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
*/
package org.spongepowered.api.entity.living.monster.piglin;

import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents a Piglin.
*/
public interface Piglin extends PiglinLike {
public interface Piglin extends PiglinLike, RangedAgent {
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
*/
package org.spongepowered.api.entity.living.monster.raider;

import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents a Witch.
*/
public interface Witch extends Raider, Ranger {
public interface Witch extends Raider, RangedAgent {

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.RangedAgent;
import org.spongepowered.api.item.inventory.Carrier;

/**
* Represents a Pillager.
*/
public interface Pillager extends Illager, Carrier {
public interface Pillager extends Illager, RangedAgent, Carrier {

/**
* {@link Keys#IS_CHARGING_CROSSBOW}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
*/
package org.spongepowered.api.entity.living.monster.raider.illager.spellcaster;

import org.spongepowered.api.entity.living.RangedAgent;

/**
* Represents an Illusioner.
*/
public interface Illusioner extends Spellcaster {
public interface Illusioner extends Spellcaster, RangedAgent {

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
package org.spongepowered.api.entity.living.monster.skeleton;

import org.spongepowered.api.entity.living.Monster;
import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

/**
* An abstract representation of a Skeleton.
*/
public interface SkeletonLike extends Monster, Ranger {
public interface SkeletonLike extends Monster, RangedAgent {

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
*/
package org.spongepowered.api.entity.living.monster.zombie;

import org.spongepowered.api.entity.living.Ranger;
import org.spongepowered.api.entity.living.RangedAgent;

public interface Drowned extends Zombie, Ranger {
public interface Drowned extends Zombie, RangedAgent {

}