mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +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
@@ -18,10 +18,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public final class TransporterUtils {
|
||||
|
||||
public static List<EnumColor> colors = Arrays
|
||||
.asList(EnumColor.DARK_BLUE, EnumColor.DARK_GREEN, EnumColor.DARK_AQUA, EnumColor.DARK_RED, EnumColor.PURPLE,
|
||||
EnumColor.INDIGO, EnumColor.BRIGHT_GREEN, EnumColor.AQUA, EnumColor.RED, EnumColor.PINK,
|
||||
EnumColor.YELLOW, EnumColor.BLACK);
|
||||
public static List<EnumColor> colors = Arrays.asList(EnumColor.DARK_BLUE, EnumColor.DARK_GREEN, EnumColor.DARK_AQUA, EnumColor.DARK_RED, EnumColor.PURPLE,
|
||||
EnumColor.INDIGO, EnumColor.BRIGHT_GREEN, EnumColor.AQUA, EnumColor.RED, EnumColor.PINK, EnumColor.YELLOW, EnumColor.BLACK);
|
||||
|
||||
public static boolean isValidAcceptorOnSide(TileEntity tile, EnumFacing side) {
|
||||
if (CapabilityUtils.hasCapability(tile, Capabilities.GRID_TRANSMITTER_CAPABILITY, side.getOpposite())) {
|
||||
@@ -30,13 +28,11 @@ public final class TransporterUtils {
|
||||
return InventoryUtils.isItemHandler(tile, side.getOpposite());
|
||||
}
|
||||
|
||||
public static TransitResponse insert(TileEntity outputter, ILogisticalTransporter transporter,
|
||||
TransitRequest request, EnumColor color, boolean doEmit, int min) {
|
||||
public static TransitResponse insert(TileEntity outputter, ILogisticalTransporter transporter, TransitRequest request, EnumColor color, boolean doEmit, int min) {
|
||||
return transporter.insert(Coord4D.get(outputter), request, color, doEmit, min);
|
||||
}
|
||||
|
||||
public static TransitResponse insertRR(TileEntityLogisticalSorter outputter, ILogisticalTransporter transporter,
|
||||
TransitRequest request, EnumColor color, boolean doEmit, int min) {
|
||||
public static TransitResponse insertRR(TileEntityLogisticalSorter outputter, ILogisticalTransporter transporter, TransitRequest request, EnumColor color, boolean doEmit, int min) {
|
||||
return transporter.insertRR(outputter, request, color, doEmit, min);
|
||||
}
|
||||
|
||||
@@ -46,7 +42,6 @@ public final class TransporterUtils {
|
||||
} else if (colors.indexOf(color) == colors.size() - 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return colors.get(colors.indexOf(color) + 1);
|
||||
}
|
||||
|
||||
@@ -56,30 +51,24 @@ public final class TransporterUtils {
|
||||
} else if (colors.indexOf(color) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return colors.get(colors.indexOf(color) - 1);
|
||||
}
|
||||
|
||||
public static void drop(ILogisticalTransporter tileEntity, TransporterStack stack) {
|
||||
float[] pos;
|
||||
|
||||
if (stack.hasPath()) {
|
||||
pos = TransporterUtils.getStackPosition(tileEntity, stack, 0);
|
||||
} else {
|
||||
pos = new float[]{0, 0, 0};
|
||||
}
|
||||
|
||||
TransporterManager.remove(stack);
|
||||
BlockPos blockPos = new BlockPos(tileEntity.coord().x + pos[0], tileEntity.coord().y + pos[1],
|
||||
tileEntity.coord().z + pos[2]);
|
||||
BlockPos blockPos = new BlockPos(tileEntity.coord().x + pos[0], tileEntity.coord().y + pos[1], tileEntity.coord().z + pos[2]);
|
||||
Block.spawnAsEntity(tileEntity.world(), blockPos, stack.itemStack);
|
||||
}
|
||||
|
||||
public static float[] getStackPosition(ILogisticalTransporter tileEntity, TransporterStack stack, float partial) {
|
||||
Coord4D offset = new Coord4D(0, 0, 0, tileEntity.world().provider.getDimension())
|
||||
.offset(stack.getSide(tileEntity));
|
||||
Coord4D offset = new Coord4D(0, 0, 0, tileEntity.world().provider.getDimension()).offset(stack.getSide(tileEntity));
|
||||
float progress = (((float) stack.progress + partial) / 100F) - 0.5F;
|
||||
|
||||
return new float[]{0.5F + offset.x * progress, 0.25F + offset.y * progress, 0.5F + offset.z * progress};
|
||||
}
|
||||
|
||||
@@ -91,8 +80,7 @@ public final class TransporterUtils {
|
||||
tileEntity.setColor(null);
|
||||
return;
|
||||
}
|
||||
|
||||
int index = colors.indexOf(tileEntity.getColor());
|
||||
tileEntity.setColor(colors.get(index + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user