mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 22:14:40 +01:00
66 lines
4.2 KiB
Diff
66 lines
4.2 KiB
Diff
--- a/net/minecraft/server/EntityTypes.java
|
|
+++ b/net/minecraft/server/EntityTypes.java
|
|
@@ -12,7 +12,7 @@
|
|
public class EntityTypes<T extends Entity> {
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = a("area_effect_cloud", EntityTypes.Builder.a(EntityAreaEffectCloud::new, EnumCreatureType.MISC).c().a(6.0F, 0.5F).trackingRange(10).updateInterval(Integer.MAX_VALUE));
|
|
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = a("area_effect_cloud", EntityTypes.Builder.a(EntityAreaEffectCloud::new, EnumCreatureType.MISC).c().a(6.0F, 0.5F).trackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
|
|
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = a("armor_stand", EntityTypes.Builder.a(EntityArmorStand::new, EnumCreatureType.MISC).a(0.5F, 1.975F).trackingRange(10));
|
|
public static final EntityTypes<EntityTippedArrow> ARROW = a("arrow", EntityTypes.Builder.a(EntityTippedArrow::new, EnumCreatureType.MISC).a(0.5F, 0.5F).trackingRange(4).updateInterval(20));
|
|
public static final EntityTypes<EntityBat> BAT = a("bat", EntityTypes.Builder.a(EntityBat::new, EnumCreatureType.AMBIENT).a(0.5F, 0.9F).trackingRange(5));
|
|
@@ -137,7 +137,7 @@
|
|
private MinecraftKey bq;
|
|
private final EntitySize br;
|
|
|
|
- private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
|
+ private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
|
|
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
|
|
}
|
|
|
|
@@ -169,10 +169,17 @@
|
|
|
|
@Nullable
|
|
public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
|
+ // CraftBukkit start
|
|
+ return this.spawnCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
|
+ }
|
|
+
|
|
+ @Nullable
|
|
+ public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
|
T t0 = this.createCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
|
|
|
|
if (t0 != null) {
|
|
- worldserver.addAllEntities(t0);
|
|
+ return worldserver.addAllEntities(t0, spawnReason) ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
return t0;
|
|
@@ -208,7 +215,7 @@
|
|
t0.setCustomName(ichatbasecomponent);
|
|
}
|
|
|
|
- a((World) worldserver, entityhuman, t0, nbttagcompound);
|
|
+ try { a((World) worldserver, entityhuman, t0, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
|
return t0;
|
|
}
|
|
}
|
|
@@ -351,7 +358,7 @@
|
|
}
|
|
|
|
return entity;
|
|
- }).orElse((Object) null);
|
|
+ }).orElse(null); // CraftBukkit - decompile error
|
|
}
|
|
|
|
private static Optional<Entity> b(NBTTagCompound nbttagcompound, World world) {
|
|
@@ -403,7 +410,7 @@
|
|
this.g = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
|
}
|
|
|
|
- public static <T extends Entity> EntityTypes.Builder<T> a(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype) {
|
|
+ public static <T extends Entity> EntityTypes.Builder<T> a(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype) { // CraftBukkit - decompile error
|
|
return new EntityTypes.Builder<>(entitytypes_b, enumcreaturetype);
|
|
}
|
|
|