Some work on the gutter

This commit is contained in:
Calclavia 2014-11-29 22:07:10 +08:00
parent a2bc8a2d4a
commit 7f204375d9
2 changed files with 67 additions and 88 deletions

View file

@ -13,54 +13,34 @@ import resonantinduction.archaic.fluid.grate.TileGrate
import resonantinduction.archaic.fluid.gutter.TileGutter import resonantinduction.archaic.fluid.gutter.TileGutter
import resonantinduction.archaic.fluid.tank.TileTank import resonantinduction.archaic.fluid.tank.TileTank
import resonantinduction.archaic.process.{TileCastingMold, TileMillstone} import resonantinduction.archaic.process.{TileCastingMold, TileMillstone}
import resonantinduction.core.{Reference, RICreativeTab} import resonantinduction.core.{RICreativeTab, Reference}
import resonantinduction.mechanical.mech.gear.ItemHandCrank import resonantinduction.mechanical.mech.gear.ItemHandCrank
; ;
object ArchaicContent extends ContentHolder object ArchaicContent extends ContentHolder
{ {
var itemImprint: Item = new ItemImprint
var itemHammer: Item = new ItemHammer
var itemHandCrank: Item = new ItemHandCrank
var itemImprint: Item = null var blockEngineeringTable: Block = new TileEngineeringTable
var itemHammer: Item = null var blockCrate: Block = null
var itemHandCrank: Item = null //manager.newBlock(classOf[BlockCrate])
var blockImprinter: Block = new TileImprinter
var blockEngineeringTable: Block = null var blockTurntable: Block = new TileTurntable
var blockCrate: Block = null//manager.newBlock(classOf[BlockCrate]) var blockFirebox: Block = new TileFirebox
var blockImprinter: Block = null var blockHotPlate: Block = new TileHotPlate
var blockTurntable: Block = null var blockMillstone: Block = new TileMillstone
var blockFirebox: Block = null var blockCast: Block = new TileCastingMold
var blockHotPlate: Block = null
var blockMillstone: Block = null
var blockCast: Block = null
//var blockFilter: Block = contentRegistry.newBlock( classOf[ TileFilter ] ) //var blockFilter: Block = contentRegistry.newBlock( classOf[ TileFilter ] )
var blockGrate: Block = null var blockGrate: Block = new TileGrate
var blockGutter: Block = null var blockGutter: Block = new TileGutter
var blockTank: Block = null var blockTank: Block = new TileTank
//Constructor //Constructor
manager.setTab(RICreativeTab) manager.setTab(RICreativeTab)
manager.setPrefix(Reference.prefix) manager.setPrefix(Reference.prefix)
override def preInit()
{
super.preInit()
itemImprint = manager.newItem(classOf[ItemImprint])
itemHammer = manager.newItem(classOf[ItemHammer])
itemHandCrank = manager.newItem(classOf[ItemHandCrank])
blockEngineeringTable = manager.newBlock(classOf[TileEngineeringTable])
blockCrate= null//manager.newBlock(classOf[BlockCrate])
blockImprinter = manager.newBlock(classOf[TileImprinter])
blockTurntable = manager.newBlock(classOf[TileTurntable])
blockFirebox = manager.newBlock(classOf[TileFirebox])
blockHotPlate = manager.newBlock(classOf[TileHotPlate])
blockMillstone = manager.newBlock(classOf[TileMillstone])
blockCast = manager.newBlock(classOf[TileCastingMold])
//var blockFilter: Block = contentRegistry.newBlock( classOf[ TileFilter ] )
blockGrate = manager.newBlock(classOf[TileGrate])
blockGutter = manager.newBlock(classOf[TileGutter])
blockTank = manager.newBlock(classOf[TileTank])
}
override def postInit() override def postInit()
{ {
RICreativeTab.itemStack = new ItemStack(ArchaicContent.blockEngineeringTable) RICreativeTab.itemStack = new ItemStack(ArchaicContent.blockEngineeringTable)

View file

@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity import net.minecraft.tileentity.TileEntity
import net.minecraft.util.ResourceLocation import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.model.{AdvancedModelLoader, IModelCustom} import net.minecraftforge.client.model.AdvancedModelLoader
import net.minecraftforge.common.util.ForgeDirection import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids.{Fluid, FluidRegistry, FluidStack, IFluidTank} import net.minecraftforge.fluids.{Fluid, FluidRegistry, FluidStack, IFluidTank}
import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL11
@ -27,8 +27,10 @@ import resonantinduction.core.prefab.node.{NodeFluidPressure, TileFluidProvider}
object TileGutter object TileGutter
{ {
@SideOnly(Side.CLIENT) private var MODEL: IModelCustom = _ @SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT) private var TEXTURE: ResourceLocation = _ private val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "gutter.tcn"))
@SideOnly(Side.CLIENT)
private val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "gutter.png")
} }
/** /**
@ -65,8 +67,6 @@ class TileGutter extends TileFluidProvider(Material.rock)
normalRender = false normalRender = false
bounds = new Cuboid(0, 0, 0, 1, 0.99, 1) bounds = new Cuboid(0, 0, 0, 1, 0.99, 1)
nodes.add(fluidNode)
override def getCollisionBoxes: java.lang.Iterable[Cuboid] = override def getCollisionBoxes: java.lang.Iterable[Cuboid] =
{ {
val list: List[Cuboid] = new ArrayList[Cuboid] val list: List[Cuboid] = new ArrayList[Cuboid]
@ -164,6 +164,8 @@ class TileGutter extends TileFluidProvider(Material.rock)
} }
return true return true
} }
return FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side)
} }
return true return true
} }
@ -176,17 +178,14 @@ class TileGutter extends TileFluidProvider(Material.rock)
} }
} }
override def renderDynamic(position: Vector3, frame: Float, pass: Int) @SideOnly(Side.CLIENT)
override def renderInventory(itemStack: ItemStack)
{ {
if (TileGutter.MODEL == null) render(0, 0x0)
{
TileGutter.MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "gutter.tcn"))
}
if (TileGutter.TEXTURE == null)
{
TileGutter.TEXTURE = new ResourceLocation(Reference.domain, Reference.modelPath + "gutter.png")
} }
override def renderDynamic(position: Vector3, frame: Float, pass: Int)
{
GL11.glPushMatrix() GL11.glPushMatrix()
GL11.glTranslated(position.x + 0.5, position.y + 0.5, position.z + 0.5) GL11.glTranslated(position.x + 0.5, position.y + 0.5, position.z + 0.5)
@ -215,7 +214,7 @@ class TileGutter extends TileFluidProvider(Material.rock)
def render(meta: Int, sides: Int) def render(meta: Int, sides: Int)
{ {
RenderUtility.bind(TileGutter.TEXTURE) RenderUtility.bind(TileGutter.texture)
for (dir <- ForgeDirection.VALID_DIRECTIONS) for (dir <- ForgeDirection.VALID_DIRECTIONS)
{ {
@ -231,11 +230,11 @@ class TileGutter extends TileFluidProvider(Material.rock)
} }
if (!sides.mask(dir)) if (!sides.mask(dir))
{ {
TileGutter.MODEL.renderOnly("left") TileGutter.model.renderOnly("left")
} }
if (!sides.mask(dir) || !sides.mask(dir.getRotation(ForgeDirection.UP))) if (!sides.mask(dir) || !sides.mask(dir.getRotation(ForgeDirection.UP)))
{ {
TileGutter.MODEL.renderOnly("backCornerL") TileGutter.model.renderOnly("backCornerL")
} }
GL11.glPopMatrix() GL11.glPopMatrix()
} }
@ -243,7 +242,7 @@ class TileGutter extends TileFluidProvider(Material.rock)
if (!sides.mask(ForgeDirection.DOWN)) if (!sides.mask(ForgeDirection.DOWN))
{ {
TileGutter.MODEL.renderOnly("base") TileGutter.model.renderOnly("base")
} }
} }
} }