mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
cleanup; fixed keyboards not being rendered when there's a block in front of them
This commit is contained in:
parent
ec1d708b56
commit
33583dd52d
@ -1,7 +1,6 @@
|
||||
package li.cil.oc
|
||||
|
||||
import java.io.File
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry
|
||||
import li.cil.oc.util.ExtendedConfiguration._
|
||||
import li.cil.oc.util.PackedColor
|
||||
|
||||
|
@ -27,8 +27,6 @@ private[oc] class Proxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.PowerDistributor], PowerDistributorRenderer)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.RobotProxy], RobotRenderer)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.Screen], ScreenRenderer)
|
||||
//ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.Keyboard], KeyboardRenderer)
|
||||
// RenderingRegistry.registerBlockHandler()
|
||||
TickRegistry.registerTickHandler(ScreenRenderer, Side.CLIENT)
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(gui.Icons)
|
||||
|
@ -3,14 +3,13 @@ package li.cil.oc.client.renderer.block
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler
|
||||
import li.cil.oc.client.renderer.tileentity.{CableRenderer, RobotRenderer}
|
||||
import li.cil.oc.common.block.{RobotProxy, Keyboard, Cable, Delegator}
|
||||
import li.cil.oc.common.tileentity
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.client.renderer.{Tessellator, RenderBlocks}
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.world.IBlockAccess
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import org.lwjgl.opengl.GL11
|
||||
import li.cil.oc.common.tileentity
|
||||
|
||||
|
||||
object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
var getRenderId = -1
|
||||
@ -54,7 +53,6 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
def renderWorldBlock(world: IBlockAccess, x: Int, y: Int, z: Int, block: Block, modelId: Int, renderer: RenderBlocks) = {
|
||||
|
||||
Delegator.subBlock(block, world.getBlockMetadata(x, y, z)) match {
|
||||
case Some(keyboard: Keyboard) =>
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
@ -77,10 +75,9 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
case _ =>
|
||||
|
||||
}
|
||||
if (teK.facing == ForgeDirection.DOWN) {
|
||||
if (teK.facing == ForgeDirection.DOWN) {
|
||||
renderer.flipTexture = true
|
||||
}
|
||||
//
|
||||
}
|
||||
val ret = renderer.renderStandardBlock(block, x, y, z)
|
||||
renderer.uvRotateTop = 0
|
||||
@ -92,6 +89,5 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
}
|
||||
case _ => renderer.renderStandardBlock(block, x, y, z)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,106 +0,0 @@
|
||||
package li.cil.oc.client.renderer.tileentity
|
||||
|
||||
import net.minecraft.util.ResourceLocation
|
||||
import li.cil.oc.Config
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.{RenderBlocks, Tessellator}
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.world.IBlockAccess
|
||||
|
||||
|
||||
//object KeyboardRenderer extends ISimpleBlockRenderingHandler {
|
||||
//
|
||||
// private val frontOn = new ResourceLocation(Config.resourceDomain, "textures/blocks/computer_front.png")
|
||||
//
|
||||
// override def renderInventoryBlock(block: Block, metadata: Int, modelID: Int, renderer: RenderBlocks) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override def renderWorldBlock(world: IBlockAccess, x: Int, y: Int, z: Int, block: Block, modelId: Int, renderer: RenderBlocks): Boolean = {
|
||||
////
|
||||
////
|
||||
//// // dont create them here, create them in your constructor and save a reference as a member variable please
|
||||
//// val tessellator = Tessellator.instance;
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
//// if (this.hasOverrideBlockTexture) {
|
||||
//// icon = this.overrideBlockTexture
|
||||
//// }
|
||||
////
|
||||
////
|
||||
////
|
||||
//// val d5: Double = icon.getMinU.asInstanceOf[Double]
|
||||
//// val d6: Double = icon.getMinV.asInstanceOf[Double]
|
||||
//// val d7: Double = icon.getMaxU.asInstanceOf[Double]
|
||||
//// val d8: Double = icon.getMaxV.asInstanceOf[Double]
|
||||
//// val d9: Double = icon.getInterpolatedU(7.0D).asInstanceOf[Double]
|
||||
//// val d10: Double = icon.getInterpolatedV(6.0D).asInstanceOf[Double]
|
||||
//// val d11: Double = icon.getInterpolatedU(9.0D).asInstanceOf[Double]
|
||||
//// val d12: Double = icon.getInterpolatedV(8.0D).asInstanceOf[Double]
|
||||
//// val d13: Double = icon.getInterpolatedU(7.0D).asInstanceOf[Double]
|
||||
//// val d14: Double = icon.getInterpolatedV(13.0D).asInstanceOf[Double]
|
||||
//// val d15: Double = icon.getInterpolatedU(9.0D).asInstanceOf[Double]
|
||||
//// val d16: Double = icon.getInterpolatedV(15.0D).asInstanceOf[Double]
|
||||
//// tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z))
|
||||
//// tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F)
|
||||
////
|
||||
//// //+1 so that our "drawing" appears 1 block over our block (to get a better view)
|
||||
//// // tessellator.startDrawingQuads()
|
||||
//// //back
|
||||
//// tessellator.addVertexWithUV(0, 0, 0, 0, 0)
|
||||
//// tessellator.addVertexWithUV(0, 1, 0, 0, 1)
|
||||
//// tessellator.addVertexWithUV(1, 1, 0, 1, 1)
|
||||
//// tessellator.addVertexWithUV(1, 0, 0, 1, 0)
|
||||
////
|
||||
////
|
||||
//// //front
|
||||
//// tessellator.addVertexWithUV(0, 0, 0.5, 0, 0)
|
||||
//// tessellator.addVertexWithUV(1, 0, 0.5, 1, 0)
|
||||
//// tessellator.addVertexWithUV(1, 1, 0.5, 1, 1)
|
||||
//// tessellator.addVertexWithUV(0, 1, 0.5, 0, 1)
|
||||
////
|
||||
//// //top
|
||||
//// tessellator.addVertexWithUV(0, 1, 0.5, 0, 0)
|
||||
//// tessellator.addVertexWithUV(1, 1, 0.5, 1, 0)
|
||||
//// tessellator.addVertexWithUV(1, 1, 0, 1, 1)
|
||||
//// tessellator.addVertexWithUV(0, 1, 0, 0, 1)
|
||||
////
|
||||
//// //bottom
|
||||
//// tessellator.addVertexWithUV(0, 0, 0, 0, 1)
|
||||
//// tessellator.addVertexWithUV(1, 0, 0, 1, 1)
|
||||
//// tessellator.addVertexWithUV(1, 0, 0.5, 1, 0)
|
||||
//// tessellator.addVertexWithUV(0, 0, 0.5, 0, 0)
|
||||
////
|
||||
////
|
||||
//// //left
|
||||
//// tessellator.addVertexWithUV(0, 0, 0.5, 0, 0)
|
||||
//// tessellator.addVertexWithUV(0, 1, 0.5, 1, 0)
|
||||
//// tessellator.addVertexWithUV(0, 1, 0, 1, 1)
|
||||
//// tessellator.addVertexWithUV(0, 0, 0, 0, 1)
|
||||
////
|
||||
//// //right
|
||||
//// tessellator.addVertexWithUV(1, 0, 0.5, 0, 0)
|
||||
//// tessellator.addVertexWithUV(1, 0, 0, 0, 1)
|
||||
//// tessellator.addVertexWithUV(1, 1, 0, 1, 1)
|
||||
//// tessellator.addVertexWithUV(1, 1, 0.5, 1, 0)
|
||||
////
|
||||
////
|
||||
//// //tessellator.draw()
|
||||
////
|
||||
// true
|
||||
// }
|
||||
//
|
||||
// override def shouldRender3DInInventory = false
|
||||
//
|
||||
// def getRenderId: Int = Config.blockRenderId
|
||||
//
|
||||
//
|
||||
// def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float) = {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,15 +1,14 @@
|
||||
package li.cil.oc.common.block
|
||||
|
||||
import li.cil.oc.Config
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.common.tileentity
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import li.cil.oc.Config
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.util.Icon
|
||||
|
||||
class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
val unlocalizedName = "Keyboard"
|
||||
@ -21,7 +20,7 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
icon = iconRegister.registerIcon(Config.resourceDomain + ":keyboard")
|
||||
}
|
||||
|
||||
//override def shouldSideBeRendered(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
override def shouldSideBeRendered(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = true
|
||||
|
||||
override def hasTileEntity = true
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user