Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue with loadedEntityList on custom server #132

Open
wants to merge 1 commit into
base: 1.12.2-forge
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/cam72cam/mod/world/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
Expand Down Expand Up @@ -113,6 +114,12 @@ private void checkLoadedEntities() {
for (net.minecraft.entity.Entity entity : this.internal.loadedEntityList) {
if (!this.entityByID.containsKey(entity.getEntityId())) {
ModCore.warn("Adding entity that was not wrapped correctly %s - %s", entity.getUniqueID(), entity);
if (entity instanceof EntityPlayerMP && !this.internal.playerEntities.contains(entity)) {
// if player is no longer online then remove player from loadedEntityList
this.internal.loadedEntityList.remove(entity);
ModCore.warn("Removing entity with uuid %s from loadedEntityList", entity.getUniqueID());
return;
}
this.onEntityAdded(entity);
}
}
Expand Down