172 Zeilen
9.9 KiB
Diff
172 Zeilen
9.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 0000000000000000000000000000000000000000..e75e1d0d833c96af139fd955b2585ec24281b294
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java
|
|
@@ -0,0 +1,19 @@
|
|
+package com.destroystokyo.paper.entity;
|
|
+
|
|
+import net.minecraft.world.entity.monster.RangedAttackMob;
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+
|
|
+public interface CraftRangedEntity<T extends RangedAttackMob> extends RangedEntity {
|
|
+ T getHandle();
|
|
+
|
|
+ @Override
|
|
+ default void rangedAttack(LivingEntity target, float charge) {
|
|
+ getHandle().rangedAttack(((CraftLivingEntity) target).getHandle(), charge);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ default void setChargingAttack(boolean raiseHands) {
|
|
+ getHandle().setChargingAttack(raiseHands);
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java b/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
|
|
index b3ad4d54eeb1b894c24a5a76e8b12b8d9568cd56..ae10f3933fe78f74995952a6a8acf09ef4e99823 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
|
|
@@ -4,5 +4,8 @@ import net.minecraft.world.entity.LivingEntity;
|
|
|
|
public interface RangedAttackMob {
|
|
|
|
- void performRangedAttack(LivingEntity target, float pullProgress);
|
|
+ void performRangedAttack(LivingEntity target, float pullProgress); default void rangedAttack(LivingEntity entityliving, float f) { performRangedAttack(entityliving, f); } // Paper - OBFHELPER
|
|
+
|
|
+ // - see EntitySkeletonAbstract melee goal
|
|
+ void setAggressive(boolean flag); default void setChargingAttack(boolean charging) { setAggressive(charging); }; // Paper
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
|
|
index 34cb8062168258bfd168826ceeb2fde669f6d1a8..03e2acd4829da449a471b0fa1a311e74aee114d3 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java
|
|
@@ -4,7 +4,7 @@ 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, 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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
|
index 59b866e54e0d7e1dd8815ffa85275e36271113da..bbf7189a0fc9921e7a6007494f91229d9fba0846 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java
|
|
@@ -4,7 +4,7 @@ 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, 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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
index 04f716af67939b2dc34875f722816dd1ffdc4966..ed3b8fcc221d6c0789eb92eb4716d640ba0fec9f 100644
|
|
--- 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 org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.craftbukkit.inventory.CraftInventoryLlama;
|
|
@@ -9,7 +10,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, CraftRangedEntity<net.minecraft.world.entity.animal.horse.Llama> { // Paper
|
|
|
|
public CraftLlama(CraftServer server, net.minecraft.world.entity.animal.horse.Llama entity) {
|
|
super(server, entity);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
index 12bce49fcb164b6311a81024d1749a582ab1be25..c06fea6e0eaf58b8e7441ccf8595d6ca8417526a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
@@ -13,7 +13,7 @@ import org.bukkit.entity.EntityType;
|
|
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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java
|
|
index fc86b8ecc349ed59c9eb6de03086d4027cb4e08d..949260d6750e71f148229955c94bcbaad9d54a2d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java
|
|
@@ -6,7 +6,7 @@ import org.bukkit.entity.EntityType;
|
|
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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
|
index 4cd3dfd3466f384aab06dacd388e8053b045b046..b2d3244cca4d9d108159f3537d8a9aace3f8e77f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
|
@@ -6,7 +6,7 @@ import org.bukkit.entity.EntityType;
|
|
import org.bukkit.entity.Skeleton;
|
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
|
|
|
-public class CraftSkeleton extends CraftMonster implements Skeleton {
|
|
+public class CraftSkeleton extends CraftMonster implements Skeleton, com.destroystokyo.paper.entity.CraftRangedEntity<AbstractSkeleton> { // Paper
|
|
|
|
public CraftSkeleton(CraftServer server, AbstractSkeleton 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
|
|
index fcce4aa391d0c448531815e99e0e32c84203c1b8..a7164a921f479c928049d4e812eab50567e96fc2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java
|
|
@@ -5,7 +5,7 @@ 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, com.destroystokyo.paper.entity.CraftRangedEntity<SnowGolem> { // Paper
|
|
public CraftSnowman(CraftServer server, SnowGolem 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
|
|
index 60e00e539d214eb8854a53364c92c3cf55ca1062..d4eeb071dbbfca3ecea256228853bcb5c11f49ee 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
|
|
@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.entity.EntityType;
|
|
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);
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
index 728a8c0f5781f33bdb096aefb569e9509dda8c89..fdcd680b972da54f9cdb41dff5563e42bd12d8e3 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.boss.CraftBossBar;
|
|
import org.bukkit.entity.EntityType;
|
|
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;
|
|
|