From bad253cd4d87a162e58e8189e41149b7db4afd30 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Mon, 7 Jul 2025 18:34:50 +0200 Subject: [PATCH] filter for EntityPlayer.class directly in the method call --- .../genetics/effect/ExtraBeesEffect.java | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/main/java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java b/src/main/java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java index 46cdcda5..3944b95d 100644 --- a/src/main/java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java +++ b/src/main/java/binnie/extrabees/genetics/effect/ExtraBeesEffect.java @@ -389,34 +389,27 @@ public enum ExtraBeesEffect implements IAlleleBeeEffect { } private void onFoodEffect(IBeeGenome genome, IBeeHousing housing) { - for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) { - if (entity instanceof EntityPlayer player) { - player.getFoodStats().addStats(2, 0.2f); - } + for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) { + player.getFoodStats().addStats(2, 0.2f); } } private void onHungerEffect(IBeeGenome genome, IBeeHousing housing, World world) { - for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) { - if (entity instanceof EntityPlayer player) { - if (world.rand.nextInt(4) < wearsItems(player)) { - continue; - } - - player.addExhaustion(4.0f); - player.addPotionEffect(new PotionEffect(Potion.hunger.id, 100)); + for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) { + if (world.rand.nextInt(4) < wearsItems(player)) { + continue; } + player.addExhaustion(4.0f); + player.addPotionEffect(new PotionEffect(Potion.hunger.id, 100)); } } private void onPotionEffect(IBeeGenome genome, IBeeHousing housing, World world, PotionEffect potion) { - for (EntityLivingBase entity : getEntities(EntityLivingBase.class, genome, housing)) { - if (entity instanceof EntityPlayer player) { - if (world.rand.nextInt(4) < wearsItems(player)) { - continue; - } - player.addPotionEffect(potion); + for (EntityPlayer player : getEntities(EntityPlayer.class, genome, housing)) { + if (world.rand.nextInt(4) < wearsItems(player)) { + continue; } + player.addPotionEffect(potion); } }