mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
here it goes again
adds OC compat to the new fusion reactor and the particle accelerator
This commit is contained in:
parent
3bdd7b4c94
commit
9ab73e382f
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.albion;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.container.ContainerPADetector;
|
import com.hbm.inventory.container.ContainerPADetector;
|
||||||
import com.hbm.inventory.gui.GUIPADetector;
|
import com.hbm.inventory.gui.GUIPADetector;
|
||||||
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes;
|
import com.hbm.inventory.recipes.ParticleAcceleratorRecipes;
|
||||||
@ -15,8 +16,13 @@ import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -24,7 +30,8 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityPADetector extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
public static final long usage = 100_000;
|
public static final long usage = 100_000;
|
||||||
|
|
||||||
@ -183,4 +190,85 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
|
|||||||
public BlockPos getExitPos(Particle particle) {
|
public BlockPos getExitPos(Particle particle) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_pa_detector";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCrafting(Context context, Arguments args) {
|
||||||
|
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
ItemStack slot = slots[i+1];
|
||||||
|
if (slot != null) {
|
||||||
|
items[i*2] = slot.getUnlocalizedName();
|
||||||
|
items[(i*2)+1] = slot.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
ItemStack slot = slots[i+1];
|
||||||
|
if (slot != null) {
|
||||||
|
items[i*2] = slot.getUnlocalizedName();
|
||||||
|
items[(i*2)+1] = slot.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
|
||||||
|
items[0], items[1], items[2], items[3],
|
||||||
|
items[4], items[5], items[6], items[7]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getCoolant",
|
||||||
|
"getCrafting",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
case "getCrafting": return getCrafting(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -266,6 +266,21 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
return "ntm_pa_dipole";
|
return "ntm_pa_dipole";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Callback(direct = true)
|
@Callback(direct = true)
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getDirLower(Context context, Arguments args) {
|
public Object[] getDirLower(Context context, Arguments args) {
|
||||||
@ -321,10 +336,25 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
return new Object[] {};
|
return new Object[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
|
||||||
|
dirToName(dirLower), dirToName(dirUpper), dirToName(dirRedstone), threshold
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public String[] methods() {
|
public String[] methods() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getCoolant",
|
||||||
"getDirLower",
|
"getDirLower",
|
||||||
"setDirLower",
|
"setDirLower",
|
||||||
"getDirUpper",
|
"getDirUpper",
|
||||||
@ -333,6 +363,7 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
"setDirRedstone",
|
"setDirRedstone",
|
||||||
"getThreshold",
|
"getThreshold",
|
||||||
"setThreshold",
|
"setThreshold",
|
||||||
|
"getInfo",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,6 +371,9 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
|
||||||
case "getDirLower": return getDirLower(context, args);
|
case "getDirLower": return getDirLower(context, args);
|
||||||
case "setDirLower": return setDirLower(context, args);
|
case "setDirLower": return setDirLower(context, args);
|
||||||
case "getDirUpper": return getDirUpper(context, args);
|
case "getDirUpper": return getDirUpper(context, args);
|
||||||
@ -348,6 +382,8 @@ public class TileEntityPADipole extends TileEntityCooledBase implements IGUIProv
|
|||||||
case "setDirRedstone": return setDirRedstone(context, args);
|
case "setDirRedstone": return setDirRedstone(context, args);
|
||||||
case "getThreshold": return getThreshold(context, args);
|
case "getThreshold": return getThreshold(context, args);
|
||||||
case "setThreshold": return setThreshold(context, args);
|
case "setThreshold": return setThreshold(context, args);
|
||||||
|
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
}
|
}
|
||||||
throw new NoSuchMethodException();
|
throw new NoSuchMethodException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity.machine.albion;
|
package com.hbm.tileentity.machine.albion;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.container.ContainerPAQuadrupole;
|
import com.hbm.inventory.container.ContainerPAQuadrupole;
|
||||||
import com.hbm.inventory.gui.GUIPAQuadrupole;
|
import com.hbm.inventory.gui.GUIPAQuadrupole;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
@ -12,15 +13,21 @@ import com.hbm.util.EnumUtil;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
public static final long usage = 100_000;
|
public static final long usage = 100_000;
|
||||||
public static final int focusGain = 100;
|
public static final int focusGain = 100;
|
||||||
@ -129,4 +136,57 @@ public class TileEntityPAQuadrupole extends TileEntityCooledBase implements IGUI
|
|||||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return new GUIPAQuadrupole(player.inventory, this);
|
return new GUIPAQuadrupole(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_pa_quad";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getCoolant",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity.machine.albion;
|
package com.hbm.tileentity.machine.albion;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.container.ContainerPARFC;
|
import com.hbm.inventory.container.ContainerPARFC;
|
||||||
import com.hbm.inventory.gui.GUIPARFC;
|
import com.hbm.inventory.gui.GUIPARFC;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
@ -9,15 +10,21 @@ import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvider, IParticleUser {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvider, IParticleUser, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
public static final long usage = 250_000;
|
public static final long usage = 250_000;
|
||||||
public static final int momentumGain = 100;
|
public static final int momentumGain = 100;
|
||||||
@ -121,4 +128,57 @@ public class TileEntityPARFC extends TileEntityCooledBase implements IGUIProvide
|
|||||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
return new GUIPARFC(player.inventory, this);
|
return new GUIPARFC(player.inventory, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_pa_rfc";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getCoolant",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.hbm.tileentity.machine.albion;
|
package com.hbm.tileentity.machine.albion;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.container.ContainerPASource;
|
import com.hbm.inventory.container.ContainerPASource;
|
||||||
import com.hbm.inventory.gui.GUIPASource;
|
import com.hbm.inventory.gui.GUIPASource;
|
||||||
@ -11,9 +12,14 @@ import com.hbm.util.EnumUtil;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
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.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
@ -24,7 +30,8 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider, IConditionalInvAccess, IControlReceiver {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityPASource extends TileEntityCooledBase implements IGUIProvider, IConditionalInvAccess, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
public static final long usage = 100_000;
|
public static final long usage = 100_000;
|
||||||
public Particle particle;
|
public Particle particle;
|
||||||
@ -278,6 +285,114 @@ public class TileEntityPASource extends TileEntityCooledBase implements IGUIProv
|
|||||||
this.particle.distanceTraveled = particleTag.getInteger("dist");
|
this.particle.distanceTraveled = particleTag.getInteger("dist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_pa_source";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getMomentum(Context context, Arguments args) {
|
||||||
|
return new Object[] {lastSpeed};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getState(Context context, Arguments args) {
|
||||||
|
return new Object[] {state.name()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCrafting(Context context, Arguments args) {
|
||||||
|
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
ItemStack slot = slots[i+1];
|
||||||
|
if (slot != null) {
|
||||||
|
items[i*2] = slot.getUnlocalizedName();
|
||||||
|
items[(i*2)+1] = slot.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] cancelOperation(Context context, Arguments args) {
|
||||||
|
particle = null;
|
||||||
|
state = PAState.IDLE;
|
||||||
|
return new Object[] {};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
Object[] items = new Object[] {"", 0, "", 0, "", 0, "", 0};
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
ItemStack slot = slots[i+1];
|
||||||
|
if (slot != null) {
|
||||||
|
items[i*2] = slot.getUnlocalizedName();
|
||||||
|
items[(i*2)+1] = slot.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
|
||||||
|
items[0], items[1], items[2], items[3],
|
||||||
|
items[4], items[5], items[6], items[7],
|
||||||
|
lastSpeed, state.name()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getCoolant",
|
||||||
|
"getMomentum",
|
||||||
|
"getState",
|
||||||
|
"getCrafting",
|
||||||
|
"cancelOperation",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
case "getMomentum": return getMomentum(context, args);
|
||||||
|
case "getState": return getState(context, args);
|
||||||
|
case "getCrafting": return getCrafting(context, args);
|
||||||
|
case "cancelOperation": return cancelOperation(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Particle {
|
public static class Particle {
|
||||||
|
|
||||||
private TileEntityPASource source;
|
private TileEntityPASource source;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity.machine.fusion;
|
package com.hbm.tileentity.machine.fusion;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.inventory.fluid.trait.FT_Heatable;
|
import com.hbm.inventory.fluid.trait.FT_Heatable;
|
||||||
@ -11,14 +12,20 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
|||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
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.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
protected GenNode plasmaNode;
|
protected GenNode plasmaNode;
|
||||||
|
|
||||||
@ -170,4 +177,57 @@ public class TileEntityFusionBoiler extends TileEntityLoadedBase implements IFlu
|
|||||||
public double getMaxRenderDistanceSquared() {
|
public double getMaxRenderDistanceSquared() {
|
||||||
return 65536.0D;
|
return 65536.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_fusion_boiler";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getPlasmaEnergy(Context context, Arguments args) {
|
||||||
|
return new Object[] {plasmaEnergySync};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getFluid(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
plasmaEnergySync,
|
||||||
|
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getPlasmaEnergy",
|
||||||
|
"getFluid",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getPlasmaEnergy": return getPlasmaEnergy(context, args);
|
||||||
|
case "getFluid": return getFluid(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity.machine.fusion;
|
package com.hbm.tileentity.machine.fusion;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.FluidStack;
|
import com.hbm.inventory.FluidStack;
|
||||||
import com.hbm.inventory.container.ContainerFusionBreeder;
|
import com.hbm.inventory.container.ContainerFusionBreeder;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -18,9 +19,14 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
|
|||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
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.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -29,7 +35,8 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityFusionBreeder extends TileEntityMachineBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver, IGUIProvider {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityFusionBreeder extends TileEntityMachineBase implements IFluidStandardTransceiverMK2, IFusionPowerReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
protected GenNode plasmaNode;
|
protected GenNode plasmaNode;
|
||||||
|
|
||||||
@ -289,4 +296,111 @@ public class TileEntityFusionBreeder extends TileEntityMachineBase implements IF
|
|||||||
public double getMaxRenderDistanceSquared() {
|
public double getMaxRenderDistanceSquared() {
|
||||||
return 65536.0D;
|
return 65536.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_fusion_breeder";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getNeutronEnergy(Context context, Arguments args) {
|
||||||
|
return new Object[] {neutronEnergySync};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getProgress(Context context, Arguments args) {
|
||||||
|
return new Object[] {progress / capacity};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getFluid(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCrafting(Context context, Arguments args) {
|
||||||
|
ItemStack input = slots[1];
|
||||||
|
String inputName = "";
|
||||||
|
int inputSize = 0;
|
||||||
|
if (input != null) {
|
||||||
|
inputName = input.getUnlocalizedName();
|
||||||
|
inputSize = input.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack output = slots[2];
|
||||||
|
String outputName = "";
|
||||||
|
int outputSize = 0;
|
||||||
|
if (output != null) {
|
||||||
|
outputName = output.getUnlocalizedName();
|
||||||
|
outputSize = output.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Object[] {
|
||||||
|
inputName, inputSize,
|
||||||
|
outputName, outputSize
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
ItemStack input = slots[1];
|
||||||
|
String inputName = "";
|
||||||
|
int inputSize = 0;
|
||||||
|
if (input != null) {
|
||||||
|
inputName = input.getUnlocalizedName();
|
||||||
|
inputSize = input.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack output = slots[2];
|
||||||
|
String outputName = "";
|
||||||
|
int outputSize = 0;
|
||||||
|
if (output != null) {
|
||||||
|
outputName = output.getUnlocalizedName();
|
||||||
|
outputSize = output.stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Object[] {
|
||||||
|
neutronEnergySync, progress / capacity,
|
||||||
|
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName(),
|
||||||
|
|
||||||
|
inputName, inputSize,
|
||||||
|
outputName, outputSize
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getNeutronEnergy",
|
||||||
|
"getProgress",
|
||||||
|
"getFluid",
|
||||||
|
"getCrafting",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getNeutronEnergy": return getNeutronEnergy(context, args);
|
||||||
|
case "getProgress": return getProgress(context, args);
|
||||||
|
case "getFluid": return getFluid(context, args);
|
||||||
|
case "getCrafting": return getCrafting(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.fusion;
|
|||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.container.ContainerFusionKlystron;
|
import com.hbm.inventory.container.ContainerFusionKlystron;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -21,9 +22,14 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
|||||||
|
|
||||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||||
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
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.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -33,7 +39,8 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityFusionKlystron extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiverMK2, IControlReceiver, IGUIProvider {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityFusionKlystron extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardReceiverMK2, IControlReceiver, IGUIProvider, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
protected GenNode klystronNode;
|
protected GenNode klystronNode;
|
||||||
public static final long MAX_OUTPUT = 1_000_000;
|
public static final long MAX_OUTPUT = 1_000_000;
|
||||||
@ -306,4 +313,70 @@ public class TileEntityFusionKlystron extends TileEntityMachineBase implements I
|
|||||||
if(this.outputTarget > MAX_OUTPUT) this.outputTarget = MAX_OUTPUT;
|
if(this.outputTarget > MAX_OUTPUT) this.outputTarget = MAX_OUTPUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_fusion_klystron";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getAir(Context context, Arguments args) {
|
||||||
|
return new Object[] {compair.getFill(), compair.getMaxFill()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getOutput(Context context, Arguments args) {
|
||||||
|
return new Object[] {output, outputTarget};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true, limit = 4)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] setOutput(Context context, Arguments args) {
|
||||||
|
outputTarget = (long) MathHelper.clamp_double(args.checkDouble(0), 0.0, MAX_OUTPUT);
|
||||||
|
return new Object[] {};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
compair.getFill(), compair.getMaxFill(),
|
||||||
|
output, outputTarget
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getAir",
|
||||||
|
"getOutput",
|
||||||
|
"setOutput",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getAir": return getAir(context, args);
|
||||||
|
case "getOutput": return getOutput(context, args);
|
||||||
|
case "setOutput": return setOutput(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
@ -18,15 +19,21 @@ import com.hbm.util.fauxpointtwelve.DirPos;
|
|||||||
|
|
||||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||||
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
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.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiverMK2, IFusionPowerReceiver, IConfigurableMachine {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnergyProviderMK2, IFluidStandardTransceiverMK2, IFusionPowerReceiver, IConfigurableMachine, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
protected GenNode plasmaNode;
|
protected GenNode plasmaNode;
|
||||||
|
|
||||||
@ -244,4 +251,65 @@ public class TileEntityFusionMHDT extends TileEntityLoadedBase implements IEnerg
|
|||||||
public double getMaxRenderDistanceSquared() {
|
public double getMaxRenderDistanceSquared() {
|
||||||
return 65536.0D;
|
return 65536.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_fusion_mhdt";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {power};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getPlasmaEnergy(Context context, Arguments args) {
|
||||||
|
return new Object[] {plasmaEnergySync};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
power, plasmaEnergySync,
|
||||||
|
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getPlasmaEnergy",
|
||||||
|
"getCoolant",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getPlasmaEnergy": return getPlasmaEnergy(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.fusion;
|
|||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.hbm.handler.CompatHandler;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
import com.hbm.inventory.container.ContainerFusionTorus;
|
import com.hbm.inventory.container.ContainerFusionTorus;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
@ -25,9 +26,14 @@ import com.hbm.util.BobMathUtil;
|
|||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
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.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -37,7 +43,8 @@ import net.minecraft.util.MathHelper;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver {
|
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||||
|
public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIProvider, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
|
||||||
|
|
||||||
public boolean didProcess = false;
|
public boolean didProcess = false;
|
||||||
|
|
||||||
@ -453,4 +460,110 @@ public class TileEntityFusionTorus extends TileEntityCooledBase implements IGUIP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String getComponentName() {
|
||||||
|
return "ntm_fusion_torus";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getEnergyInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {getPower(), getMaxPower()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getFluid(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[2].getFill(), tanks[2].getMaxFill(), tanks[2].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[3].getFill(), tanks[3].getMaxFill(), tanks[3].getTankType().getUnlocalizedName(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getCoolant(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getKlystronEnergy(Context context, Arguments args) {
|
||||||
|
return new Object[] {klystronEnergy};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getPlasmaEnergy(Context context, Arguments args) {
|
||||||
|
return new Object[] {plasmaEnergy};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getFuelConsumption(Context context, Arguments args) {
|
||||||
|
return new Object[] {fuelConsumption};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getRecipeProgress(Context context, Arguments args) {
|
||||||
|
return new Object[] {fusionModule.progress, fusionModule.bonus};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(direct = true)
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] getInfo(Context context, Arguments args) {
|
||||||
|
return new Object[] {
|
||||||
|
getPower(), getMaxPower(),
|
||||||
|
|
||||||
|
tanks[0].getFill(), tanks[0].getMaxFill(), tanks[0].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[1].getFill(), tanks[1].getMaxFill(), tanks[1].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[2].getFill(), tanks[2].getMaxFill(), tanks[2].getTankType().getUnlocalizedName(),
|
||||||
|
tanks[3].getFill(), tanks[3].getMaxFill(), tanks[3].getTankType().getUnlocalizedName(),
|
||||||
|
|
||||||
|
coolantTanks[0].getFill(), coolantTanks[0].getMaxFill(),
|
||||||
|
coolantTanks[1].getFill(), coolantTanks[1].getMaxFill(),
|
||||||
|
|
||||||
|
klystronEnergy, plasmaEnergy, fuelConsumption,
|
||||||
|
fusionModule.progress, fusionModule.bonus
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public String[] methods() {
|
||||||
|
return new String[] {
|
||||||
|
"getEnergyInfo",
|
||||||
|
"getFluid",
|
||||||
|
"getCoolant",
|
||||||
|
"getKlystronEnergy",
|
||||||
|
"getPlasmaEnergy",
|
||||||
|
"getFuelConsumption",
|
||||||
|
"getRecipeProgress",
|
||||||
|
"getInfo"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "OpenComputers")
|
||||||
|
public Object[] invoke(String method, Context context, Arguments args) throws Exception {
|
||||||
|
switch (method) {
|
||||||
|
case "getEnergyInfo": return getEnergyInfo(context, args);
|
||||||
|
case "getFluid": return getFluid(context, args);
|
||||||
|
case "getCoolant": return getCoolant(context, args);
|
||||||
|
case "getKlystronEnergy": return getKlystronEnergy(context, args);
|
||||||
|
case "getPlasmaEnergy": return getPlasmaEnergy(context, args);
|
||||||
|
case "getFuelConsumption": return getFuelConsumption(context, args);
|
||||||
|
case "getRecipeProgress": return getRecipeProgress(context, args);
|
||||||
|
case "getInfo": return getInfo(context, args);
|
||||||
|
}
|
||||||
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user