mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-04 18:01:17 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
162 lines
5.5 KiB
Diff
162 lines
5.5 KiB
Diff
From 218499ba97819e3b81c49a13e583dd3185f993c0 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 26 Jun 2018 21:34:40 -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/RangedEntity.java b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
|
|
new file mode 100644
|
|
index 000000000..f2e3233a3
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
|
|
@@ -0,0 +1,31 @@
|
|
+package com.destroystokyo.paper.entity;
|
|
+
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+import org.bukkit.entity.Mob;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+public interface RangedEntity extends Mob {
|
|
+ /**
|
|
+ * Attack the specified entity using a ranged attack.
|
|
+ *
|
|
+ * @param target the entity to target
|
|
+ * @param charge How "charged" the attack is (how far back the bow was pulled for Bow attacks).
|
|
+ * This should be a value between 0 and 1, represented as targetDistance/maxDistance.
|
|
+ */
|
|
+ void rangedAttack(@NotNull LivingEntity target, float charge);
|
|
+
|
|
+ /**
|
|
+ * Sets that the Entity is "charging" up an attack, by raising its hands
|
|
+ *
|
|
+ * @param raiseHands Whether the entities hands are raised to charge attack
|
|
+ */
|
|
+ void setChargingAttack(boolean raiseHands);
|
|
+
|
|
+ /**
|
|
+ * Alias to {@link LivingEntity#isHandRaised()}, if the entity is charging an attack
|
|
+ * @return If entities hands are raised
|
|
+ */
|
|
+ default boolean isChargingAttack() {
|
|
+ return isHandRaised();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/entity/Illusioner.java b/src/main/java/org/bukkit/entity/Illusioner.java
|
|
index 7c92c431b..14e6c5ee0 100644
|
|
--- a/src/main/java/org/bukkit/entity/Illusioner.java
|
|
+++ b/src/main/java/org/bukkit/entity/Illusioner.java
|
|
@@ -1,6 +1,10 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
+
|
|
/**
|
|
* Represents an Illusioner "Illager".
|
|
*/
|
|
-public interface Illusioner extends Spellcaster { }
|
|
+public interface Illusioner extends Spellcaster, RangedEntity { // Paper
|
|
+
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java
|
|
index c43854298..d23226ccb 100644
|
|
--- a/src/main/java/org/bukkit/entity/Llama.java
|
|
+++ b/src/main/java/org/bukkit/entity/Llama.java
|
|
@@ -1,12 +1,13 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
import org.bukkit.inventory.LlamaInventory;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* Represents a Llama.
|
|
*/
|
|
-public interface Llama extends ChestedHorse {
|
|
+public interface Llama extends ChestedHorse, RangedEntity { // Paper
|
|
|
|
/**
|
|
* Represents the base color that the llama has.
|
|
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
|
index 16b129388..1c367f78e 100644
|
|
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
|
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
|
@@ -2,11 +2,12 @@ package org.bukkit.entity;
|
|
|
|
import org.jetbrains.annotations.Contract;
|
|
import org.jetbrains.annotations.NotNull;
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
/**
|
|
* Represents a Skeleton.
|
|
*/
|
|
-public interface Skeleton extends Monster {
|
|
+public interface Skeleton extends Monster, RangedEntity { // Paper
|
|
|
|
/**
|
|
* Gets the current type of this skeleton.
|
|
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
|
|
index 818efe2a4..10f8f6d45 100644
|
|
--- a/src/main/java/org/bukkit/entity/Snowman.java
|
|
+++ b/src/main/java/org/bukkit/entity/Snowman.java
|
|
@@ -1,9 +1,11 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
+
|
|
/**
|
|
* Represents a snowman entity
|
|
*/
|
|
-public interface Snowman extends Golem {
|
|
+public interface Snowman extends Golem, RangedEntity { // Paper
|
|
|
|
/**
|
|
* Gets whether this snowman is in "derp mode", meaning it is not wearing a
|
|
diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java
|
|
index b4343903b..aa88aede6 100644
|
|
--- a/src/main/java/org/bukkit/entity/Witch.java
|
|
+++ b/src/main/java/org/bukkit/entity/Witch.java
|
|
@@ -1,7 +1,9 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
+
|
|
/**
|
|
* Represents a Witch
|
|
*/
|
|
-public interface Witch extends Raider {
|
|
+public interface Witch extends Raider, RangedEntity { // Paper
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
|
|
index 3bc332ee7..426d36933 100644
|
|
--- a/src/main/java/org/bukkit/entity/Wither.java
|
|
+++ b/src/main/java/org/bukkit/entity/Wither.java
|
|
@@ -1,7 +1,9 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
+
|
|
/**
|
|
* Represents a Wither boss
|
|
*/
|
|
-public interface Wither extends Monster, Boss {
|
|
+public interface Wither extends Monster, Boss, RangedEntity { // Paper
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
index 690abbba2..6d18de762 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/**
|
|
- * Represents a stack of items
|
|
+ * Represents a stack of item
|
|
*/
|
|
public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|
private Material type = Material.AIR;
|
|
--
|
|
2.21.0
|
|
|