feat: HBM compat
This commit is contained in:
parent
a46a2b7801
commit
e899355dfb
15 changed files with 342 additions and 17 deletions
19
build.gradle
19
build.gradle
|
@ -25,11 +25,19 @@ defaultTasks 'fullBuild'
|
|||
|
||||
repositories {
|
||||
maven {
|
||||
name 'central'
|
||||
url 'https://maven.thorfusion.com/artifactory/central/'
|
||||
url 'https://maven.tilera.xyz'
|
||||
}
|
||||
maven {
|
||||
url 'https://maven.tilera.xyz'
|
||||
url = "https://s3.tilera.xyz/cdn/minecraft/libs/"
|
||||
metadataSources { artifact() }
|
||||
}
|
||||
maven {
|
||||
name "central"
|
||||
url "https://nexus.covers1624.net/repository/maven-hosted/"
|
||||
}
|
||||
maven {
|
||||
url = "https://gregtech.overminddl1.com/"
|
||||
metadataSources { artifact() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,11 +63,12 @@ dependencies {
|
|||
compile "codechicken:ForgeMultipart:${config.minecraft_version}-${config.FMP_version}:dev"
|
||||
compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev"
|
||||
compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.CCC_version}:dev"
|
||||
compile "inventorytweaks:inventory-tweaks:1.7.10-1.60.0:api"
|
||||
compile "net.industrial-craft:industrialcraft-2:2.2.828-experimental:api"
|
||||
compile "inventorytweaks:InventoryTweaks:1.59-dev:api"
|
||||
compile "net.industrial-craft:industrialcraft-2:2.2.827-experimental:dev"
|
||||
compile "mcp.mobius.waila:Waila:1.5.10_1.7.10:dev"
|
||||
compile "universalelectricity:basiccomponents:2.0.0:deobf"
|
||||
compile "universalelectricity:universalelectricity:5.1.0:deobf"
|
||||
compile "com.hbm:HBM-NTM:1.0.27_X5000:deobf"
|
||||
}
|
||||
|
||||
version = "${config.minecraft_version}-${config.mod_version}"
|
||||
|
|
|
@ -42,6 +42,7 @@ public class MekanismConfig {
|
|||
public static double minerSilkMultiplier = 6;
|
||||
public static boolean blacklistIC2;
|
||||
public static boolean blacklistRF;
|
||||
public static boolean blacklistHBM;
|
||||
public static boolean destroyDisabledBlocks;
|
||||
public static boolean prefilledFluidTanks;
|
||||
public static boolean prefilledGasTanks;
|
||||
|
|
|
@ -545,6 +545,10 @@ public class CommonProxy implements IGuiProvider {
|
|||
= Mekanism.configuration
|
||||
.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false)
|
||||
.getBoolean();
|
||||
general.blacklistHBM
|
||||
= Mekanism.configuration
|
||||
.get(Configuration.CATEGORY_GENERAL, "BlacklistHBMPower", false)
|
||||
.getBoolean();
|
||||
|
||||
general.EnableQuartzCompat
|
||||
= Mekanism.configuration
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.common.base;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import mekanism.api.Coord4D;
|
||||
|
@ -26,6 +27,8 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor {
|
|||
wrapper = new RFAcceptor((IEnergyReceiver) tileEntity);
|
||||
} else if (MekanismUtils.useIC2() && CableUtils.getIC2Tile(tileEntity) instanceof IEnergySink) {
|
||||
wrapper = new IC2Acceptor((IEnergySink) CableUtils.getIC2Tile(tileEntity));
|
||||
} else if (MekanismUtils.useHBM() && tileEntity instanceof IEnergyReceiverMK2) {
|
||||
wrapper = new HBMAcceptor((IEnergyReceiverMK2) tileEntity);
|
||||
}
|
||||
|
||||
if (wrapper != null) {
|
||||
|
@ -182,4 +185,54 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor {
|
|||
return eu * general.FROM_IC2;
|
||||
}
|
||||
}
|
||||
|
||||
public static class HBMAcceptor extends EnergyAcceptorWrapper {
|
||||
private IEnergyReceiverMK2 acceptor;
|
||||
|
||||
public HBMAcceptor(IEnergyReceiverMK2 acceptor) {
|
||||
this.acceptor = acceptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(ForgeDirection side, double amount) {
|
||||
if (!canReceiveEnergy(side)) return amount;
|
||||
long toTransfer = Math.min(Math.min(toHE(amount), acceptor.getReceiverSpeed()), acceptor.getMaxPower() - acceptor.getPower());
|
||||
long leftover = acceptor.transferPower(toTransfer);
|
||||
return fromHE(toTransfer - leftover);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side) {
|
||||
return acceptor.canConnect(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEnergy() {
|
||||
return fromHE(acceptor.getPower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(double energy) {
|
||||
acceptor.setPower(toHE(energy));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy() {
|
||||
return fromHE(acceptor.getMaxPower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsEnergy(ForgeDirection side) {
|
||||
return canReceiveEnergy(side) && acceptor.getPower() < acceptor.getMaxPower();
|
||||
}
|
||||
|
||||
public long toHE(double joules) {
|
||||
return (long)Math.floor(joules * general.TO_IC2);
|
||||
}
|
||||
|
||||
public double fromHE(long he) {
|
||||
return he * general.FROM_IC2;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package mekanism.common.base;
|
|||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
|
@ -17,11 +19,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
@InterfaceList({
|
||||
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2")
|
||||
, @Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "IC2"),
|
||||
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2")
|
||||
@Interface(iface = "ic2.api.tile.IEnergyStorage", modid = "IC2"),
|
||||
@Interface(iface = "api.hbm.energymk2.IEnergyProviderMK2", modid = "hbm"),
|
||||
@Interface(iface = "api.hbm.energymk2.IEnergyReceiverMK2", modid = "hbm")
|
||||
})
|
||||
public interface IEnergyWrapper
|
||||
extends IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergySource,
|
||||
IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter, IInventory {
|
||||
IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter, IInventory, IEnergyReceiverMK2, IEnergyProviderMK2 {
|
||||
public EnumSet<ForgeDirection> getOutputtingSides();
|
||||
|
||||
public EnumSet<ForgeDirection> getConsumingSides();
|
||||
|
|
|
@ -39,6 +39,7 @@ public final class MekanismHooks {
|
|||
public boolean TELoaded = false;
|
||||
public boolean CCLoaded = false;
|
||||
public boolean AE2Loaded = false;
|
||||
public boolean HBMLoaded = false;
|
||||
|
||||
public void hook() {
|
||||
if (Loader.isModLoaded("CoFHCore"))
|
||||
|
@ -53,6 +54,8 @@ public final class MekanismHooks {
|
|||
CCLoaded = true;
|
||||
if (Loader.isModLoaded("appliedenergistics2"))
|
||||
AE2Loaded = true;
|
||||
if (Loader.isModLoaded("hbm"))
|
||||
HBMLoaded = true;
|
||||
|
||||
if (IC2Loaded) {
|
||||
hookIC2Recipes();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import invtweaks.api.container.ChestContainer;
|
||||
//import invtweaks.api.container.ChestContainer;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.inventory.slot.SlotPersonalChest;
|
||||
import mekanism.common.tile.TileEntityPersonalChest;
|
||||
|
@ -11,7 +11,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@ChestContainer(isLargeChest = true)
|
||||
//@ChestContainer(isLargeChest = true)
|
||||
public class ContainerPersonalChest extends Container {
|
||||
private TileEntityPersonalChest tileEntity;
|
||||
private IInventory itemInventory;
|
||||
|
|
|
@ -9,10 +9,12 @@ import codechicken.multipart.MultiPartRegistry;
|
|||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.MultipartGenerator;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.Tier;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MultipartMekanism implements IPartFactory {
|
||||
|
@ -72,6 +74,9 @@ public class MultipartMekanism implements IPartFactory {
|
|||
"mekanism.common.base.ITileNetwork"
|
||||
);
|
||||
MultipartGenerator.registerPassThroughInterface("cofh.api.energy.IEnergyHandler");
|
||||
if (Loader.isModLoaded("hbm")) {
|
||||
MultipartGenerator.registerPassThroughInterface("api.hbm.energymk2.IEnergyReceiverMK2");
|
||||
}
|
||||
|
||||
registerMicroMaterials();
|
||||
}
|
||||
|
|
|
@ -3,11 +3,16 @@ package mekanism.common.multipart;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cpw.mods.fml.common.Optional.Interface;
|
||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
|
@ -32,9 +37,12 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@InterfaceList({
|
||||
@Interface(iface = "api.hbm.energymk2.IEnergyReceiverMK2", modid = "hbm")
|
||||
})
|
||||
public class PartUniversalCable
|
||||
extends PartTransmitter<EnergyAcceptorWrapper, EnergyNetwork>
|
||||
implements IStrictEnergyAcceptor, IEnergyHandler {
|
||||
implements IStrictEnergyAcceptor, IEnergyHandler, IEnergyReceiverMK2 {
|
||||
public Tier.CableTier tier;
|
||||
|
||||
public static TransmitterIcons cableIcons = new TransmitterIcons(4, 8);
|
||||
|
@ -44,6 +52,8 @@ public class PartUniversalCable
|
|||
|
||||
public EnergyStack buffer = new EnergyStack(0);
|
||||
|
||||
public boolean isLoaded = false;
|
||||
|
||||
public PartUniversalCable(Tier.CableTier cableTier) {
|
||||
super();
|
||||
tier = cableTier;
|
||||
|
@ -61,6 +71,10 @@ public class PartUniversalCable
|
|||
}
|
||||
} else {
|
||||
updateShare();
|
||||
isLoaded = true;
|
||||
if (MekanismUtils.useHBM()) {
|
||||
receiveHe();
|
||||
}
|
||||
|
||||
List<ForgeDirection> sides = getConnections(ConnectionType.PULL);
|
||||
|
||||
|
@ -72,7 +86,6 @@ public class PartUniversalCable
|
|||
for (ForgeDirection side : sides) {
|
||||
if (connectedOutputters[side.ordinal()] != null) {
|
||||
TileEntity outputter = connectedOutputters[side.ordinal()];
|
||||
|
||||
if (outputter instanceof ICableOutputter
|
||||
&& outputter instanceof IStrictEnergyStorage) {
|
||||
if (((ICableOutputter) outputter)
|
||||
|
@ -128,6 +141,14 @@ public class PartUniversalCable
|
|||
|
||||
((IEnergySource) CableUtils.getIC2Tile(outputter))
|
||||
.drawEnergy(toDraw * general.TO_IC2);
|
||||
} else if (MekanismUtils.useHBM() && outputter instanceof IEnergyProviderMK2) {
|
||||
IEnergyProviderMK2 tile = (IEnergyProviderMK2) outputter;
|
||||
double received = Math.min(Math.min(tile.getPower(), tile.getProviderSpeed()) * general.FROM_IC2, canDraw);
|
||||
double toDraw = received;
|
||||
if (received > 0) {
|
||||
toDraw -= takeEnergy(received, true);
|
||||
}
|
||||
tile.usePower((long)(toDraw * general.TO_IC2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,9 +277,16 @@ public class PartUniversalCable
|
|||
@Override
|
||||
public void onChunkUnload() {
|
||||
takeShare();
|
||||
isLoaded = false;
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved() {
|
||||
isLoaded = false;
|
||||
super.onRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBuffer() {
|
||||
return buffer;
|
||||
|
@ -408,4 +436,41 @@ public class PartUniversalCable
|
|||
|
||||
super.writeDesc(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getPower() {
|
||||
return Math.round(getEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public void setPower(long power) {
|
||||
setEnergy(power * general.FROM_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getMaxPower() {
|
||||
return Math.round(getMaxEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Method(modid = "hbm")
|
||||
public void receiveHe() {
|
||||
for (ForgeDirection dir : getConnections(ConnectionType.NORMAL))
|
||||
this.trySubscribe(
|
||||
world(),
|
||||
x() + dir.offsetX,
|
||||
y() + dir.offsetY,
|
||||
z() + dir.offsetZ,
|
||||
dir
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public boolean isLoaded() {
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
dataStream.writeDouble(general.minerSilkMultiplier);
|
||||
dataStream.writeBoolean(general.blacklistIC2);
|
||||
dataStream.writeBoolean(general.blacklistRF);
|
||||
dataStream.writeBoolean(general.blacklistHBM);
|
||||
dataStream.writeDouble(general.armoredJetpackDamageRatio);
|
||||
dataStream.writeInt(general.armoredJetpackDamageMax);
|
||||
dataStream.writeBoolean(general.aestheticWorldDamage);
|
||||
|
@ -141,6 +142,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
general.minerSilkMultiplier = dataStream.readDouble();
|
||||
general.blacklistIC2 = dataStream.readBoolean();
|
||||
general.blacklistRF = dataStream.readBoolean();
|
||||
general.blacklistHBM = dataStream.readBoolean();
|
||||
general.armoredJetpackDamageRatio = dataStream.readDouble();
|
||||
general.armoredJetpackDamageMax = dataStream.readInt();
|
||||
general.aestheticWorldDamage = dataStream.readBoolean();
|
||||
|
|
|
@ -34,6 +34,8 @@ public abstract class TileEntityElectricBlock
|
|||
/** Is this registered with IC2 */
|
||||
public boolean ic2Registered = false;
|
||||
|
||||
public boolean isLoaded = false;
|
||||
|
||||
/**
|
||||
* The base of all blocks that deal with electricity. It has a facing state,
|
||||
* initialized state, and a current amount of stored energy.
|
||||
|
@ -82,6 +84,10 @@ public abstract class TileEntityElectricBlock
|
|||
if (!ic2Registered && MekanismUtils.useIC2()) {
|
||||
register();
|
||||
}
|
||||
if (MekanismUtils.useHBM()) {
|
||||
receiveHe();
|
||||
}
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,12 +153,14 @@ public abstract class TileEntityElectricBlock
|
|||
if (MekanismUtils.useIC2()) {
|
||||
deregister();
|
||||
}
|
||||
isLoaded = false;
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
isLoaded = false;
|
||||
if (MekanismUtils.useIC2()) {
|
||||
deregister();
|
||||
}
|
||||
|
@ -349,4 +357,55 @@ public abstract class TileEntityElectricBlock
|
|||
|
||||
return toUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getPower() {
|
||||
return Math.round(getEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public void setPower(long power) {
|
||||
setEnergy(power * general.FROM_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getMaxPower() {
|
||||
return Math.round(getMaxEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getProviderSpeed() {
|
||||
return Math.round(getMaxOutput() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Method(modid = "hbm")
|
||||
public void receiveHe() {
|
||||
if (!worldObj.isRemote) {
|
||||
for (ForgeDirection dir : getConsumingSides())
|
||||
this.trySubscribe(
|
||||
worldObj,
|
||||
xCoord + dir.offsetX,
|
||||
yCoord + dir.offsetY,
|
||||
zCoord + dir.offsetZ,
|
||||
dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public boolean isLoaded() {
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public boolean canConnect(ForgeDirection from) {
|
||||
return getConsumingSides().contains(from) || getOutputtingSides().contains(from);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
|
||||
@InterfaceList({
|
||||
@Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2")
|
||||
|
@ -41,6 +40,7 @@ import universalelectricity.core.electricity.ElectricityPack;
|
|||
public class TileEntityInductionPort extends TileEntityInductionCasing
|
||||
implements IEnergyWrapper, IConfigurable, IActiveState {
|
||||
public boolean ic2Registered = false;
|
||||
public boolean isLoaded = false;
|
||||
|
||||
/** false = input, true = output */
|
||||
public boolean mode;
|
||||
|
@ -56,6 +56,10 @@ public class TileEntityInductionPort extends TileEntityInductionCasing
|
|||
if (!ic2Registered && MekanismUtils.useIC2()) {
|
||||
register();
|
||||
}
|
||||
if (MekanismUtils.useHBM()) {
|
||||
receiveHe();
|
||||
}
|
||||
isLoaded = true;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (structure != null && mode == true) {
|
||||
|
@ -169,14 +173,14 @@ public class TileEntityInductionPort extends TileEntityInductionCasing
|
|||
if (MekanismUtils.useIC2()) {
|
||||
deregister();
|
||||
}
|
||||
|
||||
isLoaded = false;
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
isLoaded = false;
|
||||
if (MekanismUtils.useIC2()) {
|
||||
deregister();
|
||||
}
|
||||
|
@ -428,4 +432,48 @@ public class TileEntityInductionPort extends TileEntityInductionCasing
|
|||
public boolean lightUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getPower() {
|
||||
return Math.round(getEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public void setPower(long power) {
|
||||
setEnergy(power * general.FROM_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getMaxPower() {
|
||||
return Math.round(getMaxEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getProviderSpeed() {
|
||||
return Math.round(getMaxOutput() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Method(modid = "hbm")
|
||||
public void receiveHe() {
|
||||
if (!worldObj.isRemote) {
|
||||
for (ForgeDirection dir : getConsumingSides())
|
||||
this.trySubscribe(
|
||||
worldObj,
|
||||
xCoord + dir.offsetX,
|
||||
yCoord + dir.offsetY,
|
||||
zCoord + dir.offsetZ,
|
||||
dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public boolean isLoaded() {
|
||||
return isLoaded;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import api.hbm.energymk2.IEnergyConnectorMK2;
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
|
@ -27,6 +30,7 @@ public final class CableUtils {
|
|||
tileEntity instanceof IStrictEnergyAcceptor
|
||||
|| (MekanismUtils.useIC2() && getIC2Tile(tileEntity) instanceof IEnergySink)
|
||||
|| (MekanismUtils.useRF() && tileEntity instanceof IEnergyReceiver)
|
||||
|| (MekanismUtils.useHBM() && tileEntity instanceof IEnergyReceiverMK2)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -112,7 +116,9 @@ public final class CableUtils {
|
|||
&& ((IEnergySource) getIC2Tile(tileEntity))
|
||||
.emitsEnergyTo(null, side.getOpposite()))
|
||||
|| (MekanismUtils.useRF() && tileEntity instanceof IEnergyProvider
|
||||
&& ((IEnergyConnection) tileEntity).canConnectEnergy(side.getOpposite()));
|
||||
&& ((IEnergyConnection) tileEntity).canConnectEnergy(side.getOpposite()))
|
||||
|| (MekanismUtils.useHBM() && tileEntity instanceof IEnergyProviderMK2
|
||||
&& ((IEnergyConnectorMK2) tileEntity).canConnect(side.getOpposite()));
|
||||
}
|
||||
|
||||
public static boolean
|
||||
|
@ -139,6 +145,10 @@ public final class CableUtils {
|
|||
if (((IEnergyConnection) tileEntity).canConnectEnergy(side.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
} else if (MekanismUtils.useHBM() && tileEntity instanceof IEnergyConnectorMK2) {
|
||||
if (((IEnergyConnectorMK2) tileEntity).canConnect(side.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -158,6 +168,15 @@ public final class CableUtils {
|
|||
if (connectable[side.ordinal()]) {
|
||||
outputtingSides.add(side);
|
||||
}
|
||||
if (MekanismUtils.useHBM()) {
|
||||
emitter.tryProvide(
|
||||
((TileEntity)emitter).getWorldObj(),
|
||||
((TileEntity)emitter).xCoord + side.offsetX,
|
||||
((TileEntity)emitter).yCoord + side.offsetY,
|
||||
((TileEntity)emitter).zCoord + side.offsetZ,
|
||||
side
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (outputtingSides.size() > 0) {
|
||||
|
|
|
@ -1208,6 +1208,10 @@ public final class MekanismUtils {
|
|||
return !general.blacklistRF;
|
||||
}
|
||||
|
||||
public static boolean useHBM() {
|
||||
return Mekanism.hooks.HBMLoaded && !general.blacklistHBM;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a clean view of a coordinate value without the dimension ID.
|
||||
* @param obj - coordinate to check
|
||||
|
|
|
@ -36,6 +36,7 @@ import net.minecraftforge.fluids.IFluidHandler;
|
|||
public class TileEntityTurbineValve
|
||||
extends TileEntityTurbineCasing implements IFluidHandler, IEnergyWrapper {
|
||||
public boolean ic2Registered = false;
|
||||
public boolean isLoaded = false;
|
||||
|
||||
public TurbineFluidTank fluidTank;
|
||||
|
||||
|
@ -51,6 +52,10 @@ public class TileEntityTurbineValve
|
|||
if (!ic2Registered && MekanismUtils.useIC2()) {
|
||||
register();
|
||||
}
|
||||
if (MekanismUtils.useHBM()) {
|
||||
receiveHe();
|
||||
}
|
||||
isLoaded = true;
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
if (structure != null) {
|
||||
|
@ -138,14 +143,14 @@ public class TileEntityTurbineValve
|
|||
if (MekanismUtils.useIC2()) {
|
||||
deregister();
|
||||
}
|
||||
|
||||
isLoaded = false;
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
|
||||
isLoaded = false;
|
||||
if (MekanismUtils.useIC2()) {
|
||||
deregister();
|
||||
}
|
||||
|
@ -356,4 +361,48 @@ public class TileEntityTurbineValve
|
|||
public String getInventoryName() {
|
||||
return LangUtils.localize("gui.industrialTurbine");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getPower() {
|
||||
return Math.round(getEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public void setPower(long power) {
|
||||
setEnergy(power * general.FROM_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getMaxPower() {
|
||||
return Math.round(getMaxEnergy() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public long getProviderSpeed() {
|
||||
return Math.round(getMaxOutput() * general.TO_IC2);
|
||||
}
|
||||
|
||||
@Method(modid = "hbm")
|
||||
public void receiveHe() {
|
||||
if (!worldObj.isRemote) {
|
||||
for (ForgeDirection dir : getConsumingSides())
|
||||
this.trySubscribe(
|
||||
worldObj,
|
||||
xCoord + dir.offsetX,
|
||||
yCoord + dir.offsetY,
|
||||
zCoord + dir.offsetZ,
|
||||
dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "hbm")
|
||||
public boolean isLoaded() {
|
||||
return isLoaded;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue