Fix EntityJoinWorldEvent not firing as expected: (#8033)

- Fix entities loaded from disk not getting the event.
- Fix vehicles with passengers getting the event twice.
This commit is contained in:
gigaherz authored and GitHub committed 2021-09-16 17:11:04 -07:00
1 parent 69136fce19
commit b01a217f45
4 files changed
+39 -19

No files matched your search

@@ -42,15 +42,30 @@ public class EntityJoinWorldEvent extends EntityEvent
{
private final Level world;
private final boolean loadedFromDisk;
public EntityJoinWorldEvent(Entity entity, Level world)
{
this(entity, world, false);
}
public EntityJoinWorldEvent(Entity entity, Level world, boolean loadedFromDisk)
{
super(entity);
this.world = world;
this.loadedFromDisk = loadedFromDisk;
}
public Level getWorld()
{
return world;
}
/**
* @return {@code true} if the entity was loaded from disk. On client entities, the info isn't available and this will always return {@code false}.
*/
public boolean loadedFromDisk()
{
return loadedFromDisk;
}
}
+1 -1
View File
@@ -35,7 +35,6 @@ net/minecraft/world/entity/item/ItemEntity.changeDimension(Lnet/minecraft/server
net/minecraft/world/entity/npc/AbstractVillager.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_35295_,teleporter
net/minecraft/world/entity/player/Player.getDigSpeed(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;)F=|p_36282_,pos
net/minecraft/world/entity/projectile/ThrownEnderpearl.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_37506_,teleporter
net/minecraft/world/entity/vehicle/AbstractMinecartContainer.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_38246_,teleporter
net/minecraft/world/item/BoneMealItem.applyBonemeal(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/entity/player/Player;)Z=|p_40628_,p_40629_,p_40630_,player
net/minecraft/world/item/DyeableHorseArmorItem.<init>(ILnet/minecraft/resources/ResourceLocation;Lnet/minecraft/world/item/Item$Properties;)V=|p_41110_,p_41111_,p_41112_
net/minecraft/world/item/HorseArmorItem.<init>(ILnet/minecraft/resources/ResourceLocation;Lnet/minecraft/world/item/Item$Properties;)V=|p_41364_,p_41111_,p_41366_
@@ -49,5 +48,6 @@ net/minecraft/world/level/block/FireBlock.tryCatchFire(Lnet/minecraft/world/leve
net/minecraft/world/level/block/FlowerPotBlock.<init>(Ljava/util/function/Supplier;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|emptyPot,p_53528_,properties
net/minecraft/world/level/block/LiquidBlock.<init>(Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|p_54694_,p_54695_
net/minecraft/world/level/chunk/PalettedContainer.setBits(IZ)V=|p_63122_,forceBits
net/minecraft/world/level/entity/PersistentEntitySectionManager.addEntityWithoutEvent(Lnet/minecraft/world/level/entity/EntityAccess;Z)Z=|p_157539_,p_157540_
net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.processEntityInfos(Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/List;)Ljava/util/List;=|template,p_215387_0_,p_215387_1_,p_215387_2_,p_215387_3_
net/minecraft/world/level/storage/loot/LootPool.<init>([Lnet/minecraft/world/level/storage/loot/entries/LootPoolEntryContainer;[Lnet/minecraft/world/level/storage/loot/predicates/LootItemCondition;[Lnet/minecraft/world/level/storage/loot/functions/LootItemFunction;Lnet/minecraft/world/level/storage/loot/providers/number/NumberProvider;Lnet/minecraft/world/level/storage/loot/providers/number/NumberProvider;Ljava/lang/String;)V=|p_165128_,p_165129_,p_165130_,p_165131_,p_165132_,name