Auto-Sync

This commit is contained in:
DarkGuardsman 2013-10-09 12:25:34 -04:00
parent b5fd22ff24
commit fba2cfcd8d
20 changed files with 54 additions and 52 deletions

View file

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
/** Generic class for link objects of the same class type to each other.
*
*
* @author Robert Seifert */
public class Group<J>
{

View file

@ -1,7 +1,7 @@
package com.builtbroken.common;
/** Container for two objects
*
*
* @author Robert Seifert */
public class Pair<L, R>
{

View file

@ -1,7 +1,7 @@
package com.builtbroken.common;
/** Class to track a user. Mainly used to create groups of users
*
*
* @author Robert Seifert */
public class User
{

View file

@ -4,7 +4,7 @@ package com.builtbroken.common.science;
* parts but each element should have a listed names, symbol, and atomic mass. Atomic number should
* be the placement # in the list. Var ZERO should not be used as its designed to offset the
* placement of all elements by one. As well is returned instead of null.
*
*
* @Source http://www.periodictable.com/Properties/A/SpecificHeat.an.html
* @source http://www.chemicalelements.com/
* @source http://www.lenntech.com/periodic/periodic-chart.htm

View file

@ -1,22 +1,21 @@
package com.builtbroken.common.science;
/** Helper class that does the work of basic formulas.
*
*
* @Note: Unless stated other wise the formulas don't care what the units are as long as the match
* up. Eg pressure can be in any unit as long as all pressures for the method are the same unit
*
*
* @Note: Some of these methods are very simple but they remove the confusion involved in rewriting
* the code for each use
*
*
* @author Robert Seifert */
public class FormulaHelper
{
public static final float ACCELERATION_EARTH = 9.80665f;
public static final float ACCELERATION_MOON = 1.622f;
/** Gay-Lussac's Law (P1/T1 = P2/T2)
*
*
* @param pressure - original pressure
* @param temp - original tempature
* @param newTemp - new tempature
@ -42,7 +41,7 @@ public class FormulaHelper
}
/** Calculates change from original value to new value
*
*
* @param a - original value
* @param b - new value
* @return change in value from original to new */

View file

@ -1,7 +1,7 @@
package com.builtbroken.common.science.units;
/** Units of measure for work with electricity
*
*
* @author Robert Seifert */
public enum ElectricUnit
{

View file

@ -1,9 +1,13 @@
package com.builtbroken.common.science.units;
/** Units of measure for force
*
*
* @author Rsobert Seifert */
public enum ForceUnit
{
N(), dyn(), kp(), Ib(), pdl();
N(),
dyn(),
kp(),
Ib(),
pdl();
}

View file

@ -4,8 +4,8 @@ package com.builtbroken.common.science.units;
* @author Robert Seifert */
public enum ImperialUnits
{
thou("thou", "th", (float) (1 / 12000)),
inch("inch", "in", (float) (1 / 12)),
thou("thou", "th", (1 / 12000)),
inch("inch", "in", (1 / 12)),
foot("foot", "ft", 1),
yard("yard", "yd", 3),
chain("chain", "ch", 66),
@ -23,9 +23,9 @@ public enum ImperialUnits
nautical("nautical mile", "", 6080),
/** Gunter's sruvey unit */
link("link", "", (float) (66 / 100)),
link("link", "", (66 / 100)),
/** Gunter's sruvey unit */
rod("rod", "", (float) (66 / 4));
rod("rod", "", (66 / 4));
public String name, symbol;
float toFeet;

View file

@ -1,7 +1,7 @@
package com.builtbroken.common.science.units;
/** Metric measurement system units
*
*
* @author Robert Seifert */
public enum MetricUnit
{
@ -112,7 +112,7 @@ public enum MetricUnit
}
/** Rounds a number to a specific number place places
*
*
* @param The number
* @return The rounded number */
public static double roundDecimals(double d, int decimalPlaces)

View file

@ -1,7 +1,7 @@
package com.builtbroken.common.science.units;
/** Enum that stores common units used to measure pressure.
*
*
* @source http://en.wikipedia.org/wiki/Atmosphere_(unit)
* @source http://en.wikipedia.org/wiki/Dyne
* @Source http://en.wikipedia.org/wiki/Kilogram-force

View file

@ -1,17 +1,19 @@
package com.builtbroken.common.science.units;
/** Units of measure for temperature
*
*
* @author Robert Seifert */
public enum TemperatureUnit
{
Fahrenheit("Fahrenheit", "F", new ITempConversion()
{
@Override
public float toKelvin(float temp)
{
return (float) ((temp + 459.67) * (5 / 9));
}
@Override
public float fromKelvin(float temp)
{
return (float) ((temp * (9 / 5)) - 459.67);
@ -20,11 +22,13 @@ public enum TemperatureUnit
}),
Celsius("Celsius", "C", new ITempConversion()
{
@Override
public float toKelvin(float temp)
{
return (float) (temp + 273.15);
}
@Override
public float fromKelvin(float temp)
{
return (float) (temp - 273.15);
@ -33,11 +37,13 @@ public enum TemperatureUnit
}),
Rankine("Rankine", "R", new ITempConversion()
{
@Override
public float toKelvin(float temp)
{
return (float) (temp * (5 / 9));
return (temp * (5 / 9));
}
@Override
public float fromKelvin(float temp)
{
return temp * (9 / 5);
@ -46,11 +52,13 @@ public enum TemperatureUnit
}),
Kelvin("Degrees", "F", new ITempConversion()
{
@Override
public float toKelvin(float temp)
{
return temp;
}
@Override
public float fromKelvin(float temp)
{
return temp;

View file

@ -10,7 +10,7 @@ public class UnitHelper
public static final float FEET_TO_METERS = 0.3048f;
public static final float METERS_TO_FEET = 3.28084f;
public static List<Character> numbers = new ArrayList<>();
public static List<Character> numbers = new ArrayList<Character>();
static
{

View file

@ -2,7 +2,6 @@ package dark.api;
import java.util.List;
/** Used by any object that needs to restrict access to it by a set of usernames
*
* @author DarkGuardsman */

View file

@ -1,8 +1,5 @@
package dark.api;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@ -10,7 +7,7 @@ import com.builtbroken.common.Group;
/** Used by a terminal to track what users are part of each group. As well used to setup access
* points to the terminal.
*
*
* @author DarkGuardsman */
public class TerminalGroup extends Group<TerminalUser>
{

View file

@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
import com.builtbroken.common.User;
/** Used to define a users access to a terminal based object.
*
*
* @author DarkGuardsman */
public class TerminalUser extends User
{

View file

@ -9,7 +9,7 @@ import com.builtbroken.common.Pair;
/** Information about block not provided by minecraft such as density, mass, volume, tempature, etc
* etc
*
*
* @author DarkGuardsman */
public class ExtraBlockData
{

View file

@ -3,8 +3,6 @@ package dark.core.common.machines;
import java.util.List;
import java.util.Set;
import com.builtbroken.common.Pair;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -13,6 +11,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import com.builtbroken.common.Pair;
import dark.core.common.CommonProxy;
import dark.core.common.DarkMain;
import dark.core.prefab.machine.BlockMachine;
@ -21,7 +22,6 @@ import dark.core.registration.ModObjectRegistry.BlockBuildData;
public class BlockHeater extends BlockMachine
{
public BlockHeater(BlockBuildData data)
{
super(data);

View file

@ -1,14 +1,10 @@
package dark.core.common.machines;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityPack;
@ -69,7 +65,7 @@ public class TileEntityCoalGenerator extends TileEntityEnergyMachine
this.generateWatts = Math.max(this.generateWatts - BASE_DECCELERATION, 0);
}
if(this.generateWatts >= MIN_GENERATE_WATTS)
if (this.generateWatts >= MIN_GENERATE_WATTS)
{
this.produceAllSides();
}

View file

@ -3,7 +3,7 @@ package dark.core.common.machines;
import dark.core.prefab.machine.TileEntityEnergyMachine;
/** Machine that turns heat into usable electrical energy
*
*
* @author DarkGuardsman */
public class TileEntityHeatCouple extends TileEntityEnergyMachine
{

View file

@ -62,7 +62,7 @@ public class FluidHelper
}
/** Gets the block's fluid if it has one
*
*
* @param world - world we are working in
* @param vector - 3D location in world
* @return @Fluid that the block is */
@ -101,10 +101,10 @@ public class FluidHelper
}
/** Drains a block of fluid
*
*
* @Note sets the block with a client update only. Doesn't tick the block allowing for better
* placement of fluid that can flow infinitely
*
*
* @param doDrain - do the action
* @return FluidStack drained from the block */
public static FluidStack drainBlock(World world, Vector3 node, boolean doDrain)
@ -113,7 +113,7 @@ public class FluidHelper
}
/** Drains a block of fluid
*
*
* @param doDrain - do the action
* @param update - block update flag to use
* @return FluidStack drained from the block */
@ -212,9 +212,9 @@ public class FluidHelper
}
/** Helper method to fill a location with a fluid
*
*
* Note: This does not update the block to prevent the liquid from flowing
*
*
* @return */
public static int fillBlock(World world, Vector3 node, FluidStack stack, boolean doFill)
{
@ -248,7 +248,7 @@ public class FluidHelper
}
/** Fills all instances of IFluidHandler surrounding the origin
*
*
* @param stack - FluidStack that will be filled into the tanks
* @param doFill - Actually perform the action or simulate action
* @param ignore - ForgeDirections to ignore
@ -281,7 +281,7 @@ public class FluidHelper
}
/** Fills an instance of IFluidHandler in the given direction
*
*
* @param stack - FluidStack to fill the tank will
* @param doFill - Actually perform the action or simulate action
* @param direction - direction to fill in from the origin
@ -299,6 +299,7 @@ public class FluidHelper
/** Does all the work needed to fill or drain an item of fluid when a player clicks on the block. */
public static boolean playerActivatedFluidItem(World world, int x, int y, int z, EntityPlayer entityplayer, int side)
{
//TODO add double click support similar to the crates in assembly line
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null && world.getBlockTileEntity(x, y, z) instanceof IFluidHandler)
{
@ -309,9 +310,7 @@ public class FluidHelper
if (liquid != null)
{
int qty = tank.fill(ForgeDirection.UNKNOWN, liquid, true);
if (qty != 0 && !entityplayer.capabilities.isCreativeMode)
if (tank.fill(ForgeDirection.UNKNOWN, liquid, true) != 0 && !entityplayer.capabilities.isCreativeMode)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, AutoCraftingManager.consumeItem(current, 1));
}
@ -360,7 +359,7 @@ public class FluidHelper
}
/** Drains an item of fluid and fills the tank with what was drained
*
*
* @param consumeItem - should it consume the item. Used mainly for creative mode players. This
* does effect the return of the method
* @return Item stack that would be returned if the item was drain of its fluid. Water bucket ->
@ -382,7 +381,7 @@ public class FluidHelper
}
/** Fills an item with fluid from the tank
*
*
* @param consumeItem - should it consume the item. Used mainly for creative mode players. This
* does effect the return of the method
* @return Item stack that would be returned if the item was filled with fluid. empty bucket ->