Remove warning for custom entities in precreaturespawn, add note to event

We can't fix this. The event will simply not fire for hacky plugins replacing
entity registrations.
This commit is contained in:
Aikar 2018-01-28 22:50:35 -05:00
parent a485501ce4
commit 9b1ada78c9
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
From a7b0ffbf5d18452aef72e50c0c588d945024aada Mon Sep 17 00:00:00 2001
From 7d386845b7417cb8d36aea49b63de9db5f9209c4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 16:59:43 -0500
Subject: [PATCH] PreCreatureSpawnEvent
@ -16,10 +16,10 @@ See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
new file mode 100644
index 00000000..c4751b61
index 00000000..bac1cef3
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
@@ -0,0 +1,97 @@
@@ -0,0 +1,98 @@
+package com.destroystokyo.paper.event.entity;
+
+import com.google.common.base.Preconditions;
@ -37,6 +37,7 @@ index 00000000..c4751b61
+ * The intent of this event is to improve server performance, so limited use cases.
+ *
+ * Currently: NATURAL and SPAWNER based reasons. Please submit a Pull Request for future additions.
+ * Also, Plugins that replace Entity Registrations with their own custom entities might not fire this event.
+ */
+public class PreCreatureSpawnEvent extends Event implements Cancellable {
+ private final Location location;

View File

@ -1,4 +1,4 @@
From c64d71ef13bc28059dd6e326df41adda0e77d11d Mon Sep 17 00:00:00 2001
From 3e08a65a29f3522738000548059c21f2fc6719cb 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 c29df55fa..3c591e67e 100644
index 87fe4775f..9d580ea01 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -1,6 +1,7 @@
@ -57,10 +57,10 @@ index c29df55fa..3c591e67e 100644
if (entity == null) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 2cd063829..f64de94fa 100644
index 2cd063829..e217d3340 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -184,6 +184,27 @@ public final class SpawnerCreature {
@@ -184,6 +184,25 @@ public final class SpawnerCreature {
}
if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition) && a(EntityPositionTypes.a(biomebase_biomemeta.b), worldserver, blockposition_mutableblockposition)) {
@ -81,8 +81,6 @@ index 2cd063829..f64de94fa 100644
+ ++j4;
+ continue;
+ }
+ } else {
+ MinecraftServer.LOGGER.warn("Warning, could not find EntityType for " + cls.getName() + " contains: " + (EntityTypes.clsToTypeMap.containsKey(cls) ? "yes" : "no") + " - Please report this to Paper at https://github.com/PaperMC/Paper/issues");
+ }
+ // Paper end
EntityInsentient entityinsentient;