mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
RangedEntity API
Allows you to determine if an entity is capable of ranged attacks, and to perform an attack.
This commit is contained in:
parent
26c0e7e3d9
commit
f6e7cce227
10 changed files with 35 additions and 9 deletions
|
@ -0,0 +1,20 @@
|
|||
package com.destroystokyo.paper.entity;
|
||||
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.monster.RangedAttackMob;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public interface CraftRangedEntity<T extends Mob & RangedAttackMob> extends RangedEntity {
|
||||
T getHandle();
|
||||
|
||||
@Override
|
||||
default void rangedAttack(LivingEntity target, float charge) {
|
||||
getHandle().performRangedAttack(((CraftLivingEntity) target).getHandle(), charge);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void setChargingAttack(boolean raiseHands) {
|
||||
getHandle().setAggressive(raiseHands);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||
import org.bukkit.entity.AbstractSkeleton;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
||||
public abstract class CraftAbstractSkeleton extends CraftMonster implements AbstractSkeleton {
|
||||
public abstract class CraftAbstractSkeleton extends CraftMonster implements AbstractSkeleton, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.AbstractSkeleton> { // Paper
|
||||
|
||||
public CraftAbstractSkeleton(CraftServer server, net.minecraft.world.entity.monster.AbstractSkeleton entity) {
|
||||
super(server, entity);
|
||||
|
@ -14,4 +14,10 @@ public abstract class CraftAbstractSkeleton extends CraftMonster implements Abst
|
|||
public void setSkeletonType(Skeleton.SkeletonType type) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
// Paper start
|
||||
@Override
|
||||
public net.minecraft.world.entity.monster.AbstractSkeleton getHandle() {
|
||||
return (net.minecraft.world.entity.monster.AbstractSkeleton) super.getHandle();
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
|
|||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Drowned;
|
||||
|
||||
public class CraftDrowned extends CraftZombie implements Drowned {
|
||||
public class CraftDrowned extends CraftZombie implements Drowned, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.Drowned> { // Paper
|
||||
|
||||
public CraftDrowned(CraftServer server, net.minecraft.world.entity.monster.Drowned entity) {
|
||||
super(server, entity);
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
|
|||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Illusioner;
|
||||
|
||||
public class CraftIllusioner extends CraftSpellcaster implements Illusioner {
|
||||
public class CraftIllusioner extends CraftSpellcaster implements Illusioner, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.Illusioner> { // Paper
|
||||
|
||||
public CraftIllusioner(CraftServer server, net.minecraft.world.entity.monster.Illusioner entity) {
|
||||
super(server, entity);
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Llama;
|
|||
import org.bukkit.entity.Llama.Color;
|
||||
import org.bukkit.inventory.LlamaInventory;
|
||||
|
||||
public class CraftLlama extends CraftChestedHorse implements Llama {
|
||||
public class CraftLlama extends CraftChestedHorse implements Llama, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.animal.horse.Llama> { // Paper
|
||||
|
||||
public CraftLlama(CraftServer server, net.minecraft.world.entity.animal.horse.Llama entity) {
|
||||
super(server, entity);
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemType;
|
|||
import org.bukkit.entity.Piglin;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class CraftPiglin extends CraftPiglinAbstract implements Piglin {
|
||||
public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.piglin.Piglin> { // Paper
|
||||
|
||||
public CraftPiglin(CraftServer server, net.minecraft.world.entity.monster.piglin.Piglin entity) {
|
||||
super(server, entity);
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
|
|||
import org.bukkit.entity.Pillager;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class CraftPillager extends CraftIllager implements Pillager {
|
||||
public class CraftPillager extends CraftIllager implements Pillager, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.Pillager> { // Paper
|
||||
|
||||
public CraftPillager(CraftServer server, net.minecraft.world.entity.monster.Pillager entity) {
|
||||
super(server, entity);
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.world.entity.animal.SnowGolem;
|
|||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Snowman;
|
||||
|
||||
public class CraftSnowman extends CraftGolem implements Snowman {
|
||||
public class CraftSnowman extends CraftGolem implements Snowman, com.destroystokyo.paper.entity.CraftRangedEntity<SnowGolem> { // Paper
|
||||
public CraftSnowman(CraftServer server, SnowGolem entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
|
|||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Witch;
|
||||
|
||||
public class CraftWitch extends CraftRaider implements Witch {
|
||||
public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.Witch> { // Paper
|
||||
public CraftWitch(CraftServer server, net.minecraft.world.entity.monster.Witch entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.bukkit.craftbukkit.boss.CraftBossBar;
|
|||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Wither;
|
||||
|
||||
public class CraftWither extends CraftMonster implements Wither {
|
||||
public class CraftWither extends CraftMonster implements Wither, com.destroystokyo.paper.entity.CraftRangedEntity<WitherBoss> { // Paper
|
||||
|
||||
private BossBar bossBar;
|
||||
|
||||
|
|
Loading…
Reference in a new issue