mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 04:06:43 -04:00
fixed somewhat item rendering
This commit is contained in:
parent
b39e550e15
commit
092fea907d
@ -1,7 +1,7 @@
|
|||||||
package li.cil.oc.client
|
package li.cil.oc.client
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.{RenderingRegistry, ClientRegistry}
|
import cpw.mods.fml.client.registry.{RenderingRegistry, ClientRegistry}
|
||||||
import cpw.mods.fml.common.event.{FMLPostInitializationEvent, FMLInitializationEvent}
|
import cpw.mods.fml.common.event.{FMLPreInitializationEvent, FMLPostInitializationEvent, FMLInitializationEvent}
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry
|
import cpw.mods.fml.common.network.NetworkRegistry
|
||||||
import li.cil.oc.client
|
import li.cil.oc.client
|
||||||
import li.cil.oc.client.renderer.WirelessNetworkDebugRenderer
|
import li.cil.oc.client.renderer.WirelessNetworkDebugRenderer
|
||||||
@ -33,7 +33,7 @@ private[oc] class Proxy extends CommonProxy {
|
|||||||
|
|
||||||
MinecraftForgeClient.registerItemRenderer(Items.multi, UpgradeRenderer)
|
MinecraftForgeClient.registerItemRenderer(Items.multi, UpgradeRenderer)
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(gui.Icons)
|
|
||||||
OpenComputers.channel.register(client.PacketHandler)
|
OpenComputers.channel.register(client.PacketHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,4 +45,10 @@ private[oc] class Proxy extends CommonProxy {
|
|||||||
MinecraftForge.EVENT_BUS.register(WirelessNetworkDebugRenderer)
|
MinecraftForge.EVENT_BUS.register(WirelessNetworkDebugRenderer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def preInit(e: FMLPreInitializationEvent): Unit = {
|
||||||
|
MinecraftForge.EVENT_BUS.register(gui.Icons)
|
||||||
|
super.preInit(e)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,16 +2,30 @@ package li.cil.oc.client.gui
|
|||||||
|
|
||||||
import li.cil.oc.client.Textures
|
import li.cil.oc.client.Textures
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer
|
import net.minecraft.client.gui.inventory.GuiContainer
|
||||||
import net.minecraft.client.renderer.Tessellator
|
import net.minecraft.client.renderer.{OpenGlHelper, RenderHelper, Tessellator}
|
||||||
import net.minecraft.inventory.Container
|
import net.minecraft.inventory.{Slot, Container}
|
||||||
import net.minecraft.util.StatCollector
|
import net.minecraft.util.{IIcon, EnumChatFormatting, MathHelper, StatCollector}
|
||||||
import org.lwjgl.opengl.GL11
|
import org.lwjgl.opengl.{GL12, GL11}
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.client.Minecraft
|
||||||
|
import li.cil.oc.util.RenderState
|
||||||
|
import li.cil.oc.common.container.ComponentSlot
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap
|
||||||
|
|
||||||
abstract class DynamicGuiContainer(container: Container) extends GuiContainer(container) {
|
abstract class DynamicGuiContainer(container: Container) extends GuiContainer(container) {
|
||||||
override def drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int) {
|
override def drawGuiContainerForegroundLayer(mouseX: Int, mouseY: Int) {
|
||||||
|
|
||||||
fontRendererObj.drawString(
|
fontRendererObj.drawString(
|
||||||
StatCollector.translateToLocal("container.inventory"),
|
StatCollector.translateToLocal("container.inventory"),
|
||||||
8, ySize - 96 + 2, 0x404040)
|
8, ySize - 96 + 2, 0x404040)
|
||||||
|
for (i1 <- 0 until inventorySlots.inventorySlots.size()) {
|
||||||
|
val slot: Slot = inventorySlots.inventorySlots.get(i1).asInstanceOf[Slot]
|
||||||
|
this.drawSlotInventory(slot, mouseX, mouseY)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def drawGuiContainerBackgroundLayer(dt: Float, mouseX: Int, mouseY: Int) {
|
override def drawGuiContainerBackgroundLayer(dt: Float, mouseX: Int, mouseY: Int) {
|
||||||
@ -21,24 +35,26 @@ abstract class DynamicGuiContainer(container: Container) extends GuiContainer(co
|
|||||||
|
|
||||||
|
|
||||||
// TODO private now?
|
// TODO private now?
|
||||||
// override def drawSlotInventory(slot: Slot) {
|
def drawSlotInventory(slot: Slot, mouseX: Int, mouseY: Int) {
|
||||||
// if (slot.slotNumber < container.inventorySlots.size() - 36) {
|
if (slot.slotNumber < container.inventorySlots.size() - 36) {
|
||||||
// GL11.glDisable(GL11.GL_LIGHTING)
|
GL11.glDisable(GL11.GL_LIGHTING)
|
||||||
// drawSlotBackground(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1)
|
drawSlotBackground(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1)
|
||||||
// GL11.glEnable(GL11.GL_LIGHTING)
|
GL11.glEnable(GL11.GL_LIGHTING)
|
||||||
// }
|
}
|
||||||
// RenderState.makeItBlend()
|
RenderState.makeItBlend()
|
||||||
// super.drawSlotInventory(slot)
|
|
||||||
// GL11.glDisable(GL11.GL_BLEND)
|
|
||||||
// if (!slot.getHasStack) slot match {
|
GL11.glDisable(GL11.GL_BLEND)
|
||||||
// case component: ComponentSlot if component.tierIcon != null =>
|
if (!slot.getHasStack) slot match {
|
||||||
// mc.getTextureManager.bindTexture(TextureMap.locationItemsTexture)
|
case component: ComponentSlot if component.tierIcon != null =>
|
||||||
// GL11.glDisable(GL11.GL_DEPTH_TEST)
|
mc.getTextureManager.bindTexture(TextureMap.locationItemsTexture)
|
||||||
// drawTexturedModelRectFromIcon(slot.xDisplayPosition, slot.yDisplayPosition, component.tierIcon, 16, 16)
|
GL11.glDisable(GL11.GL_DEPTH_TEST)
|
||||||
// GL11.glEnable(GL11.GL_DEPTH_TEST)
|
drawTexturedModelRectFromIcon(slot.xDisplayPosition, slot.yDisplayPosition, component.tierIcon, 16, 16)
|
||||||
// case _ =>
|
GL11.glEnable(GL11.GL_DEPTH_TEST)
|
||||||
// }
|
case something =>
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private def drawSlotBackground(x: Int, y: Int) {
|
private def drawSlotBackground(x: Int, y: Int) {
|
||||||
GL11.glColor4f(1, 1, 1, 1)
|
GL11.glColor4f(1, 1, 1, 1)
|
||||||
@ -51,4 +67,6 @@ abstract class DynamicGuiContainer(container: Container) extends GuiContainer(co
|
|||||||
t.addVertexWithUV(x, y, zLevel, 0, 0)
|
t.addVertexWithUV(x, y, zLevel, 0, 0)
|
||||||
t.draw()
|
t.draw()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ object Icons {
|
|||||||
private val byTier = mutable.Map.empty[Int, IIcon]
|
private val byTier = mutable.Map.empty[Int, IIcon]
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
def onItemIconRegister(e: TextureStitchEvent.Pre) {
|
def onItemIconRegister(e: TextureStitchEvent) {
|
||||||
val iconRegister = e.map
|
val iconRegister = e.map
|
||||||
if (iconRegister.getTextureType == 1) {
|
if (iconRegister.getTextureType == 1) {
|
||||||
bySlotType += Slot.Card -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_card")
|
bySlotType += Slot.Card -> iconRegister.registerIcon(Settings.resourceDomain + ":icon_card")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user