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;
}
}