2018-12-15 01:17:27 +00:00
|
|
|
From 96e4498b872011add7476c3d221f0f75c9ee8658 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
|
2018-11-11 05:37:15 +00:00
|
|
|
index 000000000..696660b08
|
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
|
2018-11-11 05:37:15 +00:00
|
|
|
index 1b06ce853..94533d19a 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
|
2018-08-31 22:56:57 +00:00
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
package net.minecraft.server;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
public interface IRangedEntity {
|
2018-08-31 22:56:57 +00:00
|
|
|
- void a(EntityLiving var1, float var2);
|
|
|
|
+ void a(EntityLiving var1, float var2);default void rangedAttack(EntityLiving entityliving, float f) { a(entityliving, f); } // Paper OBF HELPER
|
2018-06-27 02:08:01 +00:00
|
|
|
|
2018-08-31 22:56:57 +00:00
|
|
|
- void s(boolean var1);
|
|
|
|
+ void s(boolean var1); default void setChargingAttack(boolean flag) { s(flag); } // Paper OBF HELPER
|
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
|
2018-11-11 05:37:15 +00:00
|
|
|
index 2ec1af8be..f31d3eed3 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
|
2018-11-11 05:37:15 +00:00
|
|
|
index 23ab78da1..3f94c5a92 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
|
2018-11-11 05:37:15 +00:00
|
|
|
index 4ed89615f..4fa5e84ea 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
|
|
|
|
@@ -1,12 +1,13 @@
|
|
|
|
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
|
2018-11-11 05:37:15 +00:00
|
|
|
index 0349f0a57..2e3d8fcdf 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
|
2018-11-11 05:37:15 +00:00
|
|
|
index c08833cb7..f25998eb6 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;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.CraftRangedEntity;
|
|
|
|
import net.minecraft.server.EntityWitch;
|
|
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
import org.bukkit.entity.Witch;
|
|
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
|
|
|
|
-public class CraftWitch extends CraftMonster implements Witch {
|
|
|
|
+public class CraftWitch extends CraftMonster implements Witch, CraftRangedEntity<EntityWitch> { // Paper
|
|
|
|
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
|
2018-12-15 01:17:27 +00:00
|
|
|
index 3df0fcb9b..a1d04ff28 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;
|
|
|
|
|
2018-06-27 02:08:01 +00:00
|
|
|
--
|
2018-12-15 01:17:27 +00:00
|
|
|
2.20.0
|
2018-06-27 02:08:01 +00:00
|
|
|
|