Merge pull request #2183 from BillyGalbreath/WizFix

Fix Pre SpawnEvents not firing (by wizjany)
This commit is contained in:
kashike 2019-06-14 22:13:41 -07:00 committed by GitHub
commit 667c8901f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 21 deletions

View file

@ -1,4 +1,4 @@
From 510db7677c50ff504e94bf324b856853989cc306 Mon Sep 17 00:00:00 2001
From 85440e9c1108aa2da61d7e8b3e9d1844b00a0b7d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
@ -14,20 +14,8 @@ 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/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 98eb0d24cc..77d4bbce19 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -271,6 +271,7 @@ public class EntityTypes<T extends Entity> {
return this.bf;
}
+ public final MinecraftKey getKey() { return this.g(); } // Paper - OBFHELPER
public MinecraftKey g() {
if (this.bg == null) {
MinecraftKey minecraftkey = IRegistry.ENTITY_TYPE.getKey(this);
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 93fad14d3f..55764deec4 100644
index 93fad14d3..55764deec 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -103,6 +103,27 @@ public abstract class MobSpawnerAbstract {
@ -59,7 +47,7 @@ index 93fad14d3f..55764deec4 100644
Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> {
entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch);
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index f4f842b863..5da0f2211b 100644
index f4f842b86..d25c7231d 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -38,7 +38,7 @@ public final class SpawnerCreature {
@ -78,7 +66,7 @@ index f4f842b863..5da0f2211b 100644
+ // Paper start
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ EntityTypes<?> cls = biomebase_biomemeta.b;
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(cls.getKey().getKey());
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(cls).getKey());
+ if (type != null) {
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(world, blockposition_mutableblockposition),

View file

@ -1,4 +1,4 @@
From bdf18370fbd2bff56e53cb0bcd3baea44ec4bd2e Mon Sep 17 00:00:00 2001
From 4f7ce2bba482d32179e6b76b5bec2aa4d3010fec Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 18 Sep 2018 23:53:23 +0100
Subject: [PATCH] PreSpawnerSpawnEvent
@ -9,11 +9,15 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 55764deec4..dbb8098d6c 100644
index 55764dee..b2e6e2a7 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -108,11 +108,11 @@ public abstract class MobSpawnerAbstract {
String key = entityType.getKey().getKey();
@@ -105,14 +105,14 @@ public abstract class MobSpawnerAbstract {
// Paper start
EntityTypes entityType = optional.get();
- String key = entityType.getKey().getKey();
+ String key = EntityTypes.getName(entityType).getKey();
org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
if (type != null) {
- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
@ -28,5 +32,5 @@ index 55764deec4..dbb8098d6c 100644
if (!event.callEvent()) {
flag = true;
--
2.21.0
2.20.1