diff --git a/common/mekanism/induction/client/InductionClientProxy.java b/common/mekanism/induction/client/InductionClientProxy.java index 4d65ae63d..4de173338 100644 --- a/common/mekanism/induction/client/InductionClientProxy.java +++ b/common/mekanism/induction/client/InductionClientProxy.java @@ -52,11 +52,11 @@ public class InductionClientProxy extends InductionCommonProxy { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - if (tileEntity instanceof TileEntityMultimeter) + if(tileEntity instanceof TileEntityMultimeter) { return new GuiMultimeter(player.inventory, ((TileEntityMultimeter) tileEntity)); } - else if (tileEntity instanceof TileEntityBattery) + else if(tileEntity instanceof TileEntityBattery) { return new GuiBattery(player.inventory, ((TileEntityBattery) tileEntity)); } @@ -64,25 +64,6 @@ public class InductionClientProxy extends InductionCommonProxy return null; } - @Override - public boolean isPaused() - { - if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic()) - { - GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen; - - if (screen != null) - { - if (screen.doesGuiPauseGame()) - { - return true; - } - } - } - - return false; - } - @Override public boolean isFancy() { @@ -92,7 +73,7 @@ public class InductionClientProxy extends InductionCommonProxy @Override public void renderElectricShock(World world, Vector3 start, Vector3 target, float r, float g, float b, boolean split) { - if (world.isRemote) + if(world.isRemote) { FMLClientHandler.instance().getClient().effectRenderer.addEffect(new FXElectricBolt(world, start, target, split).setColor(r, g, b)); } diff --git a/common/mekanism/induction/common/InductionCommonProxy.java b/common/mekanism/induction/common/InductionCommonProxy.java index 760c6acfa..1f1031c77 100644 --- a/common/mekanism/induction/common/InductionCommonProxy.java +++ b/common/mekanism/induction/common/InductionCommonProxy.java @@ -25,7 +25,9 @@ public class InductionCommonProxy implements IGuiHandler public void registerRenderers() { Mekanism.configuration.load(); - MekanismInduction.FURNACE_WATTAGE = (float) Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage Per Tick", MekanismInduction.FURNACE_WATTAGE).getDouble(MekanismInduction.FURNACE_WATTAGE); + MekanismInduction.SOUND_FXS = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", MekanismInduction.SOUND_FXS).getBoolean(MekanismInduction.SOUND_FXS); + MekanismInduction.LO_FI_INSULATION = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Use lo-fi insulation texture", MekanismInduction.LO_FI_INSULATION).getBoolean(MekanismInduction.LO_FI_INSULATION); + MekanismInduction.SHINY_SILVER = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", MekanismInduction.SHINY_SILVER).getBoolean(MekanismInduction.SHINY_SILVER); MekanismInduction.MAX_CONTRACTOR_DISTANCE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MekanismInduction.MAX_CONTRACTOR_DISTANCE).getInt(MekanismInduction.MAX_CONTRACTOR_DISTANCE); TileEntityEMContractor.ACCELERATION = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Contractor Item Acceleration", TileEntityEMContractor.ACCELERATION).getDouble(TileEntityEMContractor.ACCELERATION); @@ -40,13 +42,13 @@ public class InductionCommonProxy implements IGuiHandler { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - if (tileEntity instanceof TileEntityMultimeter) + if(tileEntity instanceof TileEntityMultimeter) { - return new ContainerMultimeter(player.inventory, ((TileEntityMultimeter) tileEntity)); + return new ContainerMultimeter(player.inventory, ((TileEntityMultimeter)tileEntity)); } - else if (tileEntity instanceof TileEntityBattery) + else if(tileEntity instanceof TileEntityBattery) { - return new ContainerBattery(player.inventory, ((TileEntityBattery) tileEntity)); + return new ContainerBattery(player.inventory, ((TileEntityBattery)tileEntity)); } return null; @@ -58,45 +60,35 @@ public class InductionCommonProxy implements IGuiHandler return null; } - public boolean isPaused() - { - return false; - } - - public void renderElectricShock(World world, Vector3 start, Vector3 target, float r, float g, float b, boolean split) - { - - } + public void renderElectricShock(World world, Vector3 start, Vector3 target, float r, float g, float b, boolean split) {} public void renderElectricShock(World world, Vector3 start, Vector3 target, float r, float g, float b) { - this.renderElectricShock(world, start, target, r, g, b, true); + renderElectricShock(world, start, target, r, g, b, true); } public void renderElectricShock(World world, Vector3 start, Vector3 target, Vector3 color) { - this.renderElectricShock(world, start, target, (float) color.x, (float) color.y, (float) color.z); + renderElectricShock(world, start, target, (float)color.x, (float)color.y, (float)color.z); } public void renderElectricShock(World world, Vector3 start, Vector3 target, Vector3 color, boolean split) { - this.renderElectricShock(world, start, target, (float) color.x, (float) color.y, (float) color.z, split); + renderElectricShock(world, start, target, (float)color.x, (float)color.y, (float)color.z, split); } public void renderElectricShock(World world, Vector3 start, Vector3 target) { - this.renderElectricShock(world, start, target, true); + renderElectricShock(world, start, target, true); } public void renderElectricShock(World world, Vector3 start, Vector3 target, boolean b) { - this.renderElectricShock(world, start, target, 0.55f, 0.7f, 1f, b); - + renderElectricShock(world, start, target, 0.55f, 0.7f, 1f, b); } public boolean isFancy() { return false; } - } diff --git a/common/mekanism/induction/common/MekanismInduction.java b/common/mekanism/induction/common/MekanismInduction.java index 662e97271..3ec2b136d 100644 --- a/common/mekanism/induction/common/MekanismInduction.java +++ b/common/mekanism/induction/common/MekanismInduction.java @@ -15,8 +15,6 @@ import mekanism.induction.common.block.BlockEMContractor; import mekanism.induction.common.block.BlockMultimeter; import mekanism.induction.common.block.BlockTesla; import mekanism.induction.common.block.BlockWire; -import mekanism.induction.common.furnace.BlockAdvancedFurnace; -import mekanism.induction.common.furnace.TileEntityAdvancedFurnace; import mekanism.induction.common.item.ItemBlockContractor; import mekanism.induction.common.item.ItemBlockMultimeter; import mekanism.induction.common.item.ItemBlockWire; @@ -30,7 +28,6 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -63,8 +60,6 @@ public class MekanismInduction implements IModule /** MekanismInduction version number */ public static Version versionNumber = new Version(5, 6, 0); - /** - */ public static final String DOMAIN = "mekanism"; public static final String PREFIX = DOMAIN + ":"; public static final String DIRECTORY = "/assets/" + DOMAIN + "/"; @@ -77,11 +72,9 @@ public class MekanismInduction implements IModule /** * Settings */ - public static float FURNACE_WATTAGE = 0.5f; public static boolean SOUND_FXS = true; public static boolean LO_FI_INSULATION = false; public static boolean SHINY_SILVER = true; - public static boolean ENABLE_ADVANCED_FURNACE = false; /** Block ID by Jyzarc */ private static final int BLOCK_ID_PREFIX = 3200; @@ -105,14 +98,13 @@ public class MekanismInduction implements IModule /** With Forge Multipart; Use EnumWireMaterial reference. **/ private static Item itemPartWire; - // Blocks + //Blocks public static Block Tesla; public static Block Multimeter; public static Block ElectromagneticContractor; public static Block Battery; /** Without Forge Multipart **/ private static Block blockWire; - public static Block blockAdvancedFurnaceIdle, blockAdvancedFurnaceBurning; public static final Vector3[] DYE_COLORS = new Vector3[] { new Vector3(), new Vector3(1, 0, 0), new Vector3(0, 0.608, 0.232), new Vector3(0.588, 0.294, 0), new Vector3(0, 0, 1), new Vector3(0.5, 0, 05), new Vector3(0, 1, 1), new Vector3(0.8, 0.8, 0.8), new Vector3(0.3, 0.3, 0.3), new Vector3(1, 0.412, 0.706), new Vector3(0.616, 1, 0), new Vector3(1, 1, 0), new Vector3(0.46f, 0.932, 1), new Vector3(0.5, 0.2, 0.5), new Vector3(0.7, 0.5, 0.1), new Vector3(1, 1, 1) }; @@ -121,66 +113,33 @@ public class MekanismInduction implements IModule { NetworkRegistry.instance().registerGuiHandler(this, MekanismInduction.proxy); MinecraftForge.EVENT_BUS.register(new MultimeterEventHandler()); - Mekanism.configuration.load(); - - // Config - FURNACE_WATTAGE = (float) Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Furnace Wattage", FURNACE_WATTAGE).getDouble(FURNACE_WATTAGE); - SOUND_FXS = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Tesla Sound FXs", SOUND_FXS).getBoolean(SOUND_FXS); - LO_FI_INSULATION = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Use lo-fi insulation texture", LO_FI_INSULATION).getBoolean(LO_FI_INSULATION); - SHINY_SILVER = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Shiny silver wires", SHINY_SILVER).getBoolean(SHINY_SILVER); - MAX_CONTRACTOR_DISTANCE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Max EM Contractor Path", MAX_CONTRACTOR_DISTANCE).getInt(MAX_CONTRACTOR_DISTANCE); - - // Enable advanced vanilla furnace with Mekanism Generators is NOT installed. - ENABLE_ADVANCED_FURNACE = Loader.isModLoaded("MekanismGenerators"); - - ENABLE_ADVANCED_FURNACE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Enable Vanilla Electric Furnace", ENABLE_ADVANCED_FURNACE).getBoolean(ENABLE_ADVANCED_FURNACE); - - TileEntityEMContractor.ACCELERATION = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Contractor Item Acceleration", TileEntityEMContractor.ACCELERATION).getDouble(TileEntityEMContractor.ACCELERATION); - TileEntityEMContractor.MAX_REACH = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Reach", TileEntityEMContractor.MAX_REACH).getInt(TileEntityEMContractor.MAX_REACH); - TileEntityEMContractor.MAX_SPEED = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Contractor Max Item Speed", TileEntityEMContractor.MAX_SPEED).getDouble(TileEntityEMContractor.MAX_SPEED); - TileEntityEMContractor.PUSH_DELAY = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "Contractor Item Push Delay", TileEntityEMContractor.PUSH_DELAY).getInt(TileEntityEMContractor.PUSH_DELAY); //Register Items - if (Loader.isModLoaded("ForgeMultipart")) + if(Loader.isModLoaded("ForgeMultipart")) { - try - { - itemPartWire = (Item) Class.forName("mekanism.induction.common.wire.ItemPartWire").getDeclaredConstructor(Integer.TYPE).newInstance(getNextItemID()); + try { + itemPartWire = (Item)Class.forName("mekanism.induction.common.wire.ItemPartWire").getDeclaredConstructor(Integer.TYPE).newInstance(getNextItemID()); Mekanism.logger.fine("Mekanism Induction multipart loaded."); - } - catch (Exception e) - { + } catch(Exception e) { Mekanism.logger.severe("Failed to load multipart wire."); e.printStackTrace(); } } - else - { + else { Mekanism.logger.fine("Mekanism Induction Multipart disabled due to Forge Multipart not found."); } - // Blocks + //Blocks Tesla = new BlockTesla(Mekanism.configuration.getBlock("Tesla", getNextBlockID()).getInt()).setUnlocalizedName("Tesla"); Multimeter = new BlockMultimeter(Mekanism.configuration.getBlock("Multimeter", getNextBlockID()).getInt()).setUnlocalizedName("Multimeter"); ElectromagneticContractor = new BlockEMContractor(Mekanism.configuration.getBlock("ElectromagneticContractor", getNextBlockID()).getInt()).setUnlocalizedName("ElectromagneticContractor"); Battery = new BlockBattery(Mekanism.configuration.getBlock("Battery", getNextBlockID()).getInt()).setUnlocalizedName("Battery"); - if (itemPartWire == null) + if(itemPartWire == null) { blockWire = new BlockWire(getNextBlockID()); } - if (ENABLE_ADVANCED_FURNACE) - { - blockAdvancedFurnaceIdle = BlockAdvancedFurnace.createNew(false); - blockAdvancedFurnaceBurning = BlockAdvancedFurnace.createNew(true); - - GameRegistry.registerBlock(blockAdvancedFurnaceIdle, "ri_" + blockAdvancedFurnaceIdle.getUnlocalizedName()); - GameRegistry.registerBlock(blockAdvancedFurnaceBurning, "ri_" + blockAdvancedFurnaceBurning.getUnlocalizedName() + "2"); - - GameRegistry.registerTileEntity(TileEntityAdvancedFurnace.class, blockAdvancedFurnaceIdle.getUnlocalizedName()); - } - Mekanism.configuration.save(); GameRegistry.registerBlock(Tesla, "Tesla"); @@ -188,35 +147,34 @@ public class MekanismInduction implements IModule GameRegistry.registerBlock(ElectromagneticContractor, ItemBlockContractor.class, "ElectromagneticContractor"); GameRegistry.registerBlock(Battery, "Battery"); - // Tiles - if (blockWire != null) + //Tiles + if(blockWire != null) { GameRegistry.registerBlock(blockWire, ItemBlockWire.class, blockWire.getUnlocalizedName()); } - // Tiles + //Tiles GameRegistry.registerTileEntity(TileEntityTesla.class, "Tesla"); GameRegistry.registerTileEntity(TileEntityMultimeter.class, "Multimeter"); GameRegistry.registerTileEntity(TileEntityEMContractor.class, "ElectromagneticContractor"); GameRegistry.registerTileEntity(TileEntityBattery.class, "Battery"); - if (blockWire != null) + if(blockWire != null) { GameRegistry.registerTileEntity(TileEntityWire.class, blockWire.getUnlocalizedName()); } MekanismInduction.proxy.registerRenderers(); - if (itemPartWire != null) + if(itemPartWire != null) { - for (EnumWireMaterial material : EnumWireMaterial.values()) + for(EnumWireMaterial material : EnumWireMaterial.values()) { material.setWire(itemPartWire); } } - else - { - for (EnumWireMaterial material : EnumWireMaterial.values()) + else { + for(EnumWireMaterial material : EnumWireMaterial.values()) { material.setWire(blockWire); } @@ -226,17 +184,14 @@ public class MekanismInduction implements IModule @EventHandler public void init(FMLInitializationEvent evt) { - // Add this module to the core list + //Add this module to the core list Mekanism.modulesLoaded.add(this); - if (itemPartWire != null) + if(itemPartWire != null) { - try - { + try { Class.forName("mekanism.induction.common.MultipartMI").newInstance(); - } - catch (Exception e) - { + } catch(Exception e) { e.printStackTrace(); Mekanism.logger.severe("Failed to initiate Mekanism Induction multipart module."); } @@ -275,52 +230,13 @@ public class MekanismInduction implements IModule GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", "MEM", "MMM", 'M', Item.ingotGold, 'E', Item.eyeOfEnder)); /** Wire Compatiblity **/ - if (Loader.isModLoaded("IC2")) + if(Loader.isModLoaded("IC2")) { GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire(), Items.getItem("copperCableItem"))); GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.TIN.getWire(), Items.getItem("tinCableItem"))); GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.IRON.getWire(), Items.getItem("ironCableItem"))); GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(), Items.getItem("glassFiberCableItem"))); } - - if (Loader.isModLoaded("Mekanism")) - { - GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire(), "universalCable")); - } - - if (ENABLE_ADVANCED_FURNACE) - { - /** Inject new furnace tile class */ - replaceTileEntity(TileEntityFurnace.class, TileEntityAdvancedFurnace.class); - } - } - - public static void replaceTileEntity(Class findTile, Class replaceTile) - { - try - { - Map nameToClassMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_a", "nameToClassMap", "a"); - Map classToNameMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_b", "classToNameMap", "b"); - - String findTileID = classToNameMap.get(findTile); - - if (findTileID != null) - { - nameToClassMap.put(findTileID, replaceTile); - classToNameMap.put(replaceTile, findTileID); - classToNameMap.remove(findTile); - Mekanism.logger.fine("Replaced TileEntity: " + findTile); - } - else - { - Mekanism.logger.severe("Failed to replace TileEntity: " + findTile); - } - } - catch (Exception e) - { - Mekanism.logger.severe("Failed to replace TileEntity: " + findTile); - e.printStackTrace(); - } } @Override diff --git a/common/mekanism/induction/common/furnace/BlockAdvancedFurnace.java b/common/mekanism/induction/common/furnace/BlockAdvancedFurnace.java deleted file mode 100644 index 4cd3def06..000000000 --- a/common/mekanism/induction/common/furnace/BlockAdvancedFurnace.java +++ /dev/null @@ -1,59 +0,0 @@ -package mekanism.induction.common.furnace; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockFurnace; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -/** - * @author Calclavia - * - */ -public class BlockAdvancedFurnace extends BlockFurnace -{ - protected BlockAdvancedFurnace(int id, boolean isBurning) - { - super(id, isBurning); - this.setHardness(3.5F); - this.setStepSound(soundStoneFootstep); - this.setUnlocalizedName("furnace"); - - if (isBurning) - { - this.setLightValue(0.875F); - } - else - { - this.setCreativeTab(CreativeTabs.tabDecorations); - } - } - - public static BlockAdvancedFurnace createNew(boolean isBurning) - { - int id = Block.furnaceIdle.blockID; - - if (isBurning) - { - id = Block.furnaceBurning.blockID; - } - - Block.blocksList[id] = null; - Item.itemsList[id] = null; - return new BlockAdvancedFurnace(id, isBurning); - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, int newID) - { - super.onNeighborBlockChange(world, x, y, z, newID); - ((TileEntityAdvancedFurnace)world.getBlockTileEntity(x, y, z)).checkProduce(); - } - - @Override - public TileEntity createNewTileEntity(World par1World) - { - return new TileEntityAdvancedFurnace(); - } -} \ No newline at end of file diff --git a/common/mekanism/induction/common/furnace/TileEntityAdvancedFurnace.java b/common/mekanism/induction/common/furnace/TileEntityAdvancedFurnace.java deleted file mode 100644 index d49ec2720..000000000 --- a/common/mekanism/induction/common/furnace/TileEntityAdvancedFurnace.java +++ /dev/null @@ -1,246 +0,0 @@ -package mekanism.induction.common.furnace; - -import mekanism.induction.common.MekanismInduction; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraftforge.common.ForgeDirection; -import universalelectricity.core.block.IConductor; -import universalelectricity.core.block.IElectrical; -import universalelectricity.core.electricity.ElectricityHelper; -import universalelectricity.core.electricity.ElectricityPack; -import universalelectricity.core.grid.IElectricityNetwork; -import universalelectricity.core.vector.Vector3; -import universalelectricity.core.vector.VectorHelper; - -/** - * Meant to replace the furnace class. - * - * @author Calclavia - * - */ -public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IElectrical -{ - private static final float WATTAGE = 5; - private boolean doProduce = false; - private boolean init = true; - private float energyBuffer = 0; - - @Override - public void updateEntity() - { - if (this.init) - { - this.checkProduce(); - this.init = false; - } - - if (this.energyBuffer >= MekanismInduction.FURNACE_WATTAGE / 20) - { - this.furnaceCookTime++; - - if (this.furnaceCookTime == 200) - { - this.furnaceCookTime = 0; - this.smeltItem(); - this.onInventoryChanged(); - } - - this.energyBuffer = 0; - } - else - { - super.updateEntity(); - - if (this.doProduce) - { - if (this.getStackInSlot(0) == null) - { - boolean hasRequest = false; - - for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(direction).getTileEntity(this.worldObj); - - if (tileEntity instanceof IConductor) - { - if (((IConductor) tileEntity).getNetwork().getRequest(this).getWatts() > 0) - { - if (this.furnaceBurnTime > 0) - { - this.produceUE(direction); - } - - hasRequest = true; - break; - } - } - } - - if (hasRequest) - { - /** - * Steal power from furnace. - */ - boolean doBlockStateUpdate = this.furnaceBurnTime > 0; - - if (this.furnaceBurnTime == 0) - { - int burnTime = TileEntityFurnace.getItemBurnTime(this.getStackInSlot(1)); - this.decrStackSize(1, 1); - this.furnaceBurnTime = burnTime; - } - - if (doBlockStateUpdate != this.furnaceBurnTime > 0) - { - // BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0, - // this.worldObj, this.xCoord, this.yCoord, this.zCoord); - this.refreshConductors(); - } - } - } - } - } - } - - /** - * Checks if the furnace should produce power. - */ - public void checkProduce() - { - for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(direction).getTileEntity(this.worldObj); - - if (tileEntity instanceof IConductor) - { - this.doProduce = true; - return; - } - } - - this.doProduce = false; - } - - public void refreshConductors() - { - for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) - { - TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(direction).getTileEntity(this.worldObj); - - if (tileEntity instanceof IConductor) - { - ((IConductor) tileEntity).refresh(); - } - } - } - - /** - * Produces UE power towards a specific direction. - * - * @param outputDirection - The output direction. - */ - public boolean produceUE(ForgeDirection outputDirection) - { - if (!this.worldObj.isRemote && outputDirection != null && outputDirection != ForgeDirection.UNKNOWN) - { - float provide = this.getProvide(outputDirection); - - if (provide > 0) - { - TileEntity outputTile = VectorHelper.getConnectorFromSide(this.worldObj, new Vector3(this), outputDirection); - IElectricityNetwork outputNetwork = ElectricityHelper.getNetworkFromTileEntity(outputTile, outputDirection); - - if (outputNetwork != null) - { - ElectricityPack powerRequest = outputNetwork.getRequest(this); - - if (powerRequest.getWatts() > 0) - { - ElectricityPack sendPack = ElectricityPack.getFromWatts(provide, this.getVoltage()); - float rejectedPower = outputNetwork.produce(sendPack, this); - this.provideElectricity(outputDirection.getOpposite(), ElectricityPack.getFromWatts(sendPack.getWatts() - rejectedPower, this.getVoltage()), true); - } - - return true; - } - } - } - - return false; - } - - @Override - public boolean canConnect(ForgeDirection direction) - { - return true; - } - - private boolean canSmelt() - { - if (this.getStackInSlot(0) == null) - { - return false; - } - else - { - ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.getStackInSlot(0)); - if (itemstack == null) - return false; - if (this.getStackInSlot(2) == null) - return true; - if (!this.getStackInSlot(2).isItemEqual(itemstack)) - return false; - int result = getStackInSlot(2).stackSize + itemstack.stackSize; - return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); - } - } - - @Override - public float receiveElectricity(ForgeDirection from, ElectricityPack receive, boolean doReceive) - { - if (doReceive) - { - this.energyBuffer += receive.getWatts(); - return 0; - } - - return receive.getWatts(); - } - - @Override - public ElectricityPack provideElectricity(ForgeDirection from, ElectricityPack request, boolean doProvide) - { - return ElectricityPack.getFromWatts(MekanismInduction.FURNACE_WATTAGE / 20, this.getVoltage()); - } - - @Override - public float getRequest(ForgeDirection direction) - { - if (this.canSmelt() && this.getStackInSlot(1) == null && this.furnaceBurnTime == 0) - { - return MekanismInduction.FURNACE_WATTAGE / 20; - } - - return 0; - } - - @Override - public float getProvide(ForgeDirection direction) - { - if (this.furnaceBurnTime > 0) - { - return MekanismInduction.FURNACE_WATTAGE / 20; - } - - return 0; - } - - @Override - public float getVoltage() - { - return 0.12f; - } - -} \ No newline at end of file