mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Move IC2 refrences indo IndustrialcraftUnloadHelper
This commit is contained in:
1 parent
b19b5fabcf
commit
b7b64aebf6
2 files changed
+28
-16
No files matched your search
+8
-16
@@ -43,6 +43,7 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
import thaumic.tinkerer.common.compat.IndustrialcraftUnloadHelper;
|
||||
import thaumic.tinkerer.common.lib.LibFeatures;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft"),
|
||||
@@ -53,7 +54,7 @@ import thaumic.tinkerer.common.lib.LibFeatures;
|
||||
|
||||
public class TileTransvectorInterface extends TileTransvector implements ISidedInventory, IEnergySink, IFluidHandler, IPowerReceptor, IEnergyHandler, IAspectContainer, IEssentiaTransport, IPeripheral {
|
||||
|
||||
private boolean addedToICEnergyNet = false;
|
||||
public boolean addedToICEnergyNet = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
@@ -74,29 +75,20 @@ public class TileTransvectorInterface extends TileTransvector implements ISidedI
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
//if (Loader.isModLoaded("IC2")) {
|
||||
// removeFromIC2EnergyNet();
|
||||
//}
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
IndustrialcraftUnloadHelper.removeFromIC2EnergyNet(this);
|
||||
}
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
|
||||
//if (Loader.isModLoaded("IC2")) {
|
||||
// removeFromIC2EnergyNet();
|
||||
//}
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
IndustrialcraftUnloadHelper.removeFromIC2EnergyNet(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//@Optional.Method(modid = "IC2")
|
||||
//private void removeFromIC2EnergyNet() {
|
||||
// if(addedToICEnergyNet && !worldObj.isRemote) {
|
||||
// MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergySink) this));
|
||||
// addedToICEnergyNet = false;
|
||||
// }
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package thaumic.tinkerer.common.compat;
|
||||
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import thaumic.tinkerer.common.block.tile.transvector.TileTransvectorInterface;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 8/26/14.
|
||||
*/
|
||||
public class IndustrialcraftUnloadHelper {
|
||||
|
||||
public static void removeFromIC2EnergyNet(TileTransvectorInterface tileEntity) {
|
||||
if ((tileEntity.addedToICEnergyNet && !tileEntity.getWorldObj().isRemote)) {
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent((IEnergySink) tileEntity));
|
||||
tileEntity.addedToICEnergyNet = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user