Improve code readability in binnie.extratrees package

This commit is contained in:
kordum authored and mezz committed 2017-05-03 14:10:02 -07:00
1 parent adccdd181a
commit 96e4814ae3
225 files changed
+8968 -9306

No files matched your search

@@ -1,28 +1,21 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.extratrees.machines;
import java.util.HashMap;
import forestry.core.render.TankRenderInfo;
import net.minecraftforge.common.util.ForgeDirection;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import forestry.core.render.TankRenderInfo;
public class MachineRendererForestry
{
static Map<String, Object> instances;
public class MachineRendererForestry {
static Map<String, Object> instances = new HashMap<>();
static Method renderMethod;
private static void loadMethod(final String file, final boolean waterTank, final boolean productTank) {
private static void loadMethod(String file, boolean waterTank, boolean productTank) {
try {
final Class clss = Class.forName("forestry.core.render.RenderMachine");
final Object instance = clss.getConstructor(String.class).newInstance(file);
MachineRendererForestry.renderMethod = clss.getDeclaredMethod("render", TankRenderInfo.class, TankRenderInfo.class, ForgeDirection.class, Double.TYPE, Double.TYPE, Double.TYPE);
Class cls = Class.forName("forestry.core.render.RenderMachine");
Object instance = cls.getConstructor(String.class).newInstance(file);
MachineRendererForestry.renderMethod = cls.getDeclaredMethod("render", TankRenderInfo.class, TankRenderInfo.class, ForgeDirection.class, Double.TYPE, Double.TYPE, Double.TYPE);
MachineRendererForestry.renderMethod.setAccessible(true);
MachineRendererForestry.instances.put(file, instance);
} catch (Exception ex) {
@@ -30,18 +23,15 @@ public class MachineRendererForestry
}
}
public static void renderMachine(final String name, final double x, final double y, final double z, final float var8) {
public static void renderMachine(String name, double x, double y, double z, float var8) {
if (!MachineRendererForestry.instances.containsKey(name)) {
loadMethod(name, false, false);
}
try {
MachineRendererForestry.renderMethod.invoke(MachineRendererForestry.instances.get(name), TankRenderInfo.EMPTY, TankRenderInfo.EMPTY, ForgeDirection.UP, x, y, z);
} catch (Exception ex) {
// ex.printStackTrace();
}
}
static {
MachineRendererForestry.instances = new HashMap<String, Object>();
}
}