ICF reactor compat done

pellet compat too

probably gonna make a base OC machine class just to fill the name field
This commit is contained in:
BallOfEnergy 2024-06-12 17:47:30 -05:00
parent b6125ac24f
commit 9d1e20df0f
2 changed files with 75 additions and 1 deletions

View File

@ -19,10 +19,15 @@ import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardTransceiver;
import api.hbm.tile.IInfoProviderEC;
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 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.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@ -32,7 +37,8 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityICF extends TileEntityMachineBase implements IGUIProvider, IFluidStandardTransceiver, IInfoProviderEC {
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public class TileEntityICF extends TileEntityMachineBase implements IGUIProvider, IFluidStandardTransceiver, IInfoProviderEC, SimpleComponent {
public long laser;
public long maxLaser;
@ -284,4 +290,58 @@ public class TileEntityICF extends TileEntityMachineBase implements IGUIProvider
data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, this.consumption);
data.setDouble(CompatEnergyControl.D_OUTPUT_MB, this.output);
}
//OC stuff
@Override
public String getComponentName() {
return "ntm_icf_reactor";
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {this.heat};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeatingRate(Context context, Arguments args) {
return new Object[] {this.heatup};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getMaxHeat(Context context, Arguments args) {
return new Object[] {maxHeat};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPower(Context context, Arguments args) {
return new Object[] {this.laser};
}
@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()
};
}
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getPelletStats(Context context, Arguments args) {
return new Object[] {
ItemICFPellet.getDepletion(slots[5]),
ItemICFPellet.getMaxDepletion(slots[5]),
ItemICFPellet.getFusingDifficulty(slots[5]),
ItemICFPellet.getType(slots[5], true).name(),
ItemICFPellet.getType(slots[5], false).name()
};
}
}

View File

@ -23,6 +23,7 @@ import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -228,6 +229,19 @@ public class TileEntityMicrowave extends TileEntityMachineBase implements IEnerg
return new Object[] {"This is a testing device for everything OC."};
}
@Callback(direct = true, getter = true)
@Optional.Method(modid = "OpenComputers")
public Object[] variableget(Context context, Arguments args) {
return new Object[] {speed, "test of the `getter` callback function"};
}
@Callback(direct = true, setter = true)
@Optional.Method(modid = "OpenComputers")
public Object[] variableset(Context context, Arguments args) {
speed = MathHelper.clamp_int(args.checkInteger(0), 0, 5);
return new Object[] {"test of the `setter` callback function"};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMicrowave(player.inventory, this);