From 4a0b26c35629339a582799881f2db19bac480be7 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Sat, 8 Aug 2015 14:39:45 +0200 Subject: [PATCH] Fixed IC2 dependency in Reactor laser focus & Ship scanner --- .../warpdrive/item/ItemReactorLaserFocus.java | 15 ++++++++++++++- .../machines/TileEntityShipScanner.java | 18 +++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/item/ItemReactorLaserFocus.java b/src/main/java/cr0s/warpdrive/item/ItemReactorLaserFocus.java index 5d281013..8051b050 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemReactorLaserFocus.java +++ b/src/main/java/cr0s/warpdrive/item/ItemReactorLaserFocus.java @@ -1,5 +1,6 @@ package cr0s.warpdrive.item; +import cpw.mods.fml.common.Optional; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; import net.minecraft.client.renderer.texture.IIconRegister; @@ -7,6 +8,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cr0s.warpdrive.WarpDrive; +@Optional.InterfaceList({ + @Optional.Interface(iface = "ic2.api.reactor.IReactorComponent", modid = "IC2API") +}) public class ItemReactorLaserFocus extends Item implements IReactorComponent { private final static int maxHeat = 3000; @@ -44,6 +48,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent other.setItemDamage(newOne); } + @Optional.Method(modid = "IC2") private static void coolComponent(ItemStack self, IReactorComponent comp, IReactor reactor, ItemStack stack, int x, int y) { int maxTransfer = maxHeat - self.getItemDamage(); @@ -53,7 +58,8 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent 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 myHeat = stack.getItemDamage(); @@ -63,6 +69,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent } @Override + @Optional.Method(modid = "IC2") public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun) { if(heatrun) @@ -89,6 +96,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent } @Override + @Optional.Method(modid = "IC2") public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack,ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY, boolean heatrun) { @@ -96,24 +104,28 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent } @Override + @Optional.Method(modid = "IC2") public boolean canStoreHeat(IReactor reactor, ItemStack yourStack, int x, int y) { return true; } @Override + @Optional.Method(modid = "IC2") public int getMaxHeat(IReactor reactor, ItemStack yourStack, int x, int y) { return maxHeat; } @Override + @Optional.Method(modid = "IC2") public int getCurrentHeat(IReactor reactor, ItemStack yourStack, int x, int y) { return yourStack.getItemDamage(); } @Override + @Optional.Method(modid = "IC2") public int alterHeat(IReactor reactor, ItemStack yourStack, int x, int y, int heat) { //WarpDrive.debugPrint("ReactorLaserAlter:" + heat); @@ -123,6 +135,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent } @Override + @Optional.Method(modid = "IC2") public float influenceExplosion(IReactor reactor, ItemStack yourStack) { return 0; diff --git a/src/main/java/cr0s/warpdrive/machines/TileEntityShipScanner.java b/src/main/java/cr0s/warpdrive/machines/TileEntityShipScanner.java index 4dfad79f..4a1666e5 100644 --- a/src/main/java/cr0s/warpdrive/machines/TileEntityShipScanner.java +++ b/src/main/java/cr0s/warpdrive/machines/TileEntityShipScanner.java @@ -1,7 +1,5 @@ package cr0s.warpdrive.machines; -import ic2.api.energy.tile.IEnergyTile; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -285,15 +283,13 @@ public class TileEntityShipScanner extends WarpEnergyTE { } // Remove energy from energy storages - if (te instanceof IEnergyTile) { - // IC2 - if (tileTag.hasKey("energy")) { - tileTag.setInteger("energy", 0); - } - // Gregtech - if (tileTag.hasKey("mStoredEnergy")) { - tileTag.setInteger("mStoredEnergy", 0); - } + // IC2 + if (tileTag.hasKey("energy")) { + tileTag.setInteger("energy", 0); + } + // Gregtech + if (tileTag.hasKey("mStoredEnergy")) { + tileTag.setInteger("mStoredEnergy", 0); } // Transform TE's coordinates from local axis to