Fixed IC2 dependency in Reactor laser focus & Ship scanner

This commit is contained in:
LemADEC 2015-08-08 14:39:45 +02:00
parent 1467544a48
commit 4a0b26c356
2 changed files with 21 additions and 12 deletions

View file

@ -1,5 +1,6 @@
package cr0s.warpdrive.item; package cr0s.warpdrive.item;
import cpw.mods.fml.common.Optional;
import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorComponent; import ic2.api.reactor.IReactorComponent;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -7,6 +8,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
@Optional.InterfaceList({
@Optional.Interface(iface = "ic2.api.reactor.IReactorComponent", modid = "IC2API")
})
public class ItemReactorLaserFocus extends Item implements IReactorComponent public class ItemReactorLaserFocus extends Item implements IReactorComponent
{ {
private final static int maxHeat = 3000; private final static int maxHeat = 3000;
@ -44,6 +48,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
other.setItemDamage(newOne); other.setItemDamage(newOne);
} }
@Optional.Method(modid = "IC2")
private static void coolComponent(ItemStack self, IReactorComponent comp, IReactor reactor, ItemStack stack, int x, int y) private static void coolComponent(ItemStack self, IReactorComponent comp, IReactor reactor, ItemStack stack, int x, int y)
{ {
int maxTransfer = maxHeat - self.getItemDamage(); int maxTransfer = maxHeat - self.getItemDamage();
@ -53,7 +58,8 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
damageComponent(self,retained - transferHeat); damageComponent(self,retained - transferHeat);
} }
private static void coolReactor(IReactor reactor,ItemStack stack) @Optional.Method(modid = "IC2")
private static void coolReactor(IReactor reactor, ItemStack stack)
{ {
int reactorHeat = reactor.getHeat(); int reactorHeat = reactor.getHeat();
int myHeat = stack.getItemDamage(); int myHeat = stack.getItemDamage();
@ -63,6 +69,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
} }
@Override @Override
@Optional.Method(modid = "IC2")
public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun) public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun)
{ {
if(heatrun) if(heatrun)
@ -89,6 +96,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
} }
@Override @Override
@Optional.Method(modid = "IC2")
public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack,ItemStack pulsingStack, public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack,ItemStack pulsingStack,
int youX, int youY, int pulseX, int pulseY, boolean heatrun) int youX, int youY, int pulseX, int pulseY, boolean heatrun)
{ {
@ -96,24 +104,28 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
} }
@Override @Override
@Optional.Method(modid = "IC2")
public boolean canStoreHeat(IReactor reactor, ItemStack yourStack, int x, int y) public boolean canStoreHeat(IReactor reactor, ItemStack yourStack, int x, int y)
{ {
return true; return true;
} }
@Override @Override
@Optional.Method(modid = "IC2")
public int getMaxHeat(IReactor reactor, ItemStack yourStack, int x, int y) public int getMaxHeat(IReactor reactor, ItemStack yourStack, int x, int y)
{ {
return maxHeat; return maxHeat;
} }
@Override @Override
@Optional.Method(modid = "IC2")
public int getCurrentHeat(IReactor reactor, ItemStack yourStack, int x, int y) public int getCurrentHeat(IReactor reactor, ItemStack yourStack, int x, int y)
{ {
return yourStack.getItemDamage(); return yourStack.getItemDamage();
} }
@Override @Override
@Optional.Method(modid = "IC2")
public int alterHeat(IReactor reactor, ItemStack yourStack, int x, int y, int heat) public int alterHeat(IReactor reactor, ItemStack yourStack, int x, int y, int heat)
{ {
//WarpDrive.debugPrint("ReactorLaserAlter:" + heat); //WarpDrive.debugPrint("ReactorLaserAlter:" + heat);
@ -123,6 +135,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
} }
@Override @Override
@Optional.Method(modid = "IC2")
public float influenceExplosion(IReactor reactor, ItemStack yourStack) public float influenceExplosion(IReactor reactor, ItemStack yourStack)
{ {
return 0; return 0;

View file

@ -1,7 +1,5 @@
package cr0s.warpdrive.machines; package cr0s.warpdrive.machines;
import ic2.api.energy.tile.IEnergyTile;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -285,15 +283,13 @@ public class TileEntityShipScanner extends WarpEnergyTE {
} }
// Remove energy from energy storages // Remove energy from energy storages
if (te instanceof IEnergyTile) { // IC2
// IC2 if (tileTag.hasKey("energy")) {
if (tileTag.hasKey("energy")) { tileTag.setInteger("energy", 0);
tileTag.setInteger("energy", 0); }
} // Gregtech
// Gregtech if (tileTag.hasKey("mStoredEnergy")) {
if (tileTag.hasKey("mStoredEnergy")) { tileTag.setInteger("mStoredEnergy", 0);
tileTag.setInteger("mStoredEnergy", 0);
}
} }
// Transform TE's coordinates from local axis to // Transform TE's coordinates from local axis to