Updated RE
This commit is contained in:
parent
e2a9d9d2c6
commit
76f2124bc2
7 changed files with 267 additions and 268 deletions
|
@ -25,11 +25,11 @@ import resonant.lib.network.Synced
|
|||
import resonant.lib.network.Synced.{SyncedInput, SyncedOutput}
|
||||
import resonant.lib.network.discriminator.PacketAnnotation
|
||||
import resonant.lib.prefab.poison.PoisonRadiation
|
||||
import resonant.lib.utility.inventory.InventoryUtility
|
||||
import resonantinduction.atomic.machine.plasma.TilePlasma
|
||||
import resonantinduction.atomic.AtomicContent
|
||||
import resonantinduction.core.Reference
|
||||
import resonant.lib.transform.vector.{Vector3, VectorWorld}
|
||||
import resonant.lib.utility.inventory.InventoryUtility
|
||||
import resonantinduction.atomic.AtomicContent
|
||||
import resonantinduction.atomic.machine.plasma.TilePlasma
|
||||
import resonantinduction.core.Reference
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
|
@ -79,8 +79,8 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
val mainTile: TileReactorCell = getLowest
|
||||
mainTile.getMultiBlock.deconstruct
|
||||
mainTile.getMultiBlock.construct
|
||||
val top: Boolean = toVector3.add(new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
val bottom: Boolean = toVector3.add(new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
val top: Boolean = (toVector3 + new Vector3(0, 1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
val bottom: Boolean = (toVector3 + new Vector3(0, -1, 0)).getTileEntity(worldObj).isInstanceOf[TileReactorCell]
|
||||
if (top && bottom)
|
||||
{
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3)
|
||||
|
@ -326,7 +326,7 @@ class TileReactorCell extends TileInventory(Material.iron) with IMultiBlockStruc
|
|||
val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
|
||||
if (t.isInstanceOf[TileReactorCell])
|
||||
{
|
||||
vectors.add(checkPosition.clone.subtract(getPosition))
|
||||
vectors.add(checkPosition - getPosition)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4,8 +4,7 @@ import java.util.ArrayList
|
|||
|
||||
import cpw.mods.fml.common.Optional
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import li.cil.oc.api.machine.{Arguments, Context, Callback}
|
||||
import li.cil.oc.api.network.{SimpleComponent}
|
||||
import li.cil.oc.api.network.{Arguments, Callback, Context, SimpleComponent}
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
|
@ -19,217 +18,217 @@ import resonant.content.prefab.java.TileAdvanced
|
|||
import resonant.engine.grid.thermal.ThermalGrid
|
||||
import resonant.lib.network.Synced
|
||||
import resonant.lib.network.discriminator.PacketAnnotation
|
||||
import resonant.lib.transform.vector.{Vector3, VectorWorld}
|
||||
import resonant.lib.utility.inventory.InventoryUtility
|
||||
import resonantinduction.core.Reference
|
||||
import resonant.lib.transform.vector.{Vector3, VectorWorld}
|
||||
|
||||
/**
|
||||
* Thermometer TileEntity
|
||||
*/
|
||||
object TileThermometer
|
||||
{
|
||||
final val MAX_THRESHOLD: Int = 5000
|
||||
private var iconSide: IIcon = null
|
||||
final val MAX_THRESHOLD: Int = 5000
|
||||
private var iconSide: IIcon = null
|
||||
}
|
||||
|
||||
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")
|
||||
class TileThermometer extends TileAdvanced(Material.piston) with SimpleComponent
|
||||
{
|
||||
@Synced var detectedTemperature: Float = 295
|
||||
@Synced var previousDetectedTemperature: Float = 295
|
||||
@Synced var trackCoordinate: Vector3 = null
|
||||
@Synced private var threshold: Int = 1000
|
||||
@Synced private var isProvidingPower: Boolean = false
|
||||
@Synced var detectedTemperature: Float = 295
|
||||
@Synced var previousDetectedTemperature: Float = 295
|
||||
@Synced var trackCoordinate: Vector3 = null
|
||||
@Synced private var threshold: Int = 1000
|
||||
@Synced private var isProvidingPower: Boolean = false
|
||||
|
||||
//Constructor
|
||||
providePower = true
|
||||
normalRender = false
|
||||
renderStaticBlock = true
|
||||
itemBlock = classOf[ItemBlockThermometer]
|
||||
isOpaqueCube = true
|
||||
//Constructor
|
||||
providePower = true
|
||||
normalRender = false
|
||||
renderStaticBlock = true
|
||||
itemBlock = classOf[ItemBlockThermometer]
|
||||
isOpaqueCube = true
|
||||
|
||||
override def getIcon(side: Int, meta: Int): IIcon =
|
||||
override def getIcon(side: Int, meta: Int): IIcon =
|
||||
{
|
||||
return if (side == 1 || side == 0) super.getIcon(side, meta) else TileThermometer.iconSide
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) override def registerIcons(iconRegister: IIconRegister)
|
||||
{
|
||||
super.registerIcons(iconRegister)
|
||||
TileThermometer.iconSide = iconRegister.registerIcon(Reference.prefix + "machine")
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.isSneaking)
|
||||
{
|
||||
return if (side == 1 || side == 0) super.getIcon(side, meta) else TileThermometer.iconSide
|
||||
setThreshold(getThershold + 100)
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) override def registerIcons(iconRegister: IIconRegister)
|
||||
else
|
||||
{
|
||||
super.registerIcons(iconRegister)
|
||||
TileThermometer.iconSide = iconRegister.registerIcon(Reference.prefix + "machine")
|
||||
setThreshold(getThershold - 100)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.isSneaking)
|
||||
{
|
||||
if (player.isSneaking)
|
||||
{
|
||||
setThreshold(getThershold + 100)
|
||||
}
|
||||
else
|
||||
{
|
||||
setThreshold(getThershold - 100)
|
||||
}
|
||||
return true
|
||||
setThreshold(getThershold - 10)
|
||||
}
|
||||
|
||||
override def configure(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
else
|
||||
{
|
||||
if (player.isSneaking)
|
||||
{
|
||||
setThreshold(getThershold - 10)
|
||||
}
|
||||
else
|
||||
{
|
||||
setThreshold(getThershold + 10)
|
||||
}
|
||||
return true
|
||||
setThreshold(getThershold + 10)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override def getStrongRedstonePower(access: IBlockAccess, side: Int): Int =
|
||||
{
|
||||
return if (isProvidingPower) 15 else 0
|
||||
}
|
||||
override def getStrongRedstonePower(access: IBlockAccess, side: Int): Int =
|
||||
{
|
||||
return if (isProvidingPower) 15 else 0
|
||||
}
|
||||
|
||||
override def getDrops(metadata: Int, fortune: Int): ArrayList[ItemStack] =
|
||||
{
|
||||
return new ArrayList[ItemStack]
|
||||
}
|
||||
override def getDrops(metadata: Int, fortune: Int): ArrayList[ItemStack] =
|
||||
{
|
||||
return new ArrayList[ItemStack]
|
||||
}
|
||||
|
||||
override def onRemove(block: Block, par6: Int)
|
||||
{
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(getBlockType, world, xi, yi, zi)
|
||||
InventoryUtility.dropItemStack(world, center, stack)
|
||||
}
|
||||
override def onRemove(block: Block, par6: Int)
|
||||
{
|
||||
val stack: ItemStack = ItemBlockSaved.getItemStackWithNBT(getBlockType, world, xi, yi, zi)
|
||||
InventoryUtility.dropItemStack(world, center, stack)
|
||||
}
|
||||
|
||||
override def update
|
||||
override def update
|
||||
{
|
||||
super.update
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
super.update
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (ticks % 10 == 0)
|
||||
{
|
||||
if (trackCoordinate != null)
|
||||
{
|
||||
detectedTemperature = ThermalGrid.getTemperature(new VectorWorld(world, trackCoordinate))
|
||||
}
|
||||
else
|
||||
{
|
||||
detectedTemperature = ThermalGrid.getTemperature(toVectorWorld)
|
||||
}
|
||||
if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold)
|
||||
{
|
||||
previousDetectedTemperature = detectedTemperature
|
||||
isProvidingPower = isOverThreshold
|
||||
notifyChange
|
||||
//sendPacket(getDescPacket)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override def getDescPacket: PacketAnnotation =
|
||||
{
|
||||
return new PacketAnnotation(this)
|
||||
}
|
||||
|
||||
def setTrack(track: Vector3)
|
||||
{
|
||||
trackCoordinate = track
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a tile entity from NBT.
|
||||
*/
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(nbt)
|
||||
threshold = nbt.getInteger("threshold")
|
||||
if (nbt.hasKey("trackCoordinate"))
|
||||
{
|
||||
trackCoordinate = new Vector3(nbt.getCompoundTag("trackCoordinate"))
|
||||
}
|
||||
else
|
||||
{
|
||||
trackCoordinate = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbt)
|
||||
nbt.setInteger("threshold", threshold)
|
||||
if (ticks % 10 == 0)
|
||||
{
|
||||
if (trackCoordinate != null)
|
||||
{
|
||||
nbt.setTag("trackCoordinate", this.trackCoordinate.writeNBT(new NBTTagCompound))
|
||||
detectedTemperature = ThermalGrid.getTemperature(new VectorWorld(world, trackCoordinate))
|
||||
}
|
||||
}
|
||||
|
||||
def getThershold: Int =
|
||||
{
|
||||
return threshold
|
||||
}
|
||||
|
||||
def setThreshold(newThreshold: Int)
|
||||
{
|
||||
threshold = newThreshold % TileThermometer.MAX_THRESHOLD
|
||||
if (threshold <= 0)
|
||||
else
|
||||
{
|
||||
threshold = TileThermometer.MAX_THRESHOLD
|
||||
detectedTemperature = ThermalGrid.getTemperature(toVectorWorld)
|
||||
}
|
||||
markUpdate
|
||||
}
|
||||
|
||||
def isOverThreshold: Boolean =
|
||||
{
|
||||
return detectedTemperature >= getThershold
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
def getTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
return Array[Any](this.detectedTemperature)
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers") def getWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
return Array[Any](this.getThershold)
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers") def isAboveWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
return Array[Any](this.isOverThreshold)
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers") def setWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
if (args.count <= 0)
|
||||
if (detectedTemperature != previousDetectedTemperature || isProvidingPower != this.isOverThreshold)
|
||||
{
|
||||
throw new IllegalArgumentException("Not enough Arguments. Must provide one argument")
|
||||
previousDetectedTemperature = detectedTemperature
|
||||
isProvidingPower = isOverThreshold
|
||||
notifyChange
|
||||
//sendPacket(getDescPacket)
|
||||
}
|
||||
if (args.count >= 2)
|
||||
{
|
||||
throw new IllegalArgumentException("Too many Arguments. Must provide one argument")
|
||||
}
|
||||
if (!(args.isInteger(0)))
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid Argument. Must provide an Integer")
|
||||
}
|
||||
this synchronized
|
||||
{
|
||||
this.setThreshold(args.checkInteger(0))
|
||||
}
|
||||
return Array[Any](this.threshold == args.checkInteger(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getComponentName: String =
|
||||
override def getDescPacket: PacketAnnotation =
|
||||
{
|
||||
return new PacketAnnotation(this)
|
||||
}
|
||||
|
||||
def setTrack(track: Vector3)
|
||||
{
|
||||
trackCoordinate = track
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a tile entity from NBT.
|
||||
*/
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(nbt)
|
||||
threshold = nbt.getInteger("threshold")
|
||||
if (nbt.hasKey("trackCoordinate"))
|
||||
{
|
||||
return "AS Thermometer"
|
||||
trackCoordinate = new Vector3(nbt.getCompoundTag("trackCoordinate"))
|
||||
}
|
||||
else
|
||||
{
|
||||
trackCoordinate = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(nbt)
|
||||
nbt.setInteger("threshold", threshold)
|
||||
if (trackCoordinate != null)
|
||||
{
|
||||
nbt.setTag("trackCoordinate", this.trackCoordinate.writeNBT(new NBTTagCompound))
|
||||
}
|
||||
}
|
||||
|
||||
def getThershold: Int =
|
||||
{
|
||||
return threshold
|
||||
}
|
||||
|
||||
def setThreshold(newThreshold: Int)
|
||||
{
|
||||
threshold = newThreshold % TileThermometer.MAX_THRESHOLD
|
||||
if (threshold <= 0)
|
||||
{
|
||||
threshold = TileThermometer.MAX_THRESHOLD
|
||||
}
|
||||
markUpdate
|
||||
}
|
||||
|
||||
def isOverThreshold: Boolean =
|
||||
{
|
||||
return detectedTemperature >= getThershold
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
def getTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
return Array[Any](this.detectedTemperature)
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers") def getWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
return Array[Any](this.getThershold)
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers") def isAboveWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
return Array[Any](this.isOverThreshold)
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers") def setWarningTemperature(context: Context, args: Arguments): Array[Any] =
|
||||
{
|
||||
if (args.count <= 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Not enough Arguments. Must provide one argument")
|
||||
}
|
||||
if (args.count >= 2)
|
||||
{
|
||||
throw new IllegalArgumentException("Too many Arguments. Must provide one argument")
|
||||
}
|
||||
if (!(args.isInteger(0)))
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid Argument. Must provide an Integer")
|
||||
}
|
||||
this synchronized
|
||||
{
|
||||
this.setThreshold(args.checkInteger(0))
|
||||
}
|
||||
return Array[Any](this.threshold == args.checkInteger(0))
|
||||
}
|
||||
|
||||
def getComponentName: String =
|
||||
{
|
||||
return "AS Thermometer"
|
||||
}
|
||||
}
|
|
@ -7,89 +7,89 @@ import net.minecraft.init.Blocks
|
|||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import resonant.lib.`type`.Pair
|
||||
import resonant.lib.schematic.Schematic
|
||||
import resonantinduction.atomic.AtomicContent
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonantinduction.atomic.AtomicContent
|
||||
|
||||
class SchematicFissionReactor extends Schematic
|
||||
{
|
||||
override def getName: String =
|
||||
override def getName: String =
|
||||
{
|
||||
return "schematic.fissionReactor.name"
|
||||
}
|
||||
|
||||
def getStructure(dir: ForgeDirection, size: Int): HashMap[Vector3, Pair[Block, Integer]] =
|
||||
{
|
||||
val returnMap: HashMap[Vector3, Pair[Block, Integer]] = new HashMap[Vector3, Pair[Block, Integer]]
|
||||
if (size <= 1)
|
||||
{
|
||||
return "schematic.fissionReactor.name"
|
||||
}
|
||||
var r: Int = 2
|
||||
|
||||
def getStructure(dir: ForgeDirection, size: Int): HashMap[Vector3, Pair[Block, Integer]] =
|
||||
for (x <- -r to r; z <- -r to r)
|
||||
{
|
||||
val targetPosition: Vector3 = new Vector3(x, 0, z)
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Blocks.water, 0))
|
||||
}
|
||||
|
||||
r -= 1
|
||||
for (x <- -r to r; z <- -r to r)
|
||||
{
|
||||
val targetPosition: Vector3 = new Vector3(x, 1, z)
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Block.getBlockFromName("electricTurbine"), 0))
|
||||
if (!((x == -r || x == r) && (z == -r || z == r)) && new Vector3(x, 0, z).magnitude <= 1)
|
||||
{
|
||||
returnMap.put(new Vector3(x, -1, z), new Pair[Block, Integer](AtomicContent.blockControlRod, 0))
|
||||
returnMap.put(new Vector3(x, -2, z), new Pair[Block, Integer](Blocks.sticky_piston, 1))
|
||||
}
|
||||
}
|
||||
|
||||
returnMap.put(new Vector3(0, -1, 0), new Pair[Block, Integer](AtomicContent.blockThermometer, 0))
|
||||
returnMap.put(new Vector3(0, -3, 0), new Pair[Block, Integer](AtomicContent.blockSiren, 0))
|
||||
returnMap.put(new Vector3(0, -2, 0), new Pair[Block, Integer](Blocks.redstone_wire, 0))
|
||||
returnMap.put(new Vector3, new Pair[Block, Integer](AtomicContent.blockReactorCell, 0))
|
||||
}
|
||||
else
|
||||
{
|
||||
val returnMap: HashMap[Vector3, Pair[Block, Integer]] = new HashMap[Vector3, Pair[Block, Integer]]
|
||||
if (size <= 1)
|
||||
val r: Int = 2
|
||||
|
||||
for (y <- 0 to size; x <- -r to r; z <- -r to r)
|
||||
{
|
||||
val targetPosition: Vector3 = new Vector3(x, y, z)
|
||||
val leveledPosition: Vector3 = new Vector3(0, y, 0)
|
||||
if (y < size - 1)
|
||||
{
|
||||
var r: Int = 2
|
||||
|
||||
for (x <- -r to r; z <- -r to r)
|
||||
if (targetPosition.distance(leveledPosition) == 2)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](AtomicContent.blockControlRod, 0))
|
||||
var rotationMetadata: Int = 0
|
||||
val offset: Vector3 = new Vector3(x, 0, z).normalize
|
||||
for (checkDir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
val targetPosition: Vector3 = new Vector3(x, 0, z)
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Blocks.water, 0))
|
||||
if (offset.x == checkDir.offsetX && offset.y == checkDir.offsetY && offset.z == checkDir.offsetZ)
|
||||
{
|
||||
rotationMetadata = checkDir.getOpposite.ordinal
|
||||
}
|
||||
}
|
||||
|
||||
r -= 1
|
||||
for (x <- -r to r; z <- -r to r)
|
||||
{
|
||||
val targetPosition: Vector3 = new Vector3(x, 1, z)
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Block.getBlockFromName("electricTurbine"), 0))
|
||||
if (!((x == -r || x == r) && (z == -r || z == r)) && new Vector3(x, 0, z).magnitude <= 1)
|
||||
{
|
||||
returnMap.put(new Vector3(x, -1, z), new Pair[Block, Integer](AtomicContent.blockControlRod, 0))
|
||||
returnMap.put(new Vector3(x, -2, z), new Pair[Block, Integer](Blocks.sticky_piston, 1))
|
||||
}
|
||||
}
|
||||
|
||||
returnMap.put(new Vector3(0, -1, 0), new Pair[Block, Integer](AtomicContent.blockThermometer, 0))
|
||||
returnMap.put(new Vector3(0, -3, 0), new Pair[Block, Integer](AtomicContent.blockSiren, 0))
|
||||
returnMap.put(new Vector3(0, -2, 0), new Pair[Block, Integer](Blocks.redstone_wire, 0))
|
||||
returnMap.put(new Vector3, new Pair[Block, Integer](AtomicContent.blockReactorCell, 0))
|
||||
returnMap.put(targetPosition + offset, new Pair[Block, Integer](Blocks.sticky_piston, rotationMetadata))
|
||||
}
|
||||
else if (x == -r || x == r || z == -r || z == r)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Blocks.glass, 0))
|
||||
}
|
||||
else if (x == 0 && z == 0)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](AtomicContent.blockReactorCell, 0))
|
||||
}
|
||||
else
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Blocks.water, 0))
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (targetPosition.distance(leveledPosition) < 2)
|
||||
{
|
||||
val r: Int = 2
|
||||
|
||||
for (y <- 0 to size; x <- -r to r; z <- -r to r)
|
||||
{
|
||||
val targetPosition: Vector3 = new Vector3(x, y, z)
|
||||
val leveledPosition: Vector3 = new Vector3(0, y, 0)
|
||||
if (y < size - 1)
|
||||
{
|
||||
if (targetPosition.distance(leveledPosition) == 2)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](AtomicContent.blockControlRod, 0))
|
||||
var rotationMetadata: Int = 0
|
||||
val offset: Vector3 = new Vector3(x, 0, z).normalize
|
||||
for (checkDir <- ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (offset.x == checkDir.offsetX && offset.y == checkDir.offsetY && offset.z == checkDir.offsetZ)
|
||||
{
|
||||
rotationMetadata = checkDir.getOpposite.ordinal
|
||||
}
|
||||
}
|
||||
returnMap.put(targetPosition.clone.add(offset), new Pair[Block, Integer](Blocks.sticky_piston, rotationMetadata))
|
||||
}
|
||||
else if (x == -r || x == r || z == -r || z == r)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Blocks.glass, 0))
|
||||
}
|
||||
else if (x == 0 && z == 0)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](AtomicContent.blockReactorCell, 0))
|
||||
}
|
||||
else
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Blocks.water, 0))
|
||||
}
|
||||
}
|
||||
else if (targetPosition.distance(leveledPosition) < 2)
|
||||
{
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Block.getBlockFromName("electricTurbine"), 0))
|
||||
}
|
||||
}
|
||||
returnMap.put(targetPosition, new Pair[Block, Integer](Block.getBlockFromName("electricTurbine"), 0))
|
||||
}
|
||||
return returnMap
|
||||
}
|
||||
}
|
||||
return returnMap
|
||||
}
|
||||
}
|
|
@ -124,8 +124,8 @@ class MultimeterGrid extends Grid[PartMultimeter](classOf[PartMultimeter]) with
|
|||
lowerBound = null
|
||||
super.reconstruct
|
||||
center = upperBound.midPoint(lowerBound)
|
||||
upperBound.subtract(center)
|
||||
lowerBound.subtract(center)
|
||||
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))
|
||||
val area: Double = (if (size.x != 0) size.x else 1) * (if (size.y != 0) size.y else 1) * (if (size.z != 0) size.z else 1)
|
||||
isEnabled = area == getNodes.size
|
||||
|
|
|
@ -10,9 +10,9 @@ import net.minecraftforge.common.util.ForgeDirection
|
|||
import org.lwjgl.opengl.GL11
|
||||
import resonant.content.prefab.scal.render.ISimpleItemRenderer
|
||||
import resonant.lib.render.RenderUtility
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
import resonant.lib.utility.LanguageUtility
|
||||
import resonantinduction.core.Reference
|
||||
import resonant.lib.transform.vector.Vector3
|
||||
|
||||
/**
|
||||
* Class used to render text onto the multimeter block.
|
||||
|
@ -130,7 +130,7 @@ object RenderMultimeter extends ISimpleItemRenderer
|
|||
{
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5)
|
||||
val centerTranslation: Vector3 = part.getNetwork.center.clone.subtract(new Vector3(part.x, part.y, part.z)).add(-0.5)
|
||||
val centerTranslation: Vector3 = part.getNetwork.center - new Vector3(part.x, part.y, part.z) - 0.5
|
||||
GL11.glTranslated(centerTranslation.x, centerTranslation.y, centerTranslation.z)
|
||||
RenderUtility.rotateFaceBlockToSideOutwards(part.getDirection.getOpposite)
|
||||
if (part.getDirection.offsetY != 0)
|
||||
|
|
|
@ -23,7 +23,7 @@ import resonant.lib.content.prefab.TEnergyStorage
|
|||
import resonant.lib.content.prefab.java.TileElectric
|
||||
import resonant.lib.multiblock.reference.{IMultiBlockStructure, MultiBlockHandler}
|
||||
import resonant.lib.network.discriminator.{PacketTile, PacketType}
|
||||
import resonant.lib.network.handle.{TPacketSender, TPacketIDReceiver}
|
||||
import resonant.lib.network.handle.{TPacketIDReceiver, TPacketSender}
|
||||
import resonant.lib.render.EnumColor
|
||||
import resonant.lib.transform.vector.{Vector3, VectorWorld}
|
||||
import resonant.lib.utility.{LanguageUtility, LinkUtility}
|
||||
|
@ -118,7 +118,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
}
|
||||
else
|
||||
{
|
||||
ResonantInduction.proxy.renderElectricShock(this.worldObj, topTeslaVector.clone.add(0.5), topTeslaVector.clone.add(new Vector3(0.5, java.lang.Double.POSITIVE_INFINITY, 0.5)), false)
|
||||
ResonantInduction.proxy.renderElectricShock(this.worldObj, topTeslaVector.clone.add(0.5), topTeslaVector + new Vector3(0.5, java.lang.Double.POSITIVE_INFINITY, 0.5), false)
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -179,7 +179,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
heightRange = (tesla.asInstanceOf[TileTesla]).getHeight
|
||||
}
|
||||
val distance: Double = topTeslaVector.distance(targetVector)
|
||||
ResonantInduction.proxy.renderElectricShock(this.worldObj, topTesla.toVector3.add(new Vector3(0.5)), targetVector.add(new Vector3(0.5, Math.random * heightRange / 3 - heightRange / 3, 0.5)), EnumColor.DYES(this.dyeID).toColor)
|
||||
ResonantInduction.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)
|
||||
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP))
|
||||
if (!sentPacket && transferEnergy > 0)
|
||||
{
|
||||
|
@ -317,8 +317,8 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
val mainTile: TileTesla = getLowestTesla
|
||||
mainTile.getMultiBlock.deconstruct
|
||||
mainTile.getMultiBlock.construct
|
||||
val isTop: Boolean = toVector3.add(new Vector3(0, 1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
|
||||
val isBottom: Boolean = toVector3.add(new Vector3(0, -1, 0)).getTileEntity(this.worldObj).isInstanceOf[TileTesla]
|
||||
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]
|
||||
if (isTop && isBottom)
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3)
|
||||
|
@ -381,7 +381,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
var exit = false
|
||||
while (!exit)
|
||||
{
|
||||
val t: TileEntity = toVector3.add(new Vector3(0, y, 0)).getTileEntity(this.worldObj)
|
||||
val t: TileEntity = (toVector3 + new Vector3(0, y, 0)).getTileEntity(this.worldObj)
|
||||
if (t.isInstanceOf[TileTesla])
|
||||
{
|
||||
this.connectedTeslas.add(t.asInstanceOf[TileTesla])
|
||||
|
@ -512,7 +512,7 @@ class TileTesla extends TileElectric(Material.iron) with IMultiBlockStructure[Ti
|
|||
val t: TileEntity = checkPosition.getTileEntity(this.worldObj)
|
||||
if (t.isInstanceOf[TileTesla])
|
||||
{
|
||||
vectors.add(checkPosition.clone.subtract(getPosition))
|
||||
vectors.add(checkPosition - getPosition)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -104,10 +104,10 @@ class TileMixer extends TileMechanical(Material.iron)
|
|||
{
|
||||
val entity: Entity = obj.asInstanceOf[Entity]
|
||||
val originalPosition: Vector3 = new Vector3(entity)
|
||||
val relativePosition: Vector3 = originalPosition.clone.subtract(toVector3.add(0.5))
|
||||
val relativePosition: Vector3 = originalPosition - toVector3.add(0.5)
|
||||
relativePosition.transform(new Quaternion(-mechanicalNode.angularVelocity, new Vector3(1, 0, 0)))
|
||||
val newPosition: Vector3 = toVector3.add(0.5).add(relativePosition)
|
||||
val difference: Vector3 = newPosition.subtract(originalPosition).multiply(0.5)
|
||||
val newPosition: Vector3 = toVector3 + 0.5 + relativePosition
|
||||
val difference: Vector3 = (newPosition - originalPosition) * 0.5
|
||||
entity.addVelocity(difference.x, difference.y, difference.z)
|
||||
entity.onGround = false
|
||||
if (entity.isInstanceOf[EntityItem])
|
||||
|
@ -125,7 +125,7 @@ class TileMixer extends TileMechanical(Material.iron)
|
|||
{
|
||||
TileMixer.MIXER_ITEM_TIMER.put(processingItem, TileMixer.PROCESS_TIME)
|
||||
}
|
||||
if (!processingItem.isDead && toVector3.add(0.5).distance(new Vector3(processingItem)) < 2)
|
||||
if (!processingItem.isDead && (toVector3 + 0.5).distance(new Vector3(processingItem)) < 2)
|
||||
{
|
||||
val timeLeft: Int = TileMixer.MIXER_ITEM_TIMER.decrease(processingItem)
|
||||
if (timeLeft <= 0)
|
||||
|
|
Loading…
Reference in a new issue