Patched battery side render

This commit is contained in:
Calclavia 2014-06-20 17:48:22 -07:00
parent e752bd9ccc
commit 91f402b18f
2 changed files with 214 additions and 187 deletions

View file

@ -5,6 +5,7 @@ package resonantinduction.electrical.battery;
import static org.lwjgl.opengl.GL11.glPopMatrix; import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix; import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -21,14 +22,16 @@ import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer; import resonant.api.items.ISimpleItemRenderer;
import resonant.lib.render.RenderUtility; import resonant.lib.render.RenderUtility;
import resonant.lib.utility.WorldUtility;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
/** /**
* @author Calclavia * TODO: Make this more efficient.
* *
* @author Calclavia
*/ */
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleItemRenderer public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleItemRenderer
@ -83,8 +86,8 @@ public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleI
int energyLevel = (int) Math.round(((double) tile.getEnergyHandler().getEnergy() / (double) TileBattery.getEnergyForTier(tile.getBlockMetadata())) * 8); int energyLevel = (int) Math.round(((double) tile.getEnergyHandler().getEnergy() / (double) TileBattery.getEnergyForTier(tile.getBlockMetadata())) * 8);
RenderUtility.bind(Reference.DOMAIN, Reference.MODEL_PATH + "battery/battery.png"); RenderUtility.bind(Reference.DOMAIN, Reference.MODEL_PATH + "battery/battery.png");
List<String> disabledParts = new ArrayList<String>(); List<String> disabledParts = new ArrayList();
List<String> enabledParts = new ArrayList<String>(); List<String> enabledParts = new ArrayList();
for (ForgeDirection check : ForgeDirection.VALID_DIRECTIONS) for (ForgeDirection check : ForgeDirection.VALID_DIRECTIONS)
{ {
@ -128,6 +131,24 @@ public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleI
{ {
GL11.glPushMatrix(); GL11.glPushMatrix();
RenderUtility.rotateBlockBasedOnDirection(check); RenderUtility.rotateBlockBasedOnDirection(check);
//TODO: Fix this horrible patch.
switch (check)
{
case NORTH:
glRotatef(0, 0, 1, 0);
break;
case SOUTH:
glRotatef(0, 0, 1, 0);
break;
case WEST:
glRotatef(-180, 0, 1, 0);
break;
case EAST:
glRotatef(180, 0, 1, 0);
break;
}
GL11.glRotatef(-90, 0, 1, 0); GL11.glRotatef(-90, 0, 1, 0);
int io = tile.getIO(check); int io = tile.getIO(check);

View file

@ -21,12 +21,16 @@ import resonantinduction.mechanical.energy.grid.MechanicalNode;
import resonantinduction.mechanical.energy.grid.TileMechanical; import resonantinduction.mechanical.energy.grid.TileMechanical;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
/** @author Calclavia */ /**
* @author Calclavia
*/
public class TileGrindingWheel extends TileMechanical implements IRotatable public class TileGrindingWheel extends TileMechanical implements IRotatable
{ {
public static final int PROCESS_TIME = 20 * 20; public static final int PROCESS_TIME = 20 * 20;
/** A map of ItemStacks and their remaining grind-time left. */ /**
public static final Timer<EntityItem> timer = new Timer<EntityItem>(); * A map of ItemStacks and their remaining grind-time left.
*/
public static final Timer<EntityItem> timer = new Timer();
public EntityItem grindingItem = null; public EntityItem grindingItem = null;
@ -114,9 +118,11 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
} }
} }
/** Can this machine work this tick? /**
* Can this machine work this tick?
* *
* @return */ * @return
*/
public boolean canWork() public boolean canWork()
{ {
return counter >= requiredTorque; return counter >= requiredTorque;