MOAR PATCHES
This commit is contained in:
parent
27a8d6da9a
commit
f55b6e04b1
34 changed files with 623 additions and 967 deletions
|
@ -1,129 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 9 Feb 2020 00:19:08 -0600
|
||||
Subject: [PATCH] Add ThrownEggHatchEvent
|
||||
|
||||
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement
|
||||
(dispensers can throw eggs to hatch them, too).
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d380187c9c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
|
||||
@@ -0,0 +1,115 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Egg;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a thrown egg might hatch.
|
||||
+ * <p>
|
||||
+ * This event fires for all thrown eggs that may hatch, players, dispensers, etc.
|
||||
+ */
|
||||
+public class ThrownEggHatchEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Egg egg;
|
||||
+ private boolean hatching;
|
||||
+ private EntityType hatchType;
|
||||
+ private byte numHatches;
|
||||
+
|
||||
+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) {
|
||||
+ this.egg = egg;
|
||||
+ this.hatching = hatching;
|
||||
+ this.numHatches = numHatches;
|
||||
+ this.hatchType = hatchingType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the egg involved in this event.
|
||||
+ *
|
||||
+ * @return the egg involved in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Egg getEgg() {
|
||||
+ return egg;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the egg is hatching or not. Will be what the server
|
||||
+ * would've done without interaction.
|
||||
+ *
|
||||
+ * @return boolean Whether the egg is going to hatch or not
|
||||
+ */
|
||||
+ public boolean isHatching() {
|
||||
+ return hatching;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the egg will hatch or not.
|
||||
+ *
|
||||
+ * @param hatching true if you want the egg to hatch, false if you want it
|
||||
+ * not to
|
||||
+ */
|
||||
+ public void setHatching(boolean hatching) {
|
||||
+ this.hatching = hatching;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the type of the mob being hatched (EntityType.CHICKEN by default)
|
||||
+ *
|
||||
+ * @return The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EntityType getHatchingType() {
|
||||
+ return hatchType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the type of mob being hatched by the egg
|
||||
+ *
|
||||
+ * @param hatchType The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ public void setHatchingType(@NotNull EntityType hatchType) {
|
||||
+ if (!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!");
|
||||
+ this.hatchType = hatchType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the number of mob hatches from the egg. By default the number will
|
||||
+ * be the number the server would've done
|
||||
+ * <ul>
|
||||
+ * <li>7/8 chance of being 0
|
||||
+ * <li>31/256 ~= 1/8 chance to be 1
|
||||
+ * <li>1/256 chance to be 4
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @return The number of mobs going to be hatched by the egg
|
||||
+ */
|
||||
+ public byte getNumHatches() {
|
||||
+ return numHatches;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the number of mobs coming out of the hatched egg
|
||||
+ * <p>
|
||||
+ * The boolean hatching will override this number. Ie. If hatching =
|
||||
+ * false, this number will not matter
|
||||
+ *
|
||||
+ * @param numHatches The number of mobs coming out of the egg
|
||||
+ */
|
||||
+ public void setNumHatches(byte numHatches) {
|
||||
+ this.numHatches = numHatches;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -1,88 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 8 Feb 2020 23:26:18 -0600
|
||||
Subject: [PATCH] Entity Jump API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0067c2e953d18e1a33536980071ba3f0152ecb4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity jumps
|
||||
+ * <p>
|
||||
+ * Cancelling the event will stop the entity from jumping
|
||||
+ */
|
||||
+public class EntityJumpEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+
|
||||
+ public EntityJumpEvent(@NotNull LivingEntity entity) {
|
||||
+ super(entity);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) entity;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index ac6921093457cee6d01fd27690c8bb6034b4af53..a46379b3a777a9071b0b13357bbd6af40dbfb569 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -795,5 +795,25 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
@NotNull
|
||||
org.bukkit.inventory.EquipmentSlot getHandRaised();
|
||||
+
|
||||
+ /**
|
||||
+ * Get entity jump state.
|
||||
+ * <p>
|
||||
+ * Jump state will be true when the entity has been marked to jump.
|
||||
+ *
|
||||
+ * @return entity jump state.
|
||||
+ */
|
||||
+ boolean isJumping();
|
||||
+
|
||||
+ /**
|
||||
+ * Set entity jump state
|
||||
+ * <p>
|
||||
+ * Setting to true will mark the entity to jump.
|
||||
+ * <p>
|
||||
+ * Setting to false will unmark the entity to jump but will not stop a jump already in-progress.
|
||||
+ *
|
||||
+ * @param jumping entity jump state
|
||||
+ */
|
||||
+ void setJumping(boolean jumping);
|
||||
// Paper end
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Sun, 1 Mar 2020 22:43:34 +0100
|
||||
Subject: [PATCH] add hand to BlockMultiPlaceEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java
|
||||
index fe2ec79dd6084509cb8cbb8155a356f4162466fd..8460aa4f5e211fb0a6ab11f7487d38dba927e1da 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java
|
||||
@@ -18,9 +18,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class BlockMultiPlaceEvent extends BlockPlaceEvent {
|
||||
private final List<BlockState> states;
|
||||
|
||||
+ @Deprecated // Paper
|
||||
public BlockMultiPlaceEvent(@NotNull List<BlockState> states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) {
|
||||
- super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild);
|
||||
+ //Paper start - add hand to BlockMultiPlaceEvent
|
||||
+ this(states, clicked, itemInHand, thePlayer, canBuild, org.bukkit.inventory.EquipmentSlot.HAND);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public BlockMultiPlaceEvent(@NotNull List<BlockState> states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull org.bukkit.inventory.EquipmentSlot hand) {
|
||||
+ super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild, hand);
|
||||
this.states = ImmutableList.copyOf(states);
|
||||
+ //Paper end
|
||||
}
|
||||
|
||||
/**
|
Loading…
Add table
Add a link
Reference in a new issue