3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00

Don't decrement ItemStack when CreatureSpawnEvent is canceled - addresses SPIGOT-87

Dieser Commit ist enthalten in:
DemonWav 2014-12-13 23:59:49 -06:00 committet von Thinkofdeath
Ursprung 28f37a113c
Commit 55e592e542

Datei anzeigen

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/ItemMonsterEgg.java 2014-12-03 10:52:09.804159084 +0000
+++ src/main/java/net/minecraft/server/ItemMonsterEgg.java 2014-12-03 10:51:53.380159449 +0000
--- ../work/decompile-8eb82bde/net/minecraft/server/ItemMonsterEgg.java 2014-12-15 13:53:30.086979118 +0000
+++ src/main/java/net/minecraft/server/ItemMonsterEgg.java 2014-12-15 13:53:30.086979118 +0000
@@ -19,7 +19,8 @@
}
@ -23,12 +23,19 @@
if (!EntityTypes.eggInfo.containsKey(Integer.valueOf(i))) {
return null;
} else {
@@ -123,7 +130,7 @@
@@ -123,8 +130,13 @@
entityinsentient.aI = entityinsentient.yaw;
entityinsentient.aG = entityinsentient.yaw;
entityinsentient.prepare(world.E(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
- world.addEntity(entity);
+ world.addEntity(entity, spawnReason); // CraftBukkit
entityinsentient.x();
- entityinsentient.x();
+ // CraftBukkit start - don't return an entity when CreatureSpawnEvent is canceled
+ if (!world.addEntity(entity, spawnReason)) {
+ entity = null;
+ } else {
+ entityinsentient.x();
+ }
+ // CraftBukkit end
}
}