Removed electric turbine
This commit is contained in:
parent
6ba88e0a8d
commit
31a510d028
7 changed files with 354 additions and 529 deletions
|
@ -61,7 +61,6 @@ import resonantinduction.mechanical.mech.turbine._
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileGrindingWheel], new RenderGrindingWheel)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileWaterTurbine], new RenderWaterTurbine)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileWindTurbine], new RenderWindTurbine)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileElectricTurbine], new RenderElectricTurbine)
|
||||
|
||||
//Electrical content
|
||||
ItemRenderHandler.register(ElectricalContent.itemTransformer, RenderTransformer)
|
||||
|
@ -75,7 +74,6 @@ import resonantinduction.mechanical.mech.turbine._
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileCentrifuge], new RenderCentrifuge)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TilePlasmaHeater], new RenderPlasmaHeater)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileNuclearBoiler], new RenderNuclearBoiler)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileElectricTurbine], new RenderElectricTurbine)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileThermometer], new RenderThermometer)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileChemicalExtractor], new RenderChemicalExtractor)
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(classOf[TileReactorCell], new RenderReactorCell)
|
||||
|
|
|
@ -3,12 +3,13 @@ package resonantinduction.mechanical
|
|||
import net.minecraft.block.Block
|
||||
import net.minecraft.init.{Blocks, Items}
|
||||
import net.minecraft.item.{Item, ItemStack}
|
||||
import resonant.api.grid.NodeRegistry
|
||||
import resonant.content.loader.ContentHolder
|
||||
import resonant.lib.network.discriminator.PacketAnnotationManager
|
||||
import resonant.lib.recipe.UniversalRecipe
|
||||
import resonant.lib.schematic.{SchematicPlate, SchematicRegistry}
|
||||
import resonantinduction.core.interfaces.TMechanicalNode
|
||||
import resonantinduction.core.{Reference, ResonantPartFactory, RICreativeTab}
|
||||
import resonantinduction.core.{RICreativeTab, Reference, ResonantPartFactory}
|
||||
import resonantinduction.mechanical.fluid.pipe.{ItemPipe, PartPipe, PipeMaterials}
|
||||
import resonantinduction.mechanical.fluid.transport.TilePump
|
||||
import resonantinduction.mechanical.machine.TileDetector
|
||||
|
@ -19,8 +20,7 @@ import resonantinduction.mechanical.mech.grid.NodeMechanical
|
|||
import resonantinduction.mechanical.mech.process.crusher.TileMechanicalPiston
|
||||
import resonantinduction.mechanical.mech.process.grinder.TileGrindingWheel
|
||||
import resonantinduction.mechanical.mech.process.mixer.TileMixer
|
||||
import resonantinduction.mechanical.mech.turbine.{TileElectricTurbine, TileWaterTurbine, TileWindTurbine}
|
||||
import resonant.api.grid.NodeRegistry
|
||||
import resonantinduction.mechanical.mech.turbine.{TileWaterTurbine, TileWindTurbine}
|
||||
|
||||
/**
|
||||
* The core contents of Resonant Induction
|
||||
|
@ -28,104 +28,87 @@ import resonant.api.grid.NodeRegistry
|
|||
*/
|
||||
object MechanicalContent extends ContentHolder
|
||||
{
|
||||
//Constructor
|
||||
manager.setTab(RICreativeTab)
|
||||
manager.setPrefix(Reference.prefix)
|
||||
//Constructor
|
||||
manager.setTab(RICreativeTab)
|
||||
manager.setPrefix(Reference.prefix)
|
||||
|
||||
//Content
|
||||
var itemGear: Item = null
|
||||
var itemGearShaft: Item = null
|
||||
var itemPipe: Item = null
|
||||
//Content
|
||||
var itemGear: Item = new ItemGear
|
||||
var itemGearShaft: Item = new ItemGearShaft
|
||||
var itemPipe: Item = new ItemPipe
|
||||
|
||||
var blockWindTurbine: Block = null
|
||||
var blockWaterTurbine: Block = null
|
||||
var blockElectricTurbine: Block = null
|
||||
var blockDetector: Block = null
|
||||
var blockPump: Block = null
|
||||
var blockGrinderWheel: Block = null
|
||||
var blockMixer: Block = null
|
||||
var blockMechanicalPiston: Block = null
|
||||
var blockTileBreaker: Block = null
|
||||
var blockTilePlacer: Block = null
|
||||
var blockWindTurbine: Block = new TileWindTurbine
|
||||
var blockWaterTurbine: Block = new TileWaterTurbine
|
||||
var blockDetector: Block = new TileDetector
|
||||
var blockPump: Block = new TilePump
|
||||
var blockGrinderWheel: Block = new TileGrindingWheel
|
||||
var blockMixer: Block = new TileMixer
|
||||
var blockMechanicalPiston: Block = new TileMechanicalPiston
|
||||
var blockTileBreaker: Block = new TileBreaker
|
||||
var blockTilePlacer: Block = new TilePlacer
|
||||
|
||||
override def preInit()
|
||||
{
|
||||
super.preInit()
|
||||
override def preInit()
|
||||
{
|
||||
super.preInit()
|
||||
|
||||
itemGear = manager.newItem(classOf[ItemGear])
|
||||
itemGearShaft = manager.newItem(classOf[ItemGearShaft])
|
||||
itemPipe = manager.newItem(classOf[ItemPipe])
|
||||
SchematicRegistry.register("resonantinduction.mechanical.waterTurbine", new SchematicPlate("schematic.waterTurbine.name", MechanicalContent.blockWaterTurbine))
|
||||
SchematicRegistry.register("resonantinduction.mechanical.windTurbine", new SchematicPlate("schematic.windTurbine.name", MechanicalContent.blockWindTurbine))
|
||||
|
||||
blockWindTurbine = manager.newBlock(classOf[TileWindTurbine])
|
||||
blockWaterTurbine= manager.newBlock(classOf[TileWaterTurbine])
|
||||
blockElectricTurbine= manager.newBlock(classOf[TileElectricTurbine])
|
||||
blockDetector = manager.newBlock(classOf[TileDetector])
|
||||
blockPump = manager.newBlock(classOf[TilePump])
|
||||
blockGrinderWheel= manager.newBlock(classOf[TileGrindingWheel])
|
||||
blockMixer = manager.newBlock(classOf[TileMixer])
|
||||
blockMechanicalPiston = manager.newBlock(classOf[TileMechanicalPiston])
|
||||
blockTileBreaker = manager.newBlock(classOf[TileBreaker])
|
||||
blockTilePlacer = manager.newBlock(classOf[TilePlacer])
|
||||
NodeRegistry.register(classOf[TMechanicalNode], classOf[NodeMechanical])
|
||||
|
||||
SchematicRegistry.register("resonantinduction.mechanical.waterTurbine",new SchematicPlate("schematic.waterTurbine.name", MechanicalContent.blockWaterTurbine))
|
||||
SchematicRegistry.register("resonantinduction.mechanical.windTurbine",new SchematicPlate("schematic.windTurbine.name", MechanicalContent.blockWindTurbine))
|
||||
SchematicRegistry.register("resonantinduction.mechanical.electricalTurbine",new SchematicPlate("schematic.electricTurbine.name", MechanicalContent.blockElectricTurbine))
|
||||
RICreativeTab.itemStack(new ItemStack(MechanicalContent.blockGrinderWheel))
|
||||
|
||||
NodeRegistry.register(classOf[TMechanicalNode], classOf[NodeMechanical])
|
||||
PacketAnnotationManager.INSTANCE.register(classOf[TileWindTurbine])
|
||||
PacketAnnotationManager.INSTANCE.register(classOf[TileWaterTurbine])
|
||||
|
||||
RICreativeTab.itemStack(new ItemStack(MechanicalContent.blockGrinderWheel))
|
||||
ResonantPartFactory.register(classOf[PartGear])
|
||||
ResonantPartFactory.register(classOf[PartGearShaft])
|
||||
ResonantPartFactory.register(classOf[PartPipe])
|
||||
}
|
||||
|
||||
PacketAnnotationManager.INSTANCE.register(classOf[TileWindTurbine])
|
||||
PacketAnnotationManager.INSTANCE.register(classOf[TileWaterTurbine])
|
||||
override def init()
|
||||
{
|
||||
super.init()
|
||||
}
|
||||
|
||||
ResonantPartFactory.register(classOf[PartGear])
|
||||
ResonantPartFactory.register(classOf[PartGearShaft])
|
||||
ResonantPartFactory.register(classOf[PartPipe])
|
||||
}
|
||||
/**
|
||||
* Recipe registration
|
||||
*/
|
||||
override def postInit()
|
||||
{
|
||||
//recipes += shaped(new ItemStack(decoration, 8, 3), "XXX", "XCX", "XXX", 'X', Blocks.cobblestone, 'C', new ItemStack(Items.coal, 1, 1))
|
||||
recipes += shaped(new ItemStack(itemGear, 1, 0), "SWS", "W W", "SWS", 'W', "plankWood", 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(itemGear, 1, 1), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 0), 'W', Blocks.cobblestone)
|
||||
recipes += shaped(new ItemStack(itemGear, 1, 2), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 1), 'W', Items.iron_ingot)
|
||||
|
||||
override def init()
|
||||
{
|
||||
super.init()
|
||||
}
|
||||
recipes += shaped(new ItemStack(itemGearShaft, 1, 0), "S", "S", "S", 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(itemGearShaft, 1, 1), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 0), 'S', Blocks.cobblestone)
|
||||
recipes += shaped(new ItemStack(itemGearShaft, 1, 2), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 1), 'S', Items.iron_ingot)
|
||||
|
||||
/**
|
||||
* Recipe registration
|
||||
*/
|
||||
override def postInit()
|
||||
{
|
||||
//recipes += shaped(new ItemStack(decoration, 8, 3), "XXX", "XCX", "XXX", 'X', Blocks.cobblestone, 'C', new ItemStack(Items.coal, 1, 1))
|
||||
recipes += shaped(new ItemStack(itemGear, 1, 0), "SWS", "W W", "SWS", 'W', "plankWood", 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(itemGear, 1, 1), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 0), 'W', Blocks.cobblestone)
|
||||
recipes += shaped(new ItemStack(itemGear, 1, 2), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 1), 'W', Items.iron_ingot)
|
||||
recipes += shaped(blockDetector, "SWS", "SRS", "SWS", 'S', Items.iron_ingot, 'W', UniversalRecipe.WIRE.get)
|
||||
|
||||
recipes += shaped(new ItemStack(itemGearShaft, 1, 0), "S", "S", "S", 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(itemGearShaft, 1, 1), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 0), 'S', Blocks.cobblestone)
|
||||
recipes += shaped(new ItemStack(itemGearShaft, 1, 2), "S", "G", "S", 'G', new ItemStack(itemGearShaft, 1, 1), 'S', Items.iron_ingot)
|
||||
recipes += shaped(new ItemStack(blockWindTurbine, 1, 0), "CWC", "WGW", "CWC", 'G', itemGear, 'C', Blocks.wool, 'W', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWindTurbine, 1, 1), "CWC", "WGW", "CWC", 'G', new ItemStack(blockWindTurbine, 1, 0), 'C', Blocks.stone, 'W', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWindTurbine, 1, 2), "CWC", "WGW", "CWC", 'G', new ItemStack(blockWindTurbine, 1, 1), 'C', Items.iron_ingot, 'W', Items.stick)
|
||||
|
||||
recipes += shaped(blockDetector, "SWS", "SRS", "SWS", 'S', Items.iron_ingot, 'W', UniversalRecipe.WIRE.get)
|
||||
recipes += shaped(new ItemStack(blockWaterTurbine, 1, 0), "SWS", "WGW", "SWS", 'G', itemGear, 'W', "plankWood", 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWaterTurbine, 1, 1), "SWS", "WGW", "SWS", 'G', new ItemStack(blockWaterTurbine, 1, 0), 'W', Blocks.stone, 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWaterTurbine, 1, 2), "SWS", "WGW", "SWS", 'G', new ItemStack(blockWaterTurbine, 1, 1), 'W', UniversalRecipe.PRIMARY_METAL.get, 'S', Items.stick)
|
||||
|
||||
recipes += shaped(new ItemStack(blockWindTurbine, 1, 0), "CWC", "WGW", "CWC", 'G', itemGear, 'C', Blocks.wool, 'W', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWindTurbine, 1, 1), "CWC", "WGW", "CWC", 'G', new ItemStack(blockWindTurbine, 1, 0), 'C', Blocks.stone, 'W', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWindTurbine, 1, 2), "CWC", "WGW", "CWC", 'G', new ItemStack(blockWindTurbine, 1, 1), 'C', Items.iron_ingot, 'W', Items.stick)
|
||||
recipes += shaped(blockElectricTurbine, " B ", "BMB", " B ", 'B', UniversalRecipe.SECONDARY_PLATE.get, 'M', UniversalRecipe.MOTOR.get)
|
||||
recipes += shaped(blockPump, "PPP", "GGG", "PPP", 'P', itemPipe, 'G', new ItemStack(itemGear, 1, 2))
|
||||
|
||||
recipes += shaped(new ItemStack(blockWaterTurbine, 1, 0), "SWS", "WGW", "SWS", 'G', itemGear, 'W', "plankWood", 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWaterTurbine, 1, 1), "SWS", "WGW", "SWS", 'G', new ItemStack(blockWaterTurbine, 1, 0), 'W', Blocks.stone, 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(blockWaterTurbine, 1, 2), "SWS", "WGW", "SWS", 'G', new ItemStack(blockWaterTurbine, 1, 1), 'W', UniversalRecipe.PRIMARY_METAL.get, 'S', Items.stick)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.ceramic.id), "BBB", " ", "BBB", 'B', Items.brick)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.bronze.id), "BBB", " ", "BBB", 'B', "ingotBronze")
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.plastic.id), "BBB", " ", "BBB", 'B', UniversalRecipe.RUBBER.get)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.iron.id), "BBB", " ", "BBB", 'B', Items.iron_ingot)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.steel.id), "BBB", " ", "BBB", 'B', "ingotSteel")
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.fiberglass.id), "BBB", " ", "BBB", 'B', Items.diamond)
|
||||
|
||||
recipes += shaped(blockElectricTurbine, " B ", "BMB", " B ", 'B', UniversalRecipe.SECONDARY_PLATE.get, 'M', UniversalRecipe.MOTOR.get)
|
||||
recipes += shaped(blockPump, "PPP", "GGG", "PPP", 'P', itemPipe, 'G', new ItemStack(itemGear, 1, 2))
|
||||
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.ceramic.id), "BBB", " ", "BBB", 'B', Items.brick)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.bronze.id), "BBB", " ", "BBB", 'B', "ingotBronze")
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.plastic.id), "BBB", " ", "BBB", 'B', UniversalRecipe.RUBBER.get)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.iron.id), "BBB", " ", "BBB", 'B', Items.iron_ingot)
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.steel.id), "BBB", " ", "BBB", 'B', "ingotSteel")
|
||||
recipes += shaped(new ItemStack(itemPipe, 3, PipeMaterials.fiberglass.id), "BBB", " ", "BBB", 'B', Items.diamond)
|
||||
|
||||
recipes += shaped(blockMechanicalPiston, "SGS", "SPS", "SRS", 'P', Blocks.piston, 'S', Items.iron_ingot, 'R', Items.redstone, 'G', new ItemStack(itemGear, 1, 2))
|
||||
recipes += shaped(blockGrinderWheel, "III", "LGL", "III", 'I', UniversalRecipe.PRIMARY_METAL.get, 'L', "logWood", 'G', itemGear)
|
||||
recipes += shaped(blockMixer, "IGI", "IGI", "IGI", 'I', UniversalRecipe.PRIMARY_METAL.get, 'G', itemGear)
|
||||
recipes += shaped(blockTileBreaker, "CGC", "CPC", "CDC", 'C', Blocks.cobblestone, 'G', itemGear, 'P', Blocks.piston, 'D', Items.diamond_pickaxe)
|
||||
recipes += shaped(blockTilePlacer, "CGC", "CSC", "CRC", 'C', Blocks.cobblestone, 'G', itemGear, 'S', Items.iron_ingot, 'R', Blocks.redstone_block)
|
||||
}
|
||||
recipes += shaped(blockMechanicalPiston, "SGS", "SPS", "SRS", 'P', Blocks.piston, 'S', Items.iron_ingot, 'R', Items.redstone, 'G', new ItemStack(itemGear, 1, 2))
|
||||
recipes += shaped(blockGrinderWheel, "III", "LGL", "III", 'I', UniversalRecipe.PRIMARY_METAL.get, 'L', "logWood", 'G', itemGear)
|
||||
recipes += shaped(blockMixer, "IGI", "IGI", "IGI", 'I', UniversalRecipe.PRIMARY_METAL.get, 'G', itemGear)
|
||||
recipes += shaped(blockTileBreaker, "CGC", "CPC", "CDC", 'C', Blocks.cobblestone, 'G', itemGear, 'P', Blocks.piston, 'D', Items.diamond_pickaxe)
|
||||
recipes += shaped(blockTilePlacer, "CGC", "CSC", "CRC", 'C', Blocks.cobblestone, 'G', itemGear, 'S', Items.iron_ingot, 'R', Blocks.redstone_block)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
package resonantinduction.mechanical.mech.turbine
|
||||
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.util.ResourceLocation
|
||||
import net.minecraftforge.client.model.{AdvancedModelLoader, IModelCustom}
|
||||
import org.apache.commons.lang3.ArrayUtils
|
||||
import org.lwjgl.opengl.GL11
|
||||
import resonantinduction.core.Reference
|
||||
|
||||
@SideOnly(Side.CLIENT) object RenderElectricTurbine
|
||||
{
|
||||
final val MODEL_SMALL: IModelCustom = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "turbineSmall.tcn"))
|
||||
final val MODEL_LARGE: IModelCustom = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "turbineLarge.tcn"))
|
||||
final val SMALL_TEXTURE: ResourceLocation = new ResourceLocation(Reference.domain, Reference.modelPath + "turbineSmall.png")
|
||||
final val LARGE_TEXTURE: ResourceLocation = new ResourceLocation(Reference.domain, Reference.modelPath + "turbineLarge.png")
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) class RenderElectricTurbine extends TileEntitySpecialRenderer
|
||||
{
|
||||
def renderTileEntityAt(t: TileEntity, x: Double, y: Double, z: Double, f: Float)
|
||||
{
|
||||
val tile: TileTurbine = t.asInstanceOf[TileTurbine]
|
||||
if (tile.getMultiBlock.isPrimary)
|
||||
{
|
||||
GL11.glPushMatrix
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5)
|
||||
if (tile.getMultiBlock.isConstructed)
|
||||
{
|
||||
bindTexture(RenderElectricTurbine.LARGE_TEXTURE)
|
||||
val blades: Array[String] = Array[String]("Blade1", "Blade2", "Blade3", "Blade4", "Blade5", "Blade6")
|
||||
val mediumBlades: Array[String] = Array[String]("MediumBlade1", "MediumBlade2", "MediumBlade3", "MediumBlade4", "MediumBlade5", "MediumBlade6")
|
||||
val largeBlades: Array[String] = Array[String]("LargeBlade1", "LargeBlade2", "LargeBlade3", "LargeBlade4", "LargeBlade5", "LargeBlade6")
|
||||
GL11.glPushMatrix
|
||||
GL11.glRotated(Math.toDegrees(tile.mechanicalNode.angle), 0, 1, 0)
|
||||
RenderElectricTurbine.MODEL_LARGE.renderOnly(blades: _*)
|
||||
RenderElectricTurbine.MODEL_LARGE.renderOnly(largeBlades: _*)
|
||||
GL11.glPopMatrix
|
||||
GL11.glPushMatrix
|
||||
GL11.glRotated(-Math.toDegrees(tile.mechanicalNode.angle), 0, 1, 0)
|
||||
RenderElectricTurbine.MODEL_LARGE.renderOnly(mediumBlades: _*)
|
||||
GL11.glPopMatrix
|
||||
RenderElectricTurbine.MODEL_LARGE.renderAllExcept(ArrayUtils.addAll(ArrayUtils.addAll(blades, mediumBlades: _*), largeBlades: _*): _*)
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(1f, 1.1f, 1f)
|
||||
bindTexture(RenderElectricTurbine.SMALL_TEXTURE)
|
||||
val bladesA: Array[String] = new Array[String](3)
|
||||
|
||||
for (i <- 0 until bladesA.length)
|
||||
{
|
||||
bladesA(i) = "BLADE A" + (i + 1) + " SPINS"
|
||||
|
||||
}
|
||||
val sheildsA: Array[String] = new Array[String](6)
|
||||
|
||||
for (i <- 0 until sheildsA.length)
|
||||
{
|
||||
sheildsA(i) = "SHIELD A" + (i + 1) + " SPINS"
|
||||
|
||||
}
|
||||
val bladesB: Array[String] = new Array[String](3)
|
||||
|
||||
for (i <- 0 until bladesB.length)
|
||||
{
|
||||
bladesB(i) = "BLADE B" + (i + 1) + " SPINS"
|
||||
|
||||
}
|
||||
val sheildsB: Array[String] = new Array[String](6)
|
||||
|
||||
for (i <- 0 until sheildsB.length)
|
||||
{
|
||||
sheildsB(i) = "SHIELD B" + (i + 1) + " SPINS"
|
||||
|
||||
}
|
||||
val renderA: Array[String] = ArrayUtils.addAll(bladesA, sheildsA: _*)
|
||||
val renderB: Array[String] = ArrayUtils.addAll(bladesB, sheildsB: _*)
|
||||
GL11.glPushMatrix
|
||||
GL11.glRotated(Math.toDegrees(tile.mechanicalNode.angle), 0, 1, 0)
|
||||
RenderElectricTurbine.MODEL_SMALL.renderOnly(renderA: _*)
|
||||
GL11.glPopMatrix
|
||||
GL11.glPushMatrix
|
||||
GL11.glRotated(-Math.toDegrees(tile.mechanicalNode.angle), 0, 1, 0)
|
||||
RenderElectricTurbine.MODEL_SMALL.renderOnly(renderB: _*)
|
||||
GL11.glPopMatrix
|
||||
RenderElectricTurbine.MODEL_SMALL.renderAllExcept(ArrayUtils.addAll(renderA, renderB: _*): _*)
|
||||
}
|
||||
GL11.glPopMatrix
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package resonantinduction.mechanical.mech.turbine
|
||||
|
||||
import io.netty.buffer.ByteBuf
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids.{Fluid, FluidStack, FluidTank, FluidTankInfo}
|
||||
import resonant.api.IBoilHandler
|
||||
import resonant.lib.content.prefab.{TElectric, TEnergyStorage}
|
||||
import resonant.lib.network.discriminator.PacketType
|
||||
import resonantinduction.core.{Reference, Settings}
|
||||
|
||||
class TileElectricTurbine extends TileTurbine with IBoilHandler with TElectric with TEnergyStorage
|
||||
{
|
||||
var tank: FluidTank = new FluidTank(1000)
|
||||
maxPower = 5000000
|
||||
|
||||
override def update
|
||||
{
|
||||
if (getMultiBlock.isConstructed)
|
||||
{
|
||||
mechanicalNode.torque = defaultTorque * 500 * getArea
|
||||
}
|
||||
else
|
||||
{
|
||||
mechanicalNode.torque = defaultTorque * 500
|
||||
}
|
||||
super.update
|
||||
}
|
||||
|
||||
def onProduce
|
||||
{
|
||||
energy.receiveEnergy((power * Settings.turbineOutputMultiplier).asInstanceOf[Long], true)
|
||||
}
|
||||
|
||||
override def playSound
|
||||
{
|
||||
if (this.worldObj.getWorldTime % 1200 == 0)
|
||||
{
|
||||
val maxVelocity: Double = (getMaxPower / mechanicalNode.torque) * 4
|
||||
val percentage: Float = Math.max(mechanicalNode.angularVelocity * 4 / maxVelocity.asInstanceOf[Float], 1.0f).asInstanceOf[Float]
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, Reference.prefix + "turbine", percentage, 1.0f)
|
||||
}
|
||||
}
|
||||
|
||||
def canFill(from: ForgeDirection, fluid: Fluid): Boolean =
|
||||
{
|
||||
return from == ForgeDirection.DOWN && fluid.getName.contains("steam")
|
||||
}
|
||||
|
||||
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int = tank.fill(resource, doFill)
|
||||
|
||||
override def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack = null
|
||||
|
||||
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = null
|
||||
|
||||
override def canDrain(from: ForgeDirection, fluid: Fluid): Boolean = false
|
||||
|
||||
override def getTankInfo(from: ForgeDirection): Array[FluidTankInfo] =
|
||||
{
|
||||
val re: Array[FluidTankInfo] = new Array[FluidTankInfo](1)
|
||||
re(1) = tank.getInfo
|
||||
return re
|
||||
}
|
||||
}
|
|
@ -10,203 +10,181 @@ import net.minecraft.nbt.NBTTagCompound
|
|||
import net.minecraft.util.AxisAlignedBB
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.api.grid.INodeProvider
|
||||
import resonant.lib.multiblock.reference.IMultiBlockStructure
|
||||
import resonant.lib.network.handle.IPacketIDReceiver
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonantinduction.mechanical.mech.TileMechanical
|
||||
import resonantinduction.mechanical.mech.gear.ItemHandCrank
|
||||
import resonant.api.grid.INodeProvider
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/** Reduced version of the main turbine class */
|
||||
class TileTurbine extends TileMechanical(Material.wood) with IMultiBlockStructure[TileTurbine] with INodeProvider
|
||||
class TileTurbine extends TileMechanical(Material.wood) with IMultiBlockStructure[TileTurbine]
|
||||
{
|
||||
/** Tier of the tile */
|
||||
var tier: Int = 0
|
||||
/** Radius of large turbine? */
|
||||
var multiBlockRadius: Int = 1
|
||||
/** Max power in watts. */
|
||||
protected var maxPower: Long = 0L
|
||||
/** The power of the turbine this tick. In joules/tick */
|
||||
var power: Double = 0
|
||||
protected final val defaultTorque: Long = 5000
|
||||
/** MutliBlock methods. */
|
||||
private var multiBlock: TurbineMBlockHandler = null
|
||||
/** Tier of the turbine */
|
||||
var tier = 0
|
||||
/** Radius of large turbine? */
|
||||
var multiBlockRadius = 1
|
||||
/** MutliBlock methods. */
|
||||
private var multiBlock: TurbineMBlockHandler = null
|
||||
|
||||
//Constructor
|
||||
normalRender(false)
|
||||
isOpaqueCube(false)
|
||||
setTextureName("material_wood_surface")
|
||||
mechanicalNode = new TurbineNode(this)
|
||||
rotationMask = 63
|
||||
//Constructor
|
||||
normalRender = false
|
||||
isOpaqueCube = false
|
||||
setTextureName("material_wood_surface")
|
||||
mechanicalNode = new TurbineNode(this)
|
||||
rotationMask = 63
|
||||
|
||||
override def onRemove(block: Block, par1: Int)
|
||||
{
|
||||
super.onRemove(block, par1)
|
||||
getMultiBlock.deconstruct()
|
||||
}
|
||||
|
||||
override def onRemove(block: Block, par1: Int)
|
||||
override def update()
|
||||
{
|
||||
super.update()
|
||||
getMultiBlock.update()
|
||||
|
||||
if (getMultiBlock.isPrimary)
|
||||
{
|
||||
super.onRemove(block, par1)
|
||||
if (mechanicalNode.angularVelocity != 0)
|
||||
{
|
||||
playSound
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getArea: Int = (((multiBlockRadius + 0.5) * 2) * ((multiBlockRadius + 0.5) * 2)).toInt
|
||||
|
||||
/** Called to play sound effects */
|
||||
def playSound
|
||||
{
|
||||
}
|
||||
|
||||
/** Reads a tile entity from NBT. */
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(nbt)
|
||||
multiBlockRadius = nbt.getInteger("multiBlockRadius")
|
||||
tier = nbt.getInteger("tier")
|
||||
getMultiBlock.load(nbt)
|
||||
}
|
||||
|
||||
/** Writes a tile entity to NBT. */
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbt)
|
||||
nbt.setInteger("multiBlockRadius", multiBlockRadius)
|
||||
nbt.setInteger("tier", tier)
|
||||
getMultiBlock.save(nbt)
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def getRenderBoundingBox: AxisAlignedBB =
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(this.xCoord - multiBlockRadius, this.yCoord - multiBlockRadius, this.zCoord - multiBlockRadius, this.xCoord + 1 + multiBlockRadius, this.yCoord + 1 + multiBlockRadius, this.zCoord + 1 + multiBlockRadius)
|
||||
}
|
||||
|
||||
def getMultiBlockVectors: java.lang.Iterable[Vector3] =
|
||||
{
|
||||
val vectors: Set[Vector3] = new HashSet[Vector3]
|
||||
val dir: ForgeDirection = getDirection
|
||||
val xMulti: Int = if (dir.offsetX != 0) 0 else 1
|
||||
val yMulti: Int = if (dir.offsetY != 0) 0 else 1
|
||||
val zMulti: Int = if (dir.offsetZ != 0) 0 else 1
|
||||
|
||||
for (x: Int <- -multiBlockRadius to multiBlockRadius)
|
||||
{
|
||||
for (y: Int <- -multiBlockRadius to multiBlockRadius)
|
||||
{
|
||||
|
||||
for (z: Int <- -multiBlockRadius to multiBlockRadius)
|
||||
{
|
||||
vectors.add(new Vector3(x * xMulti, y * yMulti, z * zMulti))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vectors
|
||||
}
|
||||
|
||||
def getPosition: Vector3 =
|
||||
{
|
||||
return toVector3
|
||||
}
|
||||
|
||||
def getMultiBlock: TurbineMBlockHandler =
|
||||
{
|
||||
if (multiBlock == null) multiBlock = new TurbineMBlockHandler(this)
|
||||
return multiBlock
|
||||
}
|
||||
|
||||
def onMultiBlockChanged
|
||||
{
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, if (getBlockType != null) getBlockType else null)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||
}
|
||||
|
||||
def getWorld: World =
|
||||
{
|
||||
return worldObj
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.getCurrentEquippedItem != null && player.getCurrentEquippedItem.getItem.isInstanceOf[ItemHandCrank])
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
mechanicalNode.torque = -mechanicalNode.torque
|
||||
mechanicalNode.angularVelocity = -mechanicalNode.angularVelocity
|
||||
}
|
||||
return true
|
||||
}
|
||||
return super.use(player, side, hit)
|
||||
}
|
||||
|
||||
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (!player.isSneaking)
|
||||
{
|
||||
if (getMultiBlock.isConstructed)
|
||||
{
|
||||
getMultiBlock.deconstruct
|
||||
}
|
||||
|
||||
override def update
|
||||
{
|
||||
super.update
|
||||
getMultiBlock.update
|
||||
if (getMultiBlock.isPrimary)
|
||||
multiBlockRadius += 1
|
||||
if (!getMultiBlock.construct)
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
mechanicalNode.angularVelocity = (power.asInstanceOf[Double] / mechanicalNode.torque).asInstanceOf[Float]
|
||||
}
|
||||
if (mechanicalNode.angularVelocity != 0)
|
||||
{
|
||||
playSound
|
||||
}
|
||||
}
|
||||
if (!worldObj.isRemote) power = 0
|
||||
}
|
||||
|
||||
protected def getMaxPower: Long =
|
||||
{
|
||||
if (this.getMultiBlock.isConstructed)
|
||||
{
|
||||
return (maxPower * getArea).asInstanceOf[Long]
|
||||
}
|
||||
return maxPower
|
||||
}
|
||||
|
||||
def getArea: Int =
|
||||
{
|
||||
return (((multiBlockRadius + 0.5) * 2) * ((multiBlockRadius + 0.5) * 2)).asInstanceOf[Int]
|
||||
}
|
||||
|
||||
/** Called to play sound effects */
|
||||
def playSound
|
||||
{
|
||||
}
|
||||
|
||||
/** Reads a tile entity from NBT. */
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(nbt)
|
||||
multiBlockRadius = nbt.getInteger("multiBlockRadius")
|
||||
tier = nbt.getInteger("tier")
|
||||
getMultiBlock.load(nbt)
|
||||
}
|
||||
|
||||
/** Writes a tile entity to NBT. */
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbt)
|
||||
nbt.setInteger("multiBlockRadius", multiBlockRadius)
|
||||
nbt.setInteger("tier", tier)
|
||||
getMultiBlock.save(nbt)
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) override def getRenderBoundingBox: AxisAlignedBB =
|
||||
{
|
||||
return AxisAlignedBB.getBoundingBox(this.xCoord - multiBlockRadius, this.yCoord - multiBlockRadius, this.zCoord - multiBlockRadius, this.xCoord + 1 + multiBlockRadius, this.yCoord + 1 + multiBlockRadius, this.zCoord + 1 + multiBlockRadius)
|
||||
}
|
||||
|
||||
def getMultiBlockVectors: java.lang.Iterable[Vector3] =
|
||||
{
|
||||
val vectors: Set[Vector3] = new HashSet[Vector3]
|
||||
val dir: ForgeDirection = getDirection
|
||||
val xMulti: Int = if (dir.offsetX != 0) 0 else 1
|
||||
val yMulti: Int = if (dir.offsetY != 0) 0 else 1
|
||||
val zMulti: Int = if (dir.offsetZ != 0) 0 else 1
|
||||
|
||||
for (x : Int <- -multiBlockRadius to multiBlockRadius)
|
||||
{
|
||||
for (y : Int <- -multiBlockRadius to multiBlockRadius)
|
||||
{
|
||||
|
||||
for (z : Int <- -multiBlockRadius to multiBlockRadius)
|
||||
{
|
||||
vectors.add(new Vector3(x * xMulti, y * yMulti, z * zMulti))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vectors
|
||||
}
|
||||
|
||||
def getPosition: Vector3 =
|
||||
{
|
||||
return toVector3
|
||||
}
|
||||
|
||||
def getMultiBlock: TurbineMBlockHandler =
|
||||
{
|
||||
if (multiBlock == null) multiBlock = new TurbineMBlockHandler(this)
|
||||
return multiBlock
|
||||
}
|
||||
|
||||
def onMultiBlockChanged
|
||||
{
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, if (getBlockType != null) getBlockType else null)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||
}
|
||||
|
||||
def getWorld: World =
|
||||
{
|
||||
return worldObj
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.getCurrentEquippedItem != null && player.getCurrentEquippedItem.getItem.isInstanceOf[ItemHandCrank])
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
mechanicalNode.torque = -mechanicalNode.torque
|
||||
mechanicalNode.angularVelocity = -mechanicalNode.angularVelocity
|
||||
}
|
||||
return true
|
||||
}
|
||||
return super.use(player, side, hit)
|
||||
}
|
||||
|
||||
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (!player.isSneaking)
|
||||
{
|
||||
if (getMultiBlock.isConstructed)
|
||||
{
|
||||
getMultiBlock.deconstruct
|
||||
multiBlockRadius += 1
|
||||
if (!getMultiBlock.construct)
|
||||
{
|
||||
multiBlockRadius = 1
|
||||
}
|
||||
return true
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!getMultiBlock.construct)
|
||||
{
|
||||
multiBlockRadius = 1
|
||||
getMultiBlock.construct
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val toFlip: Set[TileTurbine] = new HashSet[TileTurbine]
|
||||
if (!getMultiBlock.isConstructed)
|
||||
{
|
||||
toFlip.add(this)
|
||||
}
|
||||
else
|
||||
{
|
||||
val str: Set[TileTurbine] = getMultiBlock.getPrimary.getMultiBlock.getStructure
|
||||
if (str != null) toFlip.addAll(str)
|
||||
}
|
||||
import scala.collection.JavaConversions._
|
||||
for (turbine <- toFlip)
|
||||
{
|
||||
if (side == turbine.getDirection.ordinal) world.setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side ^ 1, 3)
|
||||
else world.setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side, 3)
|
||||
}
|
||||
multiBlockRadius = 1
|
||||
}
|
||||
return true
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!getMultiBlock.construct)
|
||||
{
|
||||
multiBlockRadius = 1
|
||||
getMultiBlock.construct
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
val toFlip: Set[TileTurbine] = new HashSet[TileTurbine]
|
||||
if (!getMultiBlock.isConstructed)
|
||||
{
|
||||
toFlip.add(this)
|
||||
}
|
||||
else
|
||||
{
|
||||
val str: Set[TileTurbine] = getMultiBlock.getPrimary.getMultiBlock.getStructure
|
||||
if (str != null) toFlip.addAll(str)
|
||||
}
|
||||
import scala.collection.JavaConversions._
|
||||
for (turbine <- toFlip)
|
||||
{
|
||||
if (side == turbine.getDirection.ordinal) world.setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side ^ 1, 3)
|
||||
else world.setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side, 3)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -7,124 +7,141 @@ import net.minecraft.init.{Blocks, Items}
|
|||
import net.minecraft.item.{Item, ItemStack}
|
||||
import net.minecraft.world.biome.{BiomeGenBase, BiomeGenOcean, BiomeGenPlains}
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraftforge.fluids.{FluidTankInfo, FluidStack, Fluid, FluidTank}
|
||||
import resonant.api.IBoilHandler
|
||||
import resonant.content.prefab.itemblock.ItemBlockMetadata
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonant.lib.utility.inventory.InventoryUtility
|
||||
import resonant.lib.wrapper.WrapList._
|
||||
import resonantinduction.core.Settings
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/** The vertical wind turbine collects airflow. The horizontal wind turbine collects steam from steam
|
||||
* power plants.
|
||||
*
|
||||
* @author Calclavia */
|
||||
class TileWindTurbine extends TileTurbine
|
||||
class TileWindTurbine extends TileTurbine with IBoilHandler
|
||||
{
|
||||
private final val openBlockCache: Array[Byte] = new Array[Byte](224)
|
||||
private var checkCount: Int = 0
|
||||
private var efficiency: Float = 0
|
||||
private var windPower: Long = 0
|
||||
private final val openBlockCache = new Array[Byte](224)
|
||||
private var checkCount = 0
|
||||
private var efficiency = 0f
|
||||
private var windTorque = 0d
|
||||
private val gasTank = new FluidTank(1000)
|
||||
|
||||
//Constructor
|
||||
this.itemBlock = classOf[ItemBlockMetadata]
|
||||
//Constructor
|
||||
this.itemBlock = classOf[ItemBlockMetadata]
|
||||
|
||||
override def update
|
||||
override def update()
|
||||
{
|
||||
super.update()
|
||||
|
||||
if (tier == 0 && getDirection.offsetY == 0 && worldObj.isRaining && worldObj.isThundering && worldObj.rand.nextFloat < 0.00000008)
|
||||
{
|
||||
if (tier == 0 && getDirection.offsetY == 0 && worldObj.isRaining && worldObj.isThundering && worldObj.rand.nextFloat < 0.00000008)
|
||||
InventoryUtility.dropItemStack(worldObj, new Vector3(x, y, z), new ItemStack(Blocks.wool, 1 + worldObj.rand.nextInt(2)))
|
||||
InventoryUtility.dropItemStack(worldObj, new Vector3(x, y, z), new ItemStack(Items.stick, 3 + worldObj.rand.nextInt(8)))
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord)
|
||||
}
|
||||
else if (!getMultiBlock.isPrimary)
|
||||
{
|
||||
if (getDirection.offsetY == 0)
|
||||
{
|
||||
if (ticks % 20 == 0 && !worldObj.isRemote)
|
||||
{
|
||||
InventoryUtility.dropItemStack(worldObj, new Vector3(x, y, z), new ItemStack(Blocks.wool, 1 + worldObj.rand.nextInt(2)))
|
||||
InventoryUtility.dropItemStack(worldObj, new Vector3(x, y, z), new ItemStack(Items.stick, 3 + worldObj.rand.nextInt(8)))
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord)
|
||||
}
|
||||
else if (!getMultiBlock.isPrimary)
|
||||
{
|
||||
if (getDirection.offsetY == 0)
|
||||
{
|
||||
maxPower = 3000
|
||||
if (ticks % 20 == 0 && !worldObj.isRemote)
|
||||
{
|
||||
computePower
|
||||
}
|
||||
getMultiBlock.get.power += windPower
|
||||
}
|
||||
else
|
||||
{
|
||||
maxPower = 10000
|
||||
}
|
||||
if (getMultiBlock.isConstructed)
|
||||
{
|
||||
mechanicalNode.torque = (defaultTorque / (9d / multiBlockRadius)).asInstanceOf[Long]
|
||||
}
|
||||
else
|
||||
{
|
||||
mechanicalNode.torque = defaultTorque / 12
|
||||
}
|
||||
super.update
|
||||
computePower()
|
||||
}
|
||||
|
||||
getMultiBlock.get.mechanicalNode.rotate(3000)
|
||||
}
|
||||
else
|
||||
{
|
||||
getMultiBlock.get.mechanicalNode.rotate(10000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def computePower()
|
||||
{
|
||||
val checkSize: Int = 10
|
||||
val height: Int = yCoord + checkCount / 28
|
||||
val deviation: Int = checkCount % 7
|
||||
var checkDir: ForgeDirection = null
|
||||
var check: Vector3 = null
|
||||
val cc: Int = checkCount / 7 % 4
|
||||
|
||||
if (cc == 0)
|
||||
{
|
||||
checkDir = ForgeDirection.NORTH
|
||||
check = new Vector3(xCoord - 3 + deviation, height, zCoord - 4)
|
||||
}
|
||||
else if (cc == 1)
|
||||
{
|
||||
checkDir = ForgeDirection.WEST
|
||||
check = new Vector3(xCoord - 4, height, zCoord - 3 + deviation)
|
||||
}
|
||||
else if (cc == 2)
|
||||
{
|
||||
checkDir = ForgeDirection.SOUTH
|
||||
check = new Vector3(xCoord - 3 + deviation, height, zCoord + 4)
|
||||
}
|
||||
else
|
||||
{
|
||||
checkDir = ForgeDirection.EAST
|
||||
check = new Vector3(xCoord + 4, height, zCoord - 3 + deviation)
|
||||
}
|
||||
var openAirBlocks: Int = 0
|
||||
while (openAirBlocks < checkSize && worldObj.isAirBlock(check.xi, check.yi, check.zi))
|
||||
{
|
||||
check.add(checkDir)
|
||||
openAirBlocks += 1
|
||||
}
|
||||
|
||||
private def computePower
|
||||
efficiency = efficiency - openBlockCache(checkCount) + openAirBlocks
|
||||
openBlockCache(checkCount) = openAirBlocks.asInstanceOf[Byte]
|
||||
checkCount = (checkCount + 1) % (openBlockCache.length - 1)
|
||||
val multiblockMultiplier: Float = (multiBlockRadius + 0.5f) * 2
|
||||
|
||||
var materialMultiplier: Float = 1
|
||||
if (tier == 0)
|
||||
{
|
||||
val checkSize: Int = 10
|
||||
val height: Int = yCoord + checkCount / 28
|
||||
val deviation: Int = checkCount % 7
|
||||
var checkDir: ForgeDirection = null
|
||||
var check: Vector3 = null
|
||||
val cc: Int = checkCount / 7 % 4
|
||||
|
||||
if (cc == 0)
|
||||
{
|
||||
checkDir = ForgeDirection.NORTH
|
||||
check = new Vector3(xCoord - 3 + deviation, height, zCoord - 4)
|
||||
} else if (cc == 1)
|
||||
{
|
||||
checkDir = ForgeDirection.WEST
|
||||
check = new Vector3(xCoord - 4, height, zCoord - 3 + deviation)
|
||||
} else if (cc == 2)
|
||||
{
|
||||
checkDir = ForgeDirection.SOUTH
|
||||
check = new Vector3(xCoord - 3 + deviation, height, zCoord + 4)
|
||||
} else
|
||||
{
|
||||
checkDir = ForgeDirection.EAST
|
||||
check = new Vector3(xCoord + 4, height, zCoord - 3 + deviation)
|
||||
}
|
||||
var openAirBlocks: Int = 0
|
||||
while (openAirBlocks < checkSize && worldObj.isAirBlock(check.xi, check.yi, check.zi))
|
||||
{
|
||||
check.add(checkDir)
|
||||
openAirBlocks += 1
|
||||
}
|
||||
efficiency = efficiency - openBlockCache(checkCount) + openAirBlocks
|
||||
openBlockCache(checkCount) = openAirBlocks.asInstanceOf[Byte]
|
||||
checkCount = (checkCount + 1) % (openBlockCache.length - 1)
|
||||
val multiblockMultiplier: Float = (multiBlockRadius + 0.5f) * 2
|
||||
|
||||
var materialMultiplier: Float = 1
|
||||
if (tier == 0)
|
||||
{
|
||||
materialMultiplier = 1.1f
|
||||
}
|
||||
else if (tier == 1)
|
||||
{
|
||||
materialMultiplier = 0.9f
|
||||
}
|
||||
else
|
||||
{
|
||||
materialMultiplier = 1
|
||||
}
|
||||
|
||||
val biome: BiomeGenBase = worldObj.getBiomeGenForCoords(xCoord, zCoord)
|
||||
val hasBonus: Boolean = biome.isInstanceOf[BiomeGenOcean] || biome.isInstanceOf[BiomeGenPlains] || biome == BiomeGenBase.river
|
||||
val windSpeed: Float = (worldObj.rand.nextFloat / 8) + (yCoord / 256f) * (if (hasBonus) 1.2f else 1) + worldObj.getRainStrength(1.5f)
|
||||
|
||||
windPower = Math.min(materialMultiplier * multiblockMultiplier * windSpeed * efficiency * Settings.WIND_POWER_RATIO, maxPower * Settings.WIND_POWER_RATIO).asInstanceOf[Long]
|
||||
materialMultiplier = 1.1f
|
||||
}
|
||||
else if (tier == 1)
|
||||
{
|
||||
materialMultiplier = 0.9f
|
||||
}
|
||||
else
|
||||
{
|
||||
materialMultiplier = 1
|
||||
}
|
||||
|
||||
override def getSubBlocks(par1: Item, par2CreativeTabs: CreativeTabs, par3List: List[_])
|
||||
val biome: BiomeGenBase = worldObj.getBiomeGenForCoords(xCoord, zCoord)
|
||||
val hasBonus: Boolean = biome.isInstanceOf[BiomeGenOcean] || biome.isInstanceOf[BiomeGenPlains] || biome == BiomeGenBase.river
|
||||
val windSpeed: Float = (worldObj.rand.nextFloat / 8) + (yCoord / 256f) * (if (hasBonus) 1.2f else 1) + worldObj.getRainStrength(1.5f)
|
||||
|
||||
windTorque = materialMultiplier * multiblockMultiplier * windSpeed * efficiency * Settings.WIND_POWER_RATIO
|
||||
}
|
||||
|
||||
override def getSubBlocks(par1: Item, par2CreativeTabs: CreativeTabs, par3List: List[_])
|
||||
{
|
||||
for (i <- 0 to 2)
|
||||
{
|
||||
for (i <- 0 to 2)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i))
|
||||
}
|
||||
par3List.add(new ItemStack(par1, 1, i))
|
||||
}
|
||||
}
|
||||
|
||||
override def canFill(from: ForgeDirection, fluid: Fluid): Boolean = from == ForgeDirection.DOWN && fluid.getName.contains("steam")
|
||||
|
||||
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int = gasTank.fill(resource, doFill)
|
||||
|
||||
override def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack = null
|
||||
|
||||
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = null
|
||||
|
||||
override def canDrain(from: ForgeDirection, fluid: Fluid): Boolean = false
|
||||
|
||||
override def getTankInfo(from: ForgeDirection): Array[FluidTankInfo] =
|
||||
{
|
||||
val re: Array[FluidTankInfo] = new Array[FluidTankInfo](1)
|
||||
re(1) = gasTank.getInfo
|
||||
return re
|
||||
}
|
||||
}
|
|
@ -9,9 +9,15 @@ import resonantinduction.mechanical.mech.grid.NodeMechanical
|
|||
*
|
||||
* @author Calclavia, Darkguardsman
|
||||
*/
|
||||
class TurbineNode(tileTurbineBase: TileTurbine) extends NodeMechanical(tileTurbineBase)
|
||||
class TurbineNode(parent: TileTurbine) extends NodeMechanical(parent)
|
||||
{
|
||||
|
||||
/**
|
||||
* Moment of inertia = m * r * r
|
||||
* Where "m" is the mass and "r" is the radius of the object.
|
||||
*/
|
||||
override def momentOfInertia = parent.multiBlockRadius * parent.multiBlockRadius
|
||||
|
||||
def turbine: TileTurbine =
|
||||
{
|
||||
return getParent.asInstanceOf[TileTurbine]
|
||||
|
@ -26,5 +32,5 @@ class TurbineNode(tileTurbineBase: TileTurbine) extends NodeMechanical(tileTurbi
|
|||
override def inverseRotation(dir: ForgeDirection): Boolean =
|
||||
{
|
||||
return dir == turbine.getDirection.getOpposite
|
||||
}*/
|
||||
} */
|
||||
}
|
Loading…
Add table
Reference in a new issue