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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 0000000000000000000000000000000000000000..696660b089ba355f865e5051237eefd0df667857
|
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;
|
|
|
|
+
|
|
|
|
+import net.minecraft.server.IRangedEntity;
|
|
|
|
+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
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/IRangedEntity.java b/src/main/java/net/minecraft/server/IRangedEntity.java
|
2020-05-06 09:48:49 +00:00
|
|
|
index b4178ce1e86ad40b64a229e066f058a8e848324d..9b79ac77db880930fcb86744924bf0baa92bef31 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/IRangedEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/IRangedEntity.java
|
2019-04-30 01:20:24 +00:00
|
|
|
@@ -2,5 +2,8 @@ package net.minecraft.server;
|
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
|
|
|
|
+ void q(boolean flag); default void setChargingAttack(boolean charging) { q(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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 6e41dfd92344e3de71642879993cf25a5dd8b30a..390183fffd952e583a7d7df9ae618458fb48d278 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
|
|
|
|
@@ -1,11 +1,12 @@
|
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import net.minecraft.server.EntityDrowned;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
import org.bukkit.entity.Drowned;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
|
|
|
|
-public class CraftDrowned extends CraftZombie implements Drowned {
|
|
|
|
+public class CraftDrowned extends CraftZombie implements Drowned, CraftRangedEntity<EntityDrowned> { // Paper
|
|
|
|
|
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 2ec1af8be419d94dfde8fe2cc46bae88751a9d8f..f31d3eed3a53d171596b888351064f6d70986785 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
|
|
|
|
@@ -1,11 +1,12 @@
|
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import net.minecraft.server.EntityIllagerIllusioner;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Illusioner;
|
|
|
|
|
|
|
|
-public class CraftIllusioner extends CraftSpellcaster implements Illusioner {
|
|
|
|
+public class CraftIllusioner extends CraftSpellcaster implements Illusioner, CraftRangedEntity<EntityIllagerIllusioner> { // Paper
|
|
|
|
|
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 23ab78da150cacefbac3e35f860dbd20548e54fa..3f94c5a9206e2da9c852d282e267ab4d9f7324c4 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;
|
|
|
|
import net.minecraft.server.EntityLlama;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
@@ -9,7 +10,7 @@ import org.bukkit.entity.Horse;
|
|
|
|
import org.bukkit.entity.Llama;
|
|
|
|
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);
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
2020-05-06 09:48:49 +00:00
|
|
|
index b4ae8984019b09ae52d708a48663d9ca7509eb29..02df66ecfe92727e1b8e662bb41faac0dc014a44 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
|
2019-04-30 01:20:24 +00:00
|
|
|
@@ -1,11 +1,12 @@
|
2018-06-27 02:08:01 +00:00
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import net.minecraft.server.EntitySkeletonAbstract;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Skeleton;
|
|
|
|
|
|
|
|
-public class CraftSkeleton extends CraftMonster implements Skeleton {
|
|
|
|
+public class CraftSkeleton extends CraftMonster implements Skeleton, CraftRangedEntity<EntitySkeletonAbstract> { // Paper
|
|
|
|
|
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 27460c59e399bbe2a38eeb6256a8985ed9a04655..e482b1c9dc01b9fdac91681ff116cd21b06fc031 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
|
|
|
|
@@ -1,11 +1,12 @@
|
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import net.minecraft.server.EntitySnowman;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
import org.bukkit.entity.Snowman;
|
|
|
|
|
|
|
|
-public class CraftSnowman extends CraftGolem implements Snowman {
|
|
|
|
+public class CraftSnowman extends CraftGolem implements Snowman, CraftRangedEntity<EntitySnowman> { // Paper
|
|
|
|
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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 244e4dc8ec740e8071f249de7f461d3c3efe7199..bae107e76e4c8df446d4a7be8dda291d820074d7 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
|
|
|
|
@@ -1,11 +1,12 @@
|
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
2019-04-30 01:20:24 +00:00
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
import net.minecraft.server.EntityWitch;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
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 {
|
|
|
|
+public class CraftWitch extends CraftRaider implements Witch, 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
|
2020-05-06 09:48:49 +00:00
|
|
|
index 38b555cc7ef80dc15ca8d37911b2acab5676e6a1..03cf6136e64bab7180933e106234b92c1255268d 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
|
2018-11-11 05:37:15 +00:00
|
|
|
@@ -1,5 +1,6 @@
|
2018-06-27 02:08:01 +00:00
|
|
|
package org.bukkit.craftbukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import net.minecraft.server.EntityWither;
|
2018-11-11 05:37:15 +00:00
|
|
|
import org.bukkit.boss.BossBar;
|
2018-06-27 02:08:01 +00:00
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
2018-11-11 05:37:15 +00:00
|
|
|
@@ -7,7 +8,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 {
|
|
|
|
+public class CraftWither extends CraftMonster implements Wither, CraftRangedEntity<EntityWither> { // Paper
|
2018-11-11 05:37:15 +00:00
|
|
|
|
|
|
|
private BossBar bossBar;
|
|
|
|
|