quick fix : 'while' loop replaceable with enhanced 'for' loop

This commit is contained in:
Alexdoru authored and Jason Mitchell committed 2023-01-28 18:02:41 -08:00
1 parent d6b69264b9
commit 7abe2f5182
17 files changed
+62 -111

No files matched your search

@@ -84,17 +84,15 @@ public class LaunchedPotion extends EntityThrowable {
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
if (!this.worldObj.isRemote) {
List list = Items.potionitem.getEffects(this.potionDamage);
List<PotionEffect> list = Items.potionitem.getEffects(this.potionDamage);
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D);
List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
List<EntityLivingBase> list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (list1 != null && !list1.isEmpty()) {
Iterator iterator = list1.iterator();
while (iterator.hasNext()) {
EntityLivingBase entityliving = (EntityLivingBase) iterator.next();
for (EntityLivingBase entityliving : list1) {
double d0 = this.getDistanceSqToEntity(entityliving);
if (d0 < 16.0D) {
@@ -104,10 +102,7 @@ public class LaunchedPotion extends EntityThrowable {
d1 = 1.0D;
}
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
PotionEffect potioneffect = (PotionEffect) iterator1.next();
for (PotionEffect potioneffect : list) {
int i = potioneffect.getPotionID();
if (Potion.potionTypes[i].isInstant()) {