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:
Richard Freimer authored and GitHub committed 2019-05-11 14:13:24 -04:00
1 parent 91ef2a5c3d
commit 0d4b50908f
909 files changed
+6234 -15623

No files matched your search

@@ -1,6 +1,7 @@
package mekanism.client.render.tileentity;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.MekanismRenderer;
@@ -32,7 +33,7 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
private Minecraft mc = FMLClientHandler.instance().getClient();
private HashMap<EnumFacing, HashMap<TransmissionType, DisplayInteger>> cachedOverlays = new HashMap<>();
private Map<EnumFacing, Map<TransmissionType, DisplayInteger>> cachedOverlays = new HashMap<>();
public RenderConfigurableMachine() {
rendererDispatcher = TileEntityRendererDispatcher.instance;
@@ -47,16 +48,14 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
RayTraceResult pos = player.rayTrace(8.0D, 1.0F);
Item item = itemStack.getItem();
if (pos != null && !itemStack.isEmpty() && item instanceof ItemConfigurator
&& ((ItemConfigurator) item).getState(itemStack).isConfigurating()) {
if (pos != null && !itemStack.isEmpty() && item instanceof ItemConfigurator && ((ItemConfigurator) item).getState(itemStack).isConfigurating()) {
BlockPos bp = pos.getBlockPos();
TransmissionType type = Objects.requireNonNull(((ItemConfigurator) item).getState(itemStack).getTransmission(), "Configurating state requires transmission type");
if (configurable.getConfig().supports(type)) {
if (bp.equals(configurable.getPos())) {
SideData data = configurable.getConfig()
.getOutput(type, pos.sideHit, configurable.getOrientation());
SideData data = configurable.getConfig().getOutput(type, pos.sideHit, configurable.getOrientation());
if (data != TileComponentConfig.EMPTY) {
push();
@@ -110,7 +109,7 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
if (cachedOverlays.containsKey(side)) {
cachedOverlays.get(side).put(type, display);
} else {
HashMap<TransmissionType, DisplayInteger> map = new HashMap<>();
Map<TransmissionType, DisplayInteger> map = new HashMap<>();
map.put(type, display);
cachedOverlays.put(side, map);
}
@@ -183,4 +182,4 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
return display;
}
}
}