quick fixes : enhanced for loop

This commit is contained in:
Alexdoru authored and Jason Mitchell committed 2023-01-28 18:02:41 -08:00
1 parent 59f3b5b72a
commit 83f54f1e97
33 files changed
+74 -96

No files matched your search

@@ -150,8 +150,8 @@ public class TinkerToolEvents {
private boolean allowCrafting(int head, int handle, int accessory) {
int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17};
for (int i = 0; i < nonMetals.length; i++) {
if (head == nonMetals[i] || handle == nonMetals[i] || accessory == nonMetals[i]) return false;
for (int nonMetal : nonMetals) {
if (head == nonMetal || handle == nonMetal || accessory == nonMetal) return false;
}
return true;
}
@@ -635,14 +635,14 @@ public class TinkerTools {
}
}
} else {
for (int mat = 0; mat < nonMetals.length; mat++) {
for (int nonMetal : nonMetals) {
for (int meta = 0; meta < TinkerTools.patternOutputs.length; meta++) {
if (TinkerTools.patternOutputs[meta] != null)
TConstructRegistry.addPartMapping(
TinkerTools.woodPattern,
meta + 1,
nonMetals[mat],
new ItemStack(TinkerTools.patternOutputs[meta], 1, nonMetals[mat]));
nonMetal,
new ItemStack(TinkerTools.patternOutputs[meta], 1, nonMetal));
}
}
}
@@ -186,11 +186,10 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = worldObj.getEntitiesWithinAABBExcludingEntity(
List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(
this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double d = 0.0D;
for (int j = 0; j < list.size(); j++) {
Entity entity1 = (Entity) list.get(j);
for (Entity entity1 : list) {
if (!entity1.canBeCollidedWith() || entity1 == owner && ticksInAir < 5) {
continue;
}
@@ -37,8 +37,8 @@ public class FrypanContainer extends Container {
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < crafters.size(); i++) {
ICrafting icrafting = (ICrafting) crafters.get(i);
for (Object crafter : crafters) {
ICrafting icrafting = (ICrafting) crafter;
if (progress != logic.progress) {
icrafting.sendProgressBarUpdate(this, 0, logic.progress);
}
@@ -47,8 +47,8 @@ public class FurnaceContainer extends Container {
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
for (Object crafter : this.crafters) {
ICrafting icrafting = (ICrafting) crafter;
if (this.lastCookTime != this.furnace.progress) {
icrafting.sendProgressBarUpdate(this, 0, this.furnace.progress);
@@ -36,7 +36,9 @@ public class PartCrafterChestContainer extends ActiveContainer {
new SlotOnlyTake(partLogic, 6, 218, 45),
new SlotOnlyTake(partLogic, 7, 236, 45)
};
for (int iter = 0; iter < inventory.length; iter++) this.addSlotToContainer(inventory[iter]);
for (Slot slot : inventory) {
this.addSlotToContainer(slot);
}
/* Holder inventory */
for (int column = 0; column < 5; column++) {
@@ -32,7 +32,9 @@ public class PartCrafterContainer extends ActiveContainer {
new SlotOnlyTake(partLogic, 6, 102, 45),
new SlotOnlyTake(partLogic, 7, 120, 45)
};
for (int iter = 0; iter < inventory.length; iter++) this.addSlotToContainer(inventory[iter]);
for (Slot slot : inventory) {
this.addSlotToContainer(slot);
}
/* Player inventory */
for (int column = 0; column < 3; column++) {
@@ -122,8 +122,8 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory
// we only allow renaming with a nametag otherwise
else if (!("\u00A7f" + name).equals(display.getString("Name")) && !name.equals(display.getString("Name"))) {
int nametagCount = 0;
for (int i = 0; i < inventory.length; i++)
if (inventory[i] != null && inventory[i].getItem() == Items.name_tag) nametagCount++;
for (ItemStack itemStack : inventory)
if (itemStack != null && itemStack.getItem() == Items.name_tag) nametagCount++;
doRename = nametagCount == 1;
}