mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #1163 from BallOfEnergy1/master
More OC Compatibility!
This commit is contained in:
commit
954e80d36e
@ -278,17 +278,6 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
public String getComponentName() {
|
||||
return "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")
|
||||
|
||||
@ -611,18 +611,6 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
|
||||
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) {
|
||||
|
||||
@ -279,18 +279,6 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
return "dfc_emitter";
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@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(direct = true, limit = 4)
|
||||
@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(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
|
||||
@ -191,18 +191,6 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
||||
return "dfc_receiver";
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInput(Context context, Arguments args) {
|
||||
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[] {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) {
|
||||
|
||||
@ -172,18 +172,6 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
|
||||
return "dfc_stabilizer";
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@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(direct = true, limit = 4)
|
||||
@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(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
|
||||
@ -298,32 +298,41 @@ public class TileEntityMachineRadar extends TileEntityTickingBase implements IEn
|
||||
return "ntm_radar";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getPower(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isJammed(Context context, Arguments args) {
|
||||
return new Object[] {jammed};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEntities(Context context, Arguments args) {
|
||||
int index = args.checkInteger(0);
|
||||
boolean raw = args.checkBoolean(1);
|
||||
if(!raw && !jammed) {
|
||||
Entity e = entList.get(index);
|
||||
double a = (e.posX);
|
||||
double b = (e.posY);
|
||||
double c = (e.posZ);
|
||||
boolean d = (e instanceof EntityPlayer);
|
||||
return new Object[] {a, b, c, d};
|
||||
} else if (!jammed) {
|
||||
return new Object[] {entList};
|
||||
public Object[] getEntities(Context context, Arguments args) { //fuck fuck fuck
|
||||
if(!jammed) {
|
||||
List<Object> list = new ArrayList();
|
||||
list.add(entList.size()); // small header of how many entities in the list
|
||||
for (Entity e : entList) {
|
||||
list.add(e.posX); // positions
|
||||
list.add(e.posY);
|
||||
list.add(e.posZ);
|
||||
list.add(e.motionX);
|
||||
list.add(e.motionY);
|
||||
list.add(e.motionZ);
|
||||
list.add(e.rotationYaw); // just do rotation so you can calculate DOT
|
||||
list.add(Math.sqrt(Math.pow(e.posX - xCoord, 2) + Math.pow(e.posZ - zCoord, 2))); // distance
|
||||
boolean player = e instanceof EntityPlayer;
|
||||
list.add(player); // isPlayer boolean
|
||||
if(!player) // missile tier
|
||||
list.add(((IRadarDetectable) e).getTargetType().ordinal());
|
||||
else // player name (hopefully)
|
||||
list.add(((EntityPlayer) e).getDisplayName());
|
||||
}
|
||||
return new Object[] {list}; // long-ass list (like 9 entries per entity)
|
||||
} else {
|
||||
return new Object[] {"Radar jammed!"};
|
||||
}
|
||||
|
||||
@ -9,8 +9,13 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
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.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -23,7 +28,8 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityReactorControl extends TileEntityMachineBase implements IControlReceiver, IGUIProvider {
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityReactorControl extends TileEntityMachineBase implements IControlReceiver, IGUIProvider, SimpleComponent {
|
||||
|
||||
public TileEntityReactorControl() {
|
||||
super(1);
|
||||
@ -101,9 +107,9 @@ public class TileEntityReactorControl extends TileEntityMachineBase implements I
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
|
||||
isLinked = establishLink();
|
||||
|
||||
if(isLinked) {
|
||||
@ -244,6 +250,67 @@ public class TileEntityReactorControl extends TileEntityMachineBase implements I
|
||||
LOG
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "reactor_control";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isLinked(Context context, Arguments args) {
|
||||
return new Object[] {isLinked};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getReactor(Context context, Arguments args) {
|
||||
return new Object[] {getDisplayData()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setParams(Context context, Arguments args) { //i hate my life
|
||||
int newFunction = args.checkInteger(0);
|
||||
double newMaxheat = args.checkDouble(1);
|
||||
double newMinheat = args.checkDouble(2);
|
||||
double newMaxlevel = args.checkDouble(3)/100.0;
|
||||
double newMinlevel = args.checkDouble(4)/100.0;
|
||||
if (newFunction > 2) { //no more out of bounds for you (and yes there's integer values for functions, sue me)
|
||||
newFunction = 0;
|
||||
} else if (newFunction < 0) {
|
||||
newFunction = 0;
|
||||
}
|
||||
if (newMaxheat < 0.0) {
|
||||
newMaxheat = 0.0;
|
||||
}
|
||||
if (newMinheat < 0.0) {
|
||||
newMinheat = 0.0;
|
||||
}
|
||||
if (newMaxlevel < 0.0) {
|
||||
newMaxlevel = 0.0;
|
||||
} else if (newMaxlevel > 1.0) {
|
||||
newMaxlevel = 1.0;
|
||||
}
|
||||
if (newMinlevel < 0.0) {
|
||||
newMinlevel = 0.0;
|
||||
} else if (newMinlevel > 1.0) {
|
||||
newMinlevel = 1.0;
|
||||
}
|
||||
function = RodFunction.values()[newFunction];
|
||||
heatUpper = newMaxheat;
|
||||
heatLower = newMinheat;
|
||||
levelUpper = newMaxlevel;
|
||||
levelLower = newMinlevel;
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getParams(Context context, Arguments args) {
|
||||
return new Object[] {function.ordinal(), heatUpper, heatLower, levelUpper, levelLower};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return new ContainerReactorControl(player.inventory, this);
|
||||
|
||||
@ -65,7 +65,7 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
lastTiltFront = tiltFront;
|
||||
lastTiltLeft = tiltLeft;
|
||||
@ -342,9 +342,8 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] move(Context context, Arguments args) {
|
||||
if(setUpCrane == true) {
|
||||
if(setUpCrane) {
|
||||
String textbruh = args.checkString(0);
|
||||
|
||||
switch(textbruh) {
|
||||
case "up":
|
||||
tiltFront = 30;
|
||||
@ -372,13 +371,13 @@ public class TileEntityCraneConsole extends TileEntity implements INBTPacketRece
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] load(Context context, Arguments args) {
|
||||
if (setUpCrane == true) {
|
||||
if (setUpCrane) {
|
||||
goesDown = true;
|
||||
return new Object[] {};
|
||||
}
|
||||
return new Object[] {"Crane not found"};
|
||||
}
|
||||
|
||||
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDepletion(Context context, Arguments args) {
|
||||
|
||||
@ -395,18 +395,6 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
return "ntm_energy_storage"; //ok if someone else can figure out how to do this that'd be nice (change the component name based on the type of storage block)
|
||||
}
|
||||
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
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(), "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[] getEnergyInfo(Context context, Arguments args) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user