minor refactorings

This commit is contained in:
SpaceToad 2014-05-05 11:15:17 +02:00
parent ebe0b1c0f6
commit 5ad4b53120
5 changed files with 59 additions and 21 deletions

View file

@ -1,7 +1,16 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.mj; package buildcraft.api.mj;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.IPowerReceptor;

View file

@ -9,6 +9,7 @@
package buildcraft.api.power; package buildcraft.api.power;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.core.SafeTimeTracker;
@ -188,24 +189,29 @@ public final class PowerHandler {
/** /**
* Setup your PowerHandler's settings. * Setup your PowerHandler's settings.
* *
* @param minEnergyReceived This is the minimum about of power that will be * @param minEnergyReceived
* accepted by the PowerHandler. This should generally be greater than the * This is the minimum about of power that will be accepted by
* activationEnergy if you plan to use the doWork() callback. Anything * the PowerHandler. This should generally be greater than the
* greater than 1 will prevent Redstone Engines from powering this Provider. * activationEnergy if you plan to use the doWork() callback.
* @param maxEnergyReceivedI The maximum amount of power accepted by the * Anything greater than 1 will prevent Redstone Engines from
* PowerHandler. This should generally be less than 500. Too low and larger * powering this Provider.
* engines will overheat while trying to power the machine. Too high, and * @param maxEnergyReceived
* the engines will never warm up. Greater values also place greater strain * The maximum amount of power accepted by the PowerHandler. This
* on the power net. * should generally be less than 500. Too low and larger engines
* @param activationEnergy If the stored energy is greater than this value, * will overheat while trying to power the machine. Too high, and
* the doWork() callback is called (once per tick). * the engines will never warm up. Greater values also place
* @param maxStoredEnergy The maximum amount of power this PowerHandler can * greater strain on the power net.
* store. Values tend to range between 100 and 5000. With 1000 and 1500 * @param activationEnergy
* being common. * If the stored energy is greater than this value, the doWork()
* callback is called (once per tick).
* @param maxStoredEnergy
* The maximum amount of power this PowerHandler can store.
* Values tend to range between 100 and 5000. With 1000 and 1500
* being common.
*/ */
public void configure(double minEnergyReceived, double maxEnergyReceivedI, double activationEnergy, public void configure(double minEnergyReceived, double maxEnergyReceived, double activationEnergy,
double maxStoredEnergy) { double maxStoredEnergy) {
double localMaxEnergyReceived = maxEnergyReceivedI; double localMaxEnergyReceived = maxEnergyReceived;
if (minEnergyReceived > localMaxEnergyReceived) { if (minEnergyReceived > localMaxEnergyReceived) {
localMaxEnergyReceived = minEnergyReceived; localMaxEnergyReceived = minEnergyReceived;
@ -496,7 +502,7 @@ public final class PowerHandler {
} }
} }
private class AnonymousBattery { private static class AnonymousBattery {
@MjBattery @MjBattery
public double mjStored; public double mjStored;
} }

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy; package buildcraft.energy;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;

View file

@ -1,6 +1,13 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy; package buildcraft.energy;
import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -8,8 +15,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import buildcraft.core.utils.StringUtils;
public class ItemEnergyConverter extends ItemBlock { public class ItemEnergyConverter extends ItemBlock {
public ItemEnergyConverter(Block block) { public ItemEnergyConverter(Block block) {
super(block); super(block);
@ -20,6 +25,7 @@ public class ItemEnergyConverter extends ItemBlock {
super.addInformation(itemStack, player, list, adv); super.addInformation(itemStack, player, list, adv);
list.add(TileEnergyConverter.getLocalizedModeName(itemStack)); list.add(TileEnergyConverter.getLocalizedModeName(itemStack));
list.add(""); list.add("");
list.addAll(Arrays.asList(StringUtils.localize("tile.energyConverter.tooltip").split("\\|"))); // This is a bit too big in the tooltip at this stage.
// list.addAll(Arrays.asList(StringUtils.localize("tile.energyConverter.tooltip").split("\\|")));
} }
} }

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy; package buildcraft.energy;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -6,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.NetworkData; import buildcraft.api.core.NetworkData;