From 15e169a120af33dc1a027b030d02c2e5dc7d5d4a Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Sat, 21 Sep 2013 17:00:37 -0400 Subject: [PATCH] Archive crane render & model classes Since i don't plan to work on the crane right now i'll archive all the model & renderers for later use. --- .../model => archive}/ModelCraneArmMount.java | 0 .../ModelCraneController.java | 0 .../model => archive}/ModelCraneRail.java | 0 .../model => archive}/ModelDropBox.java | 0 .../model => archive}/ModelLaserDrill.java | 0 archive/RenderCraneController.java | 71 +++++++++++++++++++ archive/RenderCraneFrame.java | 60 ++++++++++++++++ 7 files changed, 131 insertions(+) rename {src/minecraft/dark/assembly/client/model => archive}/ModelCraneArmMount.java (100%) rename {src/minecraft/dark/assembly/client/model => archive}/ModelCraneController.java (100%) rename {src/minecraft/dark/assembly/client/model => archive}/ModelCraneRail.java (100%) rename {src/minecraft/dark/assembly/client/model => archive}/ModelDropBox.java (100%) rename {src/minecraft/dark/assembly/client/model => archive}/ModelLaserDrill.java (100%) create mode 100644 archive/RenderCraneController.java create mode 100644 archive/RenderCraneFrame.java diff --git a/src/minecraft/dark/assembly/client/model/ModelCraneArmMount.java b/archive/ModelCraneArmMount.java similarity index 100% rename from src/minecraft/dark/assembly/client/model/ModelCraneArmMount.java rename to archive/ModelCraneArmMount.java diff --git a/src/minecraft/dark/assembly/client/model/ModelCraneController.java b/archive/ModelCraneController.java similarity index 100% rename from src/minecraft/dark/assembly/client/model/ModelCraneController.java rename to archive/ModelCraneController.java diff --git a/src/minecraft/dark/assembly/client/model/ModelCraneRail.java b/archive/ModelCraneRail.java similarity index 100% rename from src/minecraft/dark/assembly/client/model/ModelCraneRail.java rename to archive/ModelCraneRail.java diff --git a/src/minecraft/dark/assembly/client/model/ModelDropBox.java b/archive/ModelDropBox.java similarity index 100% rename from src/minecraft/dark/assembly/client/model/ModelDropBox.java rename to archive/ModelDropBox.java diff --git a/src/minecraft/dark/assembly/client/model/ModelLaserDrill.java b/archive/ModelLaserDrill.java similarity index 100% rename from src/minecraft/dark/assembly/client/model/ModelLaserDrill.java rename to archive/ModelLaserDrill.java diff --git a/archive/RenderCraneController.java b/archive/RenderCraneController.java new file mode 100644 index 000000000..d8292f735 --- /dev/null +++ b/archive/RenderCraneController.java @@ -0,0 +1,71 @@ +package dark.assembly.client.render; + +import static org.lwjgl.opengl.GL11.GL_LIGHTING; +import static org.lwjgl.opengl.GL11.glEnable; +import static org.lwjgl.opengl.GL11.glPopMatrix; +import static org.lwjgl.opengl.GL11.glPushMatrix; +import static org.lwjgl.opengl.GL11.glRotatef; +import static org.lwjgl.opengl.GL11.glTranslated; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.ForgeDirection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import dark.assembly.client.model.ModelCraneController; +import dark.assembly.common.AssemblyLine; +import dark.assembly.common.machine.crane.CraneHelper; +import dark.assembly.common.machine.crane.TileEntityCraneController; +import dark.core.prefab.ModPrefab; + +@SideOnly(Side.CLIENT) +public class RenderCraneController extends RenderImprintable +{ + public static final String TEXTURE = "crane_controller_off.png"; + public static final String TEXTURE_VALID = "crane_controller_on.png"; + public static final ModelCraneController MODEL = new ModelCraneController(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) + { + if (tileEntity != null && tileEntity instanceof TileEntityCraneController) + { + ResourceLocation name = new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + (((TileEntityCraneController) tileEntity).isCraneValid() ? TEXTURE_VALID : TEXTURE)); + func_110628_a(name); + ForgeDirection front = ForgeDirection.getOrientation(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord)); + ForgeDirection right = CraneHelper.rotateClockwise(front); + float angle = 0f; + switch (front) + { + case NORTH: + { + angle = 90f; + break; + } + case SOUTH: + { + angle = 270f; + break; + } + case EAST: + { + angle = 180f; + break; + } + } + int tX, tY, tZ; + tX = tileEntity.xCoord; + tY = tileEntity.yCoord; + tZ = tileEntity.zCoord; + boolean connectFront = CraneHelper.canFrameConnectTo(tileEntity, tX + front.offsetX, tY, tZ + front.offsetZ, front.getOpposite()); + boolean connectRight = CraneHelper.canFrameConnectTo(tileEntity, tX + right.offsetX, tY, tZ + right.offsetZ, right.getOpposite()); + glPushMatrix(); + glTranslated(x + 0.5, y + 1.5, z + 0.5); + glRotatef(180f, 0f, 0f, 1f); + glRotatef(angle, 0f, 1f, 0f); + glEnable(GL_LIGHTING); + MODEL.render(0.0625f, connectRight, connectFront); + glPopMatrix(); + } + } + +} \ No newline at end of file diff --git a/archive/RenderCraneFrame.java b/archive/RenderCraneFrame.java new file mode 100644 index 000000000..898722bab --- /dev/null +++ b/archive/RenderCraneFrame.java @@ -0,0 +1,60 @@ +package dark.assembly.client.render; + +import static org.lwjgl.opengl.GL11.GL_LIGHTING; +import static org.lwjgl.opengl.GL11.glEnable; +import static org.lwjgl.opengl.GL11.glPopMatrix; +import static org.lwjgl.opengl.GL11.glPushMatrix; +import static org.lwjgl.opengl.GL11.glRotatef; +import static org.lwjgl.opengl.GL11.glTranslated; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.ForgeDirection; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import dark.assembly.client.model.ModelCraneRail; +import dark.assembly.common.AssemblyLine; +import dark.assembly.common.machine.crane.CraneHelper; +import dark.assembly.common.machine.crane.TileEntityCraneRail; +import dark.core.prefab.ModPrefab; + +@SideOnly(Side.CLIENT) +public class RenderCraneFrame extends TileEntitySpecialRenderer +{ + public static final String TEXTURE = "crane_frame.png"; + public static final ModelCraneRail MODEL = new ModelCraneRail(); + + @Override + public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) + { + if (tileEntity != null && tileEntity instanceof TileEntityCraneRail) + { + int tX, tY, tZ; + tX = tileEntity.xCoord; + tY = tileEntity.yCoord; + tZ = tileEntity.zCoord; + boolean renderUp = CraneHelper.canFrameConnectTo(tileEntity, tX, tY + 1, tZ, ForgeDirection.DOWN); + boolean renderDown = CraneHelper.canFrameConnectTo(tileEntity, tX, tY - 1, tZ, ForgeDirection.UP); + // EAST, X- + boolean renderLeft = CraneHelper.canFrameConnectTo(tileEntity, tX - 1, tY, tZ, ForgeDirection.EAST); + // WAST, X+ + boolean renderRight = CraneHelper.canFrameConnectTo(tileEntity, tX + 1, tY, tZ, ForgeDirection.WEST); + // SOUTH, Z- + boolean renderFront = CraneHelper.canFrameConnectTo(tileEntity, tX, tY, tZ - 1, ForgeDirection.SOUTH); + // NORTH, Z+ + boolean renderBack = CraneHelper.canFrameConnectTo(tileEntity, tX, tY, tZ + 1, ForgeDirection.NORTH); + boolean renderFoot = tileEntity.worldObj.isBlockSolidOnSide(tX, tY - 1, tZ, ForgeDirection.UP); + if ((renderLeft && renderRight) || (renderFront && renderBack)) + renderFoot = false; + ResourceLocation name = new ResourceLocation(AssemblyLine.instance.DOMAIN, ModPrefab.MODEL_DIRECTORY + TEXTURE); + func_110628_a(name); + glPushMatrix(); + glTranslated(x + 0.5, y + 1.5, z + 0.5); + glRotatef(180f, 0f, 0f, 1f); + glEnable(GL_LIGHTING); + MODEL.render(renderUp, renderDown && !renderFoot, renderLeft, renderRight, renderFront, renderBack, renderFoot); + glPopMatrix(); + } + } + +}