mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 03:05:30 -04:00
Merge branch 'world-converter' of https://github.com/benblank/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
a6dcbca292
@ -0,0 +1,17 @@
|
|||||||
|
package li.cil.oc.integration.vanilla
|
||||||
|
|
||||||
|
import java.util
|
||||||
|
|
||||||
|
import li.cil.oc.api
|
||||||
|
import net.minecraft.world
|
||||||
|
|
||||||
|
import scala.collection.convert.WrapAsScala._
|
||||||
|
|
||||||
|
object ConverterWorld extends api.driver.Converter {
|
||||||
|
override def convert(value: AnyRef, output: util.Map[AnyRef, AnyRef]) =
|
||||||
|
value match {
|
||||||
|
case world: world.World =>
|
||||||
|
output += "oc:flatten" -> world.provider
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package li.cil.oc.integration.vanilla
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer
|
||||||
|
import java.security.MessageDigest
|
||||||
|
import java.util
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
import li.cil.oc.api
|
||||||
|
import net.minecraft.world
|
||||||
|
|
||||||
|
import scala.collection.convert.WrapAsScala._
|
||||||
|
|
||||||
|
object ConverterWorldProvider extends api.driver.Converter {
|
||||||
|
override def convert(value: AnyRef, output: util.Map[AnyRef, AnyRef]) =
|
||||||
|
value match {
|
||||||
|
case provider: world.WorldProvider =>
|
||||||
|
val digest = MessageDigest.getInstance("MD5")
|
||||||
|
|
||||||
|
digest.update(ByteBuffer.allocate(8).putLong(provider.getSeed).array)
|
||||||
|
digest.update(ByteBuffer.allocate(4).putInt(provider.dimensionId).array)
|
||||||
|
|
||||||
|
output += "id" -> UUID.nameUUIDFromBytes(digest.digest()).toString
|
||||||
|
output += "name" -> provider.getDimensionName
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
}
|
@ -32,5 +32,7 @@ object ModVanilla extends ModProxy {
|
|||||||
Driver.add(ConverterFluidTankInfo)
|
Driver.add(ConverterFluidTankInfo)
|
||||||
Driver.add(ConverterItemStack)
|
Driver.add(ConverterItemStack)
|
||||||
Driver.add(ConverterNBT)
|
Driver.add(ConverterNBT)
|
||||||
|
Driver.add(ConverterWorld)
|
||||||
|
Driver.add(ConverterWorldProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user