Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10

Conflicts:
	src/main/scala/li/cil/oc/common/block/Delegator.scala
	src/main/scala/li/cil/oc/common/tileentity/traits/power/BuildCraft.scala
	src/main/scala/li/cil/oc/common/tileentity/traits/power/Factorization.scala
This commit is contained in:
Florian Nücke 2014-08-24 13:06:31 +02:00
commit d25a61176b
4 changed files with 27 additions and 11 deletions

View File

@ -66,9 +66,12 @@ object SaveHandler {
def loadNBT(nbt: NBTTagCompound, name: String): NBTTagCompound = {
val data = load(nbt, name)
val bais = new ByteArrayInputStream(data)
val dis = new DataInputStream(bais)
CompressedStreamTools.read(dis)
if (data.length > 0) {
val bais = new ByteArrayInputStream(data)
val dis = new DataInputStream(bais)
CompressedStreamTools.read(dis)
}
else new NBTTagCompound()
}
def load(nbt: NBTTagCompound, name: String): Array[Byte] = {
@ -113,6 +116,7 @@ object SaveHandler {
val dimPath = new io.File(path, dimension.toString)
val chunkPath = new io.File(dimPath, s"${chunk.chunkXPos}.${chunk.chunkZPos}")
val file = new io.File(chunkPath, name)
if (!file.exists()) return Array.empty[Byte]
try {
// val bis = new io.BufferedInputStream(new GZIPInputStream(new io.FileInputStream(file)))
val bis = new io.BufferedInputStream(new io.FileInputStream(file))

View File

@ -108,6 +108,8 @@ class Delegator[Child <: Delegate] extends Block(Material.iron) {
// Block
// ----------------------------------------------------------------------- //
override def canHarvestBlock(player: EntityPlayer, meta: Int) = true
override def canBeReplacedByLeaves(world: IBlockAccess, x: Int, y: Int, z: Int) = false
override def canCreatureSpawn(creature: EnumCreatureType, world: IBlockAccess, x: Int, y: Int, z: Int) = false

View File

@ -2,8 +2,8 @@ package li.cil.oc.common.tileentity.traits.power
import buildcraft.api.power.{IPowerReceptor, PowerHandler}
import cpw.mods.fml.common.Optional
import li.cil.oc.Settings
import li.cil.oc.util.mods.Mods
import li.cil.oc.{OpenComputers, Settings}
import net.minecraftforge.common.util.ForgeDirection
trait BuildCraft extends Common {
@ -31,11 +31,16 @@ trait BuildCraft extends Common {
@Optional.Method(modid = Mods.IDs.BuildCraftPower)
def getPowerProvider = {
if (Mods.BuildCraftPower.isAvailable && powerHandler.isEmpty) {
val handler = new PowerHandler(this.asInstanceOf[IPowerReceptor], PowerHandler.Type.MACHINE)
if (handler != null) {
handler.configure(1, 320, Float.MaxValue, 640)
handler.configurePowerPerdition(0, 0)
powerHandler = Some(handler)
this match {
case receptor: IPowerReceptor =>
val handler = new PowerHandler(receptor, PowerHandler.Type.MACHINE)
if (handler != null) {
handler.configure(1, 320, Float.MaxValue, 640)
handler.configurePowerPerdition(0, 0)
powerHandler = Some(handler)
}
case _ =>
OpenComputers.log.warn("Failed setting up BuildCraft power, which most likely means the class transformer did not run. You're probably running in an incorrectly configured development environment. Try adding `-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader` to the VM options of your run configuration.")
}
}
if (powerHandler.isDefined)

View File

@ -2,15 +2,20 @@ package li.cil.oc.common.tileentity.traits.power
import cpw.mods.fml.common.Optional
import factorization.api.{Charge, Coord, IChargeConductor}
import li.cil.oc.Settings
import li.cil.oc.util.mods.Mods
import li.cil.oc.{OpenComputers, Settings}
import net.minecraftforge.common.util.ForgeDirection
trait Factorization extends Common {
private lazy val useFactorizationPower = isServer && Mods.Factorization.isAvailable
@Optional.Method(modid = Mods.IDs.Factorization)
private lazy val charge: AnyRef = new Charge(this.asInstanceOf[IChargeConductor])
private lazy val charge: AnyRef = this match {
case conductor: IChargeConductor => new Charge(conductor)
case _ =>
OpenComputers.log.warn("Failed setting up Factorization power, which most likely means the class transformer did not run. You're probably running in an incorrectly configured development environment. Try adding `-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader` to the VM options of your run configuration.")
null
}
// ----------------------------------------------------------------------- //