mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-18 11:19:20 +00:00
Mystcraft compat plugin + unit
This commit is contained in:
1 parent
ab5c3e34c3
commit
4ca151aef8
3 files changed
+69
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package mantle.compat.plugins.builtin
|
||||
|
||||
import mantle.compat.plugins.ICompatPlugin
|
||||
import mantle.router.routing.RouterCoordinator
|
||||
import mantle.router.routing.builtin.UnitMystcraft
|
||||
|
||||
/**
|
||||
* Mystcraft compatibility plugin
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
object PluginMystcraft extends ICompatPlugin {
|
||||
|
||||
def providedMod: String = "Mystcraft"
|
||||
|
||||
def accept() {
|
||||
RouterCoordinator.registerPipelineUnit(UnitMystcraft) // Register AE pipeline object
|
||||
}
|
||||
|
||||
def preInit() {
|
||||
|
||||
}
|
||||
|
||||
def init() {
|
||||
|
||||
}
|
||||
|
||||
def postInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import mantle.router.lib.RouterRepo._
|
||||
* Reserved Mantle messages:
|
||||
* * registerDecorativeBlock (Int[] - bID & meta OR tuple(bID, meta)) -- Used for FMP/BC Facades. May be hooked by other units.
|
||||
* * movableTile (String (full class path)) -- Used for AE SpatialIO. May be hooked by other units.
|
||||
* * myst_fluidSymbol (Tuple(FluidName, rarity, grammarWeight, blockInstability) OR a prebuilt NBT tag compound) -- Mystcraft fluid symbol. Should not be hooked.
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package mantle.router.routing.builtin
|
||||
|
||||
import mantle.router.routing.{MantleMessage, IPipelineUnit}
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import cpw.mods.fml.common.event.FMLInterModComms
|
||||
|
||||
/**
|
||||
* Mystcraft pipeline unit
|
||||
*
|
||||
* @author Sunstrike <[email protected]>
|
||||
*/
|
||||
object UnitMystcraft extends IPipelineUnit {
|
||||
|
||||
def unitName = "Mystcraft Compat"
|
||||
|
||||
def handleMessage(msg: MantleMessage) {
|
||||
if (msg.getMessage.equals("myst_fluidSymbol")) {
|
||||
msg.getAttachment match {
|
||||
case (fName:String, rarity:Float, grammarWeight:Float, blockInstability:Float) =>
|
||||
val nbt = new NBTTagCompound()
|
||||
val fluidSym = new NBTTagCompound()
|
||||
fluidSym.setString("fluidname", fName)
|
||||
fluidSym.setFloat("rarity", rarity)
|
||||
fluidSym.setFloat("grammarweight", grammarWeight)
|
||||
fluidSym.setFloat("instabilityPerBlock", blockInstability)
|
||||
nbt.setCompoundTag("fluidsymbol", fluidSym)
|
||||
sendMystMessage("fluidsymbol", nbt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def sendMystMessage(msg: String, nbt: NBTTagCompound) {
|
||||
FMLInterModComms.sendMessage("Mystcraft", msg, nbt)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user