diff --git a/build.gradle b/build.gradle index 4bcca0da..63131d96 100644 --- a/build.gradle +++ b/build.gradle @@ -45,11 +45,7 @@ buildscript { } } -configurations.all { - resolutionStrategy.cacheDynamicVersionsFor 7200, 'hours' -} - -sourceCompatibility = JavaVersion.VERSION_1_6 +sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_6 version = aeversion + "-" + aechannel + "-" + aebuild @@ -87,6 +83,8 @@ minecraft { // used when launching minecraft in dev env runDir = "run" + + mappings = "snapshot_20141130" } sourceSets { @@ -94,6 +92,10 @@ sourceSets { java { srcDirs += 'src/api/java' srcDirs += 'src/main/java/' + + // excludes integration due to not being available upon port + exclude 'appeng/integration/**' + exclude 'appeng/fmp/**' } resources { diff --git a/gradle.properties b/gradle.properties index b1a65e45..c84203c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -aeversion=rv2 -aechannel=stable +aeversion=rv4 +aechannel=alpha aebuild=0 aegroup=appeng aebasename=appliedenergistics2 @@ -7,8 +7,8 @@ aebasename=appliedenergistics2 ######################################################### # Versions # ######################################################### -minecraft_version=1.7.10 -forge_version=10.13.2.1291 +minecraft_version=1.8 +forge_version=11.14.3.1450 ######################################################### # Installable # diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle index 974276ad..ef67a729 100644 --- a/gradle/scripts/dependencies.gradle +++ b/gradle/scripts/dependencies.gradle @@ -83,45 +83,45 @@ configurations { dependencies { // installable - mods "mcp.mobius.waila:Waila:${waila_version}_${minecraft_version}:dev" - mods "mcp.mobius.jabba:Jabba:${jabba_version}_${minecraft_version}:dev" - mods "codechicken:EnderStorage:${minecraft_version}-${enderstorage_version}:dev" - mods "codechicken:Translocator:${minecraft_version}-${translocator_version}:dev" - mods "net.industrial-craft:industrialcraft-2:${ic2_version}-experimental:dev" - mods "com.enderio:EnderIO:${minecraft_version}-${enderio_version}:dev" - mods "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:deobf" - mods "inventorytweaks:InventoryTweaks:${invtweaks_version}:deobf" - mods "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:dev" +// mods "mcp.mobius.waila:Waila:${waila_version}_${minecraft_version}:dev" +// mods "mcp.mobius.jabba:Jabba:${jabba_version}_${minecraft_version}:dev" +// mods "codechicken:EnderStorage:${minecraft_version}-${enderstorage_version}:dev" +// mods "codechicken:Translocator:${minecraft_version}-${translocator_version}:dev" +// mods "net.industrial-craft:industrialcraft-2:${ic2_version}-experimental:dev" +// mods "com.enderio:EnderIO:${minecraft_version}-${enderio_version}:dev" +// mods "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:deobf" +// mods "inventorytweaks:InventoryTweaks:${invtweaks_version}:deobf" +// mods "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:dev" // mods name: 'CoFHLib', version: "[${minecraft_version}]${cofhlib_version}-dev", ext: 'jar' // mods name: 'CoFHCore', version: "[${minecraft_version}]${cofhcore_version}-dev", ext: 'jar' // mods name: 'ThermalExpansion', version: "[${minecraft_version}]${texpansion_version}-dev", ext: 'jar' // mods name: 'ThermalFoundation', version: "[${minecraft_version}]${tfoundation_version}-dev", ext: 'jar' - compile "codechicken:ForgeMultipart:${minecraft_version}-${fmp_version}:dev" - compile "codechicken:CodeChickenLib:${minecraft_version}-${code_chicken_lib_version}:dev" - compile "codechicken:CodeChickenCore:${minecraft_version}-${code_chicken_core_version}:dev" - compile "codechicken:NotEnoughItems:${minecraft_version}-${nei_version}:dev" - compile "com.mod-buildcraft:buildcraft:${bc_version}:dev" +// compile "codechicken:ForgeMultipart:${minecraft_version}-${fmp_version}:dev" +// compile "codechicken:CodeChickenLib:${minecraft_version}-${code_chicken_lib_version}:dev" +// compile "codechicken:CodeChickenCore:${minecraft_version}-${code_chicken_core_version}:dev" +// compile "codechicken:NotEnoughItems:${minecraft_version}-${nei_version}:dev" +// compile "com.mod-buildcraft:buildcraft:${bc_version}:dev" // provided APIs - compile "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:api" - compile "net.industrial-craft:industrialcraft-2:${ic2_version}-experimental:api" - compile "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:api" +// compile "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:api" +// compile "net.industrial-craft:industrialcraft-2:${ic2_version}-experimental:api" +// compile "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:api" // self compiled APIs - compile "appeng:Waila:${waila_version}_${minecraft_version}:api" - compile "appeng:RotaryCraft:${rotarycraft_version}:api" - compile "appeng:mekanism:${minecraft_version}-${mekansim_version}:api" - compile "appeng:InventoryTweaks:${invtweaks_version}:api" +// compile "appeng:Waila:${waila_version}_${minecraft_version}:api" +// compile "appeng:RotaryCraft:${rotarycraft_version}:api" +// compile "appeng:mekanism:${minecraft_version}-${mekansim_version}:api" +// compile "appeng:InventoryTweaks:${invtweaks_version}:api" // self compiled stubs - compile(group: 'api', name: 'coloredlightscore', version: "${api_coloredlightscore_version}") - compile(group: 'api', name: 'craftguide', version: "${api_craftguide_version}") - compile(group: 'api', name: 'immibis', version: "${api_immibis_version}") - compile(group: 'api', name: 'mfr', version: "${api_mfr_version}") - compile(group: 'api', name: 'railcraft', version: "${api_railcraft_version}") - compile(group: 'api', name: 'rf', version: "${api_rf_version}") +// compile(group: 'api', name: 'coloredlightscore', version: "${api_coloredlightscore_version}") +// compile(group: 'api', name: 'craftguide', version: "${api_craftguide_version}") +// compile(group: 'api', name: 'immibis', version: "${api_immibis_version}") +// compile(group: 'api', name: 'mfr', version: "${api_mfr_version}") +// compile(group: 'api', name: 'railcraft', version: "${api_railcraft_version}") +// compile(group: 'api', name: 'rf', version: "${api_rf_version}") testCompile "junit:junit:4.11" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e41395e9..9bc3894c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat May 16 13:19:14 CEST 2015 +#Wed Jun 17 12:06:23 CEST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/src/main/java/appeng/items/tools/powered/powersink/IC2.java b/src/main/java/appeng/items/tools/powered/powersink/IC2.java index 0883d08d..1d12917f 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/IC2.java +++ b/src/main/java/appeng/items/tools/powered/powersink/IC2.java @@ -19,125 +19,110 @@ package appeng.items.tools.powered.powersink; -import com.google.common.base.Optional; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; - -import appeng.api.config.PowerUnits; -import appeng.transformer.annotations.Integration.Interface; -import appeng.transformer.annotations.Integration.InterfaceList; -import appeng.transformer.annotations.Integration.Method; - - -@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } ) -public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem -{ - public IC2( double powerCapacity, Optional subName ) - { - super( powerCapacity, subName ); - } - - @Override - public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate ) - { - double addedAmt = amount; - double limit = this.getTransferLimit( is ); - - if( !ignoreTransferLimit && amount > limit ) - { - addedAmt = limit; - } - - return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) ); - } - - @Override - public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate ) - { - return 0; - } - - @Override - public double getCharge( ItemStack is ) - { - return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) ); - } - - @Override - public boolean canUse( ItemStack is, double amount ) - { - return this.getCharge( is ) > amount; - } - - @Override - public boolean use( ItemStack is, double amount, EntityLivingBase entity ) - { - if( this.canUse( is, amount ) ) - { - // use the power.. - this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) ); - return true; - } - return false; - } - - @Override - public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity ) - { - // wtf? - } - - @Override - public String getToolTip( ItemStack itemStack ) - { - return null; - } - - @Override - public boolean canProvideEnergy( ItemStack itemStack ) - { - return false; - } - - @Override - public Item getChargedItem( ItemStack itemStack ) - { - return itemStack.getItem(); - } - - @Override - public Item getEmptyItem( ItemStack itemStack ) - { - return itemStack.getItem(); - } - - @Override - public double getMaxCharge( ItemStack itemStack ) - { - return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) ); - } - - @Override - public int getTier( ItemStack itemStack ) - { - return 1; - } - - @Override - public double getTransferLimit( ItemStack itemStack ) - { - return Math.max( 32, this.getMaxCharge( itemStack ) / 200 ); - } - - @Override - @Method( iname = "IC2" ) - public IElectricItemManager getManager( ItemStack itemStack ) - { - return this; - } -} +//@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } ) +//public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem +//{ +// public IC2( double powerCapacity, Optional subName ) +// { +// super( powerCapacity, subName ); +// } +// +// @Override +// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate ) +// { +// double addedAmt = amount; +// double limit = this.getTransferLimit( is ); +// +// if( !ignoreTransferLimit && amount > limit ) +// { +// addedAmt = limit; +// } +// +// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) ); +// } +// +// @Override +// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate ) +// { +// return 0; +// } +// +// @Override +// public double getCharge( ItemStack is ) +// { +// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) ); +// } +// +// @Override +// public boolean canUse( ItemStack is, double amount ) +// { +// return this.getCharge( is ) > amount; +// } +// +// @Override +// public boolean use( ItemStack is, double amount, EntityLivingBase entity ) +// { +// if( this.canUse( is, amount ) ) +// { +// // use the power.. +// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) ); +// return true; +// } +// return false; +// } +// +// @Override +// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity ) +// { +// // wtf? +// } +// +// @Override +// public String getToolTip( ItemStack itemStack ) +// { +// return null; +// } +// +// @Override +// public boolean canProvideEnergy( ItemStack itemStack ) +// { +// return false; +// } +// +// @Override +// public Item getChargedItem( ItemStack itemStack ) +// { +// return itemStack.getItem(); +// } +// +// @Override +// public Item getEmptyItem( ItemStack itemStack ) +// { +// return itemStack.getItem(); +// } +// +// @Override +// public double getMaxCharge( ItemStack itemStack ) +// { +// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) ); +// } +// +// @Override +// public int getTier( ItemStack itemStack ) +// { +// return 1; +// } +// +// @Override +// public double getTransferLimit( ItemStack itemStack ) +// { +// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 ); +// } +// +// @Override +// @Method( iname = "IC2" ) +// public IElectricItemManager getManager( ItemStack itemStack ) +// { +// return this; +// } +//} diff --git a/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java b/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java index 1c0dbccd..ed3b6f81 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java +++ b/src/main/java/appeng/items/tools/powered/powersink/RedstoneFlux.java @@ -19,45 +19,35 @@ package appeng.items.tools.powered.powersink; -import com.google.common.base.Optional; - -import net.minecraft.item.ItemStack; - -import cofh.api.energy.IEnergyContainerItem; - -import appeng.api.config.PowerUnits; -import appeng.transformer.annotations.Integration.Interface; - - -@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = "RFItem" ) -public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem -{ - public RedstoneFlux( double powerCapacity, Optional subName ) - { - super( powerCapacity, subName ); - } - - @Override - public int receiveEnergy( ItemStack is, int maxReceive, boolean simulate ) - { - return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate ); - } - - @Override - public int extractEnergy( ItemStack container, int maxExtract, boolean simulate ) - { - return 0; - } - - @Override - public int getEnergyStored( ItemStack is ) - { - return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) ); - } - - @Override - public int getMaxEnergyStored( ItemStack is ) - { - return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) ); - } -} +//@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = "RFItem" ) +//public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem +//{ +// public RedstoneFlux( double powerCapacity, Optional subName ) +// { +// super( powerCapacity, subName ); +// } +// +// @Override +// public int receiveEnergy( ItemStack is, int maxReceive, boolean simulate ) +// { +// return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate ); +// } +// +// @Override +// public int extractEnergy( ItemStack container, int maxExtract, boolean simulate ) +// { +// return 0; +// } +// +// @Override +// public int getEnergyStored( ItemStack is ) +// { +// return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) ); +// } +// +// @Override +// public int getMaxEnergyStored( ItemStack is ) +// { +// return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) ); +// } +//} diff --git a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java index c82663a5..a7b71163 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java +++ b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java @@ -19,244 +19,226 @@ package appeng.parts.p2p; -import java.util.LinkedList; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import appeng.api.config.PowerUnits; -import appeng.api.util.ForgeDirection; -import appeng.me.GridAccessException; -import appeng.me.cache.helpers.TunnelCollection; -import appeng.transformer.annotations.Integration.Interface; -import appeng.transformer.annotations.Integration.InterfaceList; -import appeng.util.Platform; - - -@InterfaceList( value = { @Interface( iface = "ic2.api.energy.tile.IEnergySink", iname = "IC2" ), @Interface( iface = "ic2.api.energy.tile.IEnergySource", iname = "IC2" ) } ) -public class PartP2PIC2Power extends PartP2PTunnel implements ic2.api.energy.tile.IEnergySink, ic2.api.energy.tile.IEnergySource -{ - - // two packet buffering... - double OutputEnergyA; - double OutputEnergyB; - // two packet buffering... - double OutputVoltageA; - double OutputVoltageB; - - public PartP2PIC2Power( ItemStack is ) - { - super( is ); - } - - @Override - @SideOnly( Side.CLIENT ) - public TextureAtlasSprite getTypeTexture() - { - return Blocks.diamond_block.getBlockTextureFromSide( 0 ); - } - - @Override - public void readFromNBT( NBTTagCompound tag ) - { - super.readFromNBT( tag ); - this.OutputEnergyA = tag.getDouble( "OutputPacket" ); - this.OutputEnergyB = tag.getDouble( "OutputPacket2" ); - this.OutputVoltageA = tag.getDouble( "OutputVoltageA" ); - this.OutputVoltageB = tag.getDouble( "OutputVoltageB" ); - } - - @Override - public void writeToNBT( NBTTagCompound tag ) - { - super.writeToNBT( tag ); - tag.setDouble( "OutputPacket", this.OutputEnergyA ); - tag.setDouble( "OutputPacket2", this.OutputEnergyB ); - tag.setDouble( "OutputVoltageA", this.OutputVoltageA ); - tag.setDouble( "OutputVoltageB", this.OutputVoltageB ); - } - - @Override - public void onTunnelConfigChange() - { - this.getHost().partChanged(); - } - - @Override - public void onTunnelNetworkChange() - { - this.getHost().notifyNeighbors(); - } - - @Override - public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction ) - { - if( !this.output ) - { - return direction == this.side; - } - return false; - } - - @Override - public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction ) - { - if( this.output ) - { - return direction == this.side; - } - return false; - } - - @Override - public double getDemandedEnergy() - { - if( this.output ) - { - return 0; - } - - try - { - for( PartP2PIC2Power t : this.getOutputs() ) - { - if( t.OutputEnergyA <= 0.0001 || t.OutputEnergyB <= 0.0001 ) - { - return 2048; - } - } - } - catch( GridAccessException e ) - { - return 0; - } - - return 0; - } - - @Override - public int getSinkTier() - { - return 4; - } - - @Override - public double injectEnergy( ForgeDirection directionFrom, double amount, double voltage ) - { - TunnelCollection outs; - try - { - outs = this.getOutputs(); - } - catch( GridAccessException e ) - { - return amount; - } - - if( outs.isEmpty() ) - { - return amount; - } - - LinkedList options = new LinkedList(); - for( PartP2PIC2Power o : outs ) - { - if( o.OutputEnergyA <= 0.01 ) - { - options.add( o ); - } - } - - if( options.isEmpty() ) - { - for( PartP2PIC2Power o : outs ) - { - if( o.OutputEnergyB <= 0.01 ) - { - options.add( o ); - } - } - } - - if( options.isEmpty() ) - { - for( PartP2PIC2Power o : outs ) - { - options.add( o ); - } - } - - if( options.isEmpty() ) - { - return amount; - } - - PartP2PIC2Power x = Platform.pickRandom( options ); - - if( x != null && x.OutputEnergyA <= 0.001 ) - { - this.queueTunnelDrain( PowerUnits.EU, amount ); - x.OutputEnergyA = amount; - x.OutputVoltageA = voltage; - return 0; - } - - if( x != null && x.OutputEnergyB <= 0.001 ) - { - this.queueTunnelDrain( PowerUnits.EU, amount ); - x.OutputEnergyB = amount; - x.OutputVoltageB = voltage; - return 0; - } - - return amount; - } - - public float getPowerDrainPerTick() - { - return 0.5f; - } - - @Override - public double getOfferedEnergy() - { - if( this.output ) - { - return this.OutputEnergyA; - } - return 0; - } - - @Override - public void drawEnergy( double amount ) - { - this.OutputEnergyA -= amount; - if( this.OutputEnergyA < 0.001 ) - { - this.OutputEnergyA = this.OutputEnergyB; - this.OutputEnergyB = 0; - - this.OutputVoltageA = this.OutputVoltageB; - this.OutputVoltageB = 0; - } - } - - @Override - public int getSourceTier() - { - if( this.output ) - { - return this.calculateTierFromVoltage( this.OutputVoltageA ); - } - return 4; - } - - private int calculateTierFromVoltage( double voltage ) - { - return ic2.api.energy.EnergyNet.instance.getTierFromPower( voltage ); - } -} +//@InterfaceList( value = { @Interface( iface = "ic2.api.energy.tile.IEnergySink", iname = "IC2" ), @Interface( iface = "ic2.api.energy.tile.IEnergySource", iname = "IC2" ) } ) +//public class PartP2PIC2Power extends PartP2PTunnel implements ic2.api.energy.tile.IEnergySink, ic2.api.energy.tile.IEnergySource +//{ +// +// // two packet buffering... +// double OutputEnergyA; +// double OutputEnergyB; +// // two packet buffering... +// double OutputVoltageA; +// double OutputVoltageB; +// +// public PartP2PIC2Power( ItemStack is ) +// { +// super( is ); +// } +// +// @Override +// @SideOnly( Side.CLIENT ) +// public TextureAtlasSprite getTypeTexture() +// { +// return Blocks.diamond_block.getBlockTextureFromSide( 0 ); +// } +// +// @Override +// public void readFromNBT( NBTTagCompound tag ) +// { +// super.readFromNBT( tag ); +// this.OutputEnergyA = tag.getDouble( "OutputPacket" ); +// this.OutputEnergyB = tag.getDouble( "OutputPacket2" ); +// this.OutputVoltageA = tag.getDouble( "OutputVoltageA" ); +// this.OutputVoltageB = tag.getDouble( "OutputVoltageB" ); +// } +// +// @Override +// public void writeToNBT( NBTTagCompound tag ) +// { +// super.writeToNBT( tag ); +// tag.setDouble( "OutputPacket", this.OutputEnergyA ); +// tag.setDouble( "OutputPacket2", this.OutputEnergyB ); +// tag.setDouble( "OutputVoltageA", this.OutputVoltageA ); +// tag.setDouble( "OutputVoltageB", this.OutputVoltageB ); +// } +// +// @Override +// public void onTunnelConfigChange() +// { +// this.getHost().partChanged(); +// } +// +// @Override +// public void onTunnelNetworkChange() +// { +// this.getHost().notifyNeighbors(); +// } +// +// @Override +// public boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction ) +// { +// if( !this.output ) +// { +// return direction == this.side; +// } +// return false; +// } +// +// @Override +// public boolean emitsEnergyTo( TileEntity receiver, ForgeDirection direction ) +// { +// if( this.output ) +// { +// return direction == this.side; +// } +// return false; +// } +// +// @Override +// public double getDemandedEnergy() +// { +// if( this.output ) +// { +// return 0; +// } +// +// try +// { +// for( PartP2PIC2Power t : this.getOutputs() ) +// { +// if( t.OutputEnergyA <= 0.0001 || t.OutputEnergyB <= 0.0001 ) +// { +// return 2048; +// } +// } +// } +// catch( GridAccessException e ) +// { +// return 0; +// } +// +// return 0; +// } +// +// @Override +// public int getSinkTier() +// { +// return 4; +// } +// +// @Override +// public double injectEnergy( ForgeDirection directionFrom, double amount, double voltage ) +// { +// TunnelCollection outs; +// try +// { +// outs = this.getOutputs(); +// } +// catch( GridAccessException e ) +// { +// return amount; +// } +// +// if( outs.isEmpty() ) +// { +// return amount; +// } +// +// LinkedList options = new LinkedList(); +// for( PartP2PIC2Power o : outs ) +// { +// if( o.OutputEnergyA <= 0.01 ) +// { +// options.add( o ); +// } +// } +// +// if( options.isEmpty() ) +// { +// for( PartP2PIC2Power o : outs ) +// { +// if( o.OutputEnergyB <= 0.01 ) +// { +// options.add( o ); +// } +// } +// } +// +// if( options.isEmpty() ) +// { +// for( PartP2PIC2Power o : outs ) +// { +// options.add( o ); +// } +// } +// +// if( options.isEmpty() ) +// { +// return amount; +// } +// +// PartP2PIC2Power x = Platform.pickRandom( options ); +// +// if( x != null && x.OutputEnergyA <= 0.001 ) +// { +// this.queueTunnelDrain( PowerUnits.EU, amount ); +// x.OutputEnergyA = amount; +// x.OutputVoltageA = voltage; +// return 0; +// } +// +// if( x != null && x.OutputEnergyB <= 0.001 ) +// { +// this.queueTunnelDrain( PowerUnits.EU, amount ); +// x.OutputEnergyB = amount; +// x.OutputVoltageB = voltage; +// return 0; +// } +// +// return amount; +// } +// +// public float getPowerDrainPerTick() +// { +// return 0.5f; +// } +// +// @Override +// public double getOfferedEnergy() +// { +// if( this.output ) +// { +// return this.OutputEnergyA; +// } +// return 0; +// } +// +// @Override +// public void drawEnergy( double amount ) +// { +// this.OutputEnergyA -= amount; +// if( this.OutputEnergyA < 0.001 ) +// { +// this.OutputEnergyA = this.OutputEnergyB; +// this.OutputEnergyB = 0; +// +// this.OutputVoltageA = this.OutputVoltageB; +// this.OutputVoltageB = 0; +// } +// } +// +// @Override +// public int getSourceTier() +// { +// if( this.output ) +// { +// return this.calculateTierFromVoltage( this.OutputVoltageA ); +// } +// return 4; +// } +// +// private int calculateTierFromVoltage( double voltage ) +// { +// return ic2.api.energy.EnergyNet.instance.getTierFromPower( voltage ); +// } +//} diff --git a/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java b/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java index f3854f02..50193a95 100644 --- a/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java +++ b/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java @@ -19,229 +19,197 @@ package appeng.parts.p2p; -import java.util.concurrent.Callable; - -import javax.annotation.Nullable; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import li.cil.oc.api.API; -import li.cil.oc.api.Items; -import li.cil.oc.api.Network; -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.Message; -import li.cil.oc.api.network.Node; -import li.cil.oc.api.network.SidedEnvironment; -import li.cil.oc.api.network.Visibility; -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.api.util.ForgeDirection; -import appeng.core.AELog; -import appeng.core.settings.TickRates; -import appeng.hooks.TickHandler; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.me.GridAccessException; -import appeng.transformer.annotations.Integration.Interface; -import appeng.transformer.annotations.Integration.InterfaceList; - - -@InterfaceList(value = { @Interface(iface = "li.cil.oc.api.network.Environment", iname = "OpenComputers"), @Interface(iface = "li.cil.oc.api.network.SidedEnvironment", iname = "OpenComputers") }) -public final class PartP2POpenComputers extends PartP2PTunnel implements IGridTickable, Environment, SidedEnvironment -{ - @Nullable - private final Node node; - - private final Callable updateCallback; - - public PartP2POpenComputers(ItemStack is) - { - super( is ); - - if ( !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) ) - { - throw new RuntimeException( "OpenComputers is not installed!" ); - } - - // Avoid NPE when called in pre-init phase (part population). - if ( API.network != null ) - { - this.node = Network.newNode( this, Visibility.None ).create(); - } - else - { - this.node = null; // to satisfy final - } - - this.updateCallback = new UpdateCallback(); - } - - @Override - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getTypeTexture() - { - return Items.get( "adapter" ).block().getBlockTextureFromSide( 2 ); - } - - @Override - public void removeFromWorld() - { - super.removeFromWorld(); - if ( this.node != null) - { - this.node.remove(); - } - } - - @Override - public void onTunnelNetworkChange() - { - super.onTunnelNetworkChange(); - try - { - this.proxy.getTick().wakeDevice( this.proxy.getNode() ); - } - catch( GridAccessException e ) - { - // ignore - } - } - - @Override - public void readFromNBT(NBTTagCompound data) - { - super.readFromNBT( data ); - if ( this.node != null) - { - this.node.load( data ); - } - } - - @Override - public void writeToNBT(NBTTagCompound data) - { - super.writeToNBT( data ); - if ( this.node != null) - { - this.node.save( data ); - } - } - - @Override - public TickingRequest getTickingRequest( IGridNode node ) - { - return new TickingRequest( TickRates.OpenComputersTunnel.min, TickRates.OpenComputersTunnel.max, true, false ); - } - - @Override - public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall ) - { - try - { - if( !this.proxy.getPath().isNetworkBooting() ) - { - if ( this.node() != null ) // Client side doesn't have nodes. - { - TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.updateCallback ); - } - - return TickRateModulation.SLEEP; - } - } - catch( GridAccessException e ) - { - // ignore - } - - return TickRateModulation.IDLE; - } - - private void updateConnections() - { - if ( this.proxy.isPowered() && this.proxy.isActive() ) - { - // Make sure we're connected to existing OC nodes in the world. - Network.joinOrCreateNetwork( this.getTile() ); - - if ( this.output ) - { - if ( this.getInput() != null && this.node != null ) - { - Network.joinOrCreateNetwork( this.getInput().getTile() ); - this.node.connect( this.getInput().node() ); - } - } - else - { - try - { - for ( PartP2POpenComputers output : this.getOutputs() ) - { - if ( this.node != null ) - { - Network.joinOrCreateNetwork( output.getTile() ); - this.node.connect( output.node() ); - } - } - } - catch ( GridAccessException e ) - { - AELog.error( e ); - } - } - } - else if ( this.node != null ) - { - this.node.remove(); - } - } - - @Nullable - @Override - public Node node() - { - return this.node; - } - - @Override - public void onConnect(Node node) { - } - - @Override - public void onDisconnect(Node node) { - } - - @Override - public void onMessage(Message message) { - } - - @Nullable - @Override - public Node sidedNode(ForgeDirection side) - { - return side == this.side ? this.node : null; - } - - @Override - public boolean canConnect(ForgeDirection side) - { - return side == this.side; - } - - private final class UpdateCallback implements Callable - { - @Nullable - @Override - public Void call() throws Exception - { - PartP2POpenComputers.this.updateConnections(); - - return null; - } - } -} +//@InterfaceList(value = { @Interface(iface = "li.cil.oc.api.network.Environment", iname = "OpenComputers"), @Interface(iface = "li.cil.oc.api.network.SidedEnvironment", iname = "OpenComputers") }) +//public final class PartP2POpenComputers extends PartP2PTunnel implements IGridTickable, Environment, SidedEnvironment +//{ +// @Nullable +// private final Node node; +// +// private final Callable updateCallback; +// +// public PartP2POpenComputers(ItemStack is) +// { +// super( is ); +// +// if ( !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) ) +// { +// throw new RuntimeException( "OpenComputers is not installed!" ); +// } +// +// // Avoid NPE when called in pre-init phase (part population). +// if ( API.network != null ) +// { +// this.node = Network.newNode( this, Visibility.None ).create(); +// } +// else +// { +// this.node = null; // to satisfy final +// } +// +// this.updateCallback = new UpdateCallback(); +// } +// +// @Override +// @SideOnly(Side.CLIENT) +// public TextureAtlasSprite getTypeTexture() +// { +// return Items.get( "adapter" ).block().getBlockTextureFromSide( 2 ); +// } +// +// @Override +// public void removeFromWorld() +// { +// super.removeFromWorld(); +// if ( this.node != null) +// { +// this.node.remove(); +// } +// } +// +// @Override +// public void onTunnelNetworkChange() +// { +// super.onTunnelNetworkChange(); +// try +// { +// this.proxy.getTick().wakeDevice( this.proxy.getNode() ); +// } +// catch( GridAccessException e ) +// { +// // ignore +// } +// } +// +// @Override +// public void readFromNBT(NBTTagCompound data) +// { +// super.readFromNBT( data ); +// if ( this.node != null) +// { +// this.node.load( data ); +// } +// } +// +// @Override +// public void writeToNBT(NBTTagCompound data) +// { +// super.writeToNBT( data ); +// if ( this.node != null) +// { +// this.node.save( data ); +// } +// } +// +// @Override +// public TickingRequest getTickingRequest( IGridNode node ) +// { +// return new TickingRequest( TickRates.OpenComputersTunnel.min, TickRates.OpenComputersTunnel.max, true, false ); +// } +// +// @Override +// public TickRateModulation tickingRequest( IGridNode node, int ticksSinceLastCall ) +// { +// try +// { +// if( !this.proxy.getPath().isNetworkBooting() ) +// { +// if ( this.node() != null ) // Client side doesn't have nodes. +// { +// TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.updateCallback ); +// } +// +// return TickRateModulation.SLEEP; +// } +// } +// catch( GridAccessException e ) +// { +// // ignore +// } +// +// return TickRateModulation.IDLE; +// } +// +// private void updateConnections() +// { +// if ( this.proxy.isPowered() && this.proxy.isActive() ) +// { +// // Make sure we're connected to existing OC nodes in the world. +// Network.joinOrCreateNetwork( this.getTile() ); +// +// if ( this.output ) +// { +// if ( this.getInput() != null && this.node != null ) +// { +// Network.joinOrCreateNetwork( this.getInput().getTile() ); +// this.node.connect( this.getInput().node() ); +// } +// } +// else +// { +// try +// { +// for ( PartP2POpenComputers output : this.getOutputs() ) +// { +// if ( this.node != null ) +// { +// Network.joinOrCreateNetwork( output.getTile() ); +// this.node.connect( output.node() ); +// } +// } +// } +// catch ( GridAccessException e ) +// { +// AELog.error( e ); +// } +// } +// } +// else if ( this.node != null ) +// { +// this.node.remove(); +// } +// } +// +// @Nullable +// @Override +// public Node node() +// { +// return this.node; +// } +// +// @Override +// public void onConnect(Node node) { +// } +// +// @Override +// public void onDisconnect(Node node) { +// } +// +// @Override +// public void onMessage(Message message) { +// } +// +// @Nullable +// @Override +// public Node sidedNode(ForgeDirection side) +// { +// return side == this.side ? this.node : null; +// } +// +// @Override +// public boolean canConnect(ForgeDirection side) +// { +// return side == this.side; +// } +// +// private final class UpdateCallback implements Callable +// { +// @Nullable +// @Override +// public Void call() throws Exception +// { +// PartP2POpenComputers.this.updateConnections(); +// +// return null; +// } +// } +//} diff --git a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java index 491a35a4..3b9a3886 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRFPower.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRFPower.java @@ -19,255 +19,237 @@ package appeng.parts.p2p; -import java.util.Stack; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import cofh.api.energy.IEnergyReceiver; -import appeng.api.config.PowerUnits; -import appeng.api.util.ForgeDirection; -import appeng.integration.modules.helpers.NullRFHandler; -import appeng.me.GridAccessException; -import appeng.transformer.annotations.Integration.Interface; -import appeng.transformer.annotations.Integration.InterfaceList; -import appeng.util.Platform; - - -@InterfaceList( value = { @Interface( iface = "cofh.api.energy.IEnergyReceiver", iname = "RF" ) } ) -public final class PartP2PRFPower extends PartP2PTunnel implements IEnergyReceiver -{ - private static final ThreadLocal> THREAD_STACK = new ThreadLocal>(); - /** - * Default element based on the null element pattern - */ - private static final IEnergyReceiver NULL_HANDLER = new NullRFHandler(); - private boolean cachedTarget = false; - private IEnergyReceiver outputTarget; - - public PartP2PRFPower( ItemStack is ) - { - super( is ); - } - - @Override - @SideOnly( Side.CLIENT ) - public TextureAtlasSprite getTypeTexture() - { - return Blocks.iron_block.getBlockTextureFromSide( 0 ); - } - - @Override - public void onTunnelNetworkChange() - { - this.getHost().notifyNeighbors(); - } - - @Override - public void onNeighborChanged() - { - super.onNeighborChanged(); - - this.cachedTarget = false; - } - - @Override - public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) - { - if( this.output ) - { - return 0; - } - - if( this.isActive() ) - { - Stack stack = this.getDepth(); - - for( PartP2PRFPower t : stack ) - { - if( t == this ) - { - return 0; - } - } - - stack.push( this ); - - int total = 0; - - try - { - for( PartP2PRFPower t : this.getOutputs() ) - { - if( Platform.getRandomInt() % 2 > 0 ) - { - int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate ); - maxReceive -= receiver; - total += receiver; - - if( maxReceive <= 0 ) - { - break; - } - } - } - - if( maxReceive > 0 ) - { - for( PartP2PRFPower t : this.getOutputs() ) - { - int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate ); - maxReceive -= receiver; - total += receiver; - - if( maxReceive <= 0 ) - { - break; - } - } - } - - this.queueTunnelDrain( PowerUnits.RF, total ); - } - catch( GridAccessException ignored ) - { - } - - if( stack.pop() != this ) - { - throw new IllegalStateException( "Invalid Recursion detected." ); - } - - return total; - } - - return 0; - } - - private Stack getDepth() - { - Stack s = THREAD_STACK.get(); - - if( s == null ) - { - THREAD_STACK.set( s = new Stack() ); - } - - return s; - } - - private IEnergyReceiver getOutput() - { - if( this.output ) - { - if( !this.cachedTarget ) - { - TileEntity self = this.getTile(); - TileEntity te = self.getWorld().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ ); - this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null; - this.cachedTarget = true; - } - - if( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.side.getOpposite() ) ) - { - return NULL_HANDLER; - } - - return this.outputTarget; - } - return NULL_HANDLER; - } - - @Override - public int getEnergyStored( ForgeDirection from ) - { - if( this.output || !this.isActive() ) - { - return 0; - } - - int total = 0; - - Stack stack = this.getDepth(); - - for( PartP2PRFPower t : stack ) - { - if( t == this ) - { - return 0; - } - } - - stack.push( this ); - - try - { - for( PartP2PRFPower t : this.getOutputs() ) - { - total += t.getOutput().getEnergyStored( t.side.getOpposite() ); - } - } - catch( GridAccessException e ) - { - return 0; - } - - if( stack.pop() != this ) - { - throw new IllegalStateException( "Invalid Recursion detected." ); - } - - return total; - } - - @Override - public int getMaxEnergyStored( ForgeDirection from ) - { - if( this.output || !this.isActive() ) - { - return 0; - } - - int total = 0; - - Stack stack = this.getDepth(); - - for( PartP2PRFPower t : stack ) - { - if( t == this ) - { - return 0; - } - } - - stack.push( this ); - - try - { - for( PartP2PRFPower t : this.getOutputs() ) - { - total += t.getOutput().getMaxEnergyStored( t.side.getOpposite() ); - } - } - catch( GridAccessException e ) - { - return 0; - } - - if( stack.pop() != this ) - { - throw new IllegalStateException( "Invalid Recursion detected." ); - } - - return total; - } - - @Override - public boolean canConnectEnergy( ForgeDirection from ) - { - return true; - } -} +//@InterfaceList( value = { @Interface( iface = "cofh.api.energy.IEnergyReceiver", iname = "RF" ) } ) +//public final class PartP2PRFPower extends PartP2PTunnel implements IEnergyReceiver +//{ +// private static final ThreadLocal> THREAD_STACK = new ThreadLocal>(); +// /** +// * Default element based on the null element pattern +// */ +// private static final IEnergyReceiver NULL_HANDLER = new NullRFHandler(); +// private boolean cachedTarget = false; +// private IEnergyReceiver outputTarget; +// +// public PartP2PRFPower( ItemStack is ) +// { +// super( is ); +// } +// +// @Override +// @SideOnly( Side.CLIENT ) +// public TextureAtlasSprite getTypeTexture() +// { +// return Blocks.iron_block.getBlockTextureFromSide( 0 ); +// } +// +// @Override +// public void onTunnelNetworkChange() +// { +// this.getHost().notifyNeighbors(); +// } +// +// @Override +// public void onNeighborChanged() +// { +// super.onNeighborChanged(); +// +// this.cachedTarget = false; +// } +// +// @Override +// public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) +// { +// if( this.output ) +// { +// return 0; +// } +// +// if( this.isActive() ) +// { +// Stack stack = this.getDepth(); +// +// for( PartP2PRFPower t : stack ) +// { +// if( t == this ) +// { +// return 0; +// } +// } +// +// stack.push( this ); +// +// int total = 0; +// +// try +// { +// for( PartP2PRFPower t : this.getOutputs() ) +// { +// if( Platform.getRandomInt() % 2 > 0 ) +// { +// int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate ); +// maxReceive -= receiver; +// total += receiver; +// +// if( maxReceive <= 0 ) +// { +// break; +// } +// } +// } +// +// if( maxReceive > 0 ) +// { +// for( PartP2PRFPower t : this.getOutputs() ) +// { +// int receiver = t.getOutput().receiveEnergy( t.side.getOpposite(), maxReceive, simulate ); +// maxReceive -= receiver; +// total += receiver; +// +// if( maxReceive <= 0 ) +// { +// break; +// } +// } +// } +// +// this.queueTunnelDrain( PowerUnits.RF, total ); +// } +// catch( GridAccessException ignored ) +// { +// } +// +// if( stack.pop() != this ) +// { +// throw new IllegalStateException( "Invalid Recursion detected." ); +// } +// +// return total; +// } +// +// return 0; +// } +// +// private Stack getDepth() +// { +// Stack s = THREAD_STACK.get(); +// +// if( s == null ) +// { +// THREAD_STACK.set( s = new Stack() ); +// } +// +// return s; +// } +// +// private IEnergyReceiver getOutput() +// { +// if( this.output ) +// { +// if( !this.cachedTarget ) +// { +// TileEntity self = this.getTile(); +// TileEntity te = self.getWorld().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ ); +// this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null; +// this.cachedTarget = true; +// } +// +// if( this.outputTarget == null || !this.outputTarget.canConnectEnergy( this.side.getOpposite() ) ) +// { +// return NULL_HANDLER; +// } +// +// return this.outputTarget; +// } +// return NULL_HANDLER; +// } +// +// @Override +// public int getEnergyStored( ForgeDirection from ) +// { +// if( this.output || !this.isActive() ) +// { +// return 0; +// } +// +// int total = 0; +// +// Stack stack = this.getDepth(); +// +// for( PartP2PRFPower t : stack ) +// { +// if( t == this ) +// { +// return 0; +// } +// } +// +// stack.push( this ); +// +// try +// { +// for( PartP2PRFPower t : this.getOutputs() ) +// { +// total += t.getOutput().getEnergyStored( t.side.getOpposite() ); +// } +// } +// catch( GridAccessException e ) +// { +// return 0; +// } +// +// if( stack.pop() != this ) +// { +// throw new IllegalStateException( "Invalid Recursion detected." ); +// } +// +// return total; +// } +// +// @Override +// public int getMaxEnergyStored( ForgeDirection from ) +// { +// if( this.output || !this.isActive() ) +// { +// return 0; +// } +// +// int total = 0; +// +// Stack stack = this.getDepth(); +// +// for( PartP2PRFPower t : stack ) +// { +// if( t == this ) +// { +// return 0; +// } +// } +// +// stack.push( this ); +// +// try +// { +// for( PartP2PRFPower t : this.getOutputs() ) +// { +// total += t.getOutput().getMaxEnergyStored( t.side.getOpposite() ); +// } +// } +// catch( GridAccessException e ) +// { +// return 0; +// } +// +// if( stack.pop() != this ) +// { +// throw new IllegalStateException( "Invalid Recursion detected." ); +// } +// +// return total; +// } +// +// @Override +// public boolean canConnectEnergy( ForgeDirection from ) +// { +// return true; +// } +//} diff --git a/src/main/java/appeng/tile/powersink/IC2.java b/src/main/java/appeng/tile/powersink/IC2.java index 65a481c5..e9ee9364 100644 --- a/src/main/java/appeng/tile/powersink/IC2.java +++ b/src/main/java/appeng/tile/powersink/IC2.java @@ -19,105 +19,92 @@ package appeng.tile.powersink; -import java.util.EnumSet; - -import net.minecraft.tileentity.TileEntity; -import ic2.api.energy.tile.IEnergySink; -import appeng.api.config.PowerUnits; -import appeng.api.util.ForgeDirection; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IIC2; -import appeng.transformer.annotations.Integration.Interface; -import appeng.util.Platform; - - -@Interface( iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink" ) -public abstract class IC2 extends AERootPoweredTile implements IEnergySink -{ - - boolean isInIC2 = false; - - @Override - public final boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction ) - { - return this.getPowerSides().contains( direction ); - } - - @Override - public final double getDemandedEnergy() - { - return this.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE ); - } - - @Override - public final int getSinkTier() - { - return Integer.MAX_VALUE; - } - - @Override - public final double injectEnergy( ForgeDirection directionFrom, double amount, double voltage ) - { - // just store the excess in the current block, if I return the waste, - // IC2 will just disintegrate it - Oct 20th 2013 - double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, this.injectExternalPower( PowerUnits.EU, amount ) ); - this.internalCurrentPower += overflow; - return 0; // see above comment. - } - - @Override - public void invalidate() - { - super.invalidate(); - this.removeFromENet(); - } - - private void removeFromENet() - { - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) - { - IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 ); - if( this.isInIC2 && Platform.isServer() && ic2Integration != null ) - { - ic2Integration.removeFromEnergyNet( this ); - this.isInIC2 = false; - } - } - } - - @Override - public void onChunkUnload() - { - super.onChunkUnload(); - this.removeFromENet(); - } - - @Override - public void onReady() - { - super.onReady(); - this.addToENet(); - } - - private void addToENet() - { - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) - { - IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 ); - if( !this.isInIC2 && Platform.isServer() && ic2Integration != null ) - { - ic2Integration.addToEnergyNet( this ); - this.isInIC2 = true; - } - } - } - - @Override - protected void setPowerSides( EnumSet sides ) - { - super.setPowerSides( sides ); - this.removeFromENet(); - this.addToENet(); - } -} +//@Interface( iname = "IC2", iface = "ic2.api.energy.tile.IEnergySink" ) +//public abstract class IC2 extends AERootPoweredTile implements IEnergySink +//{ +// +// boolean isInIC2 = false; +// +// @Override +// public final boolean acceptsEnergyFrom( TileEntity emitter, ForgeDirection direction ) +// { +// return this.getPowerSides().contains( direction ); +// } +// +// @Override +// public final double getDemandedEnergy() +// { +// return this.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE ); +// } +// +// @Override +// public final int getSinkTier() +// { +// return Integer.MAX_VALUE; +// } +// +// @Override +// public final double injectEnergy( ForgeDirection directionFrom, double amount, double voltage ) +// { +// // just store the excess in the current block, if I return the waste, +// // IC2 will just disintegrate it - Oct 20th 2013 +// double overflow = PowerUnits.EU.convertTo( PowerUnits.AE, this.injectExternalPower( PowerUnits.EU, amount ) ); +// this.internalCurrentPower += overflow; +// return 0; // see above comment. +// } +// +// @Override +// public void invalidate() +// { +// super.invalidate(); +// this.removeFromENet(); +// } +// +// private void removeFromENet() +// { +// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) +// { +// IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 ); +// if( this.isInIC2 && Platform.isServer() && ic2Integration != null ) +// { +// ic2Integration.removeFromEnergyNet( this ); +// this.isInIC2 = false; +// } +// } +// } +// +// @Override +// public void onChunkUnload() +// { +// super.onChunkUnload(); +// this.removeFromENet(); +// } +// +// @Override +// public void onReady() +// { +// super.onReady(); +// this.addToENet(); +// } +// +// private void addToENet() +// { +// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) ) +// { +// IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.IC2 ); +// if( !this.isInIC2 && Platform.isServer() && ic2Integration != null ) +// { +// ic2Integration.addToEnergyNet( this ); +// this.isInIC2 = true; +// } +// } +// } +// +// @Override +// protected void setPowerSides( EnumSet sides ) +// { +// super.setPowerSides( sides ); +// this.removeFromENet(); +// this.addToENet(); +// } +//} diff --git a/src/main/java/appeng/tile/powersink/MekJoules.java b/src/main/java/appeng/tile/powersink/MekJoules.java index 0a3d0851..d30144dc 100644 --- a/src/main/java/appeng/tile/powersink/MekJoules.java +++ b/src/main/java/appeng/tile/powersink/MekJoules.java @@ -19,51 +19,45 @@ package appeng.tile.powersink; -import mekanism.api.energy.IStrictEnergyAcceptor; -import appeng.api.config.PowerUnits; -import appeng.api.util.ForgeDirection; -import appeng.transformer.annotations.Integration.Interface; - - -@Interface( iname = "Mekanism", iface = "mekanism.api.energy.IStrictEnergyAcceptor" ) -public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcceptor -{ - - @Override - public double getEnergy() - { - return 0; - } - - @Override - public void setEnergy( double energy ) - { - double extra = this.injectExternalPower( PowerUnits.MK, energy ); - this.internalCurrentPower += PowerUnits.MK.convertTo( PowerUnits.AE, extra ); - } - - @Override - public double getMaxEnergy() - { - return this.getExternalPowerDemand( PowerUnits.MK, 100000 ); - } - - @Override - public double transferEnergyToAcceptor( ForgeDirection side, double amount ) - { - double demand = this.getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE ); - if( amount > demand ) - { - amount = demand; - } - - double overflow = this.injectExternalPower( PowerUnits.MK, amount ); - return amount - overflow; - } - - @Override - public boolean canReceiveEnergy( ForgeDirection side ) - { - return this.getPowerSides().contains( side ); - } -} +//@Interface( iname = "Mekanism", iface = "mekanism.api.energy.IStrictEnergyAcceptor" ) +//public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcceptor +//{ +// +// @Override +// public double getEnergy() +// { +// return 0; +// } +// +// @Override +// public void setEnergy( double energy ) +// { +// double extra = this.injectExternalPower( PowerUnits.MK, energy ); +// this.internalCurrentPower += PowerUnits.MK.convertTo( PowerUnits.AE, extra ); +// } +// +// @Override +// public double getMaxEnergy() +// { +// return this.getExternalPowerDemand( PowerUnits.MK, 100000 ); +// } +// +// @Override +// public double transferEnergyToAcceptor( ForgeDirection side, double amount ) +// { +// double demand = this.getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE ); +// if( amount > demand ) +// { +// amount = demand; +// } +// +// double overflow = this.injectExternalPower( PowerUnits.MK, amount ); +// return amount - overflow; +// } +// +// @Override +// public boolean canReceiveEnergy( ForgeDirection side ) +// { +// return this.getPowerSides().contains( side ); +// } +//} diff --git a/src/main/java/appeng/tile/powersink/RedstoneFlux.java b/src/main/java/appeng/tile/powersink/RedstoneFlux.java index 378d5424..bbf2fa10 100644 --- a/src/main/java/appeng/tile/powersink/RedstoneFlux.java +++ b/src/main/java/appeng/tile/powersink/RedstoneFlux.java @@ -19,44 +19,38 @@ package appeng.tile.powersink; -import cofh.api.energy.IEnergyReceiver; -import appeng.api.config.PowerUnits; -import appeng.api.util.ForgeDirection; -import appeng.transformer.annotations.Integration.Interface; - - -@Interface( iname = "RF", iface = "cofh.api.energy.IEnergyReceiver" ) -public abstract class RedstoneFlux extends RotaryCraft implements IEnergyReceiver -{ - @Override - public final int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) - { - final int networkRFDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) ); - final int usedRF = Math.min( maxReceive, networkRFDemand ); - - if( !simulate ) - { - this.injectExternalPower( PowerUnits.RF, usedRF ); - } - - return usedRF; - } - - @Override - public final int getEnergyStored( ForgeDirection from ) - { - return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower() ) ); - } - - @Override - public final int getMaxEnergyStored( ForgeDirection from ) - { - return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower() ) ); - } - - @Override - public final boolean canConnectEnergy( ForgeDirection from ) - { - return this.getPowerSides().contains( from ); - } -} +//@Interface( iname = "RF", iface = "cofh.api.energy.IEnergyReceiver" ) +//public abstract class RedstoneFlux extends RotaryCraft implements IEnergyReceiver +//{ +// @Override +// public final int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate ) +// { +// final int networkRFDemand = (int) Math.floor( this.getExternalPowerDemand( PowerUnits.RF, maxReceive ) ); +// final int usedRF = Math.min( maxReceive, networkRFDemand ); +// +// if( !simulate ) +// { +// this.injectExternalPower( PowerUnits.RF, usedRF ); +// } +// +// return usedRF; +// } +// +// @Override +// public final int getEnergyStored( ForgeDirection from ) +// { +// return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower() ) ); +// } +// +// @Override +// public final int getMaxEnergyStored( ForgeDirection from ) +// { +// return (int) Math.floor( PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower() ) ); +// } +// +// @Override +// public final boolean canConnectEnergy( ForgeDirection from ) +// { +// return this.getPowerSides().contains( from ); +// } +//} diff --git a/src/main/java/appeng/tile/powersink/RotaryCraft.java b/src/main/java/appeng/tile/powersink/RotaryCraft.java index 3b1cbe6b..7d0da71d 100644 --- a/src/main/java/appeng/tile/powersink/RotaryCraft.java +++ b/src/main/java/appeng/tile/powersink/RotaryCraft.java @@ -19,166 +19,151 @@ package appeng.tile.powersink; -import appeng.transformer.annotations.Integration; -import net.minecraft.world.World; -import Reika.RotaryCraft.API.Interfaces.Transducerable; -import Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver; -import appeng.api.config.PowerUnits; -import appeng.api.util.ForgeDirection; -import appeng.tile.TileEvent; -import appeng.tile.events.TileEventType; -import appeng.transformer.annotations.Integration.Interface; -import appeng.transformer.annotations.Integration.InterfaceList; -import appeng.transformer.annotations.Integration.Method; -import appeng.util.Platform; - -import java.util.ArrayList; - -@InterfaceList( value = { @Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver" ), @Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Interfaces.Transducerable") } ) -public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerReceiver, Transducerable -{ - - private int omega = 0; - private int torque = 0; - private long power = 0; - private int alpha = 0; - - private long currentPower = 0; - - @TileEvent( TileEventType.TICK ) - @Method( iname = "RotaryCraft" ) - public void Tick_RotaryCraft() - { - if( this.worldObj != null && !this.worldObj.isRemote && this.currentPower > 0 ) - { - this.injectExternalPower( PowerUnits.WA, this.currentPower ); - this.currentPower = 0; - } - } - - @Override - public final boolean addPower( int torque, int omega, long power, ForgeDirection side ) - { - this.omega = omega; - this.torque = torque; - this.power = power; - - this.currentPower += power; - - return true; - - } - - @Override - public final int getOmega() - { - return this.omega; - } - - @Override - public final int getTorque() - { - return this.torque; - } - - @Override - public final long getPower() - { - return this.power; - } - - @Override - public final String getName() - { - return "AE"; - } - - @Override - public final int getIORenderAlpha() - { - return this.alpha; - } - - @Override - public final void setIORenderAlpha( int io ) - { - this.alpha = io; - } - - public final boolean canReadFromBlock( int x, int y, int z ) - { - ForgeDirection side = ForgeDirection.UNKNOWN; - - if( x == this.xCoord - 1 ) - { - side = ForgeDirection.WEST; - } - else if( x == this.xCoord + 1 ) - { - side = ForgeDirection.EAST; - } - else if( z == this.zCoord - 1 ) - { - side = ForgeDirection.NORTH; - } - else if( z == this.zCoord + 1 ) - { - side = ForgeDirection.SOUTH; - } - else if( y == this.yCoord - 1 ) - { - side = ForgeDirection.DOWN; - } - else if( y == this.yCoord + 1 ) - { - side = ForgeDirection.UP; - } - - return this.getPowerSides().contains( side ); - } - - @Override - public final boolean canReadFrom( ForgeDirection side ) - { - return this.getPowerSides().contains( side ); - } - - @Override - public final boolean isReceiving() - { - return true; - } - - @Override - public final int getMinTorque( int available ) - { - return 1; - } - - @Override - public final ArrayList getMessages( World world, int x, int y, int z, int side ) - { - String out; - if( power >= 1000000000 ) - { - out = String.format( "Receiving %.3f GW @ %d rad/s.", power / 1000000000.0D, omega ); - } - else if( power >= 1000000 ) - { - out = String.format( "Receiving %.3f MW @ %d rad/s.", power / 1000000.0D, omega ); - } - else if( power >= 1000 ) - { - out = String.format( "Receiving %.3f kW @ %d rad/s.", power / 1000.0D, omega ); - } - else - { - out = String.format( "Receiving %d W @ %d rad/s.", power, omega ); - } - - - ArrayList messages = new ArrayList( 1 ); - messages.add( out ); - return messages; - } -} +//@InterfaceList( value = { @Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver" ), @Interface( iname = "RotaryCraft", iface = "Reika.RotaryCraft.API.Interfaces.Transducerable") } ) +//public abstract class RotaryCraft extends IC2 implements AdvancedShaftPowerReceiver, Transducerable +//{ +// +// private int omega = 0; +// private int torque = 0; +// private long power = 0; +// private int alpha = 0; +// +// private long currentPower = 0; +// +// @TileEvent( TileEventType.TICK ) +// @Method( iname = "RotaryCraft" ) +// public void Tick_RotaryCraft() +// { +// if( this.worldObj != null && !this.worldObj.isRemote && this.currentPower > 0 ) +// { +// this.injectExternalPower( PowerUnits.WA, this.currentPower ); +// this.currentPower = 0; +// } +// } +// +// @Override +// public final boolean addPower( int torque, int omega, long power, ForgeDirection side ) +// { +// this.omega = omega; +// this.torque = torque; +// this.power = power; +// +// this.currentPower += power; +// +// return true; +// +// } +// +// @Override +// public final int getOmega() +// { +// return this.omega; +// } +// +// @Override +// public final int getTorque() +// { +// return this.torque; +// } +// +// @Override +// public final long getPower() +// { +// return this.power; +// } +// +// @Override +// public final String getName() +// { +// return "AE"; +// } +// +// @Override +// public final int getIORenderAlpha() +// { +// return this.alpha; +// } +// +// @Override +// public final void setIORenderAlpha( int io ) +// { +// this.alpha = io; +// } +// +// public final boolean canReadFromBlock( int x, int y, int z ) +// { +// ForgeDirection side = ForgeDirection.UNKNOWN; +// +// if( x == this.xCoord - 1 ) +// { +// side = ForgeDirection.WEST; +// } +// else if( x == this.xCoord + 1 ) +// { +// side = ForgeDirection.EAST; +// } +// else if( z == this.zCoord - 1 ) +// { +// side = ForgeDirection.NORTH; +// } +// else if( z == this.zCoord + 1 ) +// { +// side = ForgeDirection.SOUTH; +// } +// else if( y == this.yCoord - 1 ) +// { +// side = ForgeDirection.DOWN; +// } +// else if( y == this.yCoord + 1 ) +// { +// side = ForgeDirection.UP; +// } +// +// return this.getPowerSides().contains( side ); +// } +// +// @Override +// public final boolean canReadFrom( ForgeDirection side ) +// { +// return this.getPowerSides().contains( side ); +// } +// +// @Override +// public final boolean isReceiving() +// { +// return true; +// } +// +// @Override +// public final int getMinTorque( int available ) +// { +// return 1; +// } +// +// @Override +// public final ArrayList getMessages( World world, int x, int y, int z, int side ) +// { +// String out; +// if( power >= 1000000000 ) +// { +// out = String.format( "Receiving %.3f GW @ %d rad/s.", power / 1000000000.0D, omega ); +// } +// else if( power >= 1000000 ) +// { +// out = String.format( "Receiving %.3f MW @ %d rad/s.", power / 1000000.0D, omega ); +// } +// else if( power >= 1000 ) +// { +// out = String.format( "Receiving %.3f kW @ %d rad/s.", power / 1000.0D, omega ); +// } +// else +// { +// out = String.format( "Receiving %d W @ %d rad/s.", power, omega ); +// } +// +// +// ArrayList messages = new ArrayList( 1 ); +// messages.add( out ); +// return messages; +// } +//} diff --git a/src/main/java/appeng/util/inv/AdaptorBCPipe.java b/src/main/java/appeng/util/inv/AdaptorBCPipe.java index 55442ad6..a6f0828a 100644 --- a/src/main/java/appeng/util/inv/AdaptorBCPipe.java +++ b/src/main/java/appeng/util/inv/AdaptorBCPipe.java @@ -19,108 +19,95 @@ package appeng.util.inv; -import java.util.Iterator; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import appeng.api.config.FuzzyMode; -import appeng.api.util.ForgeDirection; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IBC; -import appeng.util.InventoryAdaptor; -import appeng.util.iterators.NullIterator; - - -public class AdaptorBCPipe extends InventoryAdaptor -{ - - private final IBC bc; - private final TileEntity i; - private final ForgeDirection d; - - public AdaptorBCPipe( TileEntity s, ForgeDirection dd ) - { - this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC ); - if( this.bc != null ) - { - if( this.bc.isPipe( s, dd ) ) - { - this.i = s; - this.d = dd; - return; - } - } - this.i = null; - this.d = null; - } - - @Override - public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination ) - { - return null; - } - - @Override - public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination ) - { - return null; - } - - @Override - public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) - { - return null; - } - - @Override - public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) - { - return null; - } - - @Override - public ItemStack addItems( ItemStack toBeAdded ) - { - if( this.i == null ) - { - return toBeAdded; - } - if( toBeAdded == null ) - { - return null; - } - if( toBeAdded.stackSize == 0 ) - { - return null; - } - - if( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) ) - { - return null; - } - return toBeAdded; - } - - @Override - public ItemStack simulateAdd( ItemStack toBeSimulated ) - { - if( this.i == null ) - { - return toBeSimulated; - } - return null; - } - - @Override - public boolean containsItems() - { - return false; - } - - @Override - public Iterator iterator() - { - return new NullIterator(); - } -} +//public class AdaptorBCPipe extends InventoryAdaptor +//{ +// +// private final IBC bc; +// private final TileEntity i; +// private final ForgeDirection d; +// +// public AdaptorBCPipe( TileEntity s, ForgeDirection dd ) +// { +// this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC ); +// if( this.bc != null ) +// { +// if( this.bc.isPipe( s, dd ) ) +// { +// this.i = s; +// this.d = dd; +// return; +// } +// } +// this.i = null; +// this.d = null; +// } +// +// @Override +// public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination ) +// { +// return null; +// } +// +// @Override +// public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination ) +// { +// return null; +// } +// +// @Override +// public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) +// { +// return null; +// } +// +// @Override +// public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination ) +// { +// return null; +// } +// +// @Override +// public ItemStack addItems( ItemStack toBeAdded ) +// { +// if( this.i == null ) +// { +// return toBeAdded; +// } +// if( toBeAdded == null ) +// { +// return null; +// } +// if( toBeAdded.stackSize == 0 ) +// { +// return null; +// } +// +// if( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) ) +// { +// return null; +// } +// return toBeAdded; +// } +// +// @Override +// public ItemStack simulateAdd( ItemStack toBeSimulated ) +// { +// if( this.i == null ) +// { +// return toBeSimulated; +// } +// return null; +// } +// +// @Override +// public boolean containsItems() +// { +// return false; +// } +// +// @Override +// public Iterator iterator() +// { +// return new NullIterator(); +// } +//} diff --git a/src/main/java/appeng/util/inv/WrapperBCPipe.java b/src/main/java/appeng/util/inv/WrapperBCPipe.java index f7b1c0bc..20105c8f 100644 --- a/src/main/java/appeng/util/inv/WrapperBCPipe.java +++ b/src/main/java/appeng/util/inv/WrapperBCPipe.java @@ -19,105 +19,95 @@ package appeng.util.inv; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import appeng.api.util.ForgeDirection; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; -import appeng.integration.abstraction.IBC; - - -public class WrapperBCPipe implements IInventory -{ - - private final IBC bc; - private final TileEntity ad; - private final ForgeDirection dir; - - public WrapperBCPipe( TileEntity te, ForgeDirection d ) - { - this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC ); - this.ad = te; - this.dir = d; - } - - @Override - public int getSizeInventory() - { - return 1; - } - - @Override - public ItemStack getStackInSlot( int i ) - { - return null; - } - - @Override - public ItemStack decrStackSize( int i, int j ) - { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing( int i ) - { - return null; - } - - @Override - public void setInventorySlotContents( int i, ItemStack itemstack ) - { - this.bc.addItemsToPipe( this.ad, itemstack, this.dir ); - } - - @Override - public String getInventoryName() - { - return "BC Pipe Wrapper"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public void markDirty() - { - - } - - @Override - public boolean isUseableByPlayer( EntityPlayer entityplayer ) - { - return false; - } - - @Override - public void openInventory() - { - - } - - @Override - public void closeInventory() - { - - } - - @Override - public boolean isItemValidForSlot( int i, ItemStack itemstack ) - { - return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir ); - } -} +//public class WrapperBCPipe implements IInventory +//{ +// +// private final IBC bc; +// private final TileEntity ad; +// private final ForgeDirection dir; +// +// public WrapperBCPipe( TileEntity te, ForgeDirection d ) +// { +// this.bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC ); +// this.ad = te; +// this.dir = d; +// } +// +// @Override +// public int getSizeInventory() +// { +// return 1; +// } +// +// @Override +// public ItemStack getStackInSlot( int i ) +// { +// return null; +// } +// +// @Override +// public ItemStack decrStackSize( int i, int j ) +// { +// return null; +// } +// +// @Override +// public ItemStack getStackInSlotOnClosing( int i ) +// { +// return null; +// } +// +// @Override +// public void setInventorySlotContents( int i, ItemStack itemstack ) +// { +// this.bc.addItemsToPipe( this.ad, itemstack, this.dir ); +// } +// +// @Override +// public String getInventoryName() +// { +// return "BC Pipe Wrapper"; +// } +// +// @Override +// public boolean hasCustomInventoryName() +// { +// return false; +// } +// +// @Override +// public int getInventoryStackLimit() +// { +// return 64; +// } +// +// @Override +// public void markDirty() +// { +// +// } +// +// @Override +// public boolean isUseableByPlayer( EntityPlayer entityplayer ) +// { +// return false; +// } +// +// @Override +// public void openInventory() +// { +// +// } +// +// @Override +// public void closeInventory() +// { +// +// } +// +// @Override +// public boolean isItemValidForSlot( int i, ItemStack itemstack ) +// { +// return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir ); +// } +//} diff --git a/src/main/java/appeng/util/inv/WrapperTEPipe.java b/src/main/java/appeng/util/inv/WrapperTEPipe.java index 6a6d546f..0858bdcb 100644 --- a/src/main/java/appeng/util/inv/WrapperTEPipe.java +++ b/src/main/java/appeng/util/inv/WrapperTEPipe.java @@ -19,100 +19,93 @@ package appeng.util.inv; -import appeng.api.util.ForgeDirection; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - - -public class WrapperTEPipe implements IInventory -{ - - final TileEntity ad; - final ForgeDirection dir; - - public WrapperTEPipe( TileEntity te, ForgeDirection d ) - { - this.ad = te; - this.dir = d; - } - - @Override - public int getSizeInventory() - { - return 1; - } - - @Override - public ItemStack getStackInSlot( int i ) - { - return null; - } - - @Override - public ItemStack decrStackSize( int i, int j ) - { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing( int i ) - { - return null; - } - - @Override - public void setInventorySlotContents( int i, ItemStack itemstack ) - { - // ITE.addItemsToPipe( ad, itemstack, dir ); - } - - @Override - public String getInventoryName() - { - return null; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public void markDirty() - { - - } - - @Override - public boolean isUseableByPlayer( EntityPlayer entityplayer ) - { - return false; - } - - @Override - public void openInventory() - { - - } - - @Override - public void closeInventory() - { - - } - - @Override - public boolean isItemValidForSlot( int i, ItemStack itemstack ) - { - return false; - } -} +//public class WrapperTEPipe implements IInventory +//{ +// +// final TileEntity ad; +// final ForgeDirection dir; +// +// public WrapperTEPipe( TileEntity te, ForgeDirection d ) +// { +// this.ad = te; +// this.dir = d; +// } +// +// @Override +// public int getSizeInventory() +// { +// return 1; +// } +// +// @Override +// public ItemStack getStackInSlot( int i ) +// { +// return null; +// } +// +// @Override +// public ItemStack decrStackSize( int i, int j ) +// { +// return null; +// } +// +// @Override +// public ItemStack getStackInSlotOnClosing( int i ) +// { +// return null; +// } +// +// @Override +// public void setInventorySlotContents( int i, ItemStack itemstack ) +// { +// // ITE.addItemsToPipe( ad, itemstack, dir ); +// } +// +// @Override +// public String getInventoryName() +// { +// return null; +// } +// +// @Override +// public boolean hasCustomInventoryName() +// { +// return false; +// } +// +// @Override +// public int getInventoryStackLimit() +// { +// return 64; +// } +// +// @Override +// public void markDirty() +// { +// +// } +// +// @Override +// public boolean isUseableByPlayer( EntityPlayer entityplayer ) +// { +// return false; +// } +// +// @Override +// public void openInventory() +// { +// +// } +// +// @Override +// public void closeInventory() +// { +// +// } +// +// @Override +// public boolean isItemValidForSlot( int i, ItemStack itemstack ) +// { +// return false; +// } +//} diff --git a/src/main/java/appeng/util/item/AEFluidStack.java b/src/main/java/appeng/util/item/AEFluidStack.java index 8404715f..6566f3f8 100644 --- a/src/main/java/appeng/util/item/AEFluidStack.java +++ b/src/main/java/appeng/util/item/AEFluidStack.java @@ -19,22 +19,22 @@ package appeng.util.item; -import io.netty.buffer.ByteBuf; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; - import javax.annotation.Nonnull; +import io.netty.buffer.ByteBuf; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; + import appeng.api.config.FuzzyMode; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEFluidStack; @@ -302,7 +302,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu { FluidStack is = (FluidStack) ia; - if( is.fluidID == this.fluid.getID() ) + if( is.getFluidID() == this.fluid.getID() ) { NBTTagCompound ta = (NBTTagCompound) this.tagCompound; NBTTagCompound tb = is.tag;