mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-07 04:18:09 +02:00
Merge branch 'master' into pre/1.13
* master: Apply spawner delay for cancelled pre spawn events (#1276)
This commit is contained in:
commit
04aba0fca7
@ -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>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sun, 14 Jan 2018 17:01:31 -0500
|
Date: Sun, 14 Jan 2018 17:01:31 -0500
|
||||||
Subject: [PATCH] PreCreatureSpawnEvent
|
Subject: [PATCH] PreCreatureSpawnEvent
|
||||||
@ -15,7 +15,7 @@ instead and save a lot of server resources.
|
|||||||
See: https://github.com/PaperMC/Paper/issues/917
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||||
@@ -1,6 +1,7 @@
|
@@ -1,6 +1,7 @@
|
||||||
@ -26,7 +26,7 @@ index c76dbe74ac..b88160a2ed 100644
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
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 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 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;
|
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
|
+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
||||||
+ );
|
+ );
|
||||||
+ if (!event.callEvent()) {
|
+ if (!event.callEvent()) {
|
||||||
|
+ flag = true;
|
||||||
+ if (event.shouldAbortSpawn()) {
|
+ if (event.shouldAbortSpawn()) {
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
Reference in New Issue
Block a user