mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 06:14:41 +00:00
Formatting and code readability cleanup (#5467)
* First pass reformatting code to be more readable (common still not done) * Replace google common collect calls with Java calls where possible * Remove a bunch of unnecessary parenthesis leaving clarifying ones * Add some missing @Nonnull annotations * Fix checking wrong type * Remove unnecessary continue/return statements and simplify comparision check * Pass exception instead of directly printing stack trace * Work on cleaning up common, through config so far * Work on cleaning up common, through integration so far * Work on cleaning up common, through network so far * Work on cleaning up common, through tier so far * Remove empty constructors that get created by default anyways * Work on cleaning up common, through transmitters so far * Work on cleaning up common, through utils so far * Finish cleaning up spacing for common
This commit is contained in:
1 parent
91ef2a5c3d
commit
0d4b50908f
909 files changed
+6234
-15623
No files matched your search
@@ -8,7 +8,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
public class Range4D {
|
||||
|
||||
public int dimensionId;
|
||||
|
||||
public int xMin;
|
||||
public int yMin;
|
||||
public int zMin;
|
||||
@@ -23,7 +22,6 @@ public class Range4D {
|
||||
xMax = maxX;
|
||||
yMax = maxY;
|
||||
zMax = maxZ;
|
||||
|
||||
dimensionId = dimension;
|
||||
}
|
||||
|
||||
@@ -34,7 +32,6 @@ public class Range4D {
|
||||
xMax = xMin + 16;
|
||||
yMax = 255;
|
||||
zMax = zMin + 16;
|
||||
|
||||
dimensionId = chunk.dimensionId;
|
||||
}
|
||||
|
||||
@@ -42,17 +39,14 @@ public class Range4D {
|
||||
xMin = coord.x;
|
||||
yMin = coord.y;
|
||||
zMin = coord.z;
|
||||
|
||||
xMax = coord.x + 1;
|
||||
yMax = coord.y + 1;
|
||||
zMax = coord.z + 1;
|
||||
|
||||
dimensionId = coord.dimensionId;
|
||||
}
|
||||
|
||||
public static Range4D getChunkRange(EntityPlayer player) {
|
||||
int radius = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getViewDistance();
|
||||
|
||||
return new Range4D(new Chunk3D(player)).expandChunks(radius);
|
||||
}
|
||||
|
||||
@@ -61,7 +55,6 @@ public class Range4D {
|
||||
xMax += chunks * 16;
|
||||
zMin -= chunks * 16;
|
||||
zMax += chunks * 16;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -70,26 +63,22 @@ public class Range4D {
|
||||
xMax += radius;
|
||||
zMin -= radius;
|
||||
zMax += radius;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Set<Chunk3D> getIntersectingChunks() {
|
||||
Set<Chunk3D> set = new HashSet<>();
|
||||
|
||||
for (int chunkX = xMin >> 4; chunkX <= xMax - 1 >> 4; chunkX++) {
|
||||
for (int chunkZ = zMin >> 4; chunkZ <= zMax - 1 >> 4; chunkZ++) {
|
||||
set.add(new Chunk3D(chunkX, chunkZ, dimensionId));
|
||||
}
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
public boolean intersects(Range4D range) {
|
||||
return (xMax + 1 - 1.E-05D > range.xMin) && (range.xMax + 1 - 1.E-05D > xMin) && (yMax + 1 - 1.E-05D
|
||||
> range.yMin) && (range.yMax + 1 - 1.E-05D > yMin) && (zMax + 1 - 1.E-05D > range.zMin) && (
|
||||
range.zMax + 1 - 1.E-05D > zMin);
|
||||
return (xMax + 1 - 1.E-05D > range.xMin) && (range.xMax + 1 - 1.E-05D > xMin) && (yMax + 1 - 1.E-05D > range.yMin) &&
|
||||
(range.yMax + 1 - 1.E-05D > yMin) && (zMax + 1 - 1.E-05D > range.zMin) && (range.zMax + 1 - 1.E-05D > zMin);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,20 +88,19 @@ public class Range4D {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[Range4D: " + xMin + ", " + yMin + ", " + zMin + ", " + xMax + ", " + yMax + ", " + zMax + ", dim="
|
||||
+ dimensionId + "]";
|
||||
return "[Range4D: " + xMin + ", " + yMin + ", " + zMin + ", " + xMax + ", " + yMax + ", " + zMax + ", dim=" + dimensionId + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Range4D &&
|
||||
((Range4D) obj).xMin == xMin &&
|
||||
((Range4D) obj).yMin == yMin &&
|
||||
((Range4D) obj).zMin == zMin &&
|
||||
((Range4D) obj).xMax == xMax &&
|
||||
((Range4D) obj).yMax == yMax &&
|
||||
((Range4D) obj).zMax == zMax &&
|
||||
((Range4D) obj).dimensionId == dimensionId;
|
||||
((Range4D) obj).xMin == xMin &&
|
||||
((Range4D) obj).yMin == yMin &&
|
||||
((Range4D) obj).zMin == zMin &&
|
||||
((Range4D) obj).xMax == xMax &&
|
||||
((Range4D) obj).yMax == yMax &&
|
||||
((Range4D) obj).zMax == zMax &&
|
||||
((Range4D) obj).dimensionId == dimensionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,4 +115,4 @@ public class Range4D {
|
||||
code = 31 * code + dimensionId;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user