diff --git a/src/main/scala/resonantinduction/core/ClientProxy.scala b/src/main/scala/resonantinduction/core/ClientProxy.scala index f7082c78c..f52aefba4 100644 --- a/src/main/scala/resonantinduction/core/ClientProxy.scala +++ b/src/main/scala/resonantinduction/core/ClientProxy.scala @@ -35,7 +35,7 @@ import resonantinduction.electrical.tesla.{RenderTesla, TileTesla} import resonantinduction.electrical.transformer.RenderTransformer import resonantinduction.mechanical.MechanicalContent import resonantinduction.mechanical.fluid.pipe.RenderPipe -import resonantinduction.mechanical.fluid.transport.{RenderPump, TilePump} +import resonantinduction.mechanical.fluid.transport.TilePump import resonantinduction.mechanical.mech.gear.RenderGear import resonantinduction.mechanical.mech.gearshaft.RenderGearShaft import resonantinduction.mechanical.mech.process.crusher.{RenderMechanicalPiston, TileMechanicalPiston} @@ -63,7 +63,6 @@ import resonantinduction.mechanical.mech.turbine._ ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileWaterTurbine], new RenderWaterTurbine) ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileWindTurbine], new RenderWindTurbine) ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileElectricTurbine], new RenderElectricTurbine) - ClientRegistry.bindTileEntitySpecialRenderer(classOf[TilePump], new RenderPump) //Electrical content ItemRenderHandler.register(ElectricalContent.itemTransformer, RenderTransformer.INSTANCE) diff --git a/src/main/scala/resonantinduction/mechanical/fluid/transport/RenderPump.scala b/src/main/scala/resonantinduction/mechanical/fluid/transport/RenderPump.scala deleted file mode 100644 index b1828b04f..000000000 --- a/src/main/scala/resonantinduction/mechanical/fluid/transport/RenderPump.scala +++ /dev/null @@ -1,46 +0,0 @@ -package resonantinduction.mechanical.fluid.transport - -import java.util.{ArrayList, List} - -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer -import net.minecraft.tileentity.TileEntity -import net.minecraft.util.ResourceLocation -import net.minecraftforge.client.model.{AdvancedModelLoader, IModelCustom} -import org.lwjgl.opengl.GL11 -import resonant.lib.render.RenderUtility -import resonantinduction.core.Reference - -object RenderPump -{ - final val MODEL: IModelCustom = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "pump.tcn")) - final val TEXTURE: ResourceLocation = new ResourceLocation(Reference.domain, Reference.modelPath + "pump.png") -} - -class RenderPump extends TileEntitySpecialRenderer -{ - def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float) - { - val tile: TilePump = tileEntity.asInstanceOf[TilePump] - GL11.glPushMatrix - GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5) - GL11.glRotatef(-90, 0, 1, 0) - if (tile.getWorldObj != null) RenderUtility.rotateBlockBasedOnDirection(tile.getDirection) - bindTexture(RenderPump.TEXTURE) - val notRendered: List[String] = new ArrayList[String] - GL11.glPushMatrix - GL11.glRotated(Math.toDegrees(tile.mechanicalNode.renderAngle.asInstanceOf[Float]), 0, 0, 1) - - for (i <- 1 to 12) - { - val fin: String = "fin" + i - val innerFin: String = "innerFin" + i - notRendered.add(fin) - notRendered.add(innerFin) - RenderPump.MODEL.renderOnly(fin, innerFin) - - } - GL11.glPopMatrix - RenderPump.MODEL.renderAllExcept(notRendered.toArray(new Array[String](0)): _*) - GL11.glPopMatrix - } -} \ No newline at end of file diff --git a/src/main/scala/resonantinduction/mechanical/fluid/transport/TilePump.scala b/src/main/scala/resonantinduction/mechanical/fluid/transport/TilePump.scala index 38d8a29a1..7c299c199 100644 --- a/src/main/scala/resonantinduction/mechanical/fluid/transport/TilePump.scala +++ b/src/main/scala/resonantinduction/mechanical/fluid/transport/TilePump.scala @@ -1,21 +1,36 @@ package resonantinduction.mechanical.fluid.transport +import java.util.{ArrayList, List} + import net.minecraft.block.material.Material import net.minecraft.tileentity.TileEntity +import net.minecraft.util.ResourceLocation +import net.minecraftforge.client.model.AdvancedModelLoader import net.minecraftforge.common.util.ForgeDirection import net.minecraftforge.fluids.{Fluid, FluidStack, FluidTankInfo, IFluidHandler} +import org.lwjgl.opengl.GL11 import resonant.api.IRotatable import resonant.api.grid.INode +import resonant.lib.render.RenderUtility +import resonant.lib.transform.vector.Vector3 +import resonantinduction.core.Reference import resonantinduction.mechanical.mech.TileMechanical +import scala.collection.mutable + +object TilePump +{ + val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "pump.tcn")) + val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "pump.png") +} + class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluidHandler { var pressureNode: PumpNode = null //Constructor - normalRender(false) - isOpaqueCube(false) - customItemRender(true) + normalRender = false + isOpaqueCube = false setTextureName("material_steel") pressureNode = new PumpNode(this) @@ -48,6 +63,32 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid } } + override def renderDynamic(pos: Vector3, frame: Float, pass: Int): Unit = + { + GL11.glPushMatrix() + GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5) + GL11.glRotatef(-90, 0, 1, 0) + if (tile.getWorldObj != null) RenderUtility.rotateBlockBasedOnDirection(getDirection) + RenderUtility.bind(TilePump.texture) + val notRendered = mutable.Set.empty[String] + + GL11.glPushMatrix + GL11.glRotated(Math.toDegrees(mechanicalNode.renderAngle.asInstanceOf[Float]), 0, 0, 1) + + for (i <- 1 to 12) + { + val fin: String = "fin" + i + val innerFin: String = "innerFin" + i + notRendered.add(fin) + notRendered.add(innerFin) + TilePump.model.renderOnly(fin, innerFin) + } + + GL11.glPopMatrix() + TilePump.model.renderAllExcept(notRendered.toArray[String]: _*) + GL11.glPopMatrix() + } + def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int = { if (from eq getDirection.getOpposite) @@ -90,13 +131,4 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid return null.asInstanceOf[N] } - - override def getDirection: ForgeDirection = - { - return null - } - - override def setDirection(direction: ForgeDirection) - { - } } \ No newline at end of file