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,86 +13,66 @@ import resonantinduction.archaic.fluid.grate.TileGrate
import resonantinduction.archaic.fluid.gutter.TileGutter
import resonantinduction.archaic.fluid.tank.TileTank
import resonantinduction.archaic.process.{TileCastingMold, TileMillstone}
import resonantinduction.core.{Reference, RICreativeTab}
import resonantinduction.core.{RICreativeTab, Reference}
import resonantinduction.mechanical.mech.gear.ItemHandCrank
;
object ArchaicContent extends ContentHolder
{
var itemImprint: Item = new ItemImprint
var itemHammer: Item = new ItemHammer
var itemHandCrank: Item = new ItemHandCrank
var itemImprint: Item = null
var itemHammer: Item = null
var itemHandCrank: Item = null
var blockEngineeringTable: Block = new TileEngineeringTable
var blockCrate: Block = null
//manager.newBlock(classOf[BlockCrate])
var blockImprinter: Block = new TileImprinter
var blockTurntable: Block = new TileTurntable
var blockFirebox: Block = new TileFirebox
var blockHotPlate: Block = new TileHotPlate
var blockMillstone: Block = new TileMillstone
var blockCast: Block = new TileCastingMold
//var blockFilter: Block = contentRegistry.newBlock( classOf[ TileFilter ] )
var blockGrate: Block = new TileGrate
var blockGutter: Block = new TileGutter
var blockTank: Block = new TileTank
var blockEngineeringTable: Block = null
var blockCrate: Block = null//manager.newBlock(classOf[BlockCrate])
var blockImprinter: Block = null
var blockTurntable: Block = null
var blockFirebox: Block = null
var blockHotPlate: Block = null
var blockMillstone: Block = null
var blockCast: Block = null
//var blockFilter: Block = contentRegistry.newBlock( classOf[ TileFilter ] )
var blockGrate: Block = null
var blockGutter: Block = null
var blockTank: Block = null
//Constructor
manager.setTab(RICreativeTab)
manager.setPrefix(Reference.prefix)
//Constructor
manager.setTab(RICreativeTab)
manager.setPrefix(Reference.prefix)
override def preInit()
override def postInit()
{
RICreativeTab.itemStack = new ItemStack(ArchaicContent.blockEngineeringTable)
if (OreDictionary.getOres("cobblestone") == null)
{
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])
OreDictionary.registerOre("cobblestone", Blocks.cobblestone)
}
override def postInit()
if (OreDictionary.getOres("stickWood") == null)
{
RICreativeTab.itemStack = new ItemStack(ArchaicContent.blockEngineeringTable)
if (OreDictionary.getOres("cobblestone") == null)
{
OreDictionary.registerOre("cobblestone", Blocks.cobblestone)
}
if (OreDictionary.getOres("stickWood") == null)
{
OreDictionary.registerOre("stickWood", Items.stick)
}
recipes += shaped(ArchaicContent.blockEngineeringTable, "P", "C", 'P', Blocks.wooden_pressure_plate, 'C', Blocks.crafting_table)
//recipes += shaped(ArchaicBlocks.blockFilter, "B", "P", "B", 'B', Blocks.iron_bars, 'P', Items.paper)
//recipes += shaped(new ItemStack(ArchaicBlocks.blockCrate, 1, 0), "WWW", "WSW", "WWW", 'S', "stickWood", 'W', "logWood")
//recipes += new CrateRecipe(new ItemStack(ArchaicBlocks.blockCrate, 1, 1), "WWW", "WSW", "WWW", 'S', new ItemStack(ArchaicBlocks.blockCrate, 1, 0), 'W', "ingotIron")
//recipes +=new CrateRecipe(new ItemStack(ArchaicBlocks.blockCrate, 1, 2), "WWW", "WSW", "WWW", 'S', new ItemStack(ArchaicBlocks.blockCrate, 1, 1), 'W', UniversalRecipe.PRIMARY_METAL.get)
recipes += shaped(ArchaicContent.blockFirebox, "III", "SFS", "SSS", 'I', Items.iron_ingot, 'F', Blocks.furnace, 'S', Blocks.stone)
recipes += shaped(new ItemStack(ArchaicContent.blockFirebox, 1, 1), "III", "SFS", "SSS", 'I', UniversalRecipe.PRIMARY_METAL.get, 'F', new ItemStack(ArchaicContent.blockFirebox, 1, 0), 'S', UniversalRecipe.WIRE.get)
recipes += shaped(ArchaicContent.blockImprinter, "SSS", "W W", "PPP", 'S', Blocks.stone, 'P', Blocks.piston, 'W', "logWood")
recipes += shaped(ArchaicContent.blockTurntable, "SSS", "PGP", "WWW", 'S', Blocks.stone, 'G', Items.redstone, 'P', Blocks.piston, 'W', "logWood")
recipes += shaped(ArchaicContent.blockCast, "I I", "IBI", "III", 'S', Items.iron_ingot, 'B', Blocks.iron_bars)
recipes += shaped(ArchaicContent.blockGutter, "S S", "I I", "III", 'S', Items.stick, 'I', "cobblestone")
recipes += shaped(ArchaicContent.blockGrate, "WBW", "B B", "WBW", 'B', Blocks.iron_bars, 'W', "plankWood")
recipes += shaped(ArchaicContent.blockHotPlate, "SSS", "III", 'I', Items.iron_ingot, 'S', Blocks.stone)
recipes += shaped(ArchaicContent.blockMillstone, "SPS", "SAS", "SSS", 'P', Blocks.piston, 'A', Items.stone_pickaxe, 'S', Blocks.stone)
recipes += shaped(ArchaicContent.blockTank, "GGG", "GSG", "GGG", 'G', Blocks.glass, 'S', Items.iron_ingot)
recipes += shaped(itemHandCrank, "S ", "SSS", " S", 'S', "stickWood")
recipes += shaped(itemImprint, "PPP", "PIP", "PPP", 'P', Items.paper, 'I', new ItemStack(Items.dye, 0))
recipes += shaped(itemHammer, "CC ", "CS ", " S", 'C', "cobblestone", 'S', "stickWood")
OreDictionary.registerOre("stickWood", Items.stick)
}
recipes += shaped(ArchaicContent.blockEngineeringTable, "P", "C", 'P', Blocks.wooden_pressure_plate, 'C', Blocks.crafting_table)
//recipes += shaped(ArchaicBlocks.blockFilter, "B", "P", "B", 'B', Blocks.iron_bars, 'P', Items.paper)
//recipes += shaped(new ItemStack(ArchaicBlocks.blockCrate, 1, 0), "WWW", "WSW", "WWW", 'S', "stickWood", 'W', "logWood")
//recipes += new CrateRecipe(new ItemStack(ArchaicBlocks.blockCrate, 1, 1), "WWW", "WSW", "WWW", 'S', new ItemStack(ArchaicBlocks.blockCrate, 1, 0), 'W', "ingotIron")
//recipes +=new CrateRecipe(new ItemStack(ArchaicBlocks.blockCrate, 1, 2), "WWW", "WSW", "WWW", 'S', new ItemStack(ArchaicBlocks.blockCrate, 1, 1), 'W', UniversalRecipe.PRIMARY_METAL.get)
recipes += shaped(ArchaicContent.blockFirebox, "III", "SFS", "SSS", 'I', Items.iron_ingot, 'F', Blocks.furnace, 'S', Blocks.stone)
recipes += shaped(new ItemStack(ArchaicContent.blockFirebox, 1, 1), "III", "SFS", "SSS", 'I', UniversalRecipe.PRIMARY_METAL.get, 'F', new ItemStack(ArchaicContent.blockFirebox, 1, 0), 'S', UniversalRecipe.WIRE.get)
recipes += shaped(ArchaicContent.blockImprinter, "SSS", "W W", "PPP", 'S', Blocks.stone, 'P', Blocks.piston, 'W', "logWood")
recipes += shaped(ArchaicContent.blockTurntable, "SSS", "PGP", "WWW", 'S', Blocks.stone, 'G', Items.redstone, 'P', Blocks.piston, 'W', "logWood")
recipes += shaped(ArchaicContent.blockCast, "I I", "IBI", "III", 'S', Items.iron_ingot, 'B', Blocks.iron_bars)
recipes += shaped(ArchaicContent.blockGutter, "S S", "I I", "III", 'S', Items.stick, 'I', "cobblestone")
recipes += shaped(ArchaicContent.blockGrate, "WBW", "B B", "WBW", 'B', Blocks.iron_bars, 'W', "plankWood")
recipes += shaped(ArchaicContent.blockHotPlate, "SSS", "III", 'I', Items.iron_ingot, 'S', Blocks.stone)
recipes += shaped(ArchaicContent.blockMillstone, "SPS", "SAS", "SSS", 'P', Blocks.piston, 'A', Items.stone_pickaxe, 'S', Blocks.stone)
recipes += shaped(ArchaicContent.blockTank, "GGG", "GSG", "GGG", 'G', Blocks.glass, 'S', Items.iron_ingot)
recipes += shaped(itemHandCrank, "S ", "SSS", " S", 'S', "stickWood")
recipes += shaped(itemImprint, "PPP", "PIP", "PPP", 'P', Items.paper, 'I', new ItemStack(Items.dye, 0))
recipes += shaped(itemHammer, "CC ", "CS ", " S", 'C', "cobblestone", 'S', "stickWood")
}
}

View file

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