Removed IVector
This commit is contained in:
parent
a46277b9a0
commit
cb3e2de7f8
|
@ -142,6 +142,28 @@ class TileImprinter extends ResonantTile(Material.circuits) with ISidedInventory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor
|
||||
* sections).
|
||||
*/
|
||||
def setInventorySlotContents(slot: Int, itemStack: ItemStack)
|
||||
{
|
||||
if (slot < this.getSizeInventory)
|
||||
{
|
||||
inventory(slot) = itemStack
|
||||
}
|
||||
}
|
||||
|
||||
def getSizeInventory: Int =
|
||||
{
|
||||
return this.inventory.length
|
||||
}
|
||||
|
||||
def getStackInSlot(slot: Int): ItemStack =
|
||||
{
|
||||
return this.inventory(slot)
|
||||
}
|
||||
|
||||
/**
|
||||
* When some containers are closed they call this on each slot, then drop whatever it returns as
|
||||
* an EntityItem - like when you close a workbench GUI.
|
||||
|
@ -248,16 +270,16 @@ class TileImprinter extends ResonantTile(Material.circuits) with ISidedInventory
|
|||
return this.isItemValidForSlot(slot, itemstack)
|
||||
}
|
||||
|
||||
def canExtractItem(slot: Int, itemstack: ItemStack, side: Int): Boolean =
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack)
|
||||
}
|
||||
|
||||
def isItemValidForSlot(i: Int, itemstack: ItemStack): Boolean =
|
||||
{
|
||||
return true
|
||||
}
|
||||
|
||||
def canExtractItem(slot: Int, itemstack: ItemStack, side: Int): Boolean =
|
||||
{
|
||||
return this.isItemValidForSlot(slot, itemstack)
|
||||
}
|
||||
|
||||
override def renderDynamic(position: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
GL11.glPushMatrix
|
||||
|
@ -348,12 +370,12 @@ class TileImprinter extends ResonantTile(Material.circuits) with ISidedInventory
|
|||
InventoryUtility.dropItemStack(world, new Vector3(player), checkStack, 0)
|
||||
inventory(slotID) = null
|
||||
}
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -374,31 +396,9 @@ class TileImprinter extends ResonantTile(Material.circuits) with ISidedInventory
|
|||
return false
|
||||
}
|
||||
|
||||
def getStackInSlot(slot: Int): ItemStack =
|
||||
{
|
||||
return this.inventory(slot)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor
|
||||
* sections).
|
||||
*/
|
||||
def setInventorySlotContents(slot: Int, itemStack: ItemStack)
|
||||
{
|
||||
if (slot < this.getSizeInventory)
|
||||
{
|
||||
inventory(slot) = itemStack
|
||||
}
|
||||
}
|
||||
|
||||
def getSizeInventory: Int =
|
||||
{
|
||||
return this.inventory.length
|
||||
}
|
||||
|
||||
override def onNeighborChanged(block: Block)
|
||||
{
|
||||
val b: Block = toVectorWorld.add(ForgeDirection.getOrientation(1)).getBlock
|
||||
val b: Block = (position + ForgeDirection.getOrientation(1)).getBlock
|
||||
if (Blocks.piston_head eq b)
|
||||
{
|
||||
onInventoryChanged
|
||||
|
|
|
@ -36,7 +36,7 @@ class TileTurntable extends ResonantBlock(Material.piston) with TRotatable
|
|||
|
||||
override def update()
|
||||
{
|
||||
updateTurntableState(world, xi, yi, zi)
|
||||
updateTurntableState(world, x, y, z)
|
||||
}
|
||||
|
||||
private def updateTurntableState(world: World, x: Int, y: Int, z: Int)
|
||||
|
|
|
@ -129,6 +129,129 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
|
|||
}
|
||||
}
|
||||
|
||||
override def getSizeInventory: Int =
|
||||
{
|
||||
return 10 + (if (this.invPlayer != null) this.invPlayer.getSizeInventory else 0)
|
||||
}
|
||||
|
||||
override def setInventorySlotContents(slot: Int, itemStack: ItemStack)
|
||||
{
|
||||
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
{
|
||||
craftingMatrix(slot) = itemStack
|
||||
}
|
||||
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
|
||||
{
|
||||
outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END) = itemStack
|
||||
}
|
||||
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && this.invPlayer != null)
|
||||
{
|
||||
this.invPlayer.setInventorySlotContents(slot - TileEngineeringTable.CRAFTING_OUTPUT_END, itemStack)
|
||||
val player: EntityPlayer = this.invPlayer.player
|
||||
if (player.isInstanceOf[EntityPlayerMP])
|
||||
{
|
||||
(player.asInstanceOf[EntityPlayerMP]).sendContainerToPlayer(player.inventoryContainer)
|
||||
}
|
||||
}
|
||||
else if (searchInventories)
|
||||
{
|
||||
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val tile: TileEntity = position.add(dir).getTileEntity
|
||||
if (tile.isInstanceOf[IInventory])
|
||||
{
|
||||
val inventory: IInventory = tile.asInstanceOf[IInventory]
|
||||
val slotID: Int = slot - idDisplacement
|
||||
if (slotID >= 0 && slotID < inventory.getSizeInventory)
|
||||
{
|
||||
inventory.setInventorySlotContents(slotID, itemStack)
|
||||
}
|
||||
idDisplacement += inventory.getSizeInventory
|
||||
}
|
||||
}
|
||||
}
|
||||
onInventoryChanged
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all the output slots. Call this to update the Engineering Table.
|
||||
*/
|
||||
override def onInventoryChanged
|
||||
{
|
||||
if (worldObj != null)
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = null
|
||||
var didCraft: Boolean = false
|
||||
val inventoryCrafting: InventoryCrafting = this.getCraftingMatrix
|
||||
val matrixOutput: ItemStack = CraftingManager.getInstance.findMatchingRecipe(inventoryCrafting, this.worldObj)
|
||||
if (matrixOutput != null && this.getCraftingManager.getIdealRecipe(matrixOutput) != null)
|
||||
{
|
||||
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = matrixOutput
|
||||
didCraft = true
|
||||
}
|
||||
if (!didCraft)
|
||||
{
|
||||
val filterStack: ItemStack = craftingMatrix(TileEngineeringTable.CENTER_SLOT)
|
||||
if (filterStack != null && filterStack.getItem.isInstanceOf[ItemImprint])
|
||||
{
|
||||
val filters: java.util.List[ItemStack] = ItemImprint.getFilters(filterStack)
|
||||
for (o <- filters)
|
||||
{
|
||||
val outputStack: ItemStack = o
|
||||
if (outputStack != null)
|
||||
{
|
||||
val idealRecipe: Pair[ItemStack, Array[ItemStack]] = this.getCraftingManager.getIdealRecipe(outputStack)
|
||||
if (idealRecipe != null)
|
||||
{
|
||||
val recipeOutput: ItemStack = idealRecipe.left
|
||||
if (recipeOutput != null & recipeOutput.stackSize > 0)
|
||||
{
|
||||
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = recipeOutput
|
||||
didCraft = true
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AutoCraftingManager that does all the crafting results
|
||||
*/
|
||||
def getCraftingManager: AutoCraftingManager =
|
||||
{
|
||||
if (craftManager == null)
|
||||
{
|
||||
craftManager = new AutoCraftingManager(this)
|
||||
}
|
||||
return craftManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an InventoryCrafting Matrix on the fly.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
def getCraftingMatrix: InventoryCrafting =
|
||||
{
|
||||
val inventoryCrafting: InventoryCrafting = new InventoryCrafting(new ContainerDummy(this), 3, 3)
|
||||
|
||||
for (i <- 0 until this.craftingMatrix.length)
|
||||
{
|
||||
inventoryCrafting.setInventorySlotContents(i, this.craftingMatrix(i))
|
||||
}
|
||||
return inventoryCrafting
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, hitSide: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.getCurrentEquippedItem != null && player.getCurrentEquippedItem.getItem.isInstanceOf[ItemHammer])
|
||||
|
@ -292,7 +415,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
|
|||
|
||||
override def onRemove(block: Block, par6: Int)
|
||||
{
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, xi, yi, zi)
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, x, y, z)
|
||||
InventoryUtility.dropItemStack(world, center, stack)
|
||||
}
|
||||
|
||||
|
@ -330,49 +453,6 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
|
|||
nbt.setBoolean("searchInventories", this.searchInventories)
|
||||
}
|
||||
|
||||
override def getSizeInventory: Int =
|
||||
{
|
||||
return 10 + (if (this.invPlayer != null) this.invPlayer.getSizeInventory else 0)
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS INTERNALLY. FOR EXTERNAL USE ONLY!
|
||||
*/
|
||||
override def getStackInSlot(slot: Int): ItemStack =
|
||||
{
|
||||
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
{
|
||||
return this.craftingMatrix(slot)
|
||||
}
|
||||
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
|
||||
{
|
||||
return outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
}
|
||||
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && invPlayer != null)
|
||||
{
|
||||
return this.invPlayer.getStackInSlot(slot - TileEngineeringTable.CRAFTING_OUTPUT_END)
|
||||
}
|
||||
else if (searchInventories)
|
||||
{
|
||||
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
|
||||
if (tile.isInstanceOf[IInventory])
|
||||
{
|
||||
val inventory: IInventory = tile.asInstanceOf[IInventory]
|
||||
val slotID: Int = slot - idDisplacement
|
||||
if (slotID >= 0 && slotID < inventory.getSizeInventory)
|
||||
{
|
||||
return inventory.getStackInSlot(slotID)
|
||||
}
|
||||
idDisplacement += inventory.getSizeInventory
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
def read(data: ByteBuf, player: EntityPlayer, `type`: PacketType)
|
||||
{
|
||||
try
|
||||
|
@ -456,124 +536,6 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
|
|||
}
|
||||
}
|
||||
|
||||
override def setInventorySlotContents(slot: Int, itemStack: ItemStack)
|
||||
{
|
||||
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
{
|
||||
craftingMatrix(slot) = itemStack
|
||||
}
|
||||
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
|
||||
{
|
||||
outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END) = itemStack
|
||||
}
|
||||
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && this.invPlayer != null)
|
||||
{
|
||||
this.invPlayer.setInventorySlotContents(slot - TileEngineeringTable.CRAFTING_OUTPUT_END, itemStack)
|
||||
val player: EntityPlayer = this.invPlayer.player
|
||||
if (player.isInstanceOf[EntityPlayerMP])
|
||||
{
|
||||
(player.asInstanceOf[EntityPlayerMP]).sendContainerToPlayer(player.inventoryContainer)
|
||||
}
|
||||
}
|
||||
else if (searchInventories)
|
||||
{
|
||||
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
|
||||
if (tile.isInstanceOf[IInventory])
|
||||
{
|
||||
val inventory: IInventory = tile.asInstanceOf[IInventory]
|
||||
val slotID: Int = slot - idDisplacement
|
||||
if (slotID >= 0 && slotID < inventory.getSizeInventory)
|
||||
{
|
||||
inventory.setInventorySlotContents(slotID, itemStack)
|
||||
}
|
||||
idDisplacement += inventory.getSizeInventory
|
||||
}
|
||||
}
|
||||
}
|
||||
onInventoryChanged
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates all the output slots. Call this to update the Engineering Table.
|
||||
*/
|
||||
override def onInventoryChanged
|
||||
{
|
||||
if (worldObj != null)
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = null
|
||||
var didCraft: Boolean = false
|
||||
val inventoryCrafting: InventoryCrafting = this.getCraftingMatrix
|
||||
val matrixOutput: ItemStack = CraftingManager.getInstance.findMatchingRecipe(inventoryCrafting, this.worldObj)
|
||||
if (matrixOutput != null && this.getCraftingManager.getIdealRecipe(matrixOutput) != null)
|
||||
{
|
||||
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = matrixOutput
|
||||
didCraft = true
|
||||
}
|
||||
if (!didCraft)
|
||||
{
|
||||
val filterStack: ItemStack = craftingMatrix(TileEngineeringTable.CENTER_SLOT)
|
||||
if (filterStack != null && filterStack.getItem.isInstanceOf[ItemImprint])
|
||||
{
|
||||
val filters: java.util.List[ItemStack] = ItemImprint.getFilters(filterStack)
|
||||
for (o <- filters)
|
||||
{
|
||||
val outputStack: ItemStack = o
|
||||
if (outputStack != null)
|
||||
{
|
||||
val idealRecipe: Pair[ItemStack, Array[ItemStack]] = this.getCraftingManager.getIdealRecipe(outputStack)
|
||||
if (idealRecipe != null)
|
||||
{
|
||||
val recipeOutput: ItemStack = idealRecipe.left
|
||||
if (recipeOutput != null & recipeOutput.stackSize > 0)
|
||||
{
|
||||
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = recipeOutput
|
||||
didCraft = true
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AutoCraftingManager that does all the crafting results
|
||||
*/
|
||||
def getCraftingManager: AutoCraftingManager =
|
||||
{
|
||||
if (craftManager == null)
|
||||
{
|
||||
craftManager = new AutoCraftingManager(this)
|
||||
}
|
||||
return craftManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an InventoryCrafting Matrix on the fly.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
def getCraftingMatrix: InventoryCrafting =
|
||||
{
|
||||
val inventoryCrafting: InventoryCrafting = new InventoryCrafting(new ContainerDummy(this), 3, 3)
|
||||
|
||||
for (i <- 0 until this.craftingMatrix.length)
|
||||
{
|
||||
inventoryCrafting.setInventorySlotContents(i, this.craftingMatrix(i))
|
||||
}
|
||||
return inventoryCrafting
|
||||
}
|
||||
|
||||
override def isItemValidForSlot(i: Int, itemstack: ItemStack): Boolean =
|
||||
{
|
||||
return true
|
||||
|
@ -621,6 +583,44 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
|
|||
return slot == optimalSlot
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS INTERNALLY. FOR EXTERNAL USE ONLY!
|
||||
*/
|
||||
override def getStackInSlot(slot: Int): ItemStack =
|
||||
{
|
||||
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
{
|
||||
return this.craftingMatrix(slot)
|
||||
}
|
||||
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
|
||||
{
|
||||
return outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
}
|
||||
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && invPlayer != null)
|
||||
{
|
||||
return this.invPlayer.getStackInSlot(slot - TileEngineeringTable.CRAFTING_OUTPUT_END)
|
||||
}
|
||||
else if (searchInventories)
|
||||
{
|
||||
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val tile: TileEntity = position.add(dir).getTileEntity
|
||||
if (tile.isInstanceOf[IInventory])
|
||||
{
|
||||
val inventory: IInventory = tile.asInstanceOf[IInventory]
|
||||
val slotID: Int = slot - idDisplacement
|
||||
if (slotID >= 0 && slotID < inventory.getSizeInventory)
|
||||
{
|
||||
return inventory.getStackInSlot(slotID)
|
||||
}
|
||||
idDisplacement += inventory.getSizeInventory
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override def canExtractItem(slot: Int, itemstack: ItemStack, side: Int): Boolean =
|
||||
{
|
||||
val outputStack: ItemStack = getStackInSlot(TileEngineeringTable.CRAFTING_MATRIX_END)
|
||||
|
@ -648,7 +648,7 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
|
|||
var temporaryInvID: Int = TileEngineeringTable.PLAYER_OUTPUT_END
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity(worldObj)
|
||||
val tile: TileEntity = position.add(dir).getTileEntity(worldObj)
|
||||
if (tile.isInstanceOf[IInventory])
|
||||
{
|
||||
val inventory: IInventory = tile.asInstanceOf[IInventory]
|
||||
|
|
|
@ -92,7 +92,7 @@ class TileGrate extends TileFluidProvider(Material.rock) with TRotatable
|
|||
if (gratePath == null)
|
||||
{
|
||||
gratePath = new GratePathfinder(true)
|
||||
gratePath.startFill(toVectorWorld, fluidNode.getFluid.getFluid.getID)
|
||||
gratePath.startFill(position, fluidNode.getFluid.getFluid.getID)
|
||||
}
|
||||
val filledInWorld = gratePath.tryFill(fluidNode.getFluidAmount, blockEffect)
|
||||
fluidNode.drain(filledInWorld, true)
|
||||
|
@ -107,7 +107,7 @@ class TileGrate extends TileFluidProvider(Material.rock) with TRotatable
|
|||
if (gratePath == null)
|
||||
{
|
||||
gratePath = new GratePathfinder(false)
|
||||
if (!gratePath.startDrain(toVector3))
|
||||
if (!gratePath.startDrain(position))
|
||||
{
|
||||
resetPath()
|
||||
}
|
||||
|
@ -235,29 +235,6 @@ class TileGrate extends TileFluidProvider(Material.rock) with TRotatable
|
|||
}
|
||||
}
|
||||
|
||||
def isConnected(nCheck: Vector3): Boolean =
|
||||
{
|
||||
var check = nCheck
|
||||
|
||||
if (check.equals(start))
|
||||
return true
|
||||
|
||||
//Trace back in the navigation map to see if it reaches the starting point
|
||||
do
|
||||
{
|
||||
check = navigationMap.get(check)
|
||||
|
||||
if (check.equals(null))
|
||||
return false
|
||||
|
||||
if (check.equals(start))
|
||||
return true
|
||||
}
|
||||
while (FluidUtility.getFluidFromBlock(TileGrate.this.worldObj, check) != null && fluidType.getID == FluidUtility.getFluidFromBlock(TileGrate.this.worldObj, check).getID)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
def startDrain(start: Vector3): Boolean =
|
||||
{
|
||||
fluidType = null
|
||||
|
@ -369,6 +346,29 @@ class TileGrate extends TileFluidProvider(Material.rock) with TRotatable
|
|||
}
|
||||
null
|
||||
}
|
||||
|
||||
def isConnected(nCheck: Vector3): Boolean =
|
||||
{
|
||||
var check = nCheck
|
||||
|
||||
if (check.equals(start))
|
||||
return true
|
||||
|
||||
//Trace back in the navigation map to see if it reaches the starting point
|
||||
do
|
||||
{
|
||||
check = navigationMap.get(check)
|
||||
|
||||
if (check.equals(null))
|
||||
return false
|
||||
|
||||
if (check.equals(start))
|
||||
return true
|
||||
}
|
||||
while (FluidUtility.getFluidFromBlock(TileGrate.this.worldObj, check) != null && fluidType.getID == FluidUtility.getFluidFromBlock(TileGrate.this.worldObj, check).getID)
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
class ComparableVector(var position: Vector3, var iterations: Int) extends Comparable[ComparableVector]
|
||||
|
|
|
@ -102,7 +102,7 @@ class TileGutter extends TileFluidProvider(Material.rock)
|
|||
{
|
||||
val dir: ForgeDirection = ForgeDirection.getOrientation(i)
|
||||
val pressure: Int = fluidNode.asInstanceOf[NodeFluidPressure].pressure(dir)
|
||||
val pos: Vector3 = toVector3.add(dir)
|
||||
val pos: Vector3 = position.add(dir)
|
||||
val checkTile: TileEntity = pos.getTileEntity(world)
|
||||
|
||||
if (checkTile.isInstanceOf[TileGutter])
|
||||
|
@ -147,7 +147,7 @@ class TileGutter extends TileFluidProvider(Material.rock)
|
|||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
val posAbove = toVectorWorld + new Vector3(0, 1, 0)
|
||||
val posAbove = position + new Vector3(0, 1, 0)
|
||||
val blockAbove = posAbove.getBlock
|
||||
val tanks = findAllTanks
|
||||
|
||||
|
@ -214,34 +214,6 @@ class TileGutter extends TileFluidProvider(Material.rock)
|
|||
render(0, 0x0)
|
||||
}
|
||||
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
|
||||
render(0, clientRenderMask)
|
||||
|
||||
if (world != null)
|
||||
{
|
||||
val tank: IFluidTank = fluidNode
|
||||
val percentageFilled = tank.getFluidAmount / tank.getCapacity.toDouble
|
||||
|
||||
if (percentageFilled > 0.1)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glScaled(0.99, 0.99, 0.99)
|
||||
val ySouthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, toVectorWorld, ForgeDirection.SOUTH, ForgeDirection.EAST)
|
||||
val yNorthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, toVectorWorld, ForgeDirection.NORTH, ForgeDirection.EAST)
|
||||
val ySouthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, toVectorWorld, ForgeDirection.SOUTH, ForgeDirection.WEST)
|
||||
val yNorthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, toVectorWorld, ForgeDirection.NORTH, ForgeDirection.WEST)
|
||||
FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest)
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
def render(meta: Int, sides: Int)
|
||||
{
|
||||
RenderUtility.bind(TileGutter.texture)
|
||||
|
@ -276,6 +248,34 @@ class TileGutter extends TileFluidProvider(Material.rock)
|
|||
}
|
||||
}
|
||||
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
|
||||
render(0, clientRenderMask)
|
||||
|
||||
if (world != null)
|
||||
{
|
||||
val tank: IFluidTank = fluidNode
|
||||
val percentageFilled = tank.getFluidAmount / tank.getCapacity.toDouble
|
||||
|
||||
if (percentageFilled > 0.1)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glScaled(0.99, 0.99, 0.99)
|
||||
val ySouthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, position, ForgeDirection.SOUTH, ForgeDirection.EAST)
|
||||
val yNorthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, position, ForgeDirection.NORTH, ForgeDirection.EAST)
|
||||
val ySouthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, position, ForgeDirection.SOUTH, ForgeDirection.WEST)
|
||||
val yNorthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileGutter], percentageFilled, world, position, ForgeDirection.NORTH, ForgeDirection.WEST)
|
||||
FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest)
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
//Recurse through all gutter blocks
|
||||
private def findGutters(traverse: Set[NodeGutter] = Set(fluidNode.asInstanceOf[NodeGutter])): Set[NodeGutter] =
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ class TileTank extends TileFluidProvider(Material.iron) with ISneakPickup with R
|
|||
|
||||
if (result == 0)
|
||||
{
|
||||
val tile = (toVectorWorld + new Vector3(0, 1, 0)).getTileEntity
|
||||
val tile = (position + new Vector3(0, 1, 0)).getTileEntity
|
||||
|
||||
if (tile.isInstanceOf[TileTank])
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ class TileTank extends TileFluidProvider(Material.iron) with ISneakPickup with R
|
|||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
return FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side)
|
||||
return FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side)
|
||||
}
|
||||
|
||||
return true
|
||||
|
@ -124,10 +124,10 @@ class TileTank extends TileFluidProvider(Material.iron) with ISneakPickup with R
|
|||
GL11.glScaled(0.99, 0.99, 0.99)
|
||||
val tank: IFluidTank = fluidNode.getTank
|
||||
val percentageFilled: Double = tank.getFluidAmount.toDouble / tank.getCapacity.toDouble
|
||||
val ySouthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.SOUTH, ForgeDirection.EAST)
|
||||
val yNorthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.NORTH, ForgeDirection.EAST)
|
||||
val ySouthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.SOUTH, ForgeDirection.WEST)
|
||||
val yNorthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, toVector3, ForgeDirection.NORTH, ForgeDirection.WEST)
|
||||
val ySouthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, position, ForgeDirection.SOUTH, ForgeDirection.EAST)
|
||||
val yNorthEast = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, position, ForgeDirection.NORTH, ForgeDirection.EAST)
|
||||
val ySouthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, position, ForgeDirection.SOUTH, ForgeDirection.WEST)
|
||||
val yNorthWest = FluidUtility.getAveragePercentageFilledForSides(classOf[TileTank], percentageFilled, world, position, ForgeDirection.NORTH, ForgeDirection.WEST)
|
||||
FluidRenderUtility.renderFluidTesselation(tank, ySouthEast, yNorthEast, ySouthWest, yNorthWest)
|
||||
}
|
||||
GL11.glPopMatrix()
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.entity.Entity
|
|||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.world.World
|
||||
import resonantengine.api.transform.vector.IVector3
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
import resonantengine.lib.utility.nbt.NBTUtility
|
||||
import resonantengine.prefab.block.itemblock.ItemBlockSaved
|
||||
|
@ -25,7 +24,7 @@ class ItemGlassJar(block: Block) extends ItemBlockSaved(block) with TAlloyItem
|
|||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
val currLook = new Vector3(player.getLookVec).asInstanceOf[IVector3]
|
||||
val currLook = new Vector3(player.getLookVec).asInstanceOf[Vector3]
|
||||
|
||||
if (lastLook == null)
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ class TileGlassJar extends ResonantTile(Material.wood) with TPacketReceiver with
|
|||
|
||||
override def onRemove(block: Block, par6: Int)
|
||||
{
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, xi, yi, zi)
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, x, y, z)
|
||||
InventoryUtility.dropItemStack(world, center, stack)
|
||||
}
|
||||
|
||||
|
@ -112,20 +112,6 @@ class TileGlassJar extends ResonantTile(Material.wood) with TPacketReceiver with
|
|||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
renderMixture()
|
||||
GL11.glPopMatrix()
|
||||
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.8, pos.z + 0.5)
|
||||
renderJar()
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
def renderMixture(itemStack: ItemStack = null)
|
||||
{
|
||||
val alloy: Alloy =
|
||||
|
@ -193,6 +179,20 @@ class TileGlassJar extends ResonantTile(Material.wood) with TPacketReceiver with
|
|||
RenderUtility.disableBlending()
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
renderMixture()
|
||||
GL11.glPopMatrix()
|
||||
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.8, pos.z + 0.5)
|
||||
renderJar()
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override protected def getTextureName: String = textureName
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class TileSieve extends ResonantTile(Material.wood) with TInventory with TPacket
|
|||
|
||||
override def onRemove(block: Block, par6: Int)
|
||||
{
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, xi, yi, zi)
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(block, world, x, y, z)
|
||||
InventoryUtility.dropItemStack(world, center, stack)
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ class TileCastingMold extends TileInventory(Material.rock) with IFluidHandler wi
|
|||
|
||||
override def update
|
||||
{
|
||||
val checkPos: Vector3 = toVector3.add(0, 1, 0)
|
||||
val checkPos: Vector3 = position.add(0, 1, 0)
|
||||
val drainStack: FluidStack = FluidUtility.drainBlock(worldObj, checkPos, false)
|
||||
if (MachineRecipes.instance.getOutput(RecipeType.SMELTER.name, drainStack).length > 0)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
|
||||
if (burnTime > 0)
|
||||
{
|
||||
if (block.isAir(world, xi, yi + 1, zi))
|
||||
if (block.isAir(world, x, y + 1, z))
|
||||
{
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, Blocks.fire)
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
{
|
||||
if (FluidRegistry.getFluid("steam") != null)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new BoilEvent(worldObj, toVectorWorld.add(0, 1, 0), new FluidStack(FluidRegistry.WATER, volume), new FluidStack(FluidRegistry.getFluid("steam"), volume), 2, false))
|
||||
MinecraftForge.EVENT_BUS.post(new BoilEvent(worldObj, position.add(0, 1, 0), new FluidStack(FluidRegistry.WATER, volume), new FluidStack(FluidRegistry.getFluid("steam"), volume), 2, false))
|
||||
boiledVolume += volume
|
||||
}
|
||||
if (boiledVolume >= FluidContainerRegistry.BUCKET_VOLUME)
|
||||
|
@ -161,11 +161,6 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
return this.getBlockMetadata == 1
|
||||
}
|
||||
|
||||
def canBurn(stack: ItemStack): Boolean =
|
||||
{
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0
|
||||
}
|
||||
|
||||
override def randomDisplayTick(): Unit =
|
||||
{
|
||||
if (isBurning)
|
||||
|
@ -191,11 +186,13 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
}
|
||||
}
|
||||
|
||||
def isBurning: Boolean = burnTime > 0
|
||||
|
||||
override def getSizeInventory = 1
|
||||
|
||||
def getMeltIronEnergy(volume: Float): Double =
|
||||
{
|
||||
val temperatureChange: Float = 1811 - ThermalPhysics.getDefaultTemperature(toVectorWorld)
|
||||
val temperatureChange: Float = 1811 - ThermalPhysics.getDefaultTemperature(position)
|
||||
val mass: Float = ThermalPhysics.getMass(volume, 7.9f)
|
||||
return ThermalPhysics.getEnergyForTemperatureChange(mass, 450, temperatureChange) + ThermalPhysics.getEnergyForStateChange(mass, 272000)
|
||||
}
|
||||
|
@ -205,6 +202,11 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
return i == 0 && canBurn(itemStack)
|
||||
}
|
||||
|
||||
def canBurn(stack: ItemStack): Boolean =
|
||||
{
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method
|
||||
* Be sure to super this method or manually write the id into the packet when sending
|
||||
|
@ -295,8 +297,6 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
return if (isBurning) (if (isElectric) ResonantBlock.icon.get("firebox_electric_side_on") else ResonantBlock.icon.get("firebox_side_on")) else (if (isElectric) ResonantBlock.icon.get("firebox_electric_side_off") else ResonantBlock.icon.get("firebox_side_off"))
|
||||
}
|
||||
|
||||
def isBurning: Boolean = burnTime > 0
|
||||
|
||||
override def click(player: EntityPlayer)
|
||||
{
|
||||
if (server)
|
||||
|
@ -307,7 +307,7 @@ class TileFirebox extends ResonantTile(Material.rock) with IFluidHandler with TI
|
|||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side))
|
||||
if (FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side))
|
||||
{
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -85,6 +85,24 @@ class TileHotPlate extends ResonantTile(Material.iron) with TInventory with TPac
|
|||
}
|
||||
}
|
||||
|
||||
def canSmelt(stack: ItemStack): Boolean = stack != null && FurnaceRecipes.smelting.getSmeltingResult(stack) != null
|
||||
|
||||
override def getSizeInventory: Int = 4
|
||||
|
||||
def canRun: Boolean =
|
||||
{
|
||||
val tileEntity = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)
|
||||
|
||||
if (tileEntity.isInstanceOf[TileFirebox])
|
||||
{
|
||||
if ((tileEntity.asInstanceOf[TileFirebox]).isBurning)
|
||||
{
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override def randomDisplayTick()
|
||||
{
|
||||
val height = 0.2
|
||||
|
@ -122,8 +140,6 @@ class TileHotPlate extends ResonantTile(Material.iron) with TInventory with TPac
|
|||
return i < getSizeInventory && canSmelt(itemStack)
|
||||
}
|
||||
|
||||
def canSmelt(stack: ItemStack): Boolean = stack != null && FurnaceRecipes.smelting.getSmeltingResult(stack) != null
|
||||
|
||||
override def write(buf: ByteBuf, id: Int)
|
||||
{
|
||||
super.write(buf, id)
|
||||
|
@ -157,8 +173,6 @@ class TileHotPlate extends ResonantTile(Material.iron) with TInventory with TPac
|
|||
|
||||
}
|
||||
|
||||
override def getSizeInventory: Int = 4
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(iconReg: IIconRegister)
|
||||
{
|
||||
|
@ -172,21 +186,7 @@ class TileHotPlate extends ResonantTile(Material.iron) with TInventory with TPac
|
|||
*/
|
||||
override def getIcon(access: IBlockAccess, side: Int): IIcon =
|
||||
{
|
||||
return if (access.getBlockMetadata(xi, yi, zi) == 1) ResonantBlock.icon.get("electricHotPlate") else (if (canRun) ResonantBlock.icon.get("hotPlate_on") else ResonantBlock.icon.get(getTextureName))
|
||||
}
|
||||
|
||||
def canRun: Boolean =
|
||||
{
|
||||
val tileEntity = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)
|
||||
|
||||
if (tileEntity.isInstanceOf[TileFirebox])
|
||||
{
|
||||
if ((tileEntity.asInstanceOf[TileFirebox]).isBurning)
|
||||
{
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return if (access.getBlockMetadata(x, y, z) == 1) ResonantBlock.icon.get("electricHotPlate") else (if (canRun) ResonantBlock.icon.get("hotPlate_on") else ResonantBlock.icon.get(getTextureName))
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -8,6 +8,7 @@ import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry}
|
|||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import edx.basic.process.smelting.firebox.{RenderHotPlate, TileHotPlate}
|
||||
import edx.basic.process.smelting.{RenderCastingMold, TileCastingMold}
|
||||
import edx.core.fx.FXElectricBolt
|
||||
import edx.electrical.ElectricalContent
|
||||
import edx.electrical.multimeter.{GuiMultimeter, PartMultimeter, RenderMultimeter}
|
||||
import edx.electrical.tesla.{RenderTesla, TileTesla}
|
||||
|
@ -33,7 +34,6 @@ import net.minecraft.client.particle.{EntityDiggingFX, EntityFX}
|
|||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.world.World
|
||||
import resonantengine.lib.render.fx.FXElectricBolt2
|
||||
import resonantengine.lib.render.wrapper.ItemRenderHandler
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
|
||||
|
@ -145,7 +145,7 @@ import resonantengine.lib.transform.vector.Vector3
|
|||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
FMLClientHandler.instance.getClient.effectRenderer.addEffect(new FXElectricBolt2(world, start, target, split).setColor(r, g, b))
|
||||
FMLClientHandler.instance.getClient.effectRenderer.addEffect(new FXElectricBolt(world, start, target, split).setColor(r, g, b))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,447 @@
|
|||
package edx.core.fx;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import resonantengine.core.Reference;
|
||||
import resonantengine.lib.transform.rotation.Quaternion;
|
||||
import resonantengine.lib.transform.vector.Vector3;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
/**
|
||||
* Electric shock Fxs.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FXElectricBolt extends EntityFX
|
||||
{
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "fadedSphere.png");
|
||||
public static final ResourceLocation PARTICLE_RESOURCE = new ResourceLocation("textures/particle/particles.png");
|
||||
private final Map<Integer, Integer> parentIDMap = new HashMap<>();
|
||||
/**
|
||||
* The maximum length of the bolt
|
||||
*/
|
||||
public double boltLength;
|
||||
/**
|
||||
* Determines how complex the bolt is.
|
||||
*/
|
||||
public float complexity;
|
||||
public int segmentCount;
|
||||
/**
|
||||
* The width of the electrical bolt.
|
||||
*/
|
||||
private float boltWidth;
|
||||
/**
|
||||
* Electric Bolt's start and end positions;
|
||||
*/
|
||||
private BoltPoint start;
|
||||
private BoltPoint end;
|
||||
/**
|
||||
* An array of the segments of the bolt.
|
||||
*/
|
||||
private List<BoltSegment> segments = new ArrayList<BoltSegment>();
|
||||
private int maxSplitID;
|
||||
private Random rand;
|
||||
|
||||
public FXElectricBolt(World world, Vector3 startVec, Vector3 targetVec, boolean doSplits)
|
||||
{
|
||||
super(world, startVec.x(), startVec.y(), startVec.z());
|
||||
|
||||
this.rand = new Random();
|
||||
this.start = new BoltPoint(startVec);
|
||||
this.end = new BoltPoint(targetVec);
|
||||
|
||||
if (this.end.basePoint.y() == Double.POSITIVE_INFINITY)
|
||||
{
|
||||
this.end.basePoint.y(Minecraft.getMinecraft().thePlayer.posY + 30);
|
||||
}
|
||||
|
||||
/** By default, we do an electrical color */
|
||||
this.segmentCount = 1;
|
||||
this.particleMaxAge = (3 + this.rand.nextInt(3) - 1);
|
||||
this.complexity = 2f;
|
||||
this.boltWidth = 0.05f;
|
||||
this.boltLength = start.basePoint.distance(end.basePoint);
|
||||
this.setUp(doSplits);
|
||||
}
|
||||
|
||||
public FXElectricBolt(World world, Vector3 startVec, Vector3 targetVec)
|
||||
{
|
||||
this(world, startVec, targetVec, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate all required segments of the entire bolt.
|
||||
*/
|
||||
private void setUp(boolean doSplits)
|
||||
{
|
||||
this.segments.add(new BoltSegment(this.start, this.end));
|
||||
this.recalculate();
|
||||
|
||||
if (doSplits)
|
||||
{
|
||||
double offsetRatio = this.boltLength * this.complexity;
|
||||
this.split(2, offsetRatio / 10, 0.7f, 0.1f, 20 / 2);
|
||||
this.split(2, offsetRatio / 15, 0.5f, 0.1f, 25 / 2);
|
||||
this.split(2, offsetRatio / 25, 0.5f, 0.1f, 28 / 2);
|
||||
this.split(2, offsetRatio / 38, 0.5f, 0.1f, 30 / 2);
|
||||
this.split(2, offsetRatio / 55, 0, 0, 0);
|
||||
this.split(2, offsetRatio / 70, 0, 0, 0);
|
||||
this.recalculate();
|
||||
|
||||
Collections.sort(this.segments, new Comparator<BoltSegment>()
|
||||
{
|
||||
public int compare(BoltSegment bolt1, BoltSegment bolt2)
|
||||
{
|
||||
return Float.compare(bolt2.alpha, bolt1.alpha);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public FXElectricBolt setColor(float r, float g, float b)
|
||||
{
|
||||
this.particleRed = r + (this.rand.nextFloat() * 0.1f) - 0.1f;
|
||||
this.particleGreen = g + (this.rand.nextFloat() * 0.1f) - 0.1f;
|
||||
this.particleBlue = b + (this.rand.nextFloat() * 0.1f) - 0.1f;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slits a large segment into multiple smaller ones.
|
||||
*
|
||||
* @param splitAmount - The amount of splits
|
||||
* @param offset - The multiplier scale for the offset.
|
||||
* @param splitChance - The chance of creating a split.
|
||||
* @param splitLength - The length of each split.
|
||||
* @param splitAngle - The angle of the split.
|
||||
*/
|
||||
public void split(int splitAmount, double offset, float splitChance, float splitLength, float splitAngle)
|
||||
{
|
||||
/** Temporarily store old segments in a new array */
|
||||
List<BoltSegment> oldSegments = this.segments;
|
||||
this.segments = new ArrayList();
|
||||
/** Previous segment */
|
||||
BoltSegment prev = null;
|
||||
|
||||
for (BoltSegment segment : oldSegments)
|
||||
{
|
||||
prev = segment.prev;
|
||||
/** Length of each subsegment */
|
||||
Vector3 subSegment = segment.difference.clone().multiply(1.0F / splitAmount);
|
||||
|
||||
/**
|
||||
* Creates an array of new bolt points. The first and last points of the bolts are the
|
||||
* respected start and end points of the current segment.
|
||||
*/
|
||||
BoltPoint[] newPoints = new BoltPoint[splitAmount + 1];
|
||||
Vector3 startPoint = segment.start.basePoint;
|
||||
newPoints[0] = segment.start;
|
||||
newPoints[splitAmount] = segment.end;
|
||||
|
||||
/**
|
||||
* Create bolt points.
|
||||
*/
|
||||
for (int i = 1; i < splitAmount; i++)
|
||||
{
|
||||
Vector3 newOffset = segment.difference.perpendicular().transform(new Quaternion(this.rand.nextFloat() * 360, segment.difference)).multiply((this.rand.nextFloat() - 0.5F) * offset);
|
||||
Vector3 basePoint = startPoint.clone().add(subSegment.clone().multiply(i));
|
||||
|
||||
newPoints[i] = new BoltPoint(basePoint, newOffset);
|
||||
}
|
||||
|
||||
for (int i = 0; i < splitAmount; i++)
|
||||
{
|
||||
BoltSegment next = new BoltSegment(newPoints[i], newPoints[(i + 1)], segment.alpha, segment.id * splitAmount + i, segment.splitID);
|
||||
next.prev = prev;
|
||||
|
||||
if (prev != null)
|
||||
{
|
||||
prev.next = next;
|
||||
}
|
||||
|
||||
if ((i != 0) && (this.rand.nextFloat() < splitChance))
|
||||
{
|
||||
Vector3 splitrot = next.difference.xCross().transform(new Quaternion(this.rand.nextFloat() * 360, next.difference));
|
||||
Vector3 diff = next.difference.clone().transform(new Quaternion((this.rand.nextFloat() * 0.66F + 0.33F) * splitAngle, splitrot)).multiply(splitLength);
|
||||
this.maxSplitID += 1;
|
||||
this.parentIDMap.put(this.maxSplitID, next.splitID);
|
||||
BoltSegment split = new BoltSegment(newPoints[i], new BoltPoint(newPoints[(i + 1)].base, newPoints[(i + 1)].offset.clone().add(diff)), segment.alpha / 2f, next.id, this.maxSplitID);
|
||||
split.prev = prev;
|
||||
this.segments.add(split);
|
||||
}
|
||||
|
||||
prev = next;
|
||||
this.segments.add(next);
|
||||
}
|
||||
|
||||
if (segment.next != null)
|
||||
{
|
||||
segment.next.prev = prev;
|
||||
}
|
||||
}
|
||||
|
||||
this.segmentCount *= splitAmount;
|
||||
|
||||
}
|
||||
|
||||
private void recalculate()
|
||||
{
|
||||
HashMap<Integer, Integer> lastActiveSegment = new HashMap<Integer, Integer>();
|
||||
|
||||
Collections.sort(this.segments, new Comparator()
|
||||
{
|
||||
public int compare(BoltSegment o1, BoltSegment o2)
|
||||
{
|
||||
int comp = Integer.valueOf(o1.splitID).compareTo(Integer.valueOf(o2.splitID));
|
||||
if (comp == 0)
|
||||
{
|
||||
return Integer.valueOf(o1.id).compareTo(Integer.valueOf(o2.id));
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Object obj, Object obj1)
|
||||
{
|
||||
return compare((BoltSegment) obj, (BoltSegment) obj1);
|
||||
}
|
||||
});
|
||||
|
||||
int lastSplitCalc = 0;
|
||||
int lastActiveSeg = 0;
|
||||
|
||||
for (BoltSegment segment : this.segments)
|
||||
{
|
||||
if (segment.splitID > lastSplitCalc)
|
||||
{
|
||||
lastActiveSegment.put(lastSplitCalc, lastActiveSeg);
|
||||
lastSplitCalc = segment.splitID;
|
||||
lastActiveSeg = lastActiveSegment.get(this.parentIDMap.get(segment.splitID)).intValue();
|
||||
}
|
||||
|
||||
lastActiveSeg = segment.id;
|
||||
}
|
||||
|
||||
lastActiveSegment.put(lastSplitCalc, lastActiveSeg);
|
||||
lastSplitCalc = 0;
|
||||
lastActiveSeg = lastActiveSegment.get(0).intValue();
|
||||
BoltSegment segment;
|
||||
|
||||
for (Iterator<BoltSegment> iterator = this.segments.iterator(); iterator.hasNext(); segment.recalculate())
|
||||
{
|
||||
segment = iterator.next();
|
||||
|
||||
if (lastSplitCalc != segment.splitID)
|
||||
{
|
||||
lastSplitCalc = segment.splitID;
|
||||
lastActiveSeg = lastActiveSegment.get(segment.splitID);
|
||||
}
|
||||
|
||||
if (segment.id > lastActiveSeg)
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tessellator, float partialframe, float cosYaw, float cosPitch, float sinYaw, float sinSinPitch, float cosSinPitch)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
tessellator.draw();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(3042);
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||
/**
|
||||
* Render the actual bolts.
|
||||
*/
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(15728880);
|
||||
Vector3 playerVector = new Vector3(sinYaw * -cosPitch, -cosSinPitch / cosYaw, cosYaw * cosPitch);
|
||||
|
||||
int renderlength = (int) ((this.particleAge + partialframe + (int) (this.boltLength * 3.0F)) / (int) (this.boltLength * 3.0F) * this.segmentCount);
|
||||
|
||||
for (BoltSegment segment : this.segments)
|
||||
{
|
||||
if (segment != null && segment.id <= renderlength)
|
||||
{
|
||||
double renderWidth = this.boltWidth * ((new Vector3(player).distance(segment.start.basePoint) / 5f + 1f) * (1 + segment.alpha) * 0.5f);
|
||||
renderWidth = Math.min(this.boltWidth, Math.max(renderWidth, 0));
|
||||
|
||||
if (segment.difference.magnitude() > 0 && segment.difference.magnitude() != Double.NaN && segment.difference.magnitude() != Double.POSITIVE_INFINITY && renderWidth > 0 && renderWidth != Double.NaN && renderWidth != Double.POSITIVE_INFINITY)
|
||||
{
|
||||
Vector3 diffPrev = playerVector.cross(segment.prevDiff).multiply(renderWidth / segment.sinPrev);
|
||||
Vector3 diffNext = playerVector.cross(segment.nextDiff).multiply(renderWidth / segment.sinNext);
|
||||
Vector3 startVec = segment.start.basePoint;
|
||||
Vector3 endVec = segment.end.basePoint;
|
||||
float rx1 = (float) (startVec.x() - interpPosX);
|
||||
float ry1 = (float) (startVec.y() - interpPosY);
|
||||
float rz1 = (float) (startVec.z() - interpPosZ);
|
||||
float rx2 = (float) (endVec.x() - interpPosX);
|
||||
float ry2 = (float) (endVec.y() - interpPosY);
|
||||
float rz2 = (float) (endVec.z() - interpPosZ);
|
||||
|
||||
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, (1.0F - (this.particleAge >= 0 ? ((float) this.particleAge / (float) this.particleMaxAge) : 0.0F) * 0.6f) * segment.alpha);
|
||||
tessellator.addVertexWithUV(rx2 - diffNext.x(), ry2 - diffNext.y(), rz2 - diffNext.z(), 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx1 - diffPrev.x(), ry1 - diffPrev.y(), rz1 - diffPrev.z(), 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx1 + diffPrev.x(), ry1 + diffPrev.y(), rz1 + diffPrev.z(), 0.5D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx2 + diffNext.x(), ry2 + diffNext.y(), rz2 + diffNext.z(), 0.5D, 1.0D);
|
||||
|
||||
/**
|
||||
* Render the bolts balls.
|
||||
*/
|
||||
|
||||
if (segment.next == null)
|
||||
{
|
||||
Vector3 roundEnd = segment.end.basePoint.clone().add(segment.difference.clone().normalize().multiply(renderWidth));
|
||||
float rx3 = (float) (roundEnd.x() - interpPosX);
|
||||
float ry3 = (float) (roundEnd.y() - interpPosY);
|
||||
float rz3 = (float) (roundEnd.z() - interpPosZ);
|
||||
tessellator.addVertexWithUV(rx3 - diffNext.x(), ry3 - diffNext.y(), rz3 - diffNext.z(), 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx2 - diffNext.x(), ry2 - diffNext.y(), rz2 - diffNext.z(), 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx2 + diffNext.x(), ry2 + diffNext.y(), rz2 + diffNext.z(), 0.5D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx3 + diffNext.x(), ry3 + diffNext.y(), rz3 + diffNext.z(), 0.0D, 1.0D);
|
||||
}
|
||||
|
||||
if (segment.prev == null)
|
||||
{
|
||||
Vector3 roundEnd = segment.start.basePoint.clone().subtract(segment.difference.clone().normalize().multiply(renderWidth));
|
||||
float rx3 = (float) (roundEnd.x() - interpPosX);
|
||||
float ry3 = (float) (roundEnd.y() - interpPosY);
|
||||
float rz3 = (float) (roundEnd.z() - interpPosZ);
|
||||
tessellator.addVertexWithUV(rx1 - diffPrev.x(), ry1 - diffPrev.y(), rz1 - diffPrev.z(), 0.5D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx3 - diffPrev.x(), ry3 - diffPrev.y(), rz3 - diffPrev.z(), 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(rx3 + diffPrev.x(), ry3 + diffPrev.y(), rz3 + diffPrev.z(), 0.0D, 1.0D);
|
||||
tessellator.addVertexWithUV(rx1 + diffPrev.x(), ry1 + diffPrev.y(), rz1 + diffPrev.z(), 0.5D, 1.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(PARTICLE_RESOURCE);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
}
|
||||
|
||||
private class BoltPoint
|
||||
{
|
||||
public Vector3 basePoint;
|
||||
public Vector3 base;
|
||||
public Vector3 offset;
|
||||
|
||||
public BoltPoint(Vector3 base, Vector3 offset)
|
||||
{
|
||||
basePoint = base.add(offset);
|
||||
this.base = base;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public BoltPoint(Vector3 base)
|
||||
{
|
||||
this(base, new Vector3());
|
||||
}
|
||||
}
|
||||
|
||||
private class BoltSegment
|
||||
{
|
||||
public BoltPoint start;
|
||||
public BoltPoint end;
|
||||
public BoltSegment prev;
|
||||
public BoltSegment next;
|
||||
public float alpha;
|
||||
public int id;
|
||||
public int splitID;
|
||||
|
||||
/**
|
||||
* All differences are cached.
|
||||
*/
|
||||
public Vector3 difference;
|
||||
public Vector3 prevDiff;
|
||||
public Vector3 nextDiff;
|
||||
public double sinPrev;
|
||||
public double sinNext;
|
||||
|
||||
public BoltSegment(BoltPoint start, BoltPoint end)
|
||||
{
|
||||
this(start, end, 1, 0, 0);
|
||||
}
|
||||
|
||||
public BoltSegment(BoltPoint start, BoltPoint end, float alpha, int id, int splitID)
|
||||
{
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.alpha = alpha;
|
||||
this.id = id;
|
||||
this.splitID = splitID;
|
||||
this.difference = this.end.basePoint.clone().subtract(this.start.basePoint);
|
||||
}
|
||||
|
||||
public void recalculate()
|
||||
{
|
||||
if (this.prev != null)
|
||||
{
|
||||
Vector3 prevDiffNorm = this.prev.difference.clone().normalize();
|
||||
Vector3 diffNorm = this.difference.clone().normalize();
|
||||
this.prevDiff = diffNorm.clone().add(prevDiffNorm).normalize();
|
||||
this.sinPrev = Math.sin(diffNorm.anglePreNorm(prevDiffNorm.clone().multiply(-1)) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.prevDiff = this.difference.clone().normalize();
|
||||
this.sinPrev = 1;
|
||||
}
|
||||
|
||||
if (this.next != null)
|
||||
{
|
||||
Vector3 nextDiffNorm = this.next.difference.clone().normalize();
|
||||
Vector3 diffNorm = this.difference.clone().normalize();
|
||||
this.nextDiff = diffNorm.clone().add(nextDiffNorm).normalize();
|
||||
this.sinNext = Math.sin(diffNorm.anglePreNorm(nextDiffNorm.clone().multiply(-1)) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.nextDiff = this.difference.clone().normalize();
|
||||
this.sinNext = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package edx.core.fx;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.world.World;
|
||||
import resonantengine.lib.transform.vector.Vector3;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* A spawner used to spawn in multiple electrical bolts for a specific duration.
|
||||
*/
|
||||
public class FXElectricBoltSpawner extends EntityFX
|
||||
{
|
||||
private Vector3 start;
|
||||
private Vector3 end;
|
||||
|
||||
public FXElectricBoltSpawner(World world, Vector3 startVec, Vector3 targetVec, long seed, int duration)
|
||||
{
|
||||
super(world, startVec.x(), startVec.y(), startVec.z(), 0.0D, 0.0D, 0.0D);
|
||||
|
||||
if (seed == 0)
|
||||
{
|
||||
this.rand = new Random();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rand = new Random(seed);
|
||||
}
|
||||
|
||||
this.start = startVec;
|
||||
this.end = targetVec;
|
||||
this.particleMaxAge = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new FXElectricBolt(this.worldObj, this.start, this.end));
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +1,13 @@
|
|||
package edx.core.interfaces
|
||||
|
||||
import resonantengine.api.graph.node.INode
|
||||
import resonantengine.api.transform.vector.IVectorWorld
|
||||
|
||||
/**
|
||||
* Applied to any node that will act as a mechanical object
|
||||
*
|
||||
* @author Darkguardsman, Calclavia
|
||||
*/
|
||||
trait TNodeMechanical extends INode with IVectorWorld
|
||||
trait TNodeMechanical extends INode
|
||||
{
|
||||
/**
|
||||
* Gets the angular velocity of the mechanical device from a specific side
|
||||
|
@ -26,7 +25,7 @@ trait TNodeMechanical extends INode with IVectorWorld
|
|||
|
||||
/**
|
||||
* The mechanical resistance of this node.
|
||||
* Consider the moment of inertia, which equals mass * radius ^ 2
|
||||
* Consider the moment of inertia, which equals mass * radius * radius
|
||||
*
|
||||
* Torque = Moment of Intertia * angular velocity
|
||||
*
|
||||
|
|
|
@ -74,13 +74,13 @@ class NodeFluid(parent: INodeProvider, volume: Int = FluidContainerRegistry.BUCK
|
|||
getTank.readFromNBT(nbt.getCompoundTag("tank"))
|
||||
}
|
||||
|
||||
override def getTank: FluidTank = tank
|
||||
|
||||
override def save(nbt: NBTTagCompound)
|
||||
{
|
||||
nbt.setTag("tank", getTank.writeToNBT(new NBTTagCompound))
|
||||
}
|
||||
|
||||
override def getTank: FluidTank = tank
|
||||
|
||||
/**
|
||||
* Sets the primary tank (not checked)
|
||||
* @param t - The new tank
|
||||
|
|
|
@ -143,8 +143,6 @@ class NodeFluidPressure(parent: INodeProvider, volume: Int = FluidContainerRegis
|
|||
}
|
||||
}
|
||||
|
||||
def pressure(direction: ForgeDirection): Int = _pressure
|
||||
|
||||
protected def updatePressure()
|
||||
{
|
||||
var totalPressure = 0
|
||||
|
@ -182,6 +180,8 @@ class NodeFluidPressure(parent: INodeProvider, volume: Int = FluidContainerRegis
|
|||
}
|
||||
}
|
||||
|
||||
def pressure(direction: ForgeDirection): Int = _pressure
|
||||
|
||||
def pressure: Int = _pressure
|
||||
|
||||
def pressure_=(pressure: Int)
|
||||
|
|
|
@ -32,6 +32,20 @@ abstract class TileFluidProvider(material: Material) extends ResonantTile(materi
|
|||
}
|
||||
}
|
||||
|
||||
def fluidNode = _fluidNode
|
||||
|
||||
def fluidNode_=(newNode: NodeFluid)
|
||||
{
|
||||
_fluidNode = newNode
|
||||
fluidNode.onConnectionChanged = () =>
|
||||
{
|
||||
clientRenderMask = fluidNode.connectedMask
|
||||
sendPacket(0)
|
||||
}
|
||||
fluidNode.onFluidChanged = () => if (!world.isRemote) sendPacket(1)
|
||||
nodes.add(fluidNode)
|
||||
}
|
||||
|
||||
override def write(buf: ByteBuf, id: Int)
|
||||
{
|
||||
super.write(buf, id)
|
||||
|
@ -82,8 +96,6 @@ abstract class TileFluidProvider(material: Material) extends ResonantTile(materi
|
|||
colorID = nbt.getInteger("colorID")
|
||||
}
|
||||
|
||||
def fluidNode = _fluidNode
|
||||
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbt)
|
||||
|
@ -93,18 +105,6 @@ abstract class TileFluidProvider(material: Material) extends ResonantTile(materi
|
|||
|
||||
override def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack = fluidNode.drain(from, resource, doDrain)
|
||||
|
||||
def fluidNode_=(newNode: NodeFluid)
|
||||
{
|
||||
_fluidNode = newNode
|
||||
fluidNode.onConnectionChanged = () =>
|
||||
{
|
||||
clientRenderMask = fluidNode.connectedMask
|
||||
sendPacket(0)
|
||||
}
|
||||
fluidNode.onFluidChanged = () => if (!world.isRemote) sendPacket(1)
|
||||
nodes.add(fluidNode)
|
||||
}
|
||||
|
||||
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = fluidNode.drain(from, maxDrain, doDrain)
|
||||
|
||||
override def canFill(from: ForgeDirection, fluid: Fluid): Boolean = fluidNode.canFill(from, fluid)
|
||||
|
|
|
@ -57,6 +57,11 @@ class PacketMultiPart extends PacketType
|
|||
handle(player)
|
||||
}
|
||||
|
||||
override def handleServerSide(player: EntityPlayer)
|
||||
{
|
||||
handle(player)
|
||||
}
|
||||
|
||||
def handle(player: EntityPlayer)
|
||||
{
|
||||
val tile = player.getEntityWorld.getTileEntity(this.x, this.y, this.z)
|
||||
|
@ -75,9 +80,4 @@ class PacketMultiPart extends PacketType
|
|||
throw new UnsupportedOperationException("Packet was sent to a multipart not implementing IPacketReceiver, this is a coding error [" + tile + "] in " + new Vector3(x, y, z))
|
||||
}
|
||||
}
|
||||
|
||||
override def handleServerSide(player: EntityPlayer)
|
||||
{
|
||||
handle(player)
|
||||
}
|
||||
}
|
|
@ -25,8 +25,6 @@ class Alloy(val max: Int) extends ISave
|
|||
|
||||
def percentage(material: String): Float = content(material) / size.toFloat
|
||||
|
||||
def size = content.values.foldLeft(0)(_ + _)
|
||||
|
||||
def percentage = size / max.toFloat
|
||||
|
||||
/**
|
||||
|
@ -44,6 +42,8 @@ class Alloy(val max: Int) extends ISave
|
|||
|
||||
def color = AlloyUtility.mixedColor(content.map(keyVal => (keyVal._1, keyVal._2 / size.toFloat)))
|
||||
|
||||
def size = content.values.foldLeft(0)(_ + _)
|
||||
|
||||
override def save(nbt: NBTTagCompound)
|
||||
{
|
||||
nbt.setMap("mixture", content)
|
||||
|
|
|
@ -55,22 +55,6 @@ class ItemBlockBattery(block: Block) extends ItemBlock(block) with TEnergyItem
|
|||
this.setEnergy(itemStack, 0)
|
||||
}
|
||||
|
||||
override def setEnergy(itemStack: ItemStack, joules: Double): ItemStack =
|
||||
{
|
||||
if (itemStack.getTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound)
|
||||
}
|
||||
val energy: Double = Math.max(Math.min(joules, this.getEnergyCapacity(itemStack)), 0)
|
||||
itemStack.getTagCompound.setDouble("energy", energy)
|
||||
return itemStack
|
||||
}
|
||||
|
||||
def getEnergyCapacity(theItem: ItemStack): Double =
|
||||
{
|
||||
return TileBattery.getEnergyForTier(ItemBlockBattery.getTier(theItem))
|
||||
}
|
||||
|
||||
override def recharge(itemStack: ItemStack, energy: Double, doReceive: Boolean): Double =
|
||||
{
|
||||
val rejectedElectricity: Double = Math.max((this.getEnergy(itemStack) + energy) - this.getEnergyCapacity(itemStack), 0)
|
||||
|
@ -105,4 +89,20 @@ class ItemBlockBattery(block: Block) extends ItemBlock(block) with TEnergyItem
|
|||
list.add(setEnergy(ItemBlockBattery.setTier(new ItemStack(this), tier), TileBattery.getEnergyForTier(tier)))
|
||||
}
|
||||
}
|
||||
|
||||
override def setEnergy(itemStack: ItemStack, joules: Double): ItemStack =
|
||||
{
|
||||
if (itemStack.getTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound)
|
||||
}
|
||||
val energy: Double = Math.max(Math.min(joules, this.getEnergyCapacity(itemStack)), 0)
|
||||
itemStack.getTagCompound.setDouble("energy", energy)
|
||||
return itemStack
|
||||
}
|
||||
|
||||
def getEnergyCapacity(theItem: ItemStack): Double =
|
||||
{
|
||||
return TileBattery.getEnergyForTier(ItemBlockBattery.getTier(theItem))
|
||||
}
|
||||
}
|
|
@ -68,6 +68,15 @@ class TileBattery extends ResonantTile(Material.iron) with TIO with TBlockNodePr
|
|||
updateConnectionMask()
|
||||
}
|
||||
|
||||
def updateConnectionMask()
|
||||
{
|
||||
electricNode.setPositives(getInputDirections())
|
||||
electricNode.setNegatives(getOutputDirections())
|
||||
electricNode.reconstruct()
|
||||
markUpdate()
|
||||
notifyChange()
|
||||
}
|
||||
|
||||
override def update()
|
||||
{
|
||||
super.update()
|
||||
|
@ -131,22 +140,13 @@ class TileBattery extends ResonantTile(Material.iron) with TIO with TBlockNodePr
|
|||
updateConnectionMask()
|
||||
}
|
||||
|
||||
def updateConnectionMask()
|
||||
{
|
||||
electricNode.setPositives(getInputDirections())
|
||||
electricNode.setNegatives(getOutputDirections())
|
||||
electricNode.reconstruct()
|
||||
markUpdate()
|
||||
notifyChange()
|
||||
}
|
||||
|
||||
override def onPlaced(entityLiving: EntityLivingBase, itemStack: ItemStack)
|
||||
{
|
||||
if (!world.isRemote && itemStack.getItem.isInstanceOf[ItemBlockBattery])
|
||||
{
|
||||
energy.max = (TileBattery.getEnergyForTier(ItemBlockBattery.getTier(itemStack)))
|
||||
energy.value = itemStack.getItem.asInstanceOf[ItemBlockBattery].getEnergy(itemStack)
|
||||
world.setBlockMetadataWithNotify(xi, yi, zi, ItemBlockBattery.getTier(itemStack), 3)
|
||||
world.setBlockMetadataWithNotify(x, y, z, ItemBlockBattery.getTier(itemStack), 3)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class TileBattery extends ResonantTile(Material.iron) with TIO with TBlockNodePr
|
|||
val ret = new ArrayList[ItemStack]
|
||||
val itemStack: ItemStack = new ItemStack(getBlockType, 1)
|
||||
val itemBlock: ItemBlockBattery = itemStack.getItem.asInstanceOf[ItemBlockBattery]
|
||||
ItemBlockBattery.setTier(itemStack, world.getBlockMetadata(xi, yi, zi).asInstanceOf[Byte])
|
||||
ItemBlockBattery.setTier(itemStack, world.getBlockMetadata(x, y, z).asInstanceOf[Byte])
|
||||
itemBlock.setEnergy(itemStack, energy.value)
|
||||
ret.add(itemStack)
|
||||
return ret
|
||||
|
@ -201,7 +201,7 @@ class TileBattery extends ResonantTile(Material.iron) with TIO with TBlockNodePr
|
|||
|
||||
for (check <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if ((toVectorWorld + check).getTileEntity.isInstanceOf[TileBattery])
|
||||
if ((position + check).getTileEntity.isInstanceOf[TileBattery])
|
||||
{
|
||||
disabledParts ++= partToDisable(check.ordinal)
|
||||
if (check == ForgeDirection.UP)
|
||||
|
@ -214,7 +214,7 @@ class TileBattery extends ResonantTile(Material.iron) with TIO with TBlockNodePr
|
|||
var connectionParts = Set.empty[String]
|
||||
val downDirs = ForgeDirection.VALID_DIRECTIONS.filter(_.offsetY == 0)
|
||||
downDirs.foreach(s => connectionParts ++= connectionPartToEnable(s.ordinal))
|
||||
downDirs.filter(s => (toVectorWorld + s).getTileEntity.isInstanceOf[TileBattery]).foreach(s => connectionParts --= connectionPartToEnable(s.ordinal))
|
||||
downDirs.filter(s => (position + s).getTileEntity.isInstanceOf[TileBattery]).foreach(s => connectionParts --= connectionPartToEnable(s.ordinal))
|
||||
enabledParts ++= connectionParts
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class TileThermopile extends ResonantTile(Material.rock) with TBlockNodeProvider
|
|||
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val checkPos = toVectorWorld + dir
|
||||
val checkPos = position + dir
|
||||
val block = checkPos.getBlock
|
||||
|
||||
if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
|
@ -77,7 +77,7 @@ class TileThermopile extends ResonantTile(Material.rock) with TBlockNodeProvider
|
|||
{
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val checkPos = toVector3.add(dir)
|
||||
val checkPos = position.add(dir)
|
||||
val block = checkPos.getBlock(worldObj)
|
||||
|
||||
if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
|
|
|
@ -30,8 +30,6 @@ class Graph[V](val name: String, val maxPoints: Int = 0)(implicit n: Numeric[V])
|
|||
|
||||
def apply(x: Int = 0): V = if (points.size > x) points.get(x) else default
|
||||
|
||||
def default: V = n.zero
|
||||
|
||||
def getDouble(x: Int = 0) = n.toDouble(this(x))
|
||||
|
||||
def queue(value: V)
|
||||
|
@ -48,6 +46,8 @@ class Graph[V](val name: String, val maxPoints: Int = 0)(implicit n: Numeric[V])
|
|||
for (point <- points) if (n.gt(point, n.zero)) peak = y
|
||||
}
|
||||
|
||||
def default: V = n.zero
|
||||
|
||||
def load(nbt: NBTTagCompound)
|
||||
{
|
||||
points.clear()
|
||||
|
|
|
@ -11,23 +11,23 @@ import scala.collection.mutable.ArrayBuffer
|
|||
|
||||
class GridMultimeter extends Grid[PartMultimeter]
|
||||
{
|
||||
final val displayInformation = new ArrayBuffer[String]
|
||||
/**
|
||||
* The available graphs to be handled.
|
||||
*/
|
||||
final val graphs = new ArrayBuffer[Graph[_]]
|
||||
final val energyGraph = new Graph[Double]("energy", maxData)
|
||||
final val powerGraph = new Graph[Double]("power", maxData)
|
||||
final val voltageGraph = new Graph[Double]("voltage", maxData)
|
||||
final val torqueGraph = new Graph[Double]("torque", maxData)
|
||||
final val angularVelocityGraph = new Graph[Double]("speed", maxData)
|
||||
final val fluidGraph = new Graph[Int]("fluid", maxData)
|
||||
final val thermalGraph = new Graph[Int]("temperature", maxData)
|
||||
final val pressureGraph = new Graph[Int]("pressure", maxData)
|
||||
/**
|
||||
* Maximum data points a graph can store.
|
||||
*/
|
||||
private val maxData: Int = 1
|
||||
private final val maxData = 1
|
||||
val displayInformation = new ArrayBuffer[String]
|
||||
/**
|
||||
* The available graphs to be handled.
|
||||
*/
|
||||
val graphs = new ArrayBuffer[Graph[_]]
|
||||
val energyGraph = new Graph[Double]("energy", maxData)
|
||||
val powerGraph = new Graph[Double]("power", maxData)
|
||||
val voltageGraph = new Graph[Double]("voltage", maxData)
|
||||
val torqueGraph = new Graph[Double]("torque", maxData)
|
||||
val angularVelocityGraph = new Graph[Double]("speed", maxData)
|
||||
val fluidGraph = new Graph[Int]("fluid", maxData)
|
||||
val thermalGraph = new Graph[Int]("temperature", maxData)
|
||||
val pressureGraph = new Graph[Int]("pressure", maxData)
|
||||
/**
|
||||
* The absolute center of the multimeter screens.
|
||||
*/
|
||||
|
@ -118,7 +118,7 @@ class GridMultimeter extends Grid[PartMultimeter]
|
|||
lowerBound = lowerBound.min(node.getPosition)
|
||||
})
|
||||
|
||||
center = upperBound.midPoint(lowerBound)
|
||||
center = upperBound.midpoint(lowerBound)
|
||||
upperBound -= center
|
||||
lowerBound -= center
|
||||
size = new Vector3(Math.abs(upperBound.x) + Math.abs(lowerBound.x), Math.abs(upperBound.y) + Math.abs(lowerBound.y), Math.abs(upperBound.z) + Math.abs(lowerBound.z))
|
||||
|
|
|
@ -54,21 +54,6 @@ class PartMultimeter extends PartFace with IRedstonePart with IPacketReceiver wi
|
|||
getGrid.remove(this)
|
||||
}
|
||||
|
||||
def getGrid: GridMultimeter =
|
||||
{
|
||||
if (grid == null)
|
||||
{
|
||||
grid = new GridMultimeter
|
||||
grid.add(this)
|
||||
}
|
||||
return grid
|
||||
}
|
||||
|
||||
def setGrid(network: GridMultimeter)
|
||||
{
|
||||
grid = network
|
||||
}
|
||||
|
||||
def updateDesc()
|
||||
{
|
||||
writeDesc(getWriteStream)
|
||||
|
@ -204,6 +189,21 @@ class PartMultimeter extends PartFace with IRedstonePart with IPacketReceiver wi
|
|||
}
|
||||
}
|
||||
|
||||
def getGrid: GridMultimeter =
|
||||
{
|
||||
if (grid == null)
|
||||
{
|
||||
grid = new GridMultimeter
|
||||
grid.add(this)
|
||||
}
|
||||
return grid
|
||||
}
|
||||
|
||||
def setGrid(network: GridMultimeter)
|
||||
{
|
||||
grid = network
|
||||
}
|
||||
|
||||
override def read(packet: MCDataInput, packetID: Int)
|
||||
{
|
||||
packetID match
|
||||
|
|
|
@ -94,7 +94,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
if (this.ticks % (4 + this.worldObj.rand.nextInt(2)) == 0 && ((this.worldObj.isRemote && isTransfering) || (this.energy.value != 0 && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))))
|
||||
{
|
||||
val topTesla: TileTesla = this.getTopTelsa
|
||||
val topTeslaVector: Vector3 = toVector3
|
||||
val topTeslaVector: Vector3 = position
|
||||
if (this.linked != null || this.isLinkedClient)
|
||||
{
|
||||
if (!this.worldObj.isRemote)
|
||||
|
@ -124,8 +124,8 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
{
|
||||
def compare(o1: ITesla, o2: ITesla): Int =
|
||||
{
|
||||
val distance1: Double = toVector3.distance(new Vector3(o1.asInstanceOf[TileEntity]))
|
||||
val distance2: Double = toVector3.distance(new Vector3(o2.asInstanceOf[TileEntity]))
|
||||
val distance1: Double = position.distance(new Vector3(o1.asInstanceOf[TileEntity]))
|
||||
val distance2: Double = position.distance(new Vector3(o2.asInstanceOf[TileEntity]))
|
||||
if (distance1 < distance2)
|
||||
{
|
||||
return 1
|
||||
|
@ -141,7 +141,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
for (o <- TeslaGrid.instance.get)
|
||||
{
|
||||
var otherTesla = o
|
||||
if (new Vector3(otherTesla.asInstanceOf[TileEntity]).distance(toVector3) < this.getRange && otherTesla != this)
|
||||
if (new Vector3(otherTesla.asInstanceOf[TileEntity]).distance(position) < this.getRange && otherTesla != this)
|
||||
{
|
||||
if (otherTesla.isInstanceOf[TileTesla])
|
||||
{
|
||||
|
@ -172,11 +172,11 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
if (tesla.isInstanceOf[TileTesla])
|
||||
{
|
||||
getMultiBlock.get.outputBlacklist.add(this)
|
||||
targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.toVector3
|
||||
targetVector = tesla.asInstanceOf[TileTesla].getTopTelsa.position
|
||||
heightRange = (tesla.asInstanceOf[TileTesla]).getHeight
|
||||
}
|
||||
val distance: Double = topTeslaVector.distance(targetVector)
|
||||
Electrodynamics.proxy.renderElectricShock(this.worldObj, topTesla.toVector3 + new Vector3(0.5), targetVector + new Vector3(0.5, Math.random * heightRange / 3 - heightRange / 3, 0.5), EnumColor.DYES(this.dyeID).toColor)
|
||||
Electrodynamics.proxy.renderElectricShock(this.worldObj, topTesla.position + new Vector3(0.5), targetVector + new Vector3(0.5, Math.random * heightRange / 3 - heightRange / 3, 0.5), EnumColor.DYES(this.dyeID).toColor)
|
||||
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP))
|
||||
if (!sentPacket && transferEnergy > 0)
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
return this.topCache
|
||||
}
|
||||
this.connectedTeslas.clear
|
||||
val checkPosition: Vector3 = toVector3
|
||||
val checkPosition: Vector3 = position
|
||||
var returnTile: TileTesla = this
|
||||
var exit = false
|
||||
while (exit)
|
||||
|
@ -344,7 +344,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
var exit = false
|
||||
while (!exit)
|
||||
{
|
||||
val t: TileEntity = (toVector3 + new Vector3(0, y, 0)).getTileEntity(this.worldObj)
|
||||
val t: TileEntity = (position + new Vector3(0, y, 0)).getTileEntity(this.worldObj)
|
||||
if (t.isInstanceOf[TileTesla])
|
||||
{
|
||||
this.connectedTeslas.add(t.asInstanceOf[TileTesla])
|
||||
|
@ -428,7 +428,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
val tileEntity: TileEntity = this.linked.getTileEntity(newOtherWorld)
|
||||
if (tileEntity.isInstanceOf[TileTesla])
|
||||
{
|
||||
(tileEntity.asInstanceOf[TileTesla]).setLink(toVector3, this.worldObj.provider.dimensionId, false)
|
||||
(tileEntity.asInstanceOf[TileTesla]).setLink(position, this.worldObj.provider.dimensionId, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
def getMultiBlockVectors: java.lang.Iterable[Vector3] =
|
||||
{
|
||||
val vectors: List[Vector3] = new ArrayList[Vector3]
|
||||
val checkPosition: Vector3 = toVector3
|
||||
val checkPosition: Vector3 = position
|
||||
var exit = false
|
||||
while (!exit)
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
|
||||
def getPosition: Vector3 =
|
||||
{
|
||||
return toVector3
|
||||
return position
|
||||
}
|
||||
|
||||
def getWorld: World =
|
||||
|
@ -576,7 +576,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
else
|
||||
{
|
||||
if (world.isRemote) player.addChatMessage(new ChatComponentText("Marked link for device."))
|
||||
LinkUtility.setLink(itemStack, toVectorWorld)
|
||||
LinkUtility.setLink(itemStack, position)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -593,8 +593,8 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
val mainTile: TileTesla = getLowestTesla
|
||||
mainTile.getMultiBlock.deconstruct
|
||||
mainTile.getMultiBlock.construct
|
||||
val isTop: Boolean = (toVector3 + new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
|
||||
val isBottom: Boolean = (toVector3 + new Vector3(0, -1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
|
||||
val isTop: Boolean = (position + new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
|
||||
val isBottom: Boolean = (position + new Vector3(0, -1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
|
||||
if (isTop && isBottom)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3)
|
||||
|
@ -612,7 +612,7 @@ class TileTesla extends ResonantTile(Material.iron) with TBlockNodeProvider with
|
|||
def getLowestTesla: TileTesla =
|
||||
{
|
||||
var lowest: TileTesla = this
|
||||
val checkPosition: Vector3 = toVector3
|
||||
val checkPosition: Vector3 = position
|
||||
var exit = false
|
||||
while (!exit)
|
||||
{
|
||||
|
|
|
@ -283,10 +283,10 @@ class PartFlatWire extends PartAbstract with TWire with TFacePart with TNormalOc
|
|||
|
||||
override def getSubParts: JIterable[IndexedCuboid6] = Seq(new IndexedCuboid6(0, PartFlatWire.selectionBounds(getThickness)(side)))
|
||||
|
||||
def getOcclusionBoxes: JIterable[Cuboid6] = Seq(PartFlatWire.occlusionBounds(getThickness)(side))
|
||||
|
||||
def getThickness: Int = if (insulated) 1 else 0
|
||||
|
||||
def getOcclusionBoxes: JIterable[Cuboid6] = Seq(PartFlatWire.occlusionBounds(getThickness)(side))
|
||||
|
||||
override def solid(arg0: Int) = false
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ class NodePipe(parent: PartPipe) extends NodeFluidPressure(parent) with TMultipa
|
|||
{
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val tile = toVectorWorld.add(dir).getTileEntity(world)
|
||||
val tile = position.add(dir).getTileEntity(world)
|
||||
|
||||
if (tile.isInstanceOf[IFluidHandler])
|
||||
{
|
||||
|
|
|
@ -51,6 +51,20 @@ object RenderPipe extends ISimpleItemRenderer
|
|||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
/**
|
||||
* Render inventory pipe
|
||||
*/
|
||||
def renderInventoryItem(renderType: ItemRenderType, itemStack: ItemStack, data: AnyRef*)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
|
||||
if (renderType == ItemRenderType.EQUIPPED_FIRST_PERSON || renderType == ItemRenderType.EQUIPPED)
|
||||
GL11.glTranslated(0.5, 0.5, 0.5)
|
||||
|
||||
render(itemStack.getItemDamage, -1, 0xC)
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Pipe Model
|
||||
*/
|
||||
|
@ -103,18 +117,4 @@ object RenderPipe extends ISimpleItemRenderer
|
|||
|
||||
RenderUtility.disableBlending()
|
||||
}
|
||||
|
||||
/**
|
||||
* Render inventory pipe
|
||||
*/
|
||||
def renderInventoryItem(renderType: ItemRenderType, itemStack: ItemStack, data: AnyRef*)
|
||||
{
|
||||
GL11.glPushMatrix()
|
||||
|
||||
if (renderType == ItemRenderType.EQUIPPED_FIRST_PERSON || renderType == ItemRenderType.EQUIPPED)
|
||||
GL11.glTranslated(0.5, 0.5, 0.5)
|
||||
|
||||
render(itemStack.getItemDamage, -1, 0xC)
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ class TilePump extends TileMechanical(Material.iron) with IRotatable with IFluid
|
|||
{
|
||||
if (from == getDirection.getOpposite)
|
||||
{
|
||||
val tileOut = (toVectorWorld + from.getOpposite).getTileEntity
|
||||
val tileOut = (position + from.getOpposite).getTileEntity
|
||||
if (tileOut.isInstanceOf[IFluidHandler])
|
||||
return (tileOut.asInstanceOf[IFluidHandler]).fill(from, resource, doFill)
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ class TileDetector extends TileFilterable with TPacketReceiver
|
|||
this.worldObj.notifyBlocksOfNeighborChange(x, this.yCoord + 1, z, MechanicalContent.blockDetector)
|
||||
}
|
||||
}
|
||||
ResonantEngine.packetHandler.sendToAllAround(new PacketTile(xi, yi, zi, Array[Any](0, this.isInverted)), this)
|
||||
ResonantEngine.packetHandler.sendToAllAround(new PacketTile(x, y, z, Array[Any](0, this.isInverted)), this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class TileDetector extends TileFilterable with TPacketReceiver
|
|||
|
||||
override def getDescriptionPacket: Packet =
|
||||
{
|
||||
return ResonantEngine.packetHandler.toMCPacket(new PacketTile(xi, yi, zi, Array[Any](0, this.isInverted)))
|
||||
return ResonantEngine.packetHandler.toMCPacket(new PacketTile(x, y, z, Array[Any](0, this.isInverted)))
|
||||
}
|
||||
|
||||
override def read(buf: ByteBuf, id: Int, packetType: PacketType)
|
||||
|
@ -139,7 +139,7 @@ class TileDetector extends TileFilterable with TPacketReceiver
|
|||
{
|
||||
var isInverted: Boolean = false
|
||||
var isFront: Boolean = false
|
||||
val tileEntity: TileEntity = iBlockAccess.getTileEntity(xi, yi, zi)
|
||||
val tileEntity: TileEntity = iBlockAccess.getTileEntity(x, y, z)
|
||||
if (tileEntity.isInstanceOf[TileDetector])
|
||||
{
|
||||
isFront = side == (tileEntity.asInstanceOf[TileDetector]).getDirection.ordinal
|
||||
|
|
|
@ -43,11 +43,6 @@ class TileBreaker extends ResonantTile(Material.iron) with TRotatable with IPack
|
|||
work
|
||||
}
|
||||
|
||||
override def onNeighborChanged(block: Block)
|
||||
{
|
||||
work
|
||||
}
|
||||
|
||||
def work
|
||||
{
|
||||
if (isIndirectlyPowered)
|
||||
|
@ -57,6 +52,11 @@ class TileBreaker extends ResonantTile(Material.iron) with TRotatable with IPack
|
|||
}
|
||||
}
|
||||
|
||||
override def onNeighborChanged(block: Block)
|
||||
{
|
||||
work
|
||||
}
|
||||
|
||||
override def update
|
||||
{
|
||||
if (_doWork)
|
||||
|
@ -78,8 +78,8 @@ class TileBreaker extends ResonantTile(Material.iron) with TRotatable with IPack
|
|||
if (isIndirectlyPowered)
|
||||
{
|
||||
val dir: ForgeDirection = getDirection
|
||||
val check: Vector3 = toVector3.add(dir)
|
||||
val put: VectorWorld = toVector3.add(dir.getOpposite).asInstanceOf[VectorWorld]
|
||||
val check: Vector3 = position.add(dir)
|
||||
val put: VectorWorld = position.add(dir.getOpposite)
|
||||
val block: Block = check.getBlock(world)
|
||||
if (block != null)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ class TileBreaker extends ResonantTile(Material.iron) with TRotatable with IPack
|
|||
|
||||
@SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): IIcon =
|
||||
{
|
||||
val meta: Int = access.getBlockMetadata(xi, yi, zi)
|
||||
val meta: Int = access.getBlockMetadata(x, y, z)
|
||||
if (side == meta)
|
||||
{
|
||||
return TileBreaker.iconFront
|
||||
|
|
|
@ -53,11 +53,6 @@ class TilePlacer extends ResonantTile(Material.rock) with TInventory with TRotat
|
|||
work
|
||||
}
|
||||
|
||||
override def onNeighborChanged(block: Block)
|
||||
{
|
||||
work
|
||||
}
|
||||
|
||||
def work
|
||||
{
|
||||
if (isIndirectlyPowered)
|
||||
|
@ -67,6 +62,11 @@ class TilePlacer extends ResonantTile(Material.rock) with TInventory with TRotat
|
|||
}
|
||||
}
|
||||
|
||||
override def onNeighborChanged(block: Block)
|
||||
{
|
||||
work
|
||||
}
|
||||
|
||||
override def start
|
||||
{
|
||||
super.start
|
||||
|
@ -108,7 +108,7 @@ class TilePlacer extends ResonantTile(Material.rock) with TInventory with TRotat
|
|||
def doWork
|
||||
{
|
||||
val side: Int = 0
|
||||
val placePos: Vector3 = toVector3.add(getDirection)
|
||||
val placePos: Vector3 = position.add(getDirection)
|
||||
val placeStack: ItemStack = getStackInSlot(0)
|
||||
if (InventoryUtility.placeItemBlock(world, placePos.xi, placePos.yi, placePos.zi, placeStack, side))
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ class TilePlacer extends ResonantTile(Material.rock) with TInventory with TRotat
|
|||
|
||||
@SideOnly(Side.CLIENT) override def getIcon(access: IBlockAccess, side: Int): IIcon =
|
||||
{
|
||||
val meta: Int = access.getBlockMetadata(xi, yi, zi)
|
||||
val meta: Int = access.getBlockMetadata(x, y, z)
|
||||
if (side == meta)
|
||||
{
|
||||
return TilePlacer.iconFront
|
||||
|
|
|
@ -17,15 +17,8 @@ abstract class PartMechanical extends PartAbstract with JNormalOcclusion with TF
|
|||
var placementSide: ForgeDirection = ForgeDirection.UNKNOWN
|
||||
/** The tier of this mechanical part */
|
||||
var tier = 0
|
||||
def mechanicalNode = _mechanicalNode
|
||||
/** Node that handles resonantinduction.mechanical action of the machine */
|
||||
private var _mechanicalNode: NodeMechanical = null
|
||||
def mechanicalNode_=(mech: NodeMechanical)
|
||||
{
|
||||
_mechanicalNode = mech
|
||||
mechanicalNode.onVelocityChanged = () => if (world != null) sendPacket(1)
|
||||
nodes.add(mechanicalNode)
|
||||
}
|
||||
|
||||
def preparePlacement(side: Int, itemDamage: Int)
|
||||
{
|
||||
|
@ -72,6 +65,15 @@ abstract class PartMechanical extends PartAbstract with JNormalOcclusion with TF
|
|||
}
|
||||
}
|
||||
|
||||
def mechanicalNode = _mechanicalNode
|
||||
|
||||
def mechanicalNode_=(mech: NodeMechanical)
|
||||
{
|
||||
_mechanicalNode = mech
|
||||
mechanicalNode.onVelocityChanged = () => if (world != null) sendPacket(1)
|
||||
nodes.add(mechanicalNode)
|
||||
}
|
||||
|
||||
override def load(nbt: NBTTagCompound)
|
||||
{
|
||||
placementSide = ForgeDirection.getOrientation(nbt.getByte("side"))
|
||||
|
|
|
@ -66,17 +66,13 @@ abstract class TileMechanical(material: Material) extends ResonantTile(material:
|
|||
def mechanicalNode = _mechanicalNode
|
||||
|
||||
def mechanicalNode_=(newNode: NodeMechanical)
|
||||
{
|
||||
_mechanicalNode = newNode
|
||||
mechanicalNode.onVelocityChanged = () => sendPacket(1)
|
||||
nodes.removeAll(nodes.filter(_.isInstanceOf[NodeMechanical]))
|
||||
nodes.add(mechanicalNode)
|
||||
{
|
||||
_mechanicalNode = newNode
|
||||
mechanicalNode.onVelocityChanged = () => sendPacket(1)
|
||||
nodes.removeAll(nodes.filter(_.isInstanceOf[NodeMechanical]))
|
||||
nodes.add(mechanicalNode)
|
||||
}
|
||||
|
||||
mechanicalNode = new NodeMechanical(this)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -20,8 +20,6 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
{
|
||||
override def angleDisplacement = if (gear.getMultiBlock.isConstructed) Math.PI / 36 else Math.PI / 12
|
||||
|
||||
protected def gear = getParent.asInstanceOf[PartGear]
|
||||
|
||||
override def inertia: Double =
|
||||
{
|
||||
gear.tier match
|
||||
|
@ -32,6 +30,8 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
}
|
||||
}
|
||||
|
||||
protected def gear = getParent.asInstanceOf[PartGear]
|
||||
|
||||
override def friction: Double =
|
||||
{
|
||||
gear.tier match
|
||||
|
@ -149,7 +149,7 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
}
|
||||
|
||||
//It's not a gear. It might be be another tile node
|
||||
val sourceTile = toVectorWorld.add(from).getTileEntity(world)
|
||||
val sourceTile = position.add(from).getTileEntity(world)
|
||||
|
||||
if (sourceTile.isInstanceOf[INodeProvider])
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
val checkPart = otherParent.asInstanceOf[PartGear].tile.partMap(gear.placementSide.ordinal)
|
||||
if (checkPart.isInstanceOf[PartGear])
|
||||
{
|
||||
val requiredDirection = checkPart.asInstanceOf[PartGear].getPosition.subtract(toVectorWorld).toForgeDirection
|
||||
val requiredDirection = checkPart.asInstanceOf[PartGear].getPosition.subtract(position).toForgeDirection
|
||||
return checkPart.asInstanceOf[PartGear].isCenterMultiBlock && otherParent.asInstanceOf[PartGear].placementSide == requiredDirection
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
}
|
||||
|
||||
//Check for gear outside this block placed on the same plane
|
||||
val otherTile = other.toVectorWorld.getTileEntity
|
||||
val otherTile = other.position.getTileEntity
|
||||
|
||||
if (otherTile.isInstanceOf[TileMultipart])
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
{
|
||||
//We found another gear, but check if we are connecting to the center spaces of the gear
|
||||
//If this is a multiblock, "otherTile" would be the center of that gear, not the adjacent
|
||||
val adjacentTile = toVectorWorld.add(from).getTileEntity
|
||||
val adjacentTile = position.add(from).getTileEntity
|
||||
|
||||
if (adjacentTile.isInstanceOf[TileMultipart])
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ class NodeGear(parent: PartGear) extends NodeMechanical(parent: PartGear)
|
|||
|
||||
override def radius(other: TNodeMechanical): Double =
|
||||
{
|
||||
val deltaPos = other.asInstanceOf[NodeMechanical].toVectorWorld - toVectorWorld
|
||||
val deltaPos = other.asInstanceOf[NodeMechanical].position - position
|
||||
val caseX = gear.placementSide.offsetX != 0 && deltaPos.y == 0 && deltaPos.z == 0
|
||||
val caseY = gear.placementSide.offsetY != 0 && deltaPos.x == 0 && deltaPos.z == 0
|
||||
val caseZ = gear.placementSide.offsetZ != 0 && deltaPos.x == 0 && deltaPos.y == 0
|
||||
|
|
|
@ -96,6 +96,8 @@ class PartGear extends PartMechanical with IMultiBlockStructure[PartGear]
|
|||
return (primaryPos.xi == x && placementSide.offsetX == 0) || (primaryPos.yi == y && placementSide.offsetY == 0) || (primaryPos.zi == z && placementSide.offsetZ == 0)
|
||||
}
|
||||
|
||||
override def getMultiBlock: GearMultiBlockHandler = multiBlock
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
|
||||
{
|
||||
|
@ -115,8 +117,6 @@ class PartGear extends PartMechanical with IMultiBlockStructure[PartGear]
|
|||
getMultiBlock.save(nbt)
|
||||
}
|
||||
|
||||
override def getMultiBlock: GearMultiBlockHandler = multiBlock
|
||||
|
||||
override def getMultiBlockVectors: java.util.List[resonantengine.lib.transform.vector.Vector3] = new resonantengine.lib.transform.vector.Vector3().getAround(this.world, placementSide, 1)
|
||||
|
||||
def getWorld: World =
|
||||
|
|
|
@ -4,7 +4,6 @@ import edx.core.interfaces.TNodeMechanical
|
|||
import edx.core.prefab.node.TMultipartNode
|
||||
import resonantengine.api.graph.INodeProvider
|
||||
import resonantengine.api.tile.IDebugInfo
|
||||
import resonantengine.api.transform.vector.IVectorWorld
|
||||
import resonantengine.lib.grid.core.{GridNode, NodeGrid, TTileConnector}
|
||||
|
||||
import scala.beans.BeanProperty
|
||||
|
@ -15,7 +14,7 @@ import scala.collection.convert.wrapAll._
|
|||
*
|
||||
* @author Calclavia, Darkguardsman
|
||||
*/
|
||||
class NodeMechanical(parent: INodeProvider) extends NodeGrid[NodeMechanical](parent) with TTileConnector[NodeMechanical] with TMultipartNode[NodeMechanical] with TNodeMechanical with IVectorWorld with IDebugInfo
|
||||
class NodeMechanical(parent: INodeProvider) extends NodeGrid[NodeMechanical](parent) with TTileConnector[NodeMechanical] with TMultipartNode[NodeMechanical] with TNodeMechanical with IDebugInfo
|
||||
{
|
||||
/**
|
||||
* Angle calculations
|
||||
|
|
|
@ -44,7 +44,7 @@ import resonantengine.lib.render.RenderUtility
|
|||
if (tile.getWorldObj != null)
|
||||
{
|
||||
val dir: ForgeDirection = tile.getDirection
|
||||
if (tile.world.isAirBlock(tile.xi + dir.offsetX, tile.yi + dir.offsetY, tile.zi + dir.offsetZ))
|
||||
if (tile.world.isAirBlock(tile.x + dir.offsetX, tile.y + dir.offsetY, tile.z + dir.offsetZ))
|
||||
{
|
||||
GL11.glTranslated(0, 0, (0.4 * Math.sin(angle)) - 0.5)
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class TileMechanicalPiston extends TileMechanical(Material.piston)
|
|||
super.update
|
||||
if (markRevolve)
|
||||
{
|
||||
val movePosition: Vector3 = toVector3.add(getDirection)
|
||||
val movePosition: Vector3 = position.add(getDirection)
|
||||
if (!hitOreBlock(movePosition))
|
||||
{
|
||||
if (!worldObj.isRemote)
|
||||
|
|
|
@ -14,7 +14,7 @@ class NodeGrinder(parent: TileGrindingWheel) extends NodeMechanical(parent: Tile
|
|||
|
||||
override def canConnect[B <: NodeMechanical](other: B, from: ForgeDirection): Boolean = parent.getDirection == from || parent.getDirection.getOpposite == from
|
||||
|
||||
override def inverseRotation(other: TNodeMechanical): Boolean = if (other.isInstanceOf[NodeGear]) (toVector3 - other.asInstanceOf[NodeMechanical].toVector3).toArray.sum < 0 else false
|
||||
override def inverseRotation(other: TNodeMechanical): Boolean = if (other.isInstanceOf[NodeGear]) (position - other.asInstanceOf[NodeMechanical].position).toArray.sum < 0 else false
|
||||
|
||||
override def inverseNext(other: TNodeMechanical): Boolean = if (other.isInstanceOf[NodeGear]) (toVector3 - other.asInstanceOf[NodeMechanical].toVector3).toArray.sum < 0 else false
|
||||
override def inverseNext(other: TNodeMechanical): Boolean = if (other.isInstanceOf[NodeGear]) (position - other.asInstanceOf[NodeMechanical].position).toArray.sum < 0 else false
|
||||
}
|
|
@ -62,7 +62,7 @@ class TileGrindingWheel extends TileMechanical(Material.rock)
|
|||
|
||||
if (grindingItem != null)
|
||||
{
|
||||
if (TileGrindingWheel.grindingTimer.containsKey(grindingItem) && !grindingItem.isDead && toVector3.add(0.5).distance(new Vector3(grindingItem)) < 1)
|
||||
if (TileGrindingWheel.grindingTimer.containsKey(grindingItem) && !grindingItem.isDead && position.add(0.5).distance(new Vector3(grindingItem)) < 1)
|
||||
{
|
||||
val timeLeft: Int = TileGrindingWheel.grindingTimer.decrease(grindingItem)
|
||||
if (timeLeft <= 0)
|
||||
|
@ -136,6 +136,11 @@ class TileGrindingWheel extends TileMechanical(Material.rock)
|
|||
return results.length > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this machine work this tick?
|
||||
*/
|
||||
def canWork: Boolean = counter >= requiredTorque
|
||||
|
||||
override def collide(entity: Entity)
|
||||
{
|
||||
if (entity.isInstanceOf[EntityItem])
|
||||
|
@ -179,11 +184,6 @@ class TileGrindingWheel extends TileMechanical(Material.rock)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this machine work this tick?
|
||||
*/
|
||||
def canWork: Boolean = counter >= requiredTorque
|
||||
|
||||
def canGrind(itemStack: ItemStack): Boolean = MachineRecipes.instance.getOutput(RecipeType.SIFTER.name, itemStack).length > 0
|
||||
|
||||
override def renderDynamic(pos: Vector3, frame: Float, pass: Int): Unit =
|
||||
|
|
|
@ -69,7 +69,7 @@ class TileMixer extends TileMechanical(Material.iron)
|
|||
{
|
||||
if (x != 0 && z != 0)
|
||||
{
|
||||
val block: Block = toVector3.add(x, 0, z).getBlock(world)
|
||||
val block: Block = position.add(x, 0, z).getBlock(world)
|
||||
if (block != null && !(block.isInstanceOf[IFluidBlock]))
|
||||
{
|
||||
return true
|
||||
|
@ -100,9 +100,9 @@ class TileMixer extends TileMechanical(Material.iron)
|
|||
{
|
||||
val entity: Entity = obj.asInstanceOf[Entity]
|
||||
val originalPosition: Vector3 = new Vector3(entity)
|
||||
val relativePosition: Vector3 = originalPosition - toVector3.add(0.5)
|
||||
val relativePosition: Vector3 = originalPosition - position.add(0.5)
|
||||
relativePosition.transform(new Quaternion(-mechanicalNode.angularVelocity, new Vector3(1, 0, 0)))
|
||||
val newPosition: Vector3 = toVector3 + 0.5 + relativePosition
|
||||
val newPosition: Vector3 = position + 0.5 + relativePosition
|
||||
val difference: Vector3 = (newPosition - originalPosition) * 0.5
|
||||
entity.addVelocity(difference.x, difference.y, difference.z)
|
||||
entity.onGround = false
|
||||
|
@ -121,7 +121,7 @@ class TileMixer extends TileMechanical(Material.iron)
|
|||
{
|
||||
TileMixer.MIXER_ITEM_TIMER.put(processingItem, TileMixer.PROCESS_TIME)
|
||||
}
|
||||
if (!processingItem.isDead && (toVector3 + 0.5).distance(new Vector3(processingItem)) < 2)
|
||||
if (!processingItem.isDead && (position + 0.5).distance(new Vector3(processingItem)) < 2)
|
||||
{
|
||||
val timeLeft: Int = TileMixer.MIXER_ITEM_TIMER.decrease(processingItem)
|
||||
if (timeLeft <= 0)
|
||||
|
|
|
@ -30,7 +30,7 @@ class NodeTurbine(parent: TileTurbine) extends NodeMechanical(parent)
|
|||
*/
|
||||
override def radius(other: TNodeMechanical): Double =
|
||||
{
|
||||
val deltaPos = other.asInstanceOf[NodeMechanical].toVectorWorld - toVectorWorld
|
||||
val deltaPos = other.asInstanceOf[NodeMechanical].position - position
|
||||
|
||||
if (deltaPos.normalize.toForgeDirection == parent.getDirection)
|
||||
return super.radius(other)
|
||||
|
|
|
@ -62,11 +62,6 @@ class TileTurbine extends TileMechanical(Material.wood) with IMultiBlockStructur
|
|||
{
|
||||
}
|
||||
|
||||
def getMultiBlock: TurbineMBlockHandler =
|
||||
{
|
||||
return multiBlock
|
||||
}
|
||||
|
||||
def getArea: Int = (((multiBlockRadius + 0.5) * 2) * ((multiBlockRadius + 0.5) * 2)).toInt
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -98,10 +93,7 @@ class TileTurbine extends TileMechanical(Material.wood) with IMultiBlockStructur
|
|||
return vectors
|
||||
}
|
||||
|
||||
def getPosition: Vector3 =
|
||||
{
|
||||
return toVector3
|
||||
}
|
||||
override def getPosition: Vector3 = position
|
||||
|
||||
def onMultiBlockChanged()
|
||||
{
|
||||
|
@ -139,6 +131,11 @@ class TileTurbine extends TileMechanical(Material.wood) with IMultiBlockStructur
|
|||
}
|
||||
}
|
||||
|
||||
def getMultiBlock: TurbineMBlockHandler =
|
||||
{
|
||||
return multiBlock
|
||||
}
|
||||
|
||||
override def write(buf: ByteBuf, id: Int)
|
||||
{
|
||||
super.write(buf, id)
|
||||
|
|
|
@ -37,7 +37,7 @@ class TileWaterTurbine extends TileTurbine
|
|||
{
|
||||
if (other.isInstanceOf[NodeMechanical] && !other.isInstanceOf[TileTurbine])
|
||||
{
|
||||
val sourceTile: TileEntity = toVectorWorld.add(from).getTileEntity
|
||||
val sourceTile: TileEntity = position.add(from).getTileEntity
|
||||
|
||||
if (sourceTile.isInstanceOf[INodeProvider])
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ class TileWaterTurbine extends TileTurbine
|
|||
val metadata = worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord)
|
||||
val isWater = blockAbove == Blocks.water || blockAbove == Blocks.flowing_water
|
||||
|
||||
if (isWater && metadata == 0 && blockBelow.isReplaceable(world, xi, yi - 1, zi))
|
||||
if (isWater && metadata == 0 && blockBelow.isReplaceable(world, x, y - 1, z))
|
||||
{
|
||||
powerTicks = 20
|
||||
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord)
|
||||
|
@ -86,7 +86,7 @@ class TileWaterTurbine extends TileTurbine
|
|||
{
|
||||
if (dir != currentDir && dir != currentDir.getOpposite)
|
||||
{
|
||||
val check: Vector3 = toVector3.add(dir)
|
||||
val check: Vector3 = position.add(dir)
|
||||
val block = worldObj.getBlock(check.xi, check.yi, check.zi)
|
||||
val metadata: Int = worldObj.getBlockMetadata(check.xi, check.yi, check.zi)
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class TileWindTurbine extends TileTurbine with IBoilHandler
|
|||
//Break under storm
|
||||
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)))
|
||||
toVectorWorld.setBlockToAir()
|
||||
position.setBlockToAir()
|
||||
}
|
||||
else if (getMultiBlock.isPrimary)
|
||||
{
|
||||
|
|
|
@ -196,19 +196,6 @@ object QuantumContent extends ContentHolder
|
|||
return fluid
|
||||
}
|
||||
|
||||
def fluidSteam: Fluid =
|
||||
{
|
||||
var fluid = FluidRegistry.getFluid("steam")
|
||||
|
||||
if (fluid == null)
|
||||
{
|
||||
fluid = new Fluid("steam").setGaseous(true)
|
||||
FluidRegistry.registerFluid(fluid)
|
||||
}
|
||||
|
||||
return fluid
|
||||
}
|
||||
|
||||
def FLUID_DEUTERIUM: Fluid =
|
||||
{
|
||||
var fluid: Fluid = FluidRegistry.getFluid("deuterium")
|
||||
|
@ -384,6 +371,16 @@ object QuantumContent extends ContentHolder
|
|||
return isItemStackOreDictionaryCompatible(itemStack, "cellEmpty")
|
||||
}
|
||||
|
||||
def isItemStackWaterCell(itemStack: ItemStack): Boolean =
|
||||
{
|
||||
return isItemStackOreDictionaryCompatible(itemStack, "cellWater")
|
||||
}
|
||||
|
||||
def isItemStackUraniumOre(itemStack: ItemStack): Boolean =
|
||||
{
|
||||
return isItemStackOreDictionaryCompatible(itemStack, "dropUranium", "oreUranium")
|
||||
}
|
||||
|
||||
/** Compare to Ore Dict
|
||||
*
|
||||
* @param itemStack
|
||||
|
@ -405,16 +402,6 @@ object QuantumContent extends ContentHolder
|
|||
return false
|
||||
}
|
||||
|
||||
def isItemStackWaterCell(itemStack: ItemStack): Boolean =
|
||||
{
|
||||
return isItemStackOreDictionaryCompatible(itemStack, "cellWater")
|
||||
}
|
||||
|
||||
def isItemStackUraniumOre(itemStack: ItemStack): Boolean =
|
||||
{
|
||||
return isItemStackOreDictionaryCompatible(itemStack, "dropUranium", "oreUranium")
|
||||
}
|
||||
|
||||
def isItemStackDeuteriumCell(itemStack: ItemStack): Boolean =
|
||||
{
|
||||
return isItemStackOreDictionaryCompatible(itemStack, "molecule_1d", "molecule_1h2", "cellDeuterium")
|
||||
|
@ -440,6 +427,19 @@ object QuantumContent extends ContentHolder
|
|||
|
||||
def fluidStackSteam: FluidStack = new FluidStack(fluidSteam, 0)
|
||||
|
||||
def fluidSteam: Fluid =
|
||||
{
|
||||
var fluid = FluidRegistry.getFluid("steam")
|
||||
|
||||
if (fluid == null)
|
||||
{
|
||||
fluid = new Fluid("steam").setGaseous(true)
|
||||
FluidRegistry.registerFluid(fluid)
|
||||
}
|
||||
|
||||
return fluid
|
||||
}
|
||||
|
||||
def FLUIDSTACK_DEUTERIUM: FluidStack = new FluidStack(FLUID_DEUTERIUM, 0)
|
||||
|
||||
def getFluidStackTritium: FluidStack = new FluidStack(getFluidTritium, 0)
|
||||
|
|
|
@ -114,7 +114,7 @@ class TileElectromagnet extends ResonantBlock(Material.iron) with IElectromagnet
|
|||
|
||||
for (dir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val check = toVector3 + dir
|
||||
val check = position + dir
|
||||
val checkTile = check.getTileEntity(world)
|
||||
|
||||
if (checkTile != null && checkTile.getClass == tile.getClass && check.getBlockMetadata(world) == tile.getBlockMetadata)
|
||||
|
@ -123,7 +123,7 @@ class TileElectromagnet extends ResonantBlock(Material.iron) with IElectromagnet
|
|||
}
|
||||
}
|
||||
|
||||
RenderBlockUtility.tessellateBlockWithConnectedTextures(sideMap, world, xi, yi, zi, tile.getBlockType, null, RenderUtility.getIcon(edgeTexture))
|
||||
RenderBlockUtility.tessellateBlockWithConnectedTextures(sideMap, world, x, y, z, tile.getBlockType, null, RenderUtility.getIcon(edgeTexture))
|
||||
}
|
||||
|
||||
}
|
|
@ -19,13 +19,13 @@ class TileSiren extends ResonantBlock(Material.wood)
|
|||
val world: World = worldObj
|
||||
if (world != null)
|
||||
{
|
||||
val metadata: Int = world.getBlockMetadata(xi, yi, zi)
|
||||
if (world.getBlockPowerInput(xi, yi, zi) > 0)
|
||||
val metadata: Int = world.getBlockMetadata(x, y, z)
|
||||
if (world.getBlockPowerInput(x, y, z) > 0)
|
||||
{
|
||||
var volume: Float = 0.5f
|
||||
for (i <- 0 to 6)
|
||||
{
|
||||
val check: Vector3 = toVector3.add(ForgeDirection.getOrientation(i))
|
||||
val check: Vector3 = position.add(ForgeDirection.getOrientation(i))
|
||||
if (check.getBlock(world) eq getBlockType)
|
||||
{
|
||||
volume *= 1.5f
|
||||
|
@ -38,7 +38,7 @@ class TileSiren extends ResonantBlock(Material.wood)
|
|||
|
||||
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
var metadata: Int = world.getBlockMetadata(xi, yi, zi)
|
||||
var metadata: Int = world.getBlockMetadata(x, y, z)
|
||||
if (player.isSneaking)
|
||||
{
|
||||
metadata -= 1
|
||||
|
@ -48,7 +48,7 @@ class TileSiren extends ResonantBlock(Material.wood)
|
|||
metadata += 1
|
||||
}
|
||||
metadata = Math.max(metadata % 16, 0)
|
||||
world.setBlockMetadataWithNotify(xi, yi, zi, metadata, 2)
|
||||
world.setBlockMetadataWithNotify(x, y, z, metadata, 2)
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -61,6 +61,36 @@ class PartQuantumGlyph extends JCuboidPart with TSlottedPart with JNormalOcclusi
|
|||
}
|
||||
}
|
||||
|
||||
def transport(`ob`: scala.Any)
|
||||
{
|
||||
if (ticks % 10 == 0 && (tile.asInstanceOf[IQuantumGate]).getFrequency != -1)
|
||||
{
|
||||
val frequencyBlocks: Set[IBlockFrequency] = FrequencyGridRegistry.instance.getNodes((tile.asInstanceOf[IQuantumGate]).getFrequency)
|
||||
val gates: List[IQuantumGate] = new ArrayList[IQuantumGate]
|
||||
|
||||
|
||||
for (frequencyBlock <- frequencyBlocks)
|
||||
{
|
||||
if (frequencyBlock.isInstanceOf[IQuantumGate])
|
||||
{
|
||||
gates.add(frequencyBlock.asInstanceOf[IQuantumGate])
|
||||
}
|
||||
}
|
||||
gates.remove(tile)
|
||||
|
||||
if (gates.size > 0)
|
||||
{
|
||||
if (ob.isInstanceOf[Entity])
|
||||
{
|
||||
val gate: IQuantumGate = gates.get(if (gates.size > 1) ob.asInstanceOf[Entity].worldObj.rand.nextInt(gates.size - 1) else 0)
|
||||
val position: VectorWorld = new VectorWorld(gate.asInstanceOf[TileEntity]).add(0.5, 2, 0.5)
|
||||
|
||||
if (QuantumGateManager.moveEntity(ob.asInstanceOf[Entity], position)) world.playSoundAtEntity(ob.asInstanceOf[Entity], "mob.endermen.portal", 1.0F, 1.0F)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override def update
|
||||
{
|
||||
if (ticks == 0) FrequencyGridRegistry.instance.add(tile.asInstanceOf[IQuantumGate])
|
||||
|
@ -92,36 +122,6 @@ class PartQuantumGlyph extends JCuboidPart with TSlottedPart with JNormalOcclusi
|
|||
return false
|
||||
}
|
||||
|
||||
def transport(`ob`: scala.Any)
|
||||
{
|
||||
if (ticks % 10 == 0 && (tile.asInstanceOf[IQuantumGate]).getFrequency != -1)
|
||||
{
|
||||
val frequencyBlocks: Set[IBlockFrequency] = FrequencyGridRegistry.instance.getNodes((tile.asInstanceOf[IQuantumGate]).getFrequency)
|
||||
val gates: List[IQuantumGate] = new ArrayList[IQuantumGate]
|
||||
|
||||
|
||||
for (frequencyBlock <- frequencyBlocks)
|
||||
{
|
||||
if (frequencyBlock.isInstanceOf[IQuantumGate])
|
||||
{
|
||||
gates.add(frequencyBlock.asInstanceOf[IQuantumGate])
|
||||
}
|
||||
}
|
||||
gates.remove(tile)
|
||||
|
||||
if (gates.size > 0)
|
||||
{
|
||||
if (ob.isInstanceOf[Entity])
|
||||
{
|
||||
val gate: IQuantumGate = gates.get(if (gates.size > 1) ob.asInstanceOf[Entity].worldObj.rand.nextInt(gates.size - 1) else 0)
|
||||
val position: VectorWorld = new VectorWorld(gate.asInstanceOf[TileEntity]).add(0.5, 2, 0.5)
|
||||
|
||||
if (QuantumGateManager.moveEntity(ob.asInstanceOf[Entity], position)) world.playSoundAtEntity(ob.asInstanceOf[Entity], "mob.endermen.portal", 1.0F, 1.0F)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getType: String =
|
||||
{
|
||||
return "resonant_induction_quantum_glyph"
|
||||
|
|
|
@ -57,8 +57,8 @@ class TileLaserEmitter extends ResonantTile(Material.iron) with ILaserHandler wi
|
|||
*/
|
||||
override def onPlaced(entityLiving: EntityLivingBase, itemStack: ItemStack)
|
||||
{
|
||||
val l = BlockPistonBase.determineOrientation(world, xi, yi, zi, entityLiving)
|
||||
world.setBlockMetadataWithNotify(xi, yi, zi, l, 2)
|
||||
val l = BlockPistonBase.determineOrientation(world, x, y, z, entityLiving)
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2)
|
||||
}
|
||||
|
||||
override def getLightValue(access: IBlockAccess): Int = ((electricNode.power / Laser.maxEnergy) * 15).toInt
|
||||
|
@ -71,7 +71,7 @@ class TileLaserEmitter extends ResonantTile(Material.iron) with ILaserHandler wi
|
|||
|
||||
if (electricNode.power > 0)
|
||||
{
|
||||
Laser.spawn(worldObj, toVector3 + 0.5 + new Vector3(getDirection) * 0.51, toVector3 + new Vector3(getDirection) * 0.6 + 0.5, new Vector3(getDirection), electricNode.power / 20)
|
||||
Laser.spawn(worldObj, position + 0.5 + new Vector3(getDirection) * 0.51, position + new Vector3(getDirection) * 0.6 + 0.5, new Vector3(getDirection), electricNode.power / 20)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ class TileLaserReceiver extends ResonantTile(Material.rock) with ILaserHandler w
|
|||
|
||||
override def onPlaced(entityLiving: EntityLivingBase, itemStack: ItemStack)
|
||||
{
|
||||
val l = BlockPistonBase.determineOrientation(world, xi, yi, zi, entityLiving)
|
||||
world.setBlockMetadataWithNotify(xi, yi, zi, l, 2)
|
||||
val l = BlockPistonBase.determineOrientation(world, x, y, z, entityLiving)
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2)
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -42,6 +42,18 @@ class ItemFocusingMatrix extends Item
|
|||
add(list, "None")
|
||||
}
|
||||
|
||||
def getControlCoordinate(stack: ItemStack): Vector3 =
|
||||
{
|
||||
val nbt = stack.getTagCompound
|
||||
|
||||
if (nbt != null)
|
||||
{
|
||||
return new Vector3(nbt)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
override def onItemUse(itemStack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, par7: Int, par8: Float, par9: Float, par10: Float): Boolean =
|
||||
{
|
||||
val tile = world.getTileEntity(x, y, z)
|
||||
|
@ -123,16 +135,4 @@ class ItemFocusingMatrix extends Item
|
|||
stack.setTagCompound(nbt)
|
||||
}
|
||||
|
||||
def getControlCoordinate(stack: ItemStack): Vector3 =
|
||||
{
|
||||
val nbt = stack.getTagCompound
|
||||
|
||||
if (nbt != null)
|
||||
{
|
||||
return new Vector3(nbt)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
|
|||
{
|
||||
val dir = ForgeDirection.getOrientation(a)
|
||||
val axis = new Vector3(dir)
|
||||
val rotateAngle = world.getIndirectPowerLevelTo(xi + axis.x.toInt, yi + axis.y.toInt, zi + axis.z.toInt, a) * 15
|
||||
val rotateAngle = world.getIndirectPowerLevelTo(x + axis.x.toInt, y + axis.y.toInt, z + axis.z.toInt, a) * 15
|
||||
|
||||
if (rotateAngle > 0)
|
||||
{
|
||||
|
@ -55,12 +55,12 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
|
|||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
}
|
||||
|
||||
if (energy > 0)
|
||||
{
|
||||
Laser.spawn(worldObj, toVector3 + 0.5 + normal * 0.9, toVector3 + 0.5, normal, color, energy)
|
||||
Laser.spawn(worldObj, position + 0.5 + normal * 0.9, position + 0.5, normal, color, energy)
|
||||
color = new Vector3(1, 1, 1)
|
||||
energy = 0
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
|
|||
|
||||
override def focus(newPosition: Vector3)
|
||||
{
|
||||
normal = ((newPosition - toVector3) - 0.5).normalize
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
normal = ((newPosition - position) - 0.5).normalize
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
}
|
||||
|
||||
override def getFocus: Vector3 = normal
|
||||
|
@ -83,7 +83,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
|
|||
|
||||
override def onLaserHit(renderStart: Vector3, incidentDirection: Vector3, hit: MovingObjectPosition, color: Vector3, energy: Double): Boolean =
|
||||
{
|
||||
Electrodynamics.proxy.renderLaser(worldObj, renderStart, toVector3 + 0.5, color, energy)
|
||||
Electrodynamics.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy)
|
||||
this.energy += energy
|
||||
this.color = (this.color + color) / 2
|
||||
return true
|
||||
|
@ -93,7 +93,7 @@ class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with
|
|||
{
|
||||
val nbt = new NBTTagCompound()
|
||||
writeToNBT(nbt)
|
||||
return new S35PacketUpdateTileEntity(xi, yi, zi, 0, nbt)
|
||||
return new S35PacketUpdateTileEntity(x, y, z, 0, nbt)
|
||||
}
|
||||
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
|
|
|
@ -49,7 +49,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
|
|||
{
|
||||
val dir = ForgeDirection.getOrientation(a)
|
||||
val axis = new Vector3(dir)
|
||||
val rotateAngle = world.getIndirectPowerLevelTo(xi + axis.x.toInt, yi + axis.y.toInt, zi + axis.z.toInt, a) * 15
|
||||
val rotateAngle = world.getIndirectPowerLevelTo(x + axis.x.toInt, y + axis.y.toInt, z + axis.z.toInt, a) * 15
|
||||
|
||||
if (rotateAngle > 0)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
|
|||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
}
|
||||
|
||||
if (world.getTotalWorldTime % 20 == 0)
|
||||
|
@ -66,8 +66,8 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
|
|||
|
||||
override def focus(newPosition: Vector3)
|
||||
{
|
||||
normal = ((newPosition - toVector3) - 0.5).normalize
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
normal = ((newPosition - position) - 0.5).normalize
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
}
|
||||
|
||||
override def getFocus: Vector3 = normal
|
||||
|
@ -89,7 +89,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
|
|||
/**
|
||||
* Render incoming laser
|
||||
*/
|
||||
Electrodynamics.proxy.renderLaser(worldObj, renderStart, toVector3 + 0.5, color, energy)
|
||||
Electrodynamics.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy)
|
||||
|
||||
/**
|
||||
* Calculate Reflection
|
||||
|
@ -102,7 +102,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
|
|||
if (rotateAngle < Math.PI)
|
||||
{
|
||||
val newDirection = (incidentDirection.clone.transform(new Quaternion(rotateAngle, axisOfReflection))).normalize
|
||||
Laser.spawn(worldObj, toVector3 + 0.5 + newDirection * 0.9, toVector3 + 0.5, newDirection, color, energy / 1.2)
|
||||
Laser.spawn(worldObj, position + 0.5 + newDirection * 0.9, position + 0.5, newDirection, color, energy / 1.2)
|
||||
}
|
||||
|
||||
return true
|
||||
|
@ -112,7 +112,7 @@ class TileMirror extends TileFocus(Material.glass) with ILaserHandler with IFocu
|
|||
{
|
||||
val nbt = new NBTTagCompound()
|
||||
writeToNBT(nbt)
|
||||
return new S35PacketUpdateTileEntity(xi, yi, zi, 0, nbt)
|
||||
return new S35PacketUpdateTileEntity(x, y, z, 0, nbt)
|
||||
}
|
||||
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
|
|
|
@ -229,9 +229,9 @@ class EntityParticle(par1World: World) extends Entity(par1World) with IEntityAdd
|
|||
return this.getParticleVelocity - (this.getParticleVelocity / Math.min(Math.max(70 * this.getParticleVelocity, 4), 30))
|
||||
}
|
||||
|
||||
def getParticleVelocity: Double =
|
||||
override def applyEntityCollision(par1Entity: Entity)
|
||||
{
|
||||
return Math.abs(this.motionX) + Math.abs(this.motionY) + Math.abs(this.motionZ)
|
||||
this.handleCollisionWithEntity
|
||||
}
|
||||
|
||||
def handleCollisionWithEntity
|
||||
|
@ -264,17 +264,17 @@ class EntityParticle(par1World: World) extends Entity(par1World) with IEntityAdd
|
|||
setDead
|
||||
}
|
||||
|
||||
def getParticleVelocity: Double =
|
||||
{
|
||||
return Math.abs(this.motionX) + Math.abs(this.motionY) + Math.abs(this.motionZ)
|
||||
}
|
||||
|
||||
override def setDead
|
||||
{
|
||||
ForgeChunkManager.releaseTicket(this.updateTicket)
|
||||
super.setDead
|
||||
}
|
||||
|
||||
override def applyEntityCollision(par1Entity: Entity)
|
||||
{
|
||||
this.handleCollisionWithEntity
|
||||
}
|
||||
|
||||
protected override def entityInit
|
||||
{
|
||||
this.dataWatcher.addObject(EntityParticle.MOVEMENT_DIRECTION_DATAWATCHER_ID, 3.asInstanceOf[Byte])
|
||||
|
|
|
@ -16,7 +16,7 @@ class GuiAccelerator(player: EntityPlayer, tileEntity: TileAccelerator) extends
|
|||
{
|
||||
this.fontRendererObj.drawString("Accelerator", 40, 10, 4210752)
|
||||
var status: String = ""
|
||||
val position: Vector3 = tileEntity.toVector3 + tileEntity.getDirection.getOpposite
|
||||
val position: Vector3 = tileEntity.position + tileEntity.getDirection.getOpposite
|
||||
if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position))
|
||||
{
|
||||
status = "\u00a74Fail to emit; try rotating."
|
||||
|
|
|
@ -68,13 +68,13 @@ class TileAccelerator extends ResonantTile(Material.iron) with TInventory with I
|
|||
//Create new particle if we have materials to spawn it with
|
||||
if (getStackInSlot(0) != null && lastSpawnTick >= 40)
|
||||
{
|
||||
val spawn_vec: Vector3 = toVector3
|
||||
val spawn_vec: Vector3 = position
|
||||
spawn_vec.add(getDirection.getOpposite)
|
||||
spawn_vec.add(0.5f)
|
||||
if (EntityParticle.canSpawnParticle(worldObj, spawn_vec))
|
||||
{
|
||||
totalEnergyConsumed = 0
|
||||
entityParticle = new EntityParticle(worldObj, spawn_vec, toVector3, getDirection.getOpposite)
|
||||
entityParticle = new EntityParticle(worldObj, spawn_vec, position, getDirection.getOpposite)
|
||||
worldObj.spawnEntityInWorld(entityParticle)
|
||||
CalculateParticleDensity
|
||||
decrStackSize(0, 1)
|
||||
|
@ -205,7 +205,7 @@ class TileAccelerator extends ResonantTile(Material.iron) with TInventory with I
|
|||
|
||||
override def getDescPacket: PacketTile =
|
||||
{
|
||||
return new PacketTile(xi, yi, zi, Array[Any](DESC_PACKET_ID, velocity, totalEnergyConsumed, antimatter, energy.value))
|
||||
return new PacketTile(x, y, z, Array[Any](DESC_PACKET_ID, velocity, totalEnergyConsumed, antimatter, energy.value))
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
|
@ -223,7 +223,7 @@ class TileAccelerator extends ResonantTile(Material.iron) with TInventory with I
|
|||
|
||||
override def activate(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
player.openGui(Electrodynamics, 0, world, xi, yi, zi)
|
||||
player.openGui(Electrodynamics, 0, world, x, y, z)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ class TileNuclearBoiler extends ResonantTile(Material.iron) with TInventory with
|
|||
|
||||
override def getDescPacket: PacketTile =
|
||||
{
|
||||
return new PacketTile(xi, yi, zi, Array[Any](this.timer, QuantumContent.getFluidAmount(this.waterTank.getFluid), QuantumContent.getFluidAmount(this.gasTank.getFluid)))
|
||||
return new PacketTile(x, y, z, Array[Any](this.timer, QuantumContent.getFluidAmount(this.waterTank.getFluid), QuantumContent.getFluidAmount(this.gasTank.getFluid)))
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
|
|
|
@ -58,7 +58,7 @@ class TileCentrifuge extends ResonantTile(Material.iron) with TInventory with TB
|
|||
for (i <- 0 to 6)
|
||||
{
|
||||
val direction: ForgeDirection = ForgeDirection.getOrientation(i)
|
||||
val tileEntity: TileEntity = toVector3.add(direction).getTileEntity(world)
|
||||
val tileEntity: TileEntity = position.add(direction).getTileEntity(world)
|
||||
if (tileEntity.isInstanceOf[IFluidHandler] && tileEntity.getClass != this.getClass)
|
||||
{
|
||||
val fluidHandler: IFluidHandler = (tileEntity.asInstanceOf[IFluidHandler])
|
||||
|
@ -165,7 +165,7 @@ class TileCentrifuge extends ResonantTile(Material.iron) with TInventory with TB
|
|||
|
||||
override def getDescPacket: PacketTile =
|
||||
{
|
||||
return new PacketTile(xi, yi, zi, Array[Any](this.timer, QuantumContent.getFluidAmount(this.gasTank.getFluid)))
|
||||
return new PacketTile(x, y, z, Array[Any](this.timer, QuantumContent.getFluidAmount(this.gasTank.getFluid)))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ class FulminationHandler
|
|||
{
|
||||
if (!tileEntity.isInvalid)
|
||||
{
|
||||
val tileDiDian: Vector3 = tileEntity.toVector3
|
||||
val tileDiDian: Vector3 = tileEntity.position
|
||||
tileDiDian.add(0.5f)
|
||||
val juLi: Double = tileDiDian.distance(new Vector3(evt.x, evt.y, evt.z))
|
||||
if (juLi <= evt.iExplosion.getRadius && juLi > 0)
|
||||
|
@ -61,7 +61,7 @@ class FulminationHandler
|
|||
for (tileEntity <- avaliableGenerators)
|
||||
{
|
||||
val density: Float = evt.world.getBlockDensity(Vec3.createVectorHelper(evt.x, evt.y, evt.z), AtomicContent.blockFulmination.getCollisionBoundingBoxFromPool(evt.world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord))
|
||||
val juLi: Double = tileEntity.toVector3.distance(new Vector3(evt.x, evt.y, evt.z))
|
||||
val juLi: Double = tileEntity.position.distance(new Vector3(evt.x, evt.y, evt.z))
|
||||
var energy: Long = Math.min(maxEnergyPerGenerator, maxEnergyPerGenerator / (juLi / evt.iExplosion.getRadius)).asInstanceOf[Long]
|
||||
energy = Math.max((1 - density) * energy, 0).asInstanceOf[Long]
|
||||
tileEntity.energy.receiveEnergy(energy, true)
|
||||
|
|
|
@ -58,7 +58,7 @@ class TilePlasma extends ResonantTile(Material.lava)
|
|||
override def update
|
||||
{
|
||||
super.update
|
||||
GridThermal.addHeat(toVectorWorld, ((temperature - GridThermal.getTemperature(toVectorWorld)) * 0.1f).asInstanceOf[Float])
|
||||
GridThermal.addHeat(position, ((temperature - GridThermal.getTemperature(position)) * 0.1f).asInstanceOf[Float])
|
||||
if (ticks % 20 == 0)
|
||||
{
|
||||
temperature /= 1.5
|
||||
|
@ -71,7 +71,7 @@ class TilePlasma extends ResonantTile(Material.lava)
|
|||
{
|
||||
if (worldObj.rand.nextFloat < 0.4)
|
||||
{
|
||||
val diDian: Vector3 = toVector3
|
||||
val diDian: Vector3 = position
|
||||
diDian.add(ForgeDirection.getOrientation(i))
|
||||
val tileEntity: TileEntity = diDian.getTileEntity(worldObj)
|
||||
if (!(tileEntity.isInstanceOf[TilePlasma]))
|
||||
|
|
|
@ -64,7 +64,7 @@ class TilePlasmaHeater extends ResonantTile(Material.iron) with TBlockNodeProvid
|
|||
}
|
||||
if (ticks % 80 == 0)
|
||||
{
|
||||
world.markBlockForUpdate(xi, yi, zi)
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ class TilePlasmaHeater extends ResonantTile(Material.iron) with TBlockNodeProvid
|
|||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
return FluidUtility.playerActivatedFluidItem(world, xi, yi, zi, player, side)
|
||||
return FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side)
|
||||
}
|
||||
|
||||
}
|
|
@ -59,7 +59,7 @@ class TileQuantumAssembler extends ResonantTile(Material.iron) with TInventory w
|
|||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
player.openGui(QuantumContent, 0, world, xi, yi, zi)
|
||||
player.openGui(QuantumContent, 0, world, x, y, z)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -195,9 +195,9 @@ class TileQuantumAssembler extends ResonantTile(Material.iron) with TInventory w
|
|||
{
|
||||
if (this.getStackInSlot(6) != null)
|
||||
{
|
||||
return new PacketTile(xi, yi, zi, Array[Any](time, getStackInSlot(6)))
|
||||
return new PacketTile(x, y, z, Array[Any](time, getStackInSlot(6)))
|
||||
}
|
||||
return new PacketTile(xi, yi, zi, Array[Any](time, -1, -1, -1))
|
||||
return new PacketTile(x, y, z, Array[Any](time, -1, -1, -1))
|
||||
}
|
||||
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
|
|
|
@ -71,16 +71,6 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
return true
|
||||
}
|
||||
|
||||
def setThreshold(newThreshold: Int)
|
||||
{
|
||||
threshold = newThreshold % TileThermometer.MAX_THRESHOLD
|
||||
if (threshold <= 0)
|
||||
{
|
||||
threshold = TileThermometer.MAX_THRESHOLD
|
||||
}
|
||||
markUpdate
|
||||
}
|
||||
|
||||
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.isSneaking)
|
||||
|
@ -94,6 +84,16 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
return true
|
||||
}
|
||||
|
||||
def setThreshold(newThreshold: Int)
|
||||
{
|
||||
threshold = newThreshold % TileThermometer.MAX_THRESHOLD
|
||||
if (threshold <= 0)
|
||||
{
|
||||
threshold = TileThermometer.MAX_THRESHOLD
|
||||
}
|
||||
markUpdate
|
||||
}
|
||||
|
||||
override def getStrongRedstonePower(access: IBlockAccess, side: Int): Int =
|
||||
{
|
||||
return if (isProvidingPower) 15 else 0
|
||||
|
@ -106,7 +106,7 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
|
||||
override def onRemove(block: Block, par6: Int)
|
||||
{
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(getBlockType, world, xi, yi, zi)
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(getBlockType, world, x, y, z)
|
||||
InventoryUtility.dropItemStack(world, center, stack)
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
}
|
||||
else
|
||||
{
|
||||
detectedTemperature = GridThermal.getTemperature(toVectorWorld)
|
||||
detectedTemperature = GridThermal.getTemperature(position)
|
||||
}
|
||||
if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold)
|
||||
{
|
||||
|
@ -136,6 +136,16 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
}
|
||||
}
|
||||
|
||||
def isOverThreshold: Boolean =
|
||||
{
|
||||
return detectedTemperature >= getThreshold
|
||||
}
|
||||
|
||||
def getThreshold: Int =
|
||||
{
|
||||
return threshold
|
||||
}
|
||||
|
||||
def setTrack(track: Vector3)
|
||||
{
|
||||
trackCoordinate = track
|
||||
|
@ -185,11 +195,6 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
return Array[Any](this.getThreshold)
|
||||
}
|
||||
|
||||
def getThreshold: Int =
|
||||
{
|
||||
return threshold
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
def isAboveWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
|
@ -197,11 +202,6 @@ class TileThermometer extends ResonantTile(Material.piston) with SimpleComponent
|
|||
return Array[Any](this.isOverThreshold)
|
||||
}
|
||||
|
||||
def isOverThreshold: Boolean =
|
||||
{
|
||||
return detectedTemperature >= getThreshold
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
def setWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
|
|
|
@ -75,8 +75,8 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
mainTile.getMultiBlock.deconstruct()
|
||||
mainTile.getMultiBlock.construct()
|
||||
|
||||
val top = (toVector3 + new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
val bottom = (toVector3 + new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
val top = (position + new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
val bottom = (position + new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
|
||||
if (top && bottom)
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
def getLowest: TileReactorCell =
|
||||
{
|
||||
var lowest: TileReactorCell = this
|
||||
val checkPosition: Vector3 = toVector3
|
||||
val checkPosition: Vector3 = position
|
||||
while (true)
|
||||
{
|
||||
val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
|
||||
|
@ -148,7 +148,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
if (drain != null && drain.amount >= FluidContainerRegistry.BUCKET_VOLUME)
|
||||
{
|
||||
val spawnDir: ForgeDirection = ForgeDirection.getOrientation(worldObj.rand.nextInt(3) + 2)
|
||||
val spawnPos: Vector3 = toVector3 + spawnDir + spawnDir
|
||||
val spawnPos: Vector3 = position + spawnDir + spawnDir
|
||||
spawnPos.add(0, Math.max(worldObj.rand.nextInt(getHeight) - 1, 0), 0)
|
||||
if (worldObj.isAirBlock(spawnPos.xi, spawnPos.yi, spawnPos.zi))
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
val entities = worldObj.getEntitiesWithinAABB(classOf[EntityLiving], AxisAlignedBB.getBoundingBox(xCoord - TileReactorCell.radius * 2, yCoord - TileReactorCell.radius * 2, zCoord - TileReactorCell.radius * 2, xCoord + TileReactorCell.radius * 2, yCoord + TileReactorCell.radius * 2, zCoord + TileReactorCell.radius * 2)).asInstanceOf[List[EntityLiving]]
|
||||
for (entity <- entities)
|
||||
{
|
||||
PoisonRadiation.INSTANCE.poisonEntity(toVector3, entity)
|
||||
PoisonRadiation.INSTANCE.poisonEntity(position, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
/**
|
||||
* Heats up the surroundings. Control rods absorbs neutrons, reducing the heat produced.
|
||||
*/
|
||||
val controlRodCount = ForgeDirection.VALID_DIRECTIONS.map(toVectorWorld + _).count(_.getBlock == QuantumContent.blockControlRod)
|
||||
GridThermal.addHeat(toVectorWorld, internalEnergy / ((controlRodCount + 1) * 0.3))
|
||||
val temperature = GridThermal.getTemperature(toVectorWorld)
|
||||
val controlRodCount = ForgeDirection.VALID_DIRECTIONS.map(position + _).count(_.getBlock == QuantumContent.blockControlRod)
|
||||
GridThermal.addHeat(position, internalEnergy / ((controlRodCount + 1) * 0.3))
|
||||
val temperature = GridThermal.getTemperature(position)
|
||||
|
||||
internalEnergy = 0
|
||||
|
||||
|
@ -233,7 +233,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
}
|
||||
else
|
||||
{
|
||||
val temperature = GridThermal.getTemperature(toVectorWorld)
|
||||
val temperature = GridThermal.getTemperature(position)
|
||||
|
||||
if (world.rand.nextInt(5) == 0 && temperature >= 373)
|
||||
{
|
||||
|
@ -243,8 +243,6 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
}
|
||||
}
|
||||
|
||||
override def getMultiBlock: MultiBlockHandler[TileReactorCell] = multiBlock
|
||||
|
||||
override def getWorld: World =
|
||||
{
|
||||
return worldObj
|
||||
|
@ -257,7 +255,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
override def getMultiBlockVectors: java.lang.Iterable[Vector3] =
|
||||
{
|
||||
val vectors: List[Vector3] = new util.ArrayList[Vector3]
|
||||
val checkPosition: Vector3 = toVector3
|
||||
val checkPosition: Vector3 = position
|
||||
while (true)
|
||||
{
|
||||
val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
|
||||
|
@ -276,7 +274,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
|
||||
def getPosition: Vector3 =
|
||||
{
|
||||
return toVector3
|
||||
return position
|
||||
}
|
||||
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
|
@ -309,6 +307,8 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
return false
|
||||
}
|
||||
|
||||
override def getMultiBlock: MultiBlockHandler[TileReactorCell] = multiBlock
|
||||
|
||||
override def isUseableByPlayer(par1EntityPlayer: EntityPlayer): Boolean =
|
||||
{
|
||||
return if (worldObj.getTileEntity(xCoord, yCoord, zCoord) ne this) false else par1EntityPlayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64.0D
|
||||
|
@ -340,7 +340,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
GL11.glTranslated(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5)
|
||||
val meta = if (frame != 0) metadata else 2
|
||||
|
||||
val hasBelow = if (frame != 0) world.getTileEntity(xi, yi - 1, zi).isInstanceOf[TileReactorCell] else false
|
||||
val hasBelow = if (frame != 0) world.getTileEntity(x, y - 1, z).isInstanceOf[TileReactorCell] else false
|
||||
|
||||
if (meta == 0)
|
||||
{
|
||||
|
@ -396,7 +396,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
def getHeight: Int =
|
||||
{
|
||||
var height: Int = 0
|
||||
val checkPosition: Vector3 = toVector3
|
||||
val checkPosition: Vector3 = position
|
||||
var tile: TileEntity = this
|
||||
while (tile.isInstanceOf[TileReactorCell])
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.Block
|
|||
import net.minecraft.init.Blocks
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonantengine.lib.collection.Pair
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
import resonantengine.lib.schematic.Schematic
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
|
||||
class SchematicAccelerator extends Schematic
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.Block
|
|||
import net.minecraft.init.Blocks
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonantengine.lib.collection.Pair
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
import resonantengine.lib.schematic.Schematic
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
|
||||
class SchematicBreedingReactor extends Schematic
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.Block
|
|||
import net.minecraft.init.Blocks
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonantengine.lib.collection.Pair
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
import resonantengine.lib.schematic.Schematic
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
|
||||
class SchematicFissionReactor extends Schematic
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.Block
|
|||
import net.minecraft.init.Blocks
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonantengine.lib.collection.Pair
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
import resonantengine.lib.schematic.Schematic
|
||||
import resonantengine.lib.transform.vector.Vector3
|
||||
|
||||
class SchematicFusionReactor extends Schematic
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue