Merge branch 'master' into pre/1.13

* master:
  Apply spawner delay for cancelled pre spawn events (#1276)
This commit is contained in:
Aikar 2018-07-25 19:07:56 -04:00
commit 04aba0fca7
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE

View File

@ -1,4 +1,4 @@
From 0bc6c124ed1c6be43add0164f7711220f38af6a8 Mon Sep 17 00:00:00 2001
From 9a0a56e528db31e6d9a887b2b3ac7cb408fd8210 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
@ -15,7 +15,7 @@ instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index c76dbe74ac..b88160a2ed 100644
index c76dbe74ac..d10196fcbd 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -1,6 +1,7 @@
@ -26,7 +26,7 @@ index c76dbe74ac..b88160a2ed 100644
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;
@@ -94,6 +95,27 @@ public abstract class MobSpawnerAbstract {
@@ -94,6 +95,28 @@ public abstract class MobSpawnerAbstract {
double d3 = j >= 1 ? nbttaglist.k(0) : (double) blockposition.getX() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
double d4 = j >= 2 ? nbttaglist.k(1) : (double) (blockposition.getY() + world.random.nextInt(3) - 1);
double d5 = j >= 3 ? nbttaglist.k(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
@ -44,6 +44,7 @@ index c76dbe74ac..b88160a2ed 100644
+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ );
+ if (!event.callEvent()) {
+ flag = true;
+ if (event.shouldAbortSpawn()) {
+ break;
+ }