Yep
This commit is contained in:
parent
bf14e3ebb1
commit
bb9f321456
|
@ -1,70 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer
|
||||
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.client.renderer.Tessellator
|
||||
import net.minecraft.world.World
|
||||
|
||||
object Render {
|
||||
|
||||
def drawFakeBlock(v:Vector3, b:Block, meta:Int, min:(Double, Double, Double), w: World): Unit = {
|
||||
|
||||
val (minX, minY, minZ) = min
|
||||
val (maxX, maxY, maxZ) = (minX + 1, minY + 1, minZ + 1)
|
||||
|
||||
val tessellator = Tessellator.instance
|
||||
|
||||
tessellator.startDrawingQuads()
|
||||
// tessellator.setBrightness(b.getMixedBrightnessForBlock(w, v.x, v.y, v.z))
|
||||
tessellator.setColorRGBA(255, 255, 255, 26)
|
||||
|
||||
var tex: (Float, Float, Float, Float) = null
|
||||
|
||||
def textureMinU = tex._1
|
||||
def textureMaxU = tex._2
|
||||
def textureMinV = tex._3
|
||||
def textureMaxV = tex._4
|
||||
|
||||
tex = g(b, meta, 0)
|
||||
tessellator.addVertexWithUV(minX, minY, minZ, textureMinU, textureMinV)
|
||||
tessellator.addVertexWithUV(maxX, minY, minZ, textureMaxU, textureMinV)
|
||||
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMaxU, textureMaxV)
|
||||
tessellator.addVertexWithUV(minX, minY, maxZ, textureMinU, textureMaxV)
|
||||
|
||||
tex = g(b, meta, 1)
|
||||
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMinU, textureMaxV)
|
||||
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMaxU, textureMaxV)
|
||||
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMaxU, textureMinV)
|
||||
tessellator.addVertexWithUV(minX, maxY, minZ, textureMinU, textureMinV)
|
||||
|
||||
tex = g(b, meta, 2)
|
||||
tessellator.addVertexWithUV(maxX, minY, minZ, textureMinU, textureMaxV)
|
||||
tessellator.addVertexWithUV(minX, minY, minZ, textureMaxU, textureMaxV)
|
||||
tessellator.addVertexWithUV(minX, maxY, minZ, textureMaxU, textureMinV)
|
||||
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMinU, textureMinV)
|
||||
|
||||
tex = g(b, meta, 3)
|
||||
tessellator.addVertexWithUV(minX, minY, maxZ, textureMinU, textureMaxV)
|
||||
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMaxU, textureMaxV)
|
||||
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMaxU, textureMinV)
|
||||
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMinU, textureMinV)
|
||||
|
||||
tex = g(b, meta, 4)
|
||||
tessellator.addVertexWithUV(minX, minY, minZ, textureMinU, textureMaxV)
|
||||
tessellator.addVertexWithUV(minX, minY, maxZ, textureMaxU, textureMaxV)
|
||||
tessellator.addVertexWithUV(minX, maxY, maxZ, textureMaxU, textureMinV)
|
||||
tessellator.addVertexWithUV(minX, maxY, minZ, textureMinU, textureMinV)
|
||||
|
||||
tex = g(b, meta, 5)
|
||||
tessellator.addVertexWithUV(maxX, minY, maxZ, textureMinU, textureMaxV)
|
||||
tessellator.addVertexWithUV(maxX, minY, minZ, textureMaxU, textureMaxV)
|
||||
tessellator.addVertexWithUV(maxX, maxY, minZ, textureMaxU, textureMinV)
|
||||
tessellator.addVertexWithUV(maxX, maxY, maxZ, textureMinU, textureMinV)
|
||||
|
||||
tessellator.draw
|
||||
}
|
||||
|
||||
def g(b: Block, m: Int, s: Int): (Float, Float, Float, Float) = {
|
||||
val i = b.getIcon(s, m)
|
||||
(i.getMinU, i.getMaxU, i.getMinV, i.getMaxV)
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks
|
||||
import WayofTime.alchemicalWizardry.api.rituals.{RitualComponent, IMasterRitualStone}
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.util.MovingObjectPosition
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent
|
||||
|
||||
import scala.collection.JavaConversions
|
||||
|
||||
/*
|
||||
* Code made by Alex-Hawks
|
||||
* Implemented by Arcaratus
|
||||
*/
|
||||
class RitualDivinerRender {
|
||||
|
||||
@SubscribeEvent
|
||||
def render(e: RenderWorldLastEvent)
|
||||
{
|
||||
val mc: Minecraft = Minecraft.getMinecraft
|
||||
val p: EntityClientPlayerMP = mc.thePlayer
|
||||
val w: World = p.worldObj
|
||||
|
||||
if (mc.objectMouseOver == null || mc.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
return
|
||||
|
||||
val te: TileEntity = w.getTileEntity(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ)
|
||||
|
||||
if (!te.isInstanceOf[IMasterRitualStone])
|
||||
return
|
||||
|
||||
val v3 = new Vector3(mc.objectMouseOver.blockX, mc.objectMouseOver.blockY, mc.objectMouseOver.blockZ)
|
||||
val (px, py, pz) = (p.lastTickPosX + (p.posX - p.lastTickPosX) * e.partialTicks, p.lastTickPosY + (p.posY - p.lastTickPosY) * e.partialTicks, p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * e.partialTicks)
|
||||
|
||||
if (p.inventory.getCurrentItem != null && p.inventory.getCurrentItem.getItem.isInstanceOf[ItemRitualDiviner]) {
|
||||
val d = p.inventory.getCurrentItem.getItem.asInstanceOf[ItemRitualDiviner]
|
||||
val dir = d.getDirection(p.inventory.getCurrentItem)
|
||||
|
||||
val r = Helper.getEffectFromString(d.getCurrentRitual(p.inventory.getCurrentItem))
|
||||
if (r == null)
|
||||
return
|
||||
|
||||
for (x <- JavaConversions.asScalaBuffer[RitualComponent](r.getRitualComponentList))
|
||||
{
|
||||
val v: Vector3 = v3 + (x.getX(dir), x.getY, x.getZ(dir))
|
||||
val min = (v.x - px, v.y - py, v.z - pz)
|
||||
|
||||
if (!w.getBlock(v.x, v.y, v.z).isOpaqueCube)
|
||||
Render.drawFakeBlock(v, ModBlocks.ritualStone, x.getStoneType, min, w)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package WayofTime.alchemicalWizardry.client.renderer
|
||||
|
||||
class Vector3 (val x: Int, val y: Int, val z: Int) {
|
||||
|
||||
def +(w: (Int,Int,Int)): Vector3 = new Vector3(x + w._1, y+ w._2, z + w._3)
|
||||
|
||||
override def toString = s"V3(${x}},${y}},${z}})"
|
||||
|
||||
def canEqual(other: Any): Boolean = other.isInstanceOf[Vector3]
|
||||
|
||||
override def equals(other: Any): Boolean = other match {
|
||||
case that: Vector3 =>
|
||||
(that canEqual this) &&
|
||||
x == that.x &&
|
||||
y == that.y &&
|
||||
z == that.z
|
||||
case _ => false
|
||||
}
|
||||
|
||||
override def hashCode(): Int = {
|
||||
val state = Seq(x, y, z)
|
||||
state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue