mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
added accelerated compatibility to other components such as the DFC and batteries, also added some highly requested compatibility to fluid tanks.
This commit is contained in:
parent
76756f02e8
commit
1a8d937f03
@ -1,7 +1,8 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import api.hbm.block.ILaserable;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.container.ContainerCoreEmitter;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
@ -11,10 +12,6 @@ import com.hbm.inventory.gui.GUICoreEmitter;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.block.ILaserable;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.fluid.IFluidStandardReceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -35,6 +32,8 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, ILaserable, IFluidStandardReceiver, SimpleComponent, IGUIProvider {
|
||||
|
||||
@ -311,50 +310,50 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne
|
||||
return "dfc_emitter";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {getPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCryogel(Context context, Arguments args) {
|
||||
return new Object[] {tank.getFill()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInput(Context context, Arguments args) {
|
||||
return new Object[] {watts};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower(), tank.getFill(), watts, isOn};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] isActive(Context context, Arguments args) {
|
||||
return new Object[] {isOn};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setActive(Context context, Arguments args) {
|
||||
isOn = args.checkBoolean(0);
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setInput(Context context, Arguments args) {
|
||||
int newOutput = args.checkInteger(0);
|
||||
|
||||
@ -200,19 +200,19 @@ public class TileEntityCoreInjector extends TileEntityMachineBase implements IFl
|
||||
return "dfc_injector";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFirstFuel(Context context, Arguments args) {
|
||||
return new Object[] {tanks[0].getFill()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getSecondFuel(Context context, Arguments args) {
|
||||
return new Object[] {tanks[1].getFill()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@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()};
|
||||
|
||||
@ -191,25 +191,25 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
||||
return "dfc_receiver";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInput(Context context, Arguments args) {
|
||||
return new Object[] {joules};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getOutput(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getCryogel(Context context, Arguments args) {
|
||||
return new Object[] {tank.getFill()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {joules, power, tank.getFill()};
|
||||
|
||||
@ -173,25 +173,25 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
|
||||
return "dfc_stabilizer";
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {power};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {maxPower};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInput(Context context, Arguments args) {
|
||||
return new Object[] {watts};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getDurability(Context context, Arguments args) {
|
||||
if(slots[0] != null && slots[0].getItem() == ModItems.ams_lens && ItemLens.getLensDamage(slots[0]) < ((ItemLens)ModItems.ams_lens).maxDamage) {
|
||||
@ -200,7 +200,7 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
|
||||
return new Object[] {"N/A"};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
Object lens_damage_buf;
|
||||
@ -212,7 +212,7 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I
|
||||
return new Object[] {power, maxPower, watts, lens_damage_buf};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 2)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] setInput(Context context, Arguments args) {
|
||||
int newOutput = args.checkInteger(0);
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import api.hbm.energy.*;
|
||||
import com.hbm.blocks.machine.MachineBattery;
|
||||
import com.hbm.inventory.container.ContainerMachineBattery;
|
||||
import com.hbm.inventory.gui.GUIMachineBattery;
|
||||
@ -12,13 +8,6 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyConductor;
|
||||
import api.hbm.energy.IEnergyConnector;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.energy.IPowerNet;
|
||||
import api.hbm.energy.PowerNet;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -36,6 +25,11 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyUser, IPersistentNBT, SimpleComponent, IGUIProvider {
|
||||
|
||||
@ -379,19 +373,19 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
||||
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
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getEnergyStored(Context context, Arguments args) {
|
||||
return new Object[] {getPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxEnergy(Context context, Arguments args) {
|
||||
return new Object[] {getMaxPower()};
|
||||
}
|
||||
|
||||
@Callback
|
||||
@Callback(direct = true, limit = 8)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getInfo(Context context, Arguments args) {
|
||||
return new Object[] {getPower(), getMaxPower()};
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
package com.hbm.tileentity.machine.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.vanillant.ExplosionVNT;
|
||||
@ -35,11 +32,13 @@ import com.hbm.tileentity.IRepairable;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||
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 net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -50,6 +49,11 @@ import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")})
|
||||
public class TileEntityMachineFluidTank extends TileEntityMachineBase implements IFluidContainer, IFluidSource, IFluidAcceptor, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable {
|
||||
|
||||
public FluidTank tank;
|
||||
@ -438,4 +442,28 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements
|
||||
this.hasExploded = false;
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public String getComponentName() {
|
||||
return "ntm_fluid_tank";
|
||||
}
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getFluidStored(Context context, Arguments args) {
|
||||
return new Object[] {tank.getFill()};
|
||||
}
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getMaxStored(Context context, Arguments args) {
|
||||
return new Object[] {tank.getMaxFill()};
|
||||
}
|
||||
@Callback(direct = true, limit = 4)
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] getTypeStored(Context context, Arguments args) {
|
||||
return new Object[] {tank.getTankType()};
|
||||
}
|
||||
@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().getName()};
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user