Merge pull request #588 from StijnSimons/master

I forgot players and items were entities too
This commit is contained in:
Leijurv 2019-07-19 17:06:48 -07:00 committed by GitHub
commit 93a090c56e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ReportedException;
@ -421,7 +422,7 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener
Optional<Entity> toFollow = Optional.empty();
for (Entity entity : ctx.world().loadedEntityList) {
String entityName = entity.getName().trim().toLowerCase();
if (entityName.contains(name) || name.contains(entityName)) {
if ((entityName.contains(name) || name.contains(entityName)) && !(entity instanceof EntityItem || entity instanceof EntityPlayer)) { // We dont want it following players while `#follow` exists.
toFollow = Optional.of(entity);
}
}