mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 19:59:36 +00:00
TIL Collection.removeIf
This commit is contained in:
2 files changed
+4
-22
No files matched your search
@@ -594,13 +594,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBoss {
|
||||
anyWithArmor = true;
|
||||
|
||||
Collection<PotionEffect> active = player.getActivePotionEffects();
|
||||
Iterator<PotionEffect> iter = active.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
PotionEffect effect = iter.next();
|
||||
if(effect.getDuration() < 200 && effect.getIsAmbient() && !effect.getPotion().isBadEffect())
|
||||
iter.remove();
|
||||
}
|
||||
active.removeIf(effect -> effect.getDuration() < 200 && effect.getIsAmbient() && !effect.getPotion().isBadEffect());
|
||||
|
||||
player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode;
|
||||
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= range) {
|
||||
|
||||
@@ -31,22 +31,10 @@ public class EntityPinkWither extends EntityWither {
|
||||
public EntityPinkWither(World world) {
|
||||
super(world);
|
||||
|
||||
Iterator<EntityAITasks.EntityAITaskEntry> taskIter = this.tasks.taskEntries.iterator();
|
||||
while (taskIter.hasNext()) {
|
||||
EntityAITasks.EntityAITaskEntry entry = taskIter.next();
|
||||
if (entry.action instanceof EntityAIAttackRanged) {
|
||||
taskIter.remove(); // Remove firing wither skulls
|
||||
}
|
||||
}
|
||||
this.tasks.taskEntries.removeIf(entry -> entry.action instanceof EntityAIAttackRanged); // Remove firing wither skulls
|
||||
|
||||
Iterator<EntityAITasks.EntityAITaskEntry> targetTaskIter = this.targetTasks.taskEntries.iterator();
|
||||
while (targetTaskIter.hasNext()) {
|
||||
EntityAITasks.EntityAITaskEntry entry = targetTaskIter.next();
|
||||
if (entry.action instanceof EntityAIHurtByTarget
|
||||
|| entry.action instanceof EntityAINearestAttackableTarget) {
|
||||
targetTaskIter.remove(); // Remove revenge and aggro
|
||||
}
|
||||
}
|
||||
this.targetTasks.taskEntries.removeIf(entry -> entry.action instanceof EntityAIHurtByTarget
|
||||
|| entry.action instanceof EntityAINearestAttackableTarget); // Remove revenge and aggro
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user