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

View file

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

View file

@ -1,7 +1,7 @@
package com.builtbroken.common; package com.builtbroken.common;
/** Class to track a user. Mainly used to create groups of users /** Class to track a user. Mainly used to create groups of users
* *
* @author Robert Seifert */ * @author Robert Seifert */
public class User 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 * 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 * 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. * 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.periodictable.com/Properties/A/SpecificHeat.an.html
* @source http://www.chemicalelements.com/ * @source http://www.chemicalelements.com/
* @source http://www.lenntech.com/periodic/periodic-chart.htm * @source http://www.lenntech.com/periodic/periodic-chart.htm

View file

@ -1,22 +1,21 @@
package com.builtbroken.common.science; package com.builtbroken.common.science;
/** Helper class that does the work of basic formulas. /** 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 * @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 * 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 * @Note: Some of these methods are very simple but they remove the confusion involved in rewriting
* the code for each use * the code for each use
* *
* @author Robert Seifert */ * @author Robert Seifert */
public class FormulaHelper public class FormulaHelper
{ {
public static final float ACCELERATION_EARTH = 9.80665f; public static final float ACCELERATION_EARTH = 9.80665f;
public static final float ACCELERATION_MOON = 1.622f; public static final float ACCELERATION_MOON = 1.622f;
/** Gay-Lussac's Law (P1/T1 = P2/T2) /** Gay-Lussac's Law (P1/T1 = P2/T2)
* *
* @param pressure - original pressure * @param pressure - original pressure
* @param temp - original tempature * @param temp - original tempature
* @param newTemp - new tempature * @param newTemp - new tempature
@ -42,7 +41,7 @@ public class FormulaHelper
} }
/** Calculates change from original value to new value /** Calculates change from original value to new value
* *
* @param a - original value * @param a - original value
* @param b - new value * @param b - new value
* @return change in value from original to new */ * @return change in value from original to new */

View file

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

View file

@ -1,9 +1,13 @@
package com.builtbroken.common.science.units; package com.builtbroken.common.science.units;
/** Units of measure for force /** Units of measure for force
* *
* @author Rsobert Seifert */ * @author Rsobert Seifert */
public enum ForceUnit 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 */ * @author Robert Seifert */
public enum ImperialUnits public enum ImperialUnits
{ {
thou("thou", "th", (float) (1 / 12000)), thou("thou", "th", (1 / 12000)),
inch("inch", "in", (float) (1 / 12)), inch("inch", "in", (1 / 12)),
foot("foot", "ft", 1), foot("foot", "ft", 1),
yard("yard", "yd", 3), yard("yard", "yd", 3),
chain("chain", "ch", 66), chain("chain", "ch", 66),
@ -23,9 +23,9 @@ public enum ImperialUnits
nautical("nautical mile", "", 6080), nautical("nautical mile", "", 6080),
/** Gunter's sruvey unit */ /** Gunter's sruvey unit */
link("link", "", (float) (66 / 100)), link("link", "", (66 / 100)),
/** Gunter's sruvey unit */ /** Gunter's sruvey unit */
rod("rod", "", (float) (66 / 4)); rod("rod", "", (66 / 4));
public String name, symbol; public String name, symbol;
float toFeet; float toFeet;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
import com.builtbroken.common.User; import com.builtbroken.common.User;
/** Used to define a users access to a terminal based object. /** Used to define a users access to a terminal based object.
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public class TerminalUser extends User 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 /** Information about block not provided by minecraft such as density, mass, volume, tempature, etc
* etc * etc
* *
* @author DarkGuardsman */ * @author DarkGuardsman */
public class ExtraBlockData public class ExtraBlockData
{ {

View file

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

View file

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

View file

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

View file

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