mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 17:56:34 -04:00
Add BloodMagic integration (Blood Altars, Master Ritual Stones and Blood Orbs)
This commit is contained in:
parent
f01e69333b
commit
c058dc2781
@ -135,6 +135,10 @@ repositories {
|
||||
name 'Railcraft'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.rc.cf}/[module]_[revision].[ext]"
|
||||
}
|
||||
ivy {
|
||||
name 'BloodMagic'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.bloodmagic.cf}/[module]-${config.minecraft.version}-[revision].[ext]"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@ -169,6 +173,7 @@ dependencies {
|
||||
provided name: 'ComputerCraft', version: config.cc.version, ext: 'jar'
|
||||
provided name: 'EnderIO', version: config.eio.version, ext: 'jar'
|
||||
provided name: 'Railcraft', version: config.rc.version, ext: 'jar'
|
||||
provided name: 'BloodMagic', version: config.bloodmagic.version, ext: 'jar'
|
||||
|
||||
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
|
||||
|
||||
|
@ -6,6 +6,8 @@ oc.subversion=dev
|
||||
|
||||
ae2.version=rv1-stable-1
|
||||
bc.version=6.2.6
|
||||
bloodmagic.cf=2223/203
|
||||
bloodmagic.version=1.3.0a-1
|
||||
cc.cf=2216/236
|
||||
cc.version=1.65
|
||||
ccl.version=1.1.1.104
|
||||
|
@ -67,6 +67,7 @@ object Mods {
|
||||
val Waila = new SimpleMod(IDs.Waila)
|
||||
val WirelessRedstoneCBE = new SimpleMod(IDs.WirelessRedstoneCBE)
|
||||
val WirelessRedstoneSVE = new SimpleMod(IDs.WirelessRedstoneSV)
|
||||
val BloodMagic = new SimpleMod(IDs.BloodMagic)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -98,6 +99,7 @@ object Mods {
|
||||
integration.waila.ModWaila,
|
||||
integration.wrcbe.ModWRCBE,
|
||||
integration.wrsve.ModWRSVE,
|
||||
integration.bloodmagic.ModBloodMagic,
|
||||
|
||||
// Register the general IPeripheral driver last, if at all, to avoid it
|
||||
// being used rather than other more concrete implementations.
|
||||
@ -171,6 +173,7 @@ object Mods {
|
||||
final val Waila = "Waila"
|
||||
final val WirelessRedstoneCBE = "WR-CBE|Core"
|
||||
final val WirelessRedstoneSV = "WirelessRedstoneCore"
|
||||
final val BloodMagic = "AWWayofTime"
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
@ -0,0 +1,30 @@
|
||||
package li.cil.oc.integration.bloodmagic;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import li.cil.oc.api.driver.Converter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ConverterBloodOrb implements Converter {
|
||||
@Override
|
||||
public void convert(Object value, Map<Object, Object> output) {
|
||||
if (value instanceof ItemStack) {
|
||||
final ItemStack stack = (ItemStack) value;
|
||||
final Item item = stack.getItem();
|
||||
if (item instanceof IBloodOrb) {
|
||||
final IBloodOrb bloodOrb = (IBloodOrb) item;
|
||||
final String ownerName = stack.stackTagCompound.getString("ownerName");
|
||||
final int maxOrbTier = SoulNetworkHandler.getCurrentMaxOrb(ownerName);
|
||||
output.put("ownerName", ownerName);
|
||||
output.put("networkOrbTier", maxOrbTier);
|
||||
output.put("networkEssence", SoulNetworkHandler.getCurrentEssence(ownerName));
|
||||
output.put("maxNetworkEssence", SoulNetworkHandler.getMaximumForOrbTier(maxOrbTier));
|
||||
output.put("maxEssence", bloodOrb.getMaxEssence());
|
||||
output.put("orbTier", bloodOrb.getOrbLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package li.cil.oc.integration.bloodmagic;
|
||||
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.prefab.DriverTileEntity;
|
||||
import li.cil.oc.integration.ManagedTileEntityEnvironment;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.tile.IBloodAltar;
|
||||
|
||||
public class DriverBloodAltar extends DriverTileEntity {
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return IBloodAltar.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
|
||||
return new Environment((IBloodAltar) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static final class Environment extends ManagedTileEntityEnvironment<IBloodAltar> implements NamedBlock {
|
||||
public Environment(final IBloodAltar tileEntity) {
|
||||
super(tileEntity, "blood_altar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String preferredName() {
|
||||
return "blood_altar";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int priority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the capacity.")
|
||||
public Object[] getCapacity(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getCapacity()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the amount of blood currently contained by this altar.")
|
||||
public Object[] getCurrentBlood(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getCurrentBlood()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the current tier.")
|
||||
public Object[] getTier(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getTier()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the progress.")
|
||||
public Object[] getProgress(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getProgress()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the sacrifice multiplier.")
|
||||
public Object[] getSacrificeMultiplier(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getCapacity()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the self sacrifice multiplier.")
|
||||
public Object[] getSelfSacrificeMultiplier(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getSelfSacrificeMultiplier()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the orb multiplier.")
|
||||
public Object[] getOrbMultiplier(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getOrbMultiplier()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the dislocation multiplier.")
|
||||
public Object[] getDislocationMultiplier(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getDislocationMultiplier()};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package li.cil.oc.integration.bloodmagic;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.machine.Arguments;
|
||||
import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.ManagedEnvironment;
|
||||
import li.cil.oc.api.prefab.DriverTileEntity;
|
||||
import li.cil.oc.integration.ManagedTileEntityEnvironment;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DriverMasterRitualStone extends DriverTileEntity {
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return IMasterRitualStone.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
|
||||
return new Environment((IMasterRitualStone) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static class Environment extends ManagedTileEntityEnvironment<IMasterRitualStone> implements NamedBlock {
|
||||
public Environment(IMasterRitualStone tileEntity) {
|
||||
super(tileEntity, "master_ritual_stone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String preferredName() {
|
||||
return "master_ritual_stone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int priority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Get the name of the player owning this master ritual stone.")
|
||||
public Object[] getOwner(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getOwner()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():string -- Get the current ritual.")
|
||||
public Object[] getCurrentRitual(final Context context, final Arguments arguments) {
|
||||
if (tileEntity instanceof TEMasterStone) {
|
||||
TEMasterStone masterStone = (TEMasterStone) tileEntity;
|
||||
return new Object[]{masterStone.getCurrentRitual()};
|
||||
}
|
||||
return new Object[]{"internal error"};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the remaining cooldown.")
|
||||
public Object[] getCooldown(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getCooldown()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():number -- Get the running time.")
|
||||
public Object[] getRunningTime(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.getRunningTime()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():boolean -- Get whether the tanks are empty.")
|
||||
public Object[] areTanksEmpty(final Context context, final Arguments arguments) {
|
||||
return new Object[]{tileEntity.areTanksEmpty()};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package li.cil.oc.integration.bloodmagic
|
||||
|
||||
import li.cil.oc.api.Driver
|
||||
import li.cil.oc.integration.{Mods, ModProxy}
|
||||
|
||||
object ModBloodMagic extends ModProxy {
|
||||
override def getMod = Mods.BloodMagic
|
||||
|
||||
override def initialize() {
|
||||
Driver.add(new DriverBloodAltar)
|
||||
Driver.add(new DriverMasterRitualStone)
|
||||
|
||||
Driver.add(new ConverterBloodOrb)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user