Archiviert
13
0

Use the entity registry id instead of translation key when posting PreCreatureSpawnEvent and PreSpawnerSpawnEvent

Dieser Commit ist enthalten in:
wizjany 2019-06-14 22:06:36 -07:00
Ursprung 8c710f789a
Commit 3213b6b1e4
2 geänderte Dateien mit 13 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -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),

Datei anzeigen

@ -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