mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-11 00:09:44 -04:00
Add Rotarycraft Integration ((item stack converters for jetpacks and springpowered pumps)
This commit is contained in:
parent
29793e780e
commit
85f463ec0c
@ -63,6 +63,7 @@ object Mods {
|
|||||||
val ProjectRedTransmission = new SimpleMod(IDs.ProjectRedTransmission)
|
val ProjectRedTransmission = new SimpleMod(IDs.ProjectRedTransmission)
|
||||||
val Railcraft = new SimpleMod(IDs.Railcraft)
|
val Railcraft = new SimpleMod(IDs.Railcraft)
|
||||||
val RedLogic = new SimpleMod(IDs.RedLogic)
|
val RedLogic = new SimpleMod(IDs.RedLogic)
|
||||||
|
val RotaryCraft = new SimpleMod(IDs.RotaryCraft)
|
||||||
val StargateTech2 = new ModBase {
|
val StargateTech2 = new ModBase {
|
||||||
def id = IDs.StargateTech2
|
def id = IDs.StargateTech2
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ object Mods {
|
|||||||
integration.projectred.ModProjectRed,
|
integration.projectred.ModProjectRed,
|
||||||
integration.railcraft.ModRailcraft,
|
integration.railcraft.ModRailcraft,
|
||||||
integration.redlogic.ModRedLogic,
|
integration.redlogic.ModRedLogic,
|
||||||
|
integration.rotarycraft.ModRotaryCraft,
|
||||||
integration.stargatetech2.ModStargateTech2,
|
integration.stargatetech2.ModStargateTech2,
|
||||||
integration.thaumcraft.ModThaumcraft,
|
integration.thaumcraft.ModThaumcraft,
|
||||||
integration.thermalexpansion.ModThermalExpansion,
|
integration.thermalexpansion.ModThermalExpansion,
|
||||||
@ -204,6 +206,7 @@ object Mods {
|
|||||||
final val ProjectRedTransmission = "ProjRed|Transmission"
|
final val ProjectRedTransmission = "ProjRed|Transmission"
|
||||||
final val Railcraft = "Railcraft"
|
final val Railcraft = "Railcraft"
|
||||||
final val RedLogic = "RedLogic"
|
final val RedLogic = "RedLogic"
|
||||||
|
final val RotaryCraft = "RotaryCraft"
|
||||||
final val StargateTech2 = "StargateTech2"
|
final val StargateTech2 = "StargateTech2"
|
||||||
final val Thaumcraft = "Thaumcraft"
|
final val Thaumcraft = "Thaumcraft"
|
||||||
final val ThermalExpansion = "ThermalExpansion"
|
final val ThermalExpansion = "ThermalExpansion"
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package li.cil.oc.integration.rotarycraft;
|
||||||
|
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import li.cil.oc.api.driver.Converter;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ConverterJetpackItem implements Converter {
|
||||||
|
@Override
|
||||||
|
public void convert(final Object value, final Map<Object, Object> output) {
|
||||||
|
if (value instanceof ItemStack) {
|
||||||
|
final ItemStack stack = (ItemStack) value;
|
||||||
|
final Item item = stack.getItem();
|
||||||
|
if (item.equals(GameRegistry.findItem("RotaryCraft", "rotarycraft_item_bedpack")) ||
|
||||||
|
item.equals(GameRegistry.findItem("RotaryCraft", "rotarycraft_item_steelpack")) ||
|
||||||
|
item.equals(GameRegistry.findItem("RotaryCraft", "rotarycraft_item_jetpack"))) {
|
||||||
|
final NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
|
||||||
|
if (tag != null && tag.hasKey("fuel"))
|
||||||
|
output.put("fuel", stack.stackTagCompound.getInteger("fuel"));
|
||||||
|
else
|
||||||
|
output.put("fuel", 0);
|
||||||
|
|
||||||
|
if (tag != null && tag.hasKey("liquid")) {
|
||||||
|
output.put("fuelType", tag.getString("liquid"));
|
||||||
|
} else {
|
||||||
|
output.put("fuelType", "empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.equals(GameRegistry.findItem("RotaryCraft", "rotarycraft_item_bedpack")))
|
||||||
|
output.put("chestplateMaterial", "bedrock");
|
||||||
|
else if (item.equals(GameRegistry.findItem("RotaryCraft", "rotarycraft_item_steelpack")))
|
||||||
|
output.put("chestplateMaterial", "steel");
|
||||||
|
else
|
||||||
|
output.put("chestplateMaterial", "none");
|
||||||
|
|
||||||
|
final HashMap<String, Boolean> upgrades = new HashMap<String, Boolean>();
|
||||||
|
upgrades.put("cooling", tag != null ? tag.getBoolean("cooling") : false);
|
||||||
|
upgrades.put("thrustBoost", tag != null ? tag.getBoolean("jet") : false);
|
||||||
|
upgrades.put("winged", tag != null ? tag.getBoolean("wing") : false);
|
||||||
|
output.put("upgrades", upgrades);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package li.cil.oc.integration.rotarycraft;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import li.cil.oc.api.driver.Converter;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ConverterPumpItem implements Converter {
|
||||||
|
@Override
|
||||||
|
public void convert(final Object value, final Map<Object, Object> output) {
|
||||||
|
if (value instanceof ItemStack) {
|
||||||
|
final ItemStack stack = (ItemStack) value;
|
||||||
|
final Item item = stack.getItem();
|
||||||
|
if (stack.getItem().equals(GameRegistry.findItem("RotaryCraft", "rotarycraft_item_pump"))) {
|
||||||
|
final NBTTagCompound tag = stack.getTagCompound();
|
||||||
|
if (tag != null && tag.hasKey("liquid"))
|
||||||
|
output.put("liquid", stack.stackTagCompound.getString("liquid"));
|
||||||
|
else
|
||||||
|
output.put("liquid", "empty");
|
||||||
|
|
||||||
|
if (tag != null && tag.hasKey("lvl"))
|
||||||
|
output.put("fluidAmount", stack.stackTagCompound.getInteger("lvl"));
|
||||||
|
else
|
||||||
|
output.put("fluidAmount", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package li.cil.oc.integration.rotarycraft
|
||||||
|
|
||||||
|
import li.cil.oc.api.Driver
|
||||||
|
import li.cil.oc.integration.{ModProxy, Mods}
|
||||||
|
|
||||||
|
object ModRotaryCraft extends ModProxy {
|
||||||
|
override def getMod = Mods.RotaryCraft
|
||||||
|
|
||||||
|
override def initialize() {
|
||||||
|
Driver.add(new ConverterJetpackItem)
|
||||||
|
Driver.add(new ConverterPumpItem)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user