Paper/nms-patches/EntityTypes.patch

40 lines
1.8 KiB
Diff
Raw Normal View History

2018-07-15 02:00:00 +02:00
--- a/net/minecraft/server/EntityTypes.java
+++ b/net/minecraft/server/EntityTypes.java
2018-08-26 04:00:00 +02:00
@@ -121,7 +121,7 @@
public static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.a<T> entitytypes_a) {
2018-12-25 22:00:00 +01:00
EntityTypes<T> entitytypes = entitytypes_a.a(s);
2018-08-26 04:00:00 +02:00
- IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), (Object) entitytypes);
+ IRegistry.ENTITY_TYPE.a(new MinecraftKey(s), entitytypes); // CraftBukkit - decompile error
return entitytypes;
}
@@ -150,10 +150,16 @@
2018-07-15 02:00:00 +02:00
@Nullable
public T a(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, boolean flag, boolean flag1) {
+ // CraftBukkit start
+ return spawnCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
+ }
+
+ @Nullable
+ public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
2018-12-25 22:00:00 +01:00
T t0 = this.b(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, flag, flag1);
2018-07-15 02:00:00 +02:00
2018-12-25 22:00:00 +01:00
- world.addEntity(t0);
- return t0;
+ return world.addEntity(t0, spawnReason) ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
2018-07-15 02:00:00 +02:00
+ // CraftBukkit end
}
@Nullable
2018-08-26 04:00:00 +02:00
@@ -250,7 +256,7 @@
2018-07-15 02:00:00 +02:00
@Nullable
public T a(World world) {
2018-08-26 04:00:00 +02:00
- return (Entity) this.aT.apply(world);
+ return this.aT.apply(world); // CraftBukkit - decompile error
2018-07-15 02:00:00 +02:00
}
@Nullable