Paper/nms-patches/EntityTypes.patch

59 lines
4.5 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
2019-12-10 23:00:00 +01:00
@@ -130,7 +130,7 @@
private MinecraftKey bi;
private final EntitySize bj;
2018-08-26 04:00:00 +02:00
2019-04-23 04:00:00 +02:00
- private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.a<T> entitytypes_a) {
+ private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.a entitytypes_a) { // CraftBukkit - decompile error
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_a.a(s));
2018-08-26 04:00:00 +02:00
}
2019-12-10 23:00:00 +01:00
@@ -159,10 +159,16 @@
2018-07-15 02:00:00 +02:00
@Nullable
2019-04-23 04:00:00 +02:00
public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
2018-07-15 02:00:00 +02:00
+ // CraftBukkit start
2019-04-23 04:00:00 +02:00
+ return this.spawnCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
2018-07-15 02:00:00 +02:00
+ }
+
+ @Nullable
2019-04-23 04:00:00 +02:00
+ public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
2020-01-21 22:00:00 +01:00
T t0 = this.createCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, 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
2019-12-10 23:00:00 +01:00
@@ -328,7 +334,7 @@
2019-04-23 04:00:00 +02:00
}
2018-07-15 02:00:00 +02:00
2019-04-23 04:00:00 +02:00
return entity;
- }).orElse((Object) null);
+ }).orElse(null); // CraftBukkit - decompile error
2018-07-15 02:00:00 +02:00
}
2019-04-23 04:00:00 +02:00
private static Optional<Entity> b(NBTTagCompound nbttagcompound, World world) {
2019-12-10 23:00:00 +01:00
@@ -345,7 +351,8 @@
2019-04-23 04:00:00 +02:00
}
public int getUpdateInterval() {
- return this != EntityTypes.PLAYER && this != EntityTypes.EVOKER_FANGS ? (this == EntityTypes.EYE_OF_ENDER ? 4 : (this == EntityTypes.FISHING_BOBBER ? 5 : (this != EntityTypes.SMALL_FIREBALL && this != EntityTypes.DRAGON_FIREBALL && this != EntityTypes.FIREBALL && this != EntityTypes.WITHER_SKULL && this != EntityTypes.SNOWBALL && this != EntityTypes.LLAMA_SPIT && this != EntityTypes.ENDER_PEARL && this != EntityTypes.EGG && this != EntityTypes.POTION && this != EntityTypes.EXPERIENCE_BOTTLE && this != EntityTypes.FIREWORK_ROCKET && this != EntityTypes.TNT ? (this != EntityTypes.ARROW && this != EntityTypes.SPECTRAL_ARROW && this != EntityTypes.TRIDENT && this != EntityTypes.ITEM && this != EntityTypes.FALLING_BLOCK && this != EntityTypes.EXPERIENCE_ORB ? (this != EntityTypes.ITEM_FRAME && this != EntityTypes.LEASH_KNOT && this != EntityTypes.PAINTING && this != EntityTypes.AREA_EFFECT_CLOUD && this != EntityTypes.END_CRYSTAL ? 3 : Integer.MAX_VALUE) : 20) : 10))) : 2;
+ // CraftBukkit - SPIGOT-3729: track area effect clouds
+ return this != EntityTypes.PLAYER && this != EntityTypes.EVOKER_FANGS ? (this == EntityTypes.EYE_OF_ENDER ? 4 : (this == EntityTypes.FISHING_BOBBER ? 5 : (this != EntityTypes.SMALL_FIREBALL && this != EntityTypes.DRAGON_FIREBALL && this != EntityTypes.FIREBALL && this != EntityTypes.WITHER_SKULL && this != EntityTypes.SNOWBALL && this != EntityTypes.LLAMA_SPIT && this != EntityTypes.ENDER_PEARL && this != EntityTypes.EGG && this != EntityTypes.POTION && this != EntityTypes.EXPERIENCE_BOTTLE && this != EntityTypes.FIREWORK_ROCKET && this != EntityTypes.TNT ? (this != EntityTypes.ARROW && this != EntityTypes.SPECTRAL_ARROW && this != EntityTypes.TRIDENT && this != EntityTypes.ITEM && this != EntityTypes.FALLING_BLOCK && this != EntityTypes.EXPERIENCE_ORB ? (this != EntityTypes.ITEM_FRAME && this != EntityTypes.LEASH_KNOT && this != EntityTypes.PAINTING && this != EntityTypes.END_CRYSTAL ? 3 : Integer.MAX_VALUE) : 20) : 10))) : 2;
}
public boolean isDeltaTracking() {
2019-12-10 23:00:00 +01:00
@@ -377,7 +384,7 @@
2019-07-20 01:00:00 +02:00
this.f = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
2019-04-23 04:00:00 +02:00
}
- public static <T extends Entity> EntityTypes.a<T> a(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype) {
+ public static <T extends Entity> EntityTypes.a<T> a(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype) { // CraftBukkit - decompile error
return new EntityTypes.a<>(entitytypes_b, enumcreaturetype);
}