2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-06-27 02:08:01 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 26 Jun 2018 22:00:49 -0400
|
|
|
|
Subject: [PATCH] RangedEntity API
|
|
|
|
|
|
|
|
Allows you to determine if an entity is capable of ranged attacks,
|
|
|
|
and to perform an attack.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java
|
|
|
|
new file mode 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
index 0000000000000000000000000000000000000000..0195d4036f06db0f3f56f134dbfbc4360d44ed86
|
2018-06-27 02:08:01 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java
|
|
|
|
@@ -0,0 +1,19 @@
|
|
|
|
+package com.destroystokyo.paper.entity;
|
|
|
|
+
|
2021-03-16 07:19:45 +00:00
|
|
|
+import net.minecraft.world.entity.monster.IRangedEntity;
|
2018-06-27 02:08:01 +00:00
|
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
|
|
+import org.bukkit.entity.LivingEntity;
|
|
|
|
+
|
|
|
|
+public interface CraftRangedEntity<T extends IRangedEntity> extends RangedEntity {
|
|
|
|
+ T getHandle();
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ default void rangedAttack(LivingEntity target, float charge) {
|
|
|
|
+ getHandle().rangedAttack(((CraftLivingEntity) target).getHandle(), charge);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2018-06-29 04:55:29 +00:00
|
|
|
+ default void setChargingAttack(boolean raiseHands) {
|
|
|
|
+ getHandle().setChargingAttack(raiseHands);
|
2018-06-27 02:08:01 +00:00
|
|
|
+ }
|
|
|
|
+}
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java b/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java
|
|
|
|
index d79e6b28c77edc468c6471d909306c2135b496c7..0f0aaa8a15301dea8405e26333d30b385831506c 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java
|
|
|
|
@@ -4,5 +4,8 @@ import net.minecraft.world.entity.EntityLiving;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
public interface IRangedEntity {
|
|
|
|
|
2019-01-01 03:15:55 +00:00
|
|
|
- void a(EntityLiving entityliving, float f);
|
|
|
|
+ void a(EntityLiving entityliving, float f); default void rangedAttack(EntityLiving entityliving, float f) { a(entityliving, f); } // Paper - OBFHELPER
|
2019-04-30 01:20:24 +00:00
|
|
|
+
|
|
|
|
+ // - see EntitySkeletonAbstract melee goal
|
2020-06-26 12:04:38 +00:00
|
|
|
+ void setAggressive(boolean flag); default void setChargingAttack(boolean charging) { setAggressive(charging); }; // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
}
|
2020-04-10 01:30:38 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 3bb39dae11847bea1330ef68f53c90309fd2a095..bba2e3fba5b225e90744e78df085b3c318a029ce 100644
|
2020-04-10 01:30:38 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
2020-04-10 01:30:38 +00:00
|
|
|
import org.bukkit.entity.Drowned;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
|
|
|
|
-public class CraftDrowned extends CraftZombie implements Drowned {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftDrowned extends CraftZombie implements Drowned, com.destroystokyo.paper.entity.CraftRangedEntity<EntityDrowned> { // Paper
|
2020-04-10 01:30:38 +00:00
|
|
|
|
|
|
|
public CraftDrowned(CraftServer server, EntityDrowned entity) {
|
|
|
|
super(server, entity);
|
2018-06-27 02:08:01 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 0dabb012b37b6dda58368765b220b7d0aaf8e2d4..3763fb13920c98bb7cd250883ec89cdd1805dbd6 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Illusioner;
|
|
|
|
|
|
|
|
-public class CraftIllusioner extends CraftSpellcaster implements Illusioner {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftIllusioner extends CraftSpellcaster implements Illusioner, com.destroystokyo.paper.entity.CraftRangedEntity<EntityIllagerIllusioner> { // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
public CraftIllusioner(CraftServer server, EntityIllagerIllusioner entity) {
|
|
|
|
super(server, entity);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 6dcf196fd83f2175a5d34c8d138d923c32ddb899..818034c62893a71808e3af0aa33393605611acdd 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import com.google.common.base.Preconditions;
|
2021-03-16 07:19:45 +00:00
|
|
|
import net.minecraft.world.entity.animal.horse.EntityLlama;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
2021-03-08 23:12:31 +00:00
|
|
|
@@ -10,7 +11,7 @@ import org.bukkit.entity.Llama;
|
|
|
|
import org.bukkit.entity.Llama.Color;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.inventory.LlamaInventory;
|
|
|
|
|
|
|
|
-public class CraftLlama extends CraftChestedHorse implements Llama {
|
|
|
|
+public class CraftLlama extends CraftChestedHorse implements Llama, CraftRangedEntity<EntityLlama> { // Paper
|
|
|
|
|
|
|
|
public CraftLlama(CraftServer server, EntityLlama entity) {
|
|
|
|
super(server, entity);
|
2020-10-22 12:01:44 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index a224ebf16834fa10e169fa3239d89b1e60673dbb..b3b5d3a7f8ed522680f764cfd20d1e5c69627804 100644
|
2020-10-22 12:01:44 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
2020-10-22 12:01:44 +00:00
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Piglin;
|
|
|
|
|
|
|
|
-public class CraftPiglin extends CraftPiglinAbstract implements Piglin {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.destroystokyo.paper.entity.CraftRangedEntity<EntityPiglin> { // Paper
|
2020-10-22 12:01:44 +00:00
|
|
|
|
|
|
|
public CraftPiglin(CraftServer server, EntityPiglin entity) {
|
|
|
|
super(server, entity);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 72ac9eae71028a40541f949d617ce326c00c6369..87eeb5b632b581dca7613973bc9a25f152839a33 100644
|
2020-10-22 12:01:44 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -7,7 +7,7 @@ import org.bukkit.entity.EntityType;
|
2020-10-22 12:01:44 +00:00
|
|
|
import org.bukkit.entity.Pillager;
|
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
|
|
|
|
-public class CraftPillager extends CraftIllager implements Pillager {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftPillager extends CraftIllager implements Pillager, com.destroystokyo.paper.entity.CraftRangedEntity<EntityPillager> { // Paper
|
2020-10-22 12:01:44 +00:00
|
|
|
|
|
|
|
public CraftPillager(CraftServer server, EntityPillager entity) {
|
|
|
|
super(server, entity);
|
2018-06-27 02:08:01 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index cebb90fd4a84c0a97d7493a6923d16d0c4215f5e..c2acfa2cc27a187154e17b7f45908682b41b52af 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -6,7 +6,7 @@ import org.bukkit.entity.EntityType;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.entity.Skeleton;
|
2021-03-08 23:12:31 +00:00
|
|
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
-public class CraftSkeleton extends CraftMonster implements Skeleton {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftSkeleton extends CraftMonster implements Skeleton, com.destroystokyo.paper.entity.CraftRangedEntity<EntitySkeletonAbstract> { // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
public CraftSkeleton(CraftServer server, EntitySkeletonAbstract entity) {
|
|
|
|
super(server, entity);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 5720bdf64eadec1ebe1a2253e2b537ca299ffa6d..a262cf88eefca2767eb6e5da856626be34352ccd 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Snowman;
|
|
|
|
|
|
|
|
-public class CraftSnowman extends CraftGolem implements Snowman {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftSnowman extends CraftGolem implements Snowman, com.destroystokyo.paper.entity.CraftRangedEntity<EntitySnowman> { // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
public CraftSnowman(CraftServer server, EntitySnowman entity) {
|
|
|
|
super(server, entity);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 796bd26d41b52941c38d81411688116af7053535..9cc34cdb43596eff34625045f884b93da3f27ab6 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.entity.EntityType;
|
2019-04-30 01:20:24 +00:00
|
|
|
import org.bukkit.entity.Witch;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
2019-04-30 01:20:24 +00:00
|
|
|
-public class CraftWitch extends CraftRaider implements Witch {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity<EntityWitch> { // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
public CraftWitch(CraftServer server, EntityWitch entity) {
|
|
|
|
super(server, entity);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 7150702d8dac0d9db44661b1b17f520302988b45..1d94aeec37dcb9758d88ef25a5cad1333bbfbf6c 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.boss.CraftBossBar;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.entity.EntityType;
|
2018-11-11 05:37:15 +00:00
|
|
|
import org.bukkit.entity.Wither;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
-public class CraftWither extends CraftMonster implements Wither {
|
2021-03-16 07:19:45 +00:00
|
|
|
+public class CraftWither extends CraftMonster implements Wither, com.destroystokyo.paper.entity.CraftRangedEntity<EntityWither> { // Paper
|
2018-11-11 05:37:15 +00:00
|
|
|
|
|
|
|
private BossBar bossBar;
|
|
|
|
|