Finished merging DarkLib into Resonant Induction

This commit is contained in:
Calclavia 2014-01-14 18:24:35 +08:00
parent 8744e66d3f
commit 053a62f358
20 changed files with 69 additions and 186 deletions

View file

@ -1,95 +0,0 @@
package dark.lib.helpers;
import java.awt.Color;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public enum ColorCode
{
BLACK("Black", Color.black), RED("Red", Color.red), GREEN("Green", Color.green),
BROWN("Brown", new Color(139, 69, 19)), BLUE("Blue", Color.BLUE),
PURPLE("Purple", new Color(75, 0, 130)), CYAN("Cyan", Color.cyan),
SILVER("Silver", new Color(192, 192, 192)), GREY("Grey", Color.gray), PINK("Pink", Color.pink),
LIME("Lime", new Color(0, 255, 0)), YELLOW("Yellow", Color.yellow),
LIGHTBLUE("LightBlue", new Color(135, 206, 250)), MAGENTA("Magenta", Color.magenta),
ORANGE("Orange", Color.orange), WHITE("White", Color.white), UNKOWN("", Color.BLACK);
public String name;
public Color color;
private ColorCode(String name, Color color)
{
this.name = name;
this.color = color;
}
public String getName()
{
return this.name;
}
/**
* gets a ColorCode from any of the following
*
* @param obj - Integer,String,LiquidData,ColorCode
* @return Color NONE if it can't find it
*/
public static ColorCode get(Object obj)
{
if (obj instanceof Integer && ((Integer) obj) < ColorCode.values().length)
{
return ColorCode.values()[((Integer) obj)];
}
else if (obj instanceof ColorCode)
{
return (ColorCode) obj;
}
else if (obj instanceof String)
{
for (int i = 0; i < ColorCode.values().length; i++)
{
if (((String) obj).equalsIgnoreCase(ColorCode.get(i).getName()))
{
return ColorCode.get(i);
}
}
}
return UNKOWN;
}
/** Used on anything that is coded for a set color for varies reasons */
public static interface IColorCoded
{
/** Returns the ColorCode of the object */
public ColorCode getColor();
/** Sets the ColorCode of the Object */
public boolean setColor(Object obj);
}
public static interface IColoredItem
{
/** Returns the ColorCode of the object */
public ColorCode getColor(ItemStack stack);
/** Sets the ColorCode of the Object */
public boolean setColor(ItemStack stack, Object obj);
}
public static interface IColoredId
{
/** Returns the ColorCode of the object */
public ColorCode getColor(int i);
}
public static interface IColoredBlock
{
/** Returns the ColorCode of the object */
public ColorCode getColor(World world, int x, int y, int z);
/** Sets the ColorCode of the Object */
public void setColor(World world, int x, int y, int z, Object obj);
}
}

View file

@ -1,20 +0,0 @@
package dark.lib.interfaces;
import net.minecraft.entity.player.EntityPlayer;
/**
* Applied to objects that can be control by the player using the keyboard
*
* @author DarkGuardsman
*/
public interface IControlReceiver
{
/**
* Called when the player presses a key
*
* @param player - client player
* @param character - character code
* @param keycode - keyboard code
*/
public boolean keyTyped(EntityPlayer player, int keycode);
}

View file

@ -2,6 +2,7 @@ package resonantinduction.archaic.blocks;
import java.util.List;
import calclavia.lib.render.ColorCode;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@ -12,7 +13,6 @@ import net.minecraft.world.IBlockAccess;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.lib.helpers.ColorCode;
/**
* Prefab class to make any block have 16 separate color instances similar to wool block

View file

@ -1,9 +1,9 @@
package resonantinduction.archaic.blocks;
import calclavia.lib.render.ColorCode;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import dark.lib.helpers.ColorCode;
public class ItemBlockColored extends ItemBlock
{

View file

@ -1,4 +1,4 @@
package dark.lib;
package resonantinduction.core.damage;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityCreeper;

View file

@ -1,4 +1,4 @@
package dark.lib;
package resonantinduction.core.damage;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

View file

@ -1,4 +1,4 @@
package dark.lib.prefab.invgui;
package resonantinduction.core.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;

View file

@ -1,4 +1,4 @@
package dark.lib.prefab.invgui;
package resonantinduction.core.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -13,11 +13,11 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import resonantinduction.core.Reference;
import resonantinduction.core.gui.GuiButtonImage.ButtonIcon;
import resonantinduction.core.prefab.tile.TileMachine;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.lib.prefab.invgui.GuiButtonImage.ButtonIcon;
@SideOnly(Side.CLIENT)
public abstract class GuiMachineContainer extends GuiContainer

View file

@ -24,11 +24,10 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.lib.EnumMaterial;
public class BlockOre extends Block implements IExtraBlockInfo
{
Icon[] icons = new Icon[EnumMaterial.values().length];
Icon[] icons = new Icon[EnumTierMaterial.values().length];
public BlockOre()
{
@ -91,15 +90,15 @@ public class BlockOre extends Block implements IExtraBlockInfo
public static enum OreData
{
TIN(EnumMaterial.TIN, "tin", "oreTin", 20, 8, 128),
COPPER(EnumMaterial.COPPER, "copper", "copperOre", 20, 8, 128),
SILVER(EnumMaterial.SILVER, "silver", "silverOre", 3, 8, 45),
LEAD(EnumMaterial.LEAD, "lead", "leadOre", 1, 6, 30),
Bauxite(EnumMaterial.ALUMINIUM, "bauxite", "bauxiteOre", 4, 6, 128);
TIN(EnumTierMaterial.TIN, "tin", "oreTin", 20, 8, 128),
COPPER(EnumTierMaterial.COPPER, "copper", "copperOre", 20, 8, 128),
SILVER(EnumTierMaterial.SILVER, "silver", "silverOre", 3, 8, 45),
LEAD(EnumTierMaterial.LEAD, "lead", "leadOre", 1, 6, 30),
Bauxite(EnumTierMaterial.ALUMINIUM, "bauxite", "bauxiteOre", 4, 6, 128);
public String name, oreName;
public ItemStack stack;
public EnumMaterial mat;
public EnumTierMaterial mat;
@SideOnly(Side.CLIENT)
public Icon oreIcon;
@ -108,7 +107,7 @@ public class BlockOre extends Block implements IExtraBlockInfo
public boolean doWorldGen = true;
public int ammount, branch, maxY;
private OreData(EnumMaterial mat, String name, String oreName, int ammount, int branch, int maxY)
private OreData(EnumTierMaterial mat, String name, String oreName, int ammount, int branch, int maxY)
{
this.name = name;
this.oreName = oreName;

View file

@ -1,14 +1,13 @@
package dark.lib;
package resonantinduction.core.resource;
public enum EnumOrePart
public enum EnumRecipePart
{
RUBBLE("Rubble"), DUST("Dust"), INGOTS("Ingot"), PLATES("Plate"), GEARS("Gears"), TUBE("Tube"),
ROD("Rod"), SCRAPS("Scraps"), MOLTEN("Molten");
public String simpleName;
private EnumOrePart(String name)
private EnumRecipePart(String name)
{
this.simpleName = name;
}
@ -19,10 +18,10 @@ public enum EnumOrePart
*/
public static String getPartName(int meta)
{
int partID = meta % EnumMaterial.itemCountPerMaterial;
if (partID < EnumOrePart.values().length)
int partID = meta % EnumTierMaterial.itemCountPerMaterial;
if (partID < EnumRecipePart.values().length)
{
return EnumOrePart.values()[partID].simpleName;
return EnumRecipePart.values()[partID].simpleName;
}
return "Part[" + partID + "]";
}
@ -30,11 +29,11 @@ public enum EnumOrePart
/** This gets the full name based on the metadata of the ore dirv item */
public static String getFullName(int itemMetaData)
{
int matID = itemMetaData / EnumMaterial.itemCountPerMaterial;
int partID = itemMetaData % EnumMaterial.itemCountPerMaterial;
if (matID < EnumMaterial.values().length && partID < EnumOrePart.values().length)
int matID = itemMetaData / EnumTierMaterial.itemCountPerMaterial;
int partID = itemMetaData % EnumTierMaterial.itemCountPerMaterial;
if (matID < EnumTierMaterial.values().length && partID < EnumRecipePart.values().length)
{
return EnumMaterial.values()[matID].simpleName + EnumOrePart.values()[partID].simpleName;
return EnumTierMaterial.values()[matID].simpleName + EnumRecipePart.values()[partID].simpleName;
}
return "OrePart[" + matID + "][" + partID + "]";
}

View file

@ -1,4 +1,4 @@
package dark.lib;
package resonantinduction.core.resource;
import java.util.ArrayList;
import java.util.List;
@ -16,27 +16,27 @@ import cpw.mods.fml.relauncher.SideOnly;
*
* @author DarkGuardsman
*/
public enum EnumMaterial
public enum EnumTierMaterial
{
WOOD("Wood", EnumToolMaterial.WOOD, EnumOrePart.INGOTS, EnumOrePart.PLATES, EnumOrePart.RUBBLE, EnumOrePart.ROD, EnumOrePart.MOLTEN),
STONE("Stone", EnumToolMaterial.STONE, EnumOrePart.INGOTS, EnumOrePart.SCRAPS, EnumOrePart.MOLTEN),
IRON("Iron", EnumToolMaterial.IRON, EnumOrePart.INGOTS),
OBBY("Obby", true, 7.0f, 500, 4, EnumOrePart.INGOTS, EnumOrePart.RUBBLE, EnumOrePart.SCRAPS, EnumOrePart.PLATES, EnumOrePart.MOLTEN),
GOLD("Gold", EnumToolMaterial.GOLD, EnumOrePart.GEARS, EnumOrePart.INGOTS),
COAL("Coal", EnumToolMaterial.WOOD, EnumOrePart.GEARS, EnumOrePart.TUBE, EnumOrePart.PLATES, EnumOrePart.RUBBLE, EnumOrePart.SCRAPS, EnumOrePart.MOLTEN),
WOOD("Wood", EnumToolMaterial.WOOD, EnumRecipePart.INGOTS, EnumRecipePart.PLATES, EnumRecipePart.RUBBLE, EnumRecipePart.ROD, EnumRecipePart.MOLTEN),
STONE("Stone", EnumToolMaterial.STONE, EnumRecipePart.INGOTS, EnumRecipePart.SCRAPS, EnumRecipePart.MOLTEN),
IRON("Iron", EnumToolMaterial.IRON, EnumRecipePart.INGOTS),
OBBY("Obby", true, 7.0f, 500, 4, EnumRecipePart.INGOTS, EnumRecipePart.RUBBLE, EnumRecipePart.SCRAPS, EnumRecipePart.PLATES, EnumRecipePart.MOLTEN),
GOLD("Gold", EnumToolMaterial.GOLD, EnumRecipePart.GEARS, EnumRecipePart.INGOTS),
COAL("Coal", EnumToolMaterial.WOOD, EnumRecipePart.GEARS, EnumRecipePart.TUBE, EnumRecipePart.PLATES, EnumRecipePart.RUBBLE, EnumRecipePart.SCRAPS, EnumRecipePart.MOLTEN),
COPPER("Copper", true, 3.5f, 79, 1),
TIN("Tin", true, 2.0f, 50, 1, EnumOrePart.GEARS, EnumOrePart.TUBE),
LEAD("Lead", false, 0, 0, 1, EnumOrePart.GEARS, EnumOrePart.TUBE),
ALUMINIUM("Aluminum", true, 5.0f, 100, 2, EnumOrePart.GEARS, EnumOrePart.TUBE),
SILVER("Silver", true, 11.0f, 30, 0, EnumOrePart.GEARS),
STEEL("Steel", true, 7.0f, 4, 1000, EnumOrePart.RUBBLE),
BRONZE("Bronze", true, 6.5f, 3, 560, EnumOrePart.RUBBLE);
TIN("Tin", true, 2.0f, 50, 1, EnumRecipePart.GEARS, EnumRecipePart.TUBE),
LEAD("Lead", false, 0, 0, 1, EnumRecipePart.GEARS, EnumRecipePart.TUBE),
ALUMINIUM("Aluminum", true, 5.0f, 100, 2, EnumRecipePart.GEARS, EnumRecipePart.TUBE),
SILVER("Silver", true, 11.0f, 30, 0, EnumRecipePart.GEARS),
STEEL("Steel", true, 7.0f, 4, 1000, EnumRecipePart.RUBBLE),
BRONZE("Bronze", true, 6.5f, 3, 560, EnumRecipePart.RUBBLE);
/** Name of the material */
public String simpleName;
/** List of ore parts that to not be created for the material */
public List<EnumOrePart> unneedItems;
public List<EnumRecipePart> unneedItems;
public boolean hasTools = false;
@ -51,19 +51,19 @@ public enum EnumMaterial
public int maxUses = 100;
public float damageBoost = 0;
private EnumMaterial(String name, EnumToolMaterial material, EnumOrePart... enumOreParts)
private EnumTierMaterial(String name, EnumToolMaterial material, EnumRecipePart... enumOreParts)
{
this(name, false, material.getEfficiencyOnProperMaterial(), material.getMaxUses(), material.getDamageVsEntity(), enumOreParts);
}
private EnumMaterial(String name, boolean tool, float effectiveness, int toolUses, float damage, EnumOrePart... enumOreParts)
private EnumTierMaterial(String name, boolean tool, float effectiveness, int toolUses, float damage, EnumRecipePart... enumOreParts)
{
this.simpleName = name;
this.hasTools = tool;
this.materialEffectiveness = effectiveness;
this.maxUses = toolUses;
this.damageBoost = damage;
unneedItems = new ArrayList<EnumOrePart>();
unneedItems = new ArrayList<EnumRecipePart>();
for (int i = 0; enumOreParts != null && i < enumOreParts.length; i++)
{
unneedItems.add(enumOreParts[i]);
@ -78,18 +78,18 @@ public enum EnumMaterial
* @param part - part
* @return new ItemStack created from the two enums as long as everything goes right
*/
public static ItemStack getStack(Item item, EnumMaterial mat, EnumOrePart part, int ammount)
public static ItemStack getStack(Item item, EnumTierMaterial mat, EnumRecipePart part, int ammount)
{
ItemStack reStack = null;
if (mat != null && part != null)
{
if (part == EnumOrePart.INGOTS)
if (part == EnumRecipePart.INGOTS)
{
if (mat == EnumMaterial.IRON)
if (mat == EnumTierMaterial.IRON)
{
return new ItemStack(Item.ingotIron, 1);
}
else if (mat == EnumMaterial.GOLD)
else if (mat == EnumTierMaterial.GOLD)
{
return new ItemStack(Item.ingotGold, 1);
}
@ -101,37 +101,37 @@ public enum EnumMaterial
return reStack;
}
public ItemStack getStack(Item item, EnumOrePart part)
public ItemStack getStack(Item item, EnumRecipePart part)
{
return this.getStack(item, part, 1);
}
public ItemStack getStack(Item item, EnumOrePart part, int ammount)
public ItemStack getStack(Item item, EnumRecipePart part, int ammount)
{
return getStack(item, this, part, ammount);
}
public static Icon getIcon(int metadata)
{
int mat = metadata / EnumMaterial.itemCountPerMaterial;
if (mat < EnumMaterial.values().length)
int mat = metadata / EnumTierMaterial.itemCountPerMaterial;
if (mat < EnumTierMaterial.values().length)
{
return EnumMaterial.values()[metadata / EnumMaterial.itemCountPerMaterial].itemIcons[metadata % EnumMaterial.itemCountPerMaterial];
return EnumTierMaterial.values()[metadata / EnumTierMaterial.itemCountPerMaterial].itemIcons[metadata % EnumTierMaterial.itemCountPerMaterial];
}
return null;
}
public static String getOreName(EnumMaterial mat, EnumOrePart part)
public static String getOreName(EnumTierMaterial mat, EnumRecipePart part)
{
return mat.getOreName(part);
}
public String getOreName(EnumOrePart part)
public String getOreName(EnumRecipePart part)
{
return part.simpleName.toLowerCase() + this.simpleName;
}
public boolean shouldCreateItem(EnumOrePart part)
public boolean shouldCreateItem(EnumRecipePart part)
{
return this.unneedItems == null || !this.unneedItems.contains(part);
}

View file

@ -6,9 +6,9 @@ import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import resonantinduction.core.gui.GuiButtonImage;
import resonantinduction.core.gui.GuiButtonImage.ButtonIcon;
import resonantinduction.electrical.encoder.TileEncoder;
import dark.lib.prefab.invgui.GuiButtonImage;
import dark.lib.prefab.invgui.GuiButtonImage.ButtonIcon;
public class GuiEncoderCoder extends GuiEncoderBase
{

View file

@ -17,11 +17,11 @@ import net.minecraftforge.fluids.FluidTank;
import resonantinduction.mechanical.fluid.prefab.BlockFluidNetwork;
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.render.ColorCode;
import calclavia.lib.render.ColorCode.IColorCoded;
import calclavia.lib.utility.FluidUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.lib.helpers.ColorCode;
import dark.lib.helpers.ColorCode.IColorCoded;
public class BlockPipe extends BlockFluidNetwork
{

View file

@ -1,7 +1,7 @@
package resonantinduction.mechanical.fluid.pipe;
import dark.lib.helpers.ColorCode;
import dark.lib.helpers.ColorCode.IColoredId;
import calclavia.lib.render.ColorCode;
import calclavia.lib.render.ColorCode.IColoredId;
public enum EnumPipeType implements IColoredId
{

View file

@ -3,13 +3,13 @@ package resonantinduction.mechanical.fluid.pipe;
import java.util.ArrayList;
import java.util.List;
import calclavia.lib.render.ColorCode;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import resonantinduction.mechanical.Mechanical;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
import dark.lib.helpers.ColorCode;
/**
* Enum to hold info about each pipe material. Values are by default and some can change with pipe

View file

@ -1,6 +1,6 @@
package resonantinduction.mechanical.fluid.pipe;
import dark.lib.helpers.ColorCode.IColoredId;
import calclavia.lib.render.ColorCode.IColoredId;
public interface IPipeType extends IColoredId
{

View file

@ -1,5 +1,7 @@
package resonantinduction.mechanical.fluid.pipe;
import calclavia.lib.render.ColorCode;
import calclavia.lib.render.ColorCode.IColorCoded;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@ -9,8 +11,6 @@ import resonantinduction.api.fluid.IFluidPipe;
import resonantinduction.core.tilenetwork.ITileConnector;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
import universalelectricity.api.vector.Vector3;
import dark.lib.helpers.ColorCode;
import dark.lib.helpers.ColorCode.IColorCoded;
public class TilePipe extends TileFluidNetwork implements IColorCoded, IFluidPipe
{

View file

@ -1,9 +1,9 @@
package resonantinduction.mechanical.fluid.prefab;
import calclavia.lib.render.ColorCode;
import calclavia.lib.render.ColorCode.IColoredId;
import resonantinduction.mechanical.fluid.pipe.EnumPipeType;
import resonantinduction.mechanical.fluid.pipe.IPipeType;
import dark.lib.helpers.ColorCode;
import dark.lib.helpers.ColorCode.IColoredId;
public enum EnumTankTypes implements IColoredId
{

View file

@ -8,8 +8,8 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import calclavia.lib.render.ColorCode.IColorCoded;
import calclavia.lib.utility.FluidUtility;
import dark.lib.helpers.ColorCode.IColorCoded;
public abstract class TileEntityFluidStorage extends TileEntityFluidDevice implements IFluidHandler, IColorCoded
{

View file

@ -14,10 +14,10 @@ import resonantinduction.core.render.RenderFluidHelper;
import resonantinduction.electrical.Electrical;
import resonantinduction.mechanical.Mechanical;
import resonantinduction.old.client.model.ModelTankSide;
import calclavia.lib.render.ColorCode;
import calclavia.lib.render.RenderUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.lib.helpers.ColorCode;
@SideOnly(Side.CLIENT)
public class RenderTank extends TileEntitySpecialRenderer