diff --git a/core/AEConfig.java b/core/AEConfig.java index 49007049..8b56b001 100644 --- a/core/AEConfig.java +++ b/core/AEConfig.java @@ -25,7 +25,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo public static AEConfig instance; - public static float TunnelPowerLoss = 0.05f; + public static double TunnelPowerLoss = 0.05; public String latestVersion = VERSION; public long latestTimeStamp = 0; @@ -267,7 +267,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo min = Math.max( min, thisInt + 1 ); } - + if ( alreadyUsed ) { if ( min < 16383 ) diff --git a/core/features/registries/P2PTunnelRegistry.java b/core/features/registries/P2PTunnelRegistry.java index 273ef0d7..70a31b8b 100644 --- a/core/features/registries/P2PTunnelRegistry.java +++ b/core/features/registries/P2PTunnelRegistry.java @@ -80,16 +80,19 @@ public class P2PTunnelRegistry implements IP2PTunnelRegistry @Override public TunnelType getTunnelTypeByItem(ItemStack trigger) { - if ( FluidContainerRegistry.isContainer( trigger ) ) - return TunnelType.FLUID; - - for (ItemStack is : Tunnels.keySet()) + if ( trigger != null ) { - if ( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) - return Tunnels.get( is ); + if ( FluidContainerRegistry.isContainer( trigger ) ) + return TunnelType.FLUID; - if ( Platform.isSameItem( is, trigger ) ) - return Tunnels.get( is ); + for (ItemStack is : Tunnels.keySet()) + { + if ( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) + return Tunnels.get( is ); + + if ( Platform.isSameItem( is, trigger ) ) + return Tunnels.get( is ); + } } return null; diff --git a/parts/p2p/PartP2PBCPower.java b/parts/p2p/PartP2PBCPower.java index 31ddc908..fd5db110 100644 --- a/parts/p2p/PartP2PBCPower.java +++ b/parts/p2p/PartP2PBCPower.java @@ -13,7 +13,6 @@ import appeng.api.networking.IGridNode; import appeng.api.networking.ticking.IGridTickable; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.networking.ticking.TickingRequest; -import appeng.core.AEConfig; import appeng.core.AppEng; import appeng.core.settings.TickRates; import appeng.me.GridAccessException; @@ -115,7 +114,7 @@ public class PartP2PBCPower extends PartP2PTunnel implements IPo { double toPull = currentTotal * (howmuch / totalRequiredPower); double pulled = pp.useEnergy( 0, toPull, true ); - QueueTunnelDrain( PowerUnits.MJ, pulled * AEConfig.TunnelPowerLoss ); + QueueTunnelDrain( PowerUnits.MJ, pulled ); tp.receiveEnergy( Type.PIPE, pulled, o.side.getOpposite() ); } diff --git a/parts/p2p/PartP2PIC2Power.java b/parts/p2p/PartP2PIC2Power.java index 578b7d8d..69f42bfa 100644 --- a/parts/p2p/PartP2PIC2Power.java +++ b/parts/p2p/PartP2PIC2Power.java @@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.config.PowerUnits; import appeng.api.config.TunnelType; import appeng.core.AppEng; import appeng.me.GridAccessException; @@ -143,6 +144,7 @@ public class PartP2PIC2Power extends PartP2PTunnel implements i PartP2PIC2Power x = (PartP2PIC2Power) Platform.pickRandom( Options ); if ( x != null && x.OutputPacket <= 0.001 ) { + QueueTunnelDrain( PowerUnits.EU, amount ); x.OutputPacket = amount; return 0; } diff --git a/parts/p2p/PartP2PRFPower.java b/parts/p2p/PartP2PRFPower.java index f154a660..bd792264 100644 --- a/parts/p2p/PartP2PRFPower.java +++ b/parts/p2p/PartP2PRFPower.java @@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; +import appeng.api.config.PowerUnits; import appeng.api.config.TunnelType; import appeng.core.AppEng; import appeng.integration.modules.helpers.NullRFHandler; @@ -133,6 +134,8 @@ public class PartP2PRFPower extends PartP2PTunnel implements cof break; } } + + QueueTunnelDrain( PowerUnits.RF, total ); } catch (GridAccessException e) { diff --git a/parts/p2p/PartP2PTunnel.java b/parts/p2p/PartP2PTunnel.java index dc9626b0..65f9732b 100644 --- a/parts/p2p/PartP2PTunnel.java +++ b/parts/p2p/PartP2PTunnel.java @@ -10,6 +10,8 @@ import net.minecraft.util.IIcon; import net.minecraft.util.Vec3; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; +import appeng.api.config.Actionable; +import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerUnits; import appeng.api.config.TunnelType; import appeng.api.implementations.items.IMemoryCard; @@ -20,6 +22,7 @@ import appeng.api.parts.IPartItem; import appeng.api.parts.IPartRenderHelper; import appeng.api.parts.PartItemStack; import appeng.client.texture.CableBusTextures; +import appeng.core.AEConfig; import appeng.me.GridAccessException; import appeng.me.cache.P2PCache; import appeng.me.cache.helpers.TunnelCollection; @@ -321,10 +324,18 @@ public class PartP2PTunnel extends PartBasicState renderLights( x, y, z, rh, renderer ); } - protected void QueueTunnelDrain(PowerUnits mj, double f) + protected void QueueTunnelDrain(PowerUnits unit, double f) { - // TODO Auto-generated method stub + double ae_to_tax = unit.convertTo( PowerUnits.AE, f * AEConfig.TunnelPowerLoss ); + try + { + proxy.getEnergy().extractAEPower( ae_to_tax, Actionable.MODULATE, PowerMultiplier.ONE ); + } + catch (GridAccessException e) + { + // :P + } } @Override