Compare commits

...
6 Commits
Author SHA1 Message Date
bdew 7c275f434a bump version 2014-08-12 13:05:52 +03:00
bdew f960050f9c Added creative tabs helper 2014-08-12 12:41:23 +03:00
bdew 87dd7c34c5 Added DataSlotOption 2014-08-12 12:41:10 +03:00
bdew 9fdc6bd880 Added connected textures renderer 2014-08-11 16:51:18 +03:00
bdew 490433a7f4 Added BlockFace, HasTE can now work with BlockRef, Fixed missing copyrights 2014-08-11 16:45:01 +03:00
bdew 71bef762a6 Added BlockRef (from pressure pipes) 2014-08-07 12:46:21 +03:00
18 changed files with 496 additions and 19 deletions

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ buildscript {
apply plugin: 'scala'
apply plugin: 'forge'
version = "1.4.1"
version = "1.4.2"
if (project.hasProperty('buildnum')) {
project.version = project.version + '.' + project.buildnum
@@ -0,0 +1,24 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.item.Item
class CreativeTabContainer {
class Tab(name: String, item: => Item) extends CreativeTabs(name) {
override def getTabIconItem = item
}
BdLib.logInfo("Loaded creative tabs for %s", Misc.getActiveModId)
def init() {}
}
+6 -1
View File
@@ -64,7 +64,7 @@ object Misc {
def filterType[T](from: Iterable[_], cls: Class[T]) = from.filter(cls.isInstance).asInstanceOf[Iterable[T]]
def getBiomeByName(name: String) = BiomeGenBase.getBiomeGenArray.find(x => x != null && x.biomeName == name).getOrElse(null)
def getBiomeByName(name: String) = BiomeGenBase.getBiomeGenArray.find(x => x != null && x.biomeName == name).orNull
def haveModVersion(spec: String): Boolean = {
val req = VersionParser.parseVersionReference(spec)
@@ -89,5 +89,10 @@ object Misc {
def getNeighbourTile[T](origin: TileEntity, dir: ForgeDirection, cls: Class[T]) =
Option(origin.getWorldObj.getTileEntity(origin.xCoord + dir.offsetX,
origin.yCoord + dir.offsetY, origin.zCoord + dir.offsetZ)) flatMap (asInstanceOpt(_, cls))
def applyMutator[T](f: (T) => Unit, init: T): T = {
f(init)
init
}
}
+22
View File
@@ -0,0 +1,22 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.block
import net.minecraftforge.common.util.ForgeDirection
case class BlockFace(x: Int, y: Int, z: Int, face: ForgeDirection) {
def origin = BlockRef(x, y, z)
def target = origin.neighbour(face)
def opposite = face.getOpposite
}
object BlockFace {
def apply(bp: BlockRef, face: ForgeDirection) = new BlockFace(bp.x, bp.y, bp.z, face)
}
+59
View File
@@ -0,0 +1,59 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.block
import net.minecraft.block.Block
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.IBlockAccess
import net.minecraftforge.common.util.ForgeDirection
import scala.reflect.ClassTag
case class BlockRef(x: Int, y: Int, z: Int) {
def block(w: IBlockAccess) = Option(w.getBlock(x, y, z))
def tile(w: IBlockAccess) = Option(w.getTileEntity(x, y, z))
def meta(w: IBlockAccess) = w.getBlockMetadata(x, y, z)
def blockIs(w: IBlockAccess, other: Block) = block(w).contains(other)
def neighbour(side: ForgeDirection) = BlockRef(x + side.offsetX, y + side.offsetY, z + side.offsetZ)
def neighbours = ForgeDirection.VALID_DIRECTIONS.map(x => x -> neighbour(x)).toMap
override def toString = "(x=%d y=%d z=%d)".format(x, y, z)
def getTile[T: ClassTag](w: IBlockAccess) = tile(w) flatMap { tile =>
val cls = implicitly[ClassTag[T]].runtimeClass
if (cls.isInstance(tile))
Some(tile.asInstanceOf[T])
else None
}
def ==(tx: Int, ty: Int, tz: Int) = x == tx && y == ty && z == tz
def getBlock[T: ClassTag](w: IBlockAccess) = block(w) flatMap { block =>
val cls = implicitly[ClassTag[T]].runtimeClass
if (cls.isInstance(block))
Some(block.asInstanceOf[T])
else None
}
def writeToNBT(tag: NBTTagCompound) {
tag.setInteger("x", x)
tag.setInteger("y", y)
tag.setInteger("z", z)
}
}
object BlockRef {
def fromTile(te: TileEntity) = BlockRef(te.xCoord, te.yCoord, te.zCoord)
def fromNBT(tag: NBTTagCompound) =
BlockRef(tag.getInteger("x"), tag.getInteger("y"), tag.getInteger("z"))
}
+3
View File
@@ -18,6 +18,9 @@ trait HasTE[T] extends Block with ITileEntityProvider {
val TEClass: Class[_ <: TileEntity]
def createNewTileEntity(world: World, meta: Int): TileEntity = TEClass.newInstance()
def getTE(w: IBlockAccess, ref: BlockRef): T = getTE(w, ref.x, ref.y, ref.z)
def getTE(w: IBlockAccess, x: Int, y: Int, z: Int): T = {
var t = w.getTileEntity(x, y, z)
if ((t == null) || !TEClass.isInstance(t)) {
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.block
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.Misc
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IIconRegister
trait NamedBlock extends Block {
def name: String
}
class SimpleBlock(val name: String, material: Material) extends Block(material) with NamedBlock {
val modId = Misc.getActiveModId
setBlockName(modId + "." + name)
@SideOnly(Side.CLIENT)
override def registerBlockIcons(reg: IIconRegister) {
blockIcon = reg.registerIcon(modId + ":" + name.toLowerCase)
}
}
+6 -7
View File
@@ -11,20 +11,19 @@ package net.bdew.lib.config
import cpw.mods.fml.common.registry.GameRegistry
import net.bdew.lib.Misc
import net.bdew.lib.block.HasTE
import net.bdew.lib.block.{HasTE, SimpleBlock}
import net.minecraft.block.Block
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.item.ItemStack
class BlockManager() {
def regBlockCls[T <: Block](blockCls: Class[T], name: String, addStack: Boolean = false): T = {
val block = blockCls.newInstance()
regBlock[T](block, name, addStack)
}
class BlockManager(creativeTab: CreativeTabs) {
def regBlock[T <: SimpleBlock](block: T): T = regBlock(block, block.name)
def regBlock[T <: Block](block: T, name: String, addStack: Boolean = false): T = {
GameRegistry.registerBlock(block, name)
block.setCreativeTab(creativeTab)
if (addStack)
GameRegistry.registerCustomItemStack(name, new ItemStack(block))
+4 -6
View File
@@ -11,23 +11,21 @@ package net.bdew.lib.config
import cpw.mods.fml.common.registry.GameRegistry
import net.bdew.lib.items.{NamedItem, SimpleItem}
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.item.{Item, ItemStack}
class ItemManager() {
class ItemManager(creativeTab: CreativeTabs) {
def regSimpleItem(name: String): SimpleItem = regItem(new SimpleItem(name), name)
def regItem[T <: NamedItem](item: T): T = regItem[T](item, item.name)
def regItemCls[T <: Item](itemCls: Class[T], name: String, addStack: Boolean = false): T = {
val item = itemCls.newInstance()
regItem[T](item, name, addStack)
}
def regItem[T <: Item](item: T, name: String, addStack: Boolean = false): T = {
GameRegistry.registerItem(item, name)
item.setCreativeTab(creativeTab)
if (addStack)
GameRegistry.registerCustomItemStack(name, new ItemStack(item))
return item
}
def load() {}
}
+3 -2
View File
@@ -12,13 +12,14 @@ package net.bdew.lib.config
import net.bdew.lib.gui.{GuiHandler, GuiProvider}
import net.bdew.lib.machine.Machine
import net.bdew.lib.recipes.gencfg.ConfigSection
import net.minecraft.creativetab.CreativeTabs
class MachineManager(val tuning: ConfigSection, guiHandler: GuiHandler) {
class MachineManager(val tuning: ConfigSection, guiHandler: GuiHandler, creativeTab: CreativeTabs) {
def registerMachine[R <: Machine[_]](machine: R): R = {
machine.tuning = tuning.getSection(machine.name)
if (machine.tuning.getBoolean("Enabled")) {
machine.enabled = true
machine.regBlock()
machine.regBlock(creativeTab)
if (machine.isInstanceOf[GuiProvider])
guiHandler.register(machine.asInstanceOf[GuiProvider])
}
@@ -1,3 +1,12 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.data
import java.util.UUID
@@ -0,0 +1,46 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.data
import net.bdew.lib.data.base.DataSlotVal
abstract class DataSlotOption[T] extends DataSlotVal[Option[T]] {
override var cval: Option[T] = None
def set(v: T) {
if (v == null) sys.error("Null should never be used with DataSlotOption")
cval = Some(v)
}
def unset() {
cval = None
}
override def isSame(v: Option[T]) = {
if (v == null) sys.error("Null should never be used with DataSlotOption")
super.isSame(v)
}
override def :=(that: Option[T]) = {
if (that == null) sys.error("Null should never be used with DataSlotOption")
super.:=(that)
}
override def :!=(that: Option[T]) = {
if (that == null) sys.error("Null should never be used with DataSlotOption")
super.:!=(that)
}
override def :==(that: Option[T]) = {
if (that == null) sys.error("Null should never be used with DataSlotOption")
super.:==(that)
}
override def update(v: Option[T]) = {
if (v == null) sys.error("Null should never be used with DataSlotOption")
super.update(v)
}
}
@@ -9,7 +9,7 @@
package net.bdew.lib.gui.widgets
import net.bdew.lib.gui.{Rect, _}
import net.bdew.lib.gui._
class WidgetSubcontainer(val rect: Rect) extends BaseWidget with WidgetContainer with SimpleDrawTarget {
def getZLevel = parent.getZLevel
+3 -1
View File
@@ -14,6 +14,7 @@ import net.bdew.lib.Misc
import net.bdew.lib.block.HasTE
import net.bdew.lib.recipes.gencfg.ConfigSection
import net.minecraft.block.Block
import net.minecraft.creativetab.CreativeTabs
abstract class Machine[T <: Block](val name: String, blockConstruct: => T) {
var block: T = null.asInstanceOf[T]
@@ -21,9 +22,10 @@ abstract class Machine[T <: Block](val name: String, blockConstruct: => T) {
var enabled = false
val modId = Misc.getActiveModId
def regBlock() {
def regBlock(creativeTab: CreativeTabs) {
block = blockConstruct
GameRegistry.registerBlock(block, name)
block.setCreativeTab(creativeTab)
if (block.isInstanceOf[HasTE[_]]) {
GameRegistry.registerTileEntity(block.asInstanceOf[HasTE[_]].TEClass, "%s.%s".format(modId, name))
}
@@ -0,0 +1,23 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.render.connected
import net.bdew.lib.gui.Color
import net.minecraft.util.IIcon
import net.minecraft.world.IBlockAccess
import net.minecraftforge.common.util.ForgeDirection
case class FaceOverlay(icon: IIcon, color: Color) {
def this(icon: IIcon, color: (Float, Float, Float)) = this(icon, new Color(color._1, color._2, color._3))
}
trait BlockAdditionalRender {
def getFaceOverlays(world: IBlockAccess, x: Int, y: Int, z: Int, face: ForgeDirection): List[FaceOverlay]
}
@@ -0,0 +1,121 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.render.connected
import net.bdew.lib.block.BlockRef
import net.minecraft.client.renderer.Tessellator
import net.minecraft.util.IIcon
import net.minecraftforge.common.util.ForgeDirection
object ConnectedHelper {
val edgeWidth = 1 / 16F
// Represents the rectangles of all edges/corners on a 2d pane
// 701
// 6 2
// 543
// 8 is a special case for the full face
val faceEdges = Array(
RectF(0, 1 - edgeWidth, 1, 1),
RectF(1 - edgeWidth, 1 - edgeWidth, 1, 1),
RectF(1 - edgeWidth, 0, 1, 1),
RectF(1 - edgeWidth, 0, 1, edgeWidth),
RectF(0, 0, 1, edgeWidth),
RectF(0, 0, edgeWidth, edgeWidth),
RectF(0, 0, edgeWidth, 1),
RectF(0, 1 - edgeWidth, edgeWidth, 1),
RectF(0, 0, 1, 1)
)
val faceAdjanced = (for (x <- ForgeDirection.VALID_DIRECTIONS) yield x -> new FaceAdjanced(x)).toMap
// Maps edge number + face to 3d vertices
val draw =
(for ((rect, n) <- faceEdges.zipWithIndex; face <- ForgeDirection.VALID_DIRECTIONS)
yield (face, n) -> new EdgeDraw(rect, face)).toMap
val brightnessMultiplier = Map(
ForgeDirection.UP -> 1F,
ForgeDirection.DOWN -> 0.5F,
ForgeDirection.NORTH -> 0.8F,
ForgeDirection.SOUTH -> 0.8F,
ForgeDirection.WEST -> 0.6F,
ForgeDirection.EAST -> 0.6F
)
case class Vec3F(x: Float, y: Float, z: Float) {
def *(m: Float) = Vec3F(x * m, y * m, z * m)
def +(m: Vec3F) = Vec3F(x + m.x, y + m.y, z + m.z)
def -(m: Vec3F) = Vec3F(x - m.x, y - m.y, z - m.z)
def +(d: ForgeDirection) = Vec3F(x + d.offsetX, y + d.offsetY, z + d.offsetZ)
def toInts = (x.toInt, y.toInt, z.toInt)
def asBlockRef = BlockRef(x.toInt, y.toInt, z.toInt)
}
case class RectF(x1: Float, y1: Float, x2: Float, y2: Float) {
def corners = Seq(Vec2F(x1, y1), Vec2F(x2, y1), Vec2F(x2, y2), Vec2F(x1, y2))
}
case class Vec2F(u: Float, v: Float)
case class VecPair(pos: Vec3F, tex: Vec2F)
class EdgeDraw(rect: RectF, face: ForgeDirection) {
val vertices = rect.corners map { d =>
val v = face match {
case ForgeDirection.UP => Vec3F(d.u, 1, 1 - d.v)
case ForgeDirection.DOWN => Vec3F(d.u, 0, d.v)
case ForgeDirection.NORTH => Vec3F(1 - d.u, d.v, 0)
case ForgeDirection.SOUTH => Vec3F(d.u, d.v, 1)
case ForgeDirection.EAST => Vec3F(1, d.v, 1 - d.u)
case ForgeDirection.WEST => Vec3F(0, d.v, d.u)
case _ => sys.error("Invalid face")
}
VecPair(extend(v, 0.001F), d)
}
def doDraw(pos: Vec3F, icon: IIcon) {
for (v <- vertices)
addVertextWithUV(v.pos + pos, mapToIcon(v.tex, icon))
}
}
def extend(v: Vec3F, o: Float) = Vec3F(
if (v.x == 0F) -o else if (v.x == 1F) 1 + o else v.x,
if (v.y == 0F) -o else if (v.y == 1F) 1 + o else v.y,
if (v.z == 0F) -o else if (v.z == 1F) 1 + o else v.z
)
def mapToIcon(v: Vec2F, i: IIcon) = Vec2F(i.getInterpolatedU(v.u * 16), i.getInterpolatedV((1 - v.v) * 16))
def addVertextWithUV(p: Vec3F, t: Vec2F) =
Tessellator.instance.addVertexWithUV(p.x, p.y, p.z, t.u, t.v)
class FaceAdjanced(d: ForgeDirection) {
val top = d match {
case ForgeDirection.UP => ForgeDirection.NORTH
case ForgeDirection.DOWN => ForgeDirection.SOUTH
case _ => ForgeDirection.UP
}
val right = d match {
case ForgeDirection.UP => ForgeDirection.EAST
case ForgeDirection.DOWN => ForgeDirection.EAST
case ForgeDirection.NORTH => ForgeDirection.WEST
case ForgeDirection.WEST => ForgeDirection.SOUTH
case ForgeDirection.SOUTH => ForgeDirection.EAST
case ForgeDirection.EAST => ForgeDirection.NORTH
case _ => ForgeDirection.UNKNOWN
}
val bottom = top.getOpposite
val left = right.getOpposite
}
}
@@ -0,0 +1,113 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.render.connected
import cpw.mods.fml.client.registry.{ISimpleBlockRenderingHandler, RenderingRegistry}
import net.bdew.lib.block.BlockRef
import net.minecraft.block.Block
import net.minecraft.client.renderer.{RenderBlocks, Tessellator}
import net.minecraft.world.IBlockAccess
import net.minecraftforge.common.util.ForgeDirection
import org.lwjgl.opengl.GL11
object ConnectedRenderer extends ISimpleBlockRenderingHandler {
val id = RenderingRegistry.getNextAvailableRenderId
RenderingRegistry.registerBlockHandler(this)
def doRenderItemSide(d: ForgeDirection, r: RenderBlocks, block: Block, meta: Int) = {
val icon = r.getBlockIconFromSideAndMetadata(block, d.ordinal(), meta)
Tessellator.instance.setNormal(d.offsetX, d.offsetY, d.offsetZ)
d match {
case ForgeDirection.DOWN => r.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icon)
case ForgeDirection.UP => r.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon)
case ForgeDirection.NORTH => r.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon)
case ForgeDirection.SOUTH => r.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon)
case ForgeDirection.WEST => r.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon)
case ForgeDirection.EAST => r.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon)
case _ => sys.error("Invalid side")
}
}
override def renderInventoryBlock(block: Block, metadata: Int, modelID: Int, renderer: RenderBlocks) {
val tessellator = Tessellator.instance
GL11.glTranslatef(-0.5F, -0.5F, -0.5F)
val edge = block.asInstanceOf[ConnectedTextureBlock].edgeIcon
for (side <- ForgeDirection.VALID_DIRECTIONS) {
tessellator.startDrawingQuads()
doRenderItemSide(side, renderer, block, metadata)
val m = ConnectedHelper.brightnessMultiplier(side)
ConnectedHelper.draw(side, 8).doDraw(ConnectedHelper.Vec3F(0, 0, 0), edge)
tessellator.draw()
}
GL11.glTranslatef(0.5F, 0.5F, 0.5F)
}
override def renderWorldBlock(world: IBlockAccess, x: Int, y: Int, z: Int, block: Block, modelId: Int, renderer: RenderBlocks): Boolean = {
renderer.renderStandardBlock(block, x, y, z)
val pos = ConnectedHelper.Vec3F(x, y, z)
for (face <- ForgeDirection.VALID_DIRECTIONS)
if (block.shouldSideBeRendered(world, x + face.offsetX, y + face.offsetY, z + face.offsetZ, face.ordinal()))
drawFaceEdges(world, pos, face, block.asInstanceOf[ConnectedTextureBlock])
return true
}
def drawFaceEdges(world: IBlockAccess, pos: ConnectedHelper.Vec3F, face: ForgeDirection, block: ConnectedTextureBlock) {
val edge = block.edgeIcon
val canConnect = block.canConnect(world, pos.asBlockRef, _: BlockRef)
val sides = ConnectedHelper.faceAdjanced(face)
val m = ConnectedHelper.brightnessMultiplier(face)
Tessellator.instance.setColorOpaque_F(m, m, m)
val fo = pos + face
val b = block.getMixedBrightnessForBlock(world, fo.x.toInt, fo.y.toInt, fo.z.toInt)
Tessellator.instance.setBrightness(b)
val U = !canConnect((pos + sides.top).asBlockRef)
val D = !canConnect((pos + sides.bottom).asBlockRef)
val L = !canConnect((pos + sides.left).asBlockRef)
val R = !canConnect((pos + sides.right).asBlockRef)
if (!U && !R && !canConnect((pos + sides.top + sides.right).asBlockRef))
ConnectedHelper.draw(face, 1).doDraw(pos, edge)
if (!U && !L && !canConnect((pos + sides.top + sides.left).asBlockRef))
ConnectedHelper.draw(face, 7).doDraw(pos, edge)
if (!D && !R && !canConnect((pos + sides.bottom + sides.right).asBlockRef))
ConnectedHelper.draw(face, 3).doDraw(pos, edge)
if (!D && !L && !canConnect((pos + sides.bottom + sides.left).asBlockRef))
ConnectedHelper.draw(face, 5).doDraw(pos, edge)
if (U) ConnectedHelper.draw(face, 0).doDraw(pos, edge)
if (D) ConnectedHelper.draw(face, 4).doDraw(pos, edge)
if (R) ConnectedHelper.draw(face, 2).doDraw(pos, edge)
if (L) ConnectedHelper.draw(face, 6).doDraw(pos, edge)
if (block.isInstanceOf[BlockAdditionalRender]) {
val overlays = block.asInstanceOf[BlockAdditionalRender].getFaceOverlays(world, pos.x.toInt, pos.y.toInt, pos.z.toInt, face)
for (overlay <- overlays) {
Tessellator.instance.setColorOpaque_F(overlay.color.r, overlay.color.g, overlay.color.b)
ConnectedHelper.draw(face, 8).doDraw(pos, overlay.icon)
}
}
}
override def shouldRender3DInInventory(modelId: Int) = true
override def getRenderId = id
}
@@ -0,0 +1,22 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.render.connected
import net.bdew.lib.block.BlockRef
import net.minecraft.block.Block
import net.minecraft.util.IIcon
import net.minecraft.world.IBlockAccess
trait ConnectedTextureBlock extends Block {
def edgeIcon: IIcon
def canConnect(world: IBlockAccess, origin: BlockRef, target: BlockRef): Boolean
override def getRenderType = ConnectedRenderer.id
}