mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Revamped OpenComputers compatibility, the following is a list of changes/additions.
Added compatibility to the large launch pad Changed the way that fluids are handled by OC, they now use the internal names of said fluids. Changing over to a more compact function for energy related compatibility, not doing it fully until people have a bit of time to modify their programs. Fixed a minor bug where changing the steam type using OC in a RBMK boiler could potentially make infinite steam. Wiki will be updated for the compatibility on merge of this PR.
This commit is contained in:
parent
dc2387f480
commit
eaedb33a77
@ -280,12 +280,18 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {getPower()};
|
||||
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {getMaxPower()};
|
||||
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@ -296,13 +302,15 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
|
||||
|
||||
// Not sure if i should have this
|
||||
/*
|
||||
if(xCoord2 == xCoord && zCoord2 == zCoord) {
|
||||
xCoord2 += 1;
|
||||
}
|
||||
*/
|
||||
|
||||
return new Object[] {xCoord2, zCoord2};
|
||||
}
|
||||
return new Object[] {"Designator not found"};
|
||||
return new Object[] {false, "Designator not found"};
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
@ -311,9 +319,9 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0));
|
||||
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
||||
|
||||
return new Object[] {"Success"};
|
||||
return new Object[] {true};
|
||||
}
|
||||
return new Object[] {"Designator not found"};
|
||||
return new Object[] {false, "Designator not found"};
|
||||
}
|
||||
|
||||
@Callback
|
||||
|
||||
@ -2,6 +2,8 @@ package com.hbm.tileentity.bomb;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.bomb.LaunchPad;
|
||||
import com.hbm.entity.missile.EntityMissileCustom;
|
||||
import com.hbm.handler.MissileStruct;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
@ -28,9 +30,14 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
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.SimpleComponent;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -43,7 +50,8 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IGUIProvider {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IGUIProvider, SimpleComponent {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -597,6 +605,80 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
|
||||
return tanks;
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "large_launch_pad";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getContents(Context context, Arguments args) {
|
||||
return new Object[] {tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getName(), tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getName(), solid, maxSolid};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getLaunchInfo(Context context, Arguments args) {
|
||||
return new Object[] {canLaunch(), isMissileValid(), hasDesignator(), hasFuel()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCoords(Context context, Arguments args) {
|
||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
int xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
|
||||
int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
|
||||
|
||||
//unsure if this is needed, leaving here in case it is
|
||||
/*
|
||||
if(xCoord2 == xCoord && zCoord2 == zCoord) {
|
||||
xCoord2 += 1;
|
||||
}
|
||||
*/
|
||||
|
||||
return new Object[] {xCoord2, zCoord2};
|
||||
}
|
||||
return new Object[] {false, "Designator not found"};
|
||||
}
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setCoords(Context context, Arguments args) {
|
||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0));
|
||||
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
||||
|
||||
return new Object[] {true};
|
||||
}
|
||||
return new Object[] {false, "Designator not found"};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] launch(Context context, Arguments args) {
|
||||
//worldObj.getBlock(xCoord, yCoord, zCoord).explode(worldObj, xCoord, yCoord, zCoord);
|
||||
((LaunchPad) ModBlocks.launch_pad).explode(worldObj, xCoord, yCoord, zCoord);
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerLaunchTable(player.inventory, this);
|
||||
|
||||
@ -279,13 +279,19 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {getPower()};
|
||||
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {getMaxPower()};
|
||||
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
|
||||
@ -202,20 +202,20 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
|
||||
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFirstFuel(Context context, Arguments args) {
|
||||
return new Object[] {tanks[0].getFill()};
|
||||
public Object[] getFuel(Context context, Arguments args) {
|
||||
return new Object[] {tanks[0].getFill(), tanks[1].getFill()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSecondFuel(Context context, Arguments args) {
|
||||
return new Object[] {tanks[1].getFill()};
|
||||
public Object[] getTypes(Context context, Arguments args) {
|
||||
return new Object[] {tanks[0].getTankType().getName(), tanks[1].getTankType().getName()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {tanks[0].getFill(), tanks[1].getFill()};
|
||||
return new Object[] {tanks[0].getFill(), tanks[0].getTankType().getName(), tanks[1].getFill(), tanks[1].getTankType().getName()};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -194,13 +194,19 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInput(Context context, Arguments args) {
|
||||
return new Object[] {joules};
|
||||
return new Object[] {joules, "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getOutput(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {joules, getPower()}; //literally only doing this for the consistency between components
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@ -212,7 +218,7 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {joules, power, tank.getFill()};
|
||||
return new Object[] {joules, getPower(), tank.getFill()};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -176,13 +176,19 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {maxPower};
|
||||
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
|
||||
@ -401,15 +401,19 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
||||
}
|
||||
if(type == 0) {
|
||||
steam.setTankType(Fluids.STEAM);
|
||||
steam.setFill(0); //too lazy to add a ton of additional code to divide the fill amount, fuck your steam
|
||||
return new Object[] {true};
|
||||
} else if(type == 1) {
|
||||
steam.setTankType(Fluids.HOTSTEAM);
|
||||
steam.setFill(0);
|
||||
return new Object[] {true};
|
||||
} else if(type == 2) {
|
||||
steam.setTankType(Fluids.SUPERHOTSTEAM);
|
||||
steam.setFill(0);
|
||||
return new Object[] {true};
|
||||
} else {
|
||||
steam.setTankType(Fluids.ULTRAHOTSTEAM);
|
||||
steam.setFill(0);
|
||||
return new Object[] {true};
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,19 +312,19 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFillType(Context context, Arguments args) {
|
||||
return new Object[] {feed.getTankType().getID()};
|
||||
return new Object[] {feed.getTankType().getName()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getExportType(Context context, Arguments args) {
|
||||
return new Object[] {steam.getTankType().getID()};
|
||||
return new Object[] {steam.getTankType().getName()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {heat, feed.getFill(), feed.getMaxFill(), steam.getFill(), steam.getMaxFill(), feed.getTankType().getID(), steam.getTankType().getID(), xCoord, yCoord, zCoord};
|
||||
return new Object[] {heat, feed.getFill(), feed.getMaxFill(), steam.getFill(), steam.getMaxFill(), feed.getTankType().getName(), steam.getTankType().getName(), xCoord, yCoord, zCoord};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
|
||||
@ -389,12 +389,12 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getTypeStored(Context context, Arguments args) {
|
||||
return new Object[] {tank.getTankType().getUnlocalizedName()};
|
||||
return new Object[] {tank.getTankType().getName()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getUnlocalizedName()};
|
||||
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getName()};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import api.hbm.energy.*;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.MachineBattery;
|
||||
import com.hbm.inventory.container.ContainerMachineBattery;
|
||||
import com.hbm.inventory.gui.GUIMachineBattery;
|
||||
@ -15,6 +16,7 @@ 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.SimpleComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -392,19 +394,35 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "ntm_energy_storage"; // need a way to somehow detect the first word of the energy storage block so people wont get confused when it comes to multiple energy storage blocks
|
||||
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
if (block.equals(ModBlocks.machine_battery_potato)) {
|
||||
return "ntm_energy_storage_potato";
|
||||
} else if (block.equals(ModBlocks.machine_lithium_battery)) {
|
||||
return "ntm_energy_storage_lithium";
|
||||
} else if (block.equals(ModBlocks.machine_schrabidium_battery)) {
|
||||
return "ntm_energy_storage_schrabidum";
|
||||
} else if (block.equals(ModBlocks.machine_dineutronium_battery)) {
|
||||
return "ntm_energy_storage_dineutronium";
|
||||
} else
|
||||
return "ntm_energy_storage";
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {getPower()};
|
||||
public Object[] getEnergyStored(Context context, Arguments args) { //TODO for gamma: when ready remove these deprecated functions in all components
|
||||
return new Object[] {getPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {getMaxPower()};
|
||||
return new Object[] {getMaxPower(), "Consider switching to the main function 'getEnergyInfo', as this function is deprecated and will soon be removed."};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
|
||||
@ -487,12 +487,12 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getTypeStored(Context context, Arguments args) {
|
||||
return new Object[] {tank.getTankType().getUnlocalizedName()};
|
||||
return new Object[] {tank.getTankType().getName()};
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getUnlocalizedName()};
|
||||
return new Object[]{tank.getFill(), tank.getMaxFill(), tank.getTankType().getName()};
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user