ton of rework to make the merged mods function

This commit is contained in:
Robert 2013-12-20 02:10:49 -05:00
parent fb2cdd9f1f
commit 9dc85a77c3
110 changed files with 1965 additions and 2322 deletions

View file

@ -1,13 +1,13 @@
package dark.api.al;
import com.dark.helpers.AutoCraftingManager.IAutoCrafter;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import universalelectricity.core.vector.Vector3;
import com.dark.helpers.AutoCraftingManager.IAutoCrafter;
/** Events called when an automated crafter is working on crafting an item
*
* @author DarkGuardsman */

View file

@ -0,0 +1,65 @@
package dark.api.al;
import java.util.HashMap;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import com.builtbroken.common.Pair;
public class FluidMasterList
{
public static HashMap<String, Float> moltenFluids = new HashMap();
/** Map containing items to FluidStack for melting down. Anything not in the list will be turned
* into slag. */
public static HashMap<Pair<Integer, Integer>, FluidStack> meltDownMap = new HashMap();
public static final Fluid WATER = FluidRegistry.WATER;
public static final Fluid LAVA = FluidRegistry.LAVA;
static
{
//http://www.engineeringtoolbox.com/melting-temperature-metals-d_860.html
moltenFluids.put("lava", 1200f);
moltenFluids.put("molten-iron", 1200f);
moltenFluids.put("molten-gold", 1063f);
moltenFluids.put("molten-silver", 1000f);
}
/** Registers a fluid, by fluid name, as a molten fluids so pipes will interact with it different
*
* @param name - fluid name
* @param heatValue - temperature of the fluid */
public static void registerMoltenFluid(String name, float heatValue)
{
if (name != null && heatValue > 0)
{
moltenFluids.put(name, heatValue);
}
}
/** Try to only register very simple items as a reverse recipe system will be used to get to the
* items used to craft the object
*
* @param id - item id
* @param meta - item meta
* @param stack - fluid stack to return */
public static void registerMeltDown(int id, int meta, FluidStack stack)
{
if (id > 0 && stack != null)
{
meltDownMap.put(new Pair<Integer, Integer>(id, meta), stack);
}
}
public static boolean isMolten(Fluid fluid)
{
return fluid != null && moltenFluids.containsKey(fluid.getName());
}
public static float getHeatPerPass(Fluid fluid)
{
return moltenFluids.get(fluid.getName());
}
}

View file

@ -0,0 +1,70 @@
package dark.api.al;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.fluids.FluidEvent;
import net.minecraftforge.fluids.FluidStack;
import universalelectricity.core.vector.Vector3;
public class FluidMixingEvent extends FluidEvent
{
public FluidMixingEvent(FluidStack fluid, World world, Vector3 vec)
{
super(fluid, world, vec.intX(), vec.intY(), vec.intZ());
}
@Cancelable
/**Called before a fluid is mixed with something else, normally another fluid. You can use this event to cancel the mixing or change its output */
public static class PreMixEvent extends FluidMixingEvent
{
public final Object input;
public Object output;
public PreMixEvent(World world, Vector3 vec, FluidStack fluid, Object input, Object output)
{
super(fluid, world, vec);
this.input = input;
this.output = output;
}
}
@Cancelable
/**Called right when the fluid is mixed with an object. This is the last chance to cancel the mixing. As well this can be used to cause a different outcome */
public static class MixEvent extends FluidMixingEvent
{
public final Object input;
public Object output;
public MixEvent(World world, Vector3 vec, FluidStack fluid, Object input, Object output)
{
super(fluid, world, vec);
this.input = input;
this.output = output;
}
}
/** Called when a mixer has gone threw all the recipes and not found one for the fluid and input.
* Use this to hook into this can create a new recipe without registering it with the mixing
* class */
public static class MixingRecipeCall extends FluidMixingEvent
{
public final Object input;
public Object output;
public MixingRecipeCall(World world, Vector3 vec, FluidStack fluid, Object input)
{
super(fluid, world, vec);
this.input = input;
}
}
public static final void fireEvent(FluidMixingEvent event)
{
MinecraftForge.EVENT_BUS.post(event);
}
}

View file

@ -1,48 +0,0 @@
package dark.api.farm;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import com.builtbroken.common.Pair;
/** Tracks a list of all crops that can be auto farmed. Does some guessing on block to avoid having
* each mod register all its crops
*
* @author DarkGuardsman */
public class CropAutomationHandler
{
//TODO handle special cases
public static HashMap<Pair<Integer, Integer>, Pair<Integer, Integer>> cropList = new HashMap<Pair<Integer, Integer>, Pair<Integer, Integer>>();
public static HashMap<Object, Class<? extends ICropHandler>> specialCropCases = new HashMap<Object, Class<? extends ICropHandler>>();
static
{
//TODO add some items here but leave most of the work to some of the sub methods that will ID and upload all crop like blocks
}
public void addCrop(ItemStack stack, int level, int time)
{
if (stack != null)
{
Pair<Integer, Integer> par = new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage());
Pair<Integer, Integer> par2 = new Pair<Integer, Integer>(level, time);
if (!cropList.containsKey(par))
{
cropList.put(par, par2);
}
}
}
public static boolean isAllowedCrop(ItemStack stack)
{
return stack != null && cropList.containsKey(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage()));
}
/** Called after all mods/blocks have loaded to auto sort threw blocks looking for anything that
* might be close to decayable matter */
public static void triggerPostBlockAddition()
{
//TODO parse the list of blocks and auto add all crop blocks.
}
}

View file

@ -1,123 +0,0 @@
package dark.api.farm;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import com.builtbroken.common.Pair;
public class DecayMatterList
{
//TODO handle special cases like single stack items that have non-meta damage values, or zombie flesh that needs to poison the compost.
public static HashMap<Pair<Integer, Integer>, Pair<Float, Integer>> compostList = new HashMap<Pair<Integer, Integer>, Pair<Float, Integer>>();
static
{
//TODO add some items here but leave most of the work to some of the sub methods that will ID and upload all crop like blocks
}
/** Used to flag an itemStack as decayable matter for the compost box and later real time world
* decay
*
* @param stack - itemID and meta to check against
* @param output - how many buckets of compost are created. Accepts part buckets
* @param time - time in which to decay the matter */
public static void addDecayMatter(ItemStack stack, float output, int time)
{
if (stack != null)
{
Pair<Integer, Integer> par = new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage());
Pair<Float, Integer> par2 = new Pair<Float, Integer>(output, time);
if (!compostList.containsKey(par))
{
compostList.put(par, par2);
}
}
}
/** Gets the time in ticks that the item will decay into compost matter
*
* @param stack
* @return -1 if the list doesn't contain the ID */
public static int getDecayTime(ItemStack stack)
{
if (stack != null && compostList.containsKey(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage())))
{
return compostList.get(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage())).right();
}
return -1;
}
/** Gets the amount of compost matter the itemStack creates on decay
*
* @param stack
* @return -1 if the list doesn't contain the ID */
public static float getDecayOuput(ItemStack stack)
{
if (stack != null && compostList.containsKey(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage())))
{
return compostList.get(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage())).left();
}
return -1;
}
public static boolean isDecayMatter(ItemStack stack)
{
return stack != null && compostList.containsKey(new Pair<Integer, Integer>(stack.itemID, stack.getItemDamage()));
}
/** Called after all mods/blocks have loaded to auto sort threw blocks looking for anything that
* might be close to decayable matter */
public static void triggerPostBlockAddition()
{
//TODO parse the list of blocks and auto add all crop blocks.
}
/** Loads user settings for items that validate for decay matter */
public static void parseConfigString(String string)
{
if (string != null && !string.isEmpty())
{
try
{
String[] subStrings = string.split(",");
for (String str : subStrings)
{
try
{
String[] split = str.split(":");
String ID = split[0];
String meta = split[1];
String decayT = split[2];
String decayO = split[3];
try
{
int blockID = Integer.parseInt(ID);
int metaID = Integer.parseInt(meta);
int decayTime = Integer.parseInt(decayT);
int decayV = Integer.parseInt(decayO);
DecayMatterList.addDecayMatter(new ItemStack(blockID, 1, metaID), decayV, decayTime);
}
catch (Exception e)
{
//TODO add a string based system that will allow for full item or block names
//eg tile.stone:0, tile.wood:2,
System.out.println("[FarmTech] Entries for compost list must be Integers");
e.printStackTrace();
}
}
catch (Exception e)
{
System.out.println("[FarmTech] Failed to read entry in compost ID config. Plz check your config for errors");
e.printStackTrace();
}
}
}
catch (Exception e)
{
System.out.println("[FarmTech] Failed to parse compost ID list from config. Plz check your config for errors");
e.printStackTrace();
}
}
}
}

View file

@ -1,29 +0,0 @@
package dark.api.farm;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
import dark.farmtech.machines.farmer.EntityFarmDrone;
/** Special case handling for crops so the farm automatons know to do a few extra steps to care for
* and harvest a crop block
*
* @author DarkGuardsman */
public interface ICropHandler
{
/** Called per block each update of the farming box. Used to manage anything from calling the
* drone to harvest, water, or to fertilise the crop */
public void onCareUpdate(EntityFarmDrone drone, World world, Vector3 pos);
/** Called before the drone harvests the crop
*
* @return true to keep harvesting */
public boolean preHarvest(EntityFarmDrone drone, World world, Vector3 pos);
/** Called as the crop is being harvest but right before its actually removed from the world
*
* @return true to finish harvesting */
public boolean onHarvest(EntityFarmDrone drone, World world, Vector3 pos);
/** Called after the crop has been removed */
public void postHarvest(EntityFarmDrone drone, World world, Vector3 pos);
}

View file

@ -1,12 +1,12 @@
package dark.api.fluid;
import com.dark.tilenetwork.INetworkPart;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.dark.tilenetwork.INetworkPart;
/** Interface used by part that are members of a fluid tile network. Parts in the network will act as
* one entity and will be controlled by the network. This means the network need the part to access
* the parts in a set way to function correctly

View file

@ -1,14 +1,27 @@
package dark.assembly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import com.dark.EnumMaterial;
import com.dark.EnumOrePart;
import com.dark.helpers.ColorCode;
import com.dark.prefab.RecipeLoader;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.api.reciepes.MachineRecipeHandler;
import dark.api.reciepes.ProcessorType;
import dark.assembly.item.ItemOreDirv;
import dark.assembly.item.ItemParts;
import dark.assembly.item.ItemParts.Parts;
import dark.assembly.machine.BlockCrate;
import dark.assembly.machine.processor.BlockProcessor;
@ -26,9 +39,26 @@ public class ALRecipeLoader extends RecipeLoader
public static Block blockTurntable;
public static Block processorMachine;
public static Block blockAdvancedHopper;
public static Block blockPipe;
public static Block blockTank;
public static Block blockPumpMachine;
public static Block blockRod;
public static Block blockGenerator;
public static Block blockReleaseValve;
public static Block blockSink;
public static Block blockDrain;
public static Block blockConPump;
public static Block blockHeater;
public static Block blockPiston;
public static Block blockBoiler;
public static Block blockWasteLiquid;
public static Block blockOilLiquid;
public static Block blockFuelLiquid;
public static Item itemImprint;
public static Item itemDisk;
public static Item itemFluidCan;
public static Item itemTool, itemParts, itemMetals;
@Override
public void loadRecipes()
@ -36,6 +66,131 @@ public class ALRecipeLoader extends RecipeLoader
super.loadRecipes();
this.createStandardRecipes();
this.createUERecipes();
this.registerPipes();
this.registerTanks();
// pump
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockPumpMachine, 1, 0), new Object[] { "C@C", "BMB", "@X@", '@', steelPlate, 'X', new ItemStack(blockPipe, 1), 'B', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'C', circuit, 'M', "motor" }));
// construction pump
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConPump, 1, 0), new Object[] { "@C@", "BMB", "@@@", '@', steelPlate, 'B', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'C', "advancedCircuit", 'M', "motor" }));
// Drain
GameRegistry.addRecipe(new ItemStack(blockDrain, 1, 0), new Object[] { "IGI", "SVS", " P ", 'I', Item.ingotIron, 'G', Block.dispenser, 'S', Block.stone, 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()) });
// release valve
GameRegistry.addRecipe(new ItemStack(blockReleaseValve, 1), new Object[] { "RPR", "PVP", "RPR", 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(itemParts, 1, Parts.Valve.ordinal()), 'R', Item.redstone });
// sink
//GameRegistry.addRecipe(new ItemStack(blockSink, 1), new Object[] { "I I", "SIS", "SPS", 'P', new ItemStack(blockPipe, 1), 'I', Item.ingotIron, 'S', Block.stone });
if (itemParts instanceof ItemParts)
{
// seal
GameRegistry.addRecipe(this.setStackSize(new ItemStack(itemParts, 1, Parts.Seal.ordinal()), 16), new Object[] { "LL", "LL", 'L', Item.leather });
// slime steal
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.GasSeal.ordinal()), " # ", "#S#", " # ", '#', Parts.Seal.name, 'S', Item.slimeBall));
// part valve
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), new Object[] { "PLP", 'P', "ironPipe", 'L', Block.lever }));
//Basic Circuit
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitBasic.ordinal()), "!#!", "#@#", "!#!", '@', copperPlate, '#', Block.glass, '!', "copperWire"));
//Advanced Circuit
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitAdvanced.ordinal()), "!#!", "#@#", "!#!", '@', copperPlate, '#', Item.redstone, '!', "copperWire"));
//Elite Circuit
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.CircuitElite.ordinal()), "!#!", "#@#", "!#!", '@', "plateGold", '#', Item.redstone, '!', "copperWire"));
// unfinished tank
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " # ", "# #", " # ", '#', bronze));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Tank.ordinal()), " # ", "# #", " # ", '#', steel));
//Motor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 1, Parts.Motor.ordinal()), new Object[] { "@!@", "!#!", "@!@", '!', steel, '#', Item.ingotIron, '@', new ItemStack(itemParts, 8, Parts.COIL.ordinal()) }));
//Laser Diode
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 4, Parts.LASER.ordinal()), new Object[] { " G ", "!S!", " C ", '!', "copperWire", 'G', Block.glass, 'S', Block.sand, 'C', RecipeLoader.circuit }));
//Coil
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemParts, 8, Parts.COIL.ordinal()), new Object[] { "WWW", "W W", "WWW", 'W', "copperWire" }));
}
if (itemMetals instanceof ItemOreDirv)
{
//Alt salvaging item list
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.DUST, 3));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.DUST, 1));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1));
//Stone recipes
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.stone, EnumMaterial.getStack(itemMetals, EnumMaterial.STONE, EnumOrePart.DUST, 1));
//Wood recipes
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.DUST, 3));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.DUST, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(itemMetals, EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1));
//Gold Recipes
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.blockIron, EnumMaterial.getStack(itemMetals, EnumMaterial.IRON, EnumOrePart.SCRAPS, 8));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.oreIron, EnumMaterial.getStack(itemMetals, EnumMaterial.IRON, EnumOrePart.RUBBLE, 1));
//Iron Recipes
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.blockGold, EnumMaterial.getStack(itemMetals, EnumMaterial.GOLD, EnumOrePart.SCRAPS, 8));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.oreGold, EnumMaterial.getStack(itemMetals, EnumMaterial.GOLD, EnumOrePart.RUBBLE, 1));
//Dust recipes
GameRegistry.addShapelessRecipe(EnumMaterial.getStack(itemMetals, EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(itemMetals, EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 0), new ItemStack(Item.coal, 1, 0) });
GameRegistry.addShapelessRecipe(EnumMaterial.getStack(itemMetals, EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(itemMetals, EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 1), new ItemStack(Item.coal, 1, 1) });
GameRegistry.addShapelessRecipe(EnumMaterial.getStack(itemMetals, EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(itemMetals, EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 1), new ItemStack(Item.coal, 1, 0) });
GameRegistry.addShapelessRecipe(EnumMaterial.getStack(itemMetals, EnumMaterial.BRONZE, EnumOrePart.DUST, 4), new Object[] { EnumMaterial.getStack(itemMetals, EnumMaterial.COPPER, EnumOrePart.DUST, 1), EnumMaterial.getStack(itemMetals, EnumMaterial.COPPER, EnumOrePart.DUST, 1), EnumMaterial.getStack(itemMetals, EnumMaterial.COPPER, EnumOrePart.DUST, 1), EnumMaterial.getStack(itemMetals, EnumMaterial.TIN, EnumOrePart.DUST, 1) });
//Ore material recipe loop
for (EnumMaterial mat : EnumMaterial.values())
{
//Dust recipes
if (mat.shouldCreateItem(EnumOrePart.DUST))
{
FurnaceRecipes.smelting().addSmelting(mat.getStack(itemMetals, EnumOrePart.DUST, 1).itemID, mat.getStack(itemMetals, EnumOrePart.DUST, 1).getItemDamage(), mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), 0.6f);
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.RUBBLE, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1), 1, 4);
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.PLATES, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1), 2, 4);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.PLATES, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 3));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.ROD, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(itemMetals, EnumOrePart.TUBE, 1), mat.getStack(itemMetals, EnumOrePart.DUST, 1));
}
// Salvaging recipe
if (mat.shouldCreateItem(EnumOrePart.SCRAPS))
{
FurnaceRecipes.smelting().addSmelting(mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1).itemID, mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1).getItemDamage(), mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), 0.6f);
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(itemMetals, EnumOrePart.PLATES, 1), mat.getStack(itemMetals, EnumOrePart.SCRAPS, 3));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, mat.getStack(itemMetals, EnumOrePart.PLATES, 1), mat.getStack(itemMetals, EnumOrePart.SCRAPS, 3));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(itemMetals, EnumOrePart.RUBBLE, 1), mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1), 1, 5);
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(itemMetals, EnumOrePart.ROD, 1), mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(itemMetals, EnumOrePart.TUBE, 1), mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
}
if (mat.shouldCreateItem(EnumOrePart.TUBE))
{
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.TUBE, 6), new Object[] { "I", "I", "I", 'I', mat.getOreName(EnumOrePart.INGOTS) }));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.TUBE, 6), new Object[] { "I", "I", "I", 'I', mat.getOreNameReverse(EnumOrePart.INGOTS) }));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.TUBE, 1), new Object[] { "I", 'I', mat.getOreName(EnumOrePart.ROD) }));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.TUBE, 1), new Object[] { "I", 'I', mat.getOreNameReverse(EnumOrePart.ROD) }));
}
if (mat.shouldCreateItem(EnumOrePart.ROD))
{
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.ROD, 4), new Object[] { "I", "I", 'I', mat.getOreName(EnumOrePart.ROD) }));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.ROD, 4), new Object[] { "I", "I", 'I', mat.getOreNameReverse(EnumOrePart.ROD) }));
}
if (mat.shouldCreateItem(EnumOrePart.PLATES))
{
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.PLATES, 1), new Object[] { "II", "II", 'I', mat.getOreName(EnumOrePart.INGOTS) }));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.PLATES, 1), new Object[] { "II", "II", 'I', mat.getOreNameReverse(EnumOrePart.INGOTS) }));
}
if (mat.shouldCreateItem(EnumOrePart.GEARS))
{
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(itemMetals, EnumOrePart.GEARS, 4), new Object[] { " I ", "IRI", " I ", 'I', mat.getOreName(EnumOrePart.INGOTS), 'R', mat.shouldCreateItem(EnumOrePart.ROD) ? mat.getOreName(EnumOrePart.ROD) : Item.stick }));
}
}
}
}
private void createUERecipes()
@ -74,4 +229,121 @@ public class ALRecipeLoader extends RecipeLoader
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCrate, 1, 1), new Object[] { "TST", "SCS", "TST", 'C', new ItemStack(blockCrate, 1, 0), 'S', RecipeLoader.steel, 'T', Block.wood }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockCrate, 1, 2), new Object[] { "TST", "SCS", "TST", 'C', new ItemStack(blockCrate, 1, 1), 'S', RecipeLoader.steelPlate, 'T', Block.wood }));
}
public void registerTanks()
{
GameRegistry.addRecipe(new ItemStack(blockPumpMachine, 1, 0), new Object[] { "IXI", "X X", "IXI", 'I', Item.ingotIron, 'X', Block.glass });
}
public void registerPipes()
{
//TODO re-add leather seal recipes
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.IRON.getStack(2), new Object[] { EnumMaterial.IRON.getOreName(EnumOrePart.TUBE), Item.leather }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.GOLD.getStack(2), new Object[] { EnumMaterial.GOLD.getOreName(EnumOrePart.TUBE), Item.leather }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.TIN.getStack(2), new Object[] { EnumMaterial.TIN.getOreName(EnumOrePart.TUBE), Item.leather }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.COPPER.getStack(2), new Object[] { EnumMaterial.COPPER.getOreName(EnumOrePart.TUBE), Item.leather }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.BRONZE.getStack(2), new Object[] { EnumMaterial.BRONZE.getOreName(EnumOrePart.TUBE), Item.leather }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.STEEL.getStack(2), new Object[] { EnumMaterial.STEEL.getOreName(EnumOrePart.TUBE), Item.leather }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.OBBY.getStack(2), new Object[] { EnumMaterial.OBBY.getOreName(EnumOrePart.TUBE), Block.netherBrick, Block.netherBrick }));
GameRegistry.addRecipe(new ShapedOreRecipe(FluidPartsMaterial.HELL.getStack(4), new Object[] { "OOO", "BNB", "OOO", 'N', Block.netherBrick, 'B', Item.blazeRod, 'O', Block.obsidian }));
for (FluidPartsMaterial mat : FluidPartsMaterial.values())
{
for (ColorCode color : ColorCode.values())
{
GameRegistry.addRecipe(mat.getStack(color), new Object[] { " X ", "XIX", " X ", 'I', new ItemStack(Item.dyePowder, 1, color.ordinal()), 'X', blockPipe });
GameRegistry.addShapelessRecipe(mat.getStack(), new Object[] { mat.getStack(color) });
}
}
}
public static void parseOreNames(Configuration config)
{
if (config.get("Ore", "processOreDictionary", true, "Scans the ore dictionary and adds other mods ore to the machine recipes").getBoolean(true))
{
for (EnumMaterial mat : EnumMaterial.values())
{ //Ingots
List<ItemStack> ingots = OreDictionary.getOres("ingot" + mat.simpleName);
ingots.addAll(OreDictionary.getOres(mat.simpleName + "ingot"));
//plate
List<ItemStack> plates = OreDictionary.getOres("plate" + mat.simpleName);
plates.addAll(OreDictionary.getOres(mat.simpleName + "plate"));
//ore
List<ItemStack> ores = OreDictionary.getOres("ore" + mat.simpleName);
ores.addAll(OreDictionary.getOres(mat.simpleName + "ore"));
//dust
List<ItemStack> dusts = OreDictionary.getOres("dust" + mat.simpleName);
dusts.addAll(OreDictionary.getOres(mat.simpleName + "dust"));
for (ItemStack du : dusts)
{
if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("Ore", "OverrideDustSmelthing", true, "Overrides other mods dust smelting so the ingots smelt as the same item.").getBoolean(true))
{
FurnaceRecipes.smelting().addSmelting(du.itemID, du.getItemDamage(), mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), 0.6f);
}
}
for (ItemStack ing : ingots)
{
if (mat.shouldCreateItem(EnumOrePart.DUST))
{
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, ing, mat.getStack(itemMetals, EnumOrePart.DUST, 1));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, ing, mat.getStack(itemMetals, EnumOrePart.DUST, 1));
}
if (mat.shouldCreateItem(EnumOrePart.SCRAPS))
{
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, ing, mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, ing, mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
}
if (mat.shouldCreateItem(EnumOrePart.INGOTS))
{
GameRegistry.addShapelessRecipe(mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), new Object[] { ing });
}
}
for (ItemStack pla : plates)
{
if (mat.shouldCreateItem(EnumOrePart.DUST))
{
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, pla, mat.getStack(itemMetals, EnumOrePart.DUST, 1));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, pla, mat.getStack(itemMetals, EnumOrePart.DUST, 1));
}
if (mat.shouldCreateItem(EnumOrePart.SCRAPS))
{
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, pla, mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, pla, mat.getStack(itemMetals, EnumOrePart.SCRAPS, 1));
}
if (mat.shouldCreateItem(EnumOrePart.PLATES))
{
GameRegistry.addShapelessRecipe(mat.getStack(itemMetals, EnumOrePart.PLATES, 1), new Object[] { pla });
if (config.get("Ore", "OverridePlateCrafting", true, "Overrides other mods metal plate crafting. As well creates new recipes for mod ingots without plate crafting.").getBoolean(true))
{
GameRegistry.addShapelessRecipe(mat.getStack(itemMetals, EnumOrePart.INGOTS, 4), new Object[] { pla });
}
}
}
for (ItemStack ore : ores)
{
if (mat.shouldCreateItem(EnumOrePart.RUBBLE))
{
MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, ore, mat.getStack(itemMetals, EnumOrePart.RUBBLE, 1), 1, 2);
}
if (mat.shouldCreateItem(EnumOrePart.DUST))
{
MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, ore, mat.getStack(itemMetals, EnumOrePart.DUST, 1), 1, 3);
}
if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("Ore", "OverrideOreSmelthing", true, "Overrides other mods smelting recipes for ingots").getBoolean(true))
{
FurnaceRecipes.smelting().addSmelting(ore.itemID, ore.getItemDamage(), mat.getStack(itemMetals, EnumOrePart.INGOTS, 1), 0.6f);
}
}
}
}
}
}

View file

@ -4,9 +4,12 @@ import java.io.File;
import java.util.Arrays;
import java.util.logging.Logger;
import net.minecraft.block.BlockDispenser;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import org.modstats.ModstatInfo;
import org.modstats.Modstats;
@ -15,6 +18,8 @@ import universalelectricity.prefab.TranslationHelper;
import com.dark.CoreRegistry;
import com.dark.DarkCore;
import com.dark.EnumMaterial;
import com.dark.EnumOrePart;
import com.dark.IndustryTabs;
import com.dark.prefab.ItemBlockHolder;
@ -31,6 +36,8 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.api.al.coding.TaskRegistry;
import dark.assembly.armbot.BlockArmbot;
import dark.assembly.armbot.command.TaskBreak;
@ -51,20 +58,36 @@ import dark.assembly.armbot.command.TaskRotateTo;
import dark.assembly.armbot.command.TaskStart;
import dark.assembly.armbot.command.TaskTake;
import dark.assembly.armbot.command.TaskUse;
import dark.assembly.entities.EntityFarmEgg;
import dark.assembly.entities.EnumBird;
import dark.assembly.imprinter.BlockImprinter;
import dark.assembly.imprinter.ItemImprinter;
import dark.assembly.item.BehaviorDispenseEgg;
import dark.assembly.item.ItemFarmEgg;
import dark.assembly.item.ItemOreDirv;
import dark.assembly.item.ItemParts;
import dark.assembly.item.ItemParts.Parts;
import dark.assembly.machine.BlockCrate;
import dark.assembly.machine.BlockDetector;
import dark.assembly.machine.BlockManipulator;
import dark.assembly.machine.BlockRejector;
import dark.assembly.machine.BlockTurntable;
import dark.assembly.machine.ItemBlockCrate;
import dark.assembly.machine.ItemFluidCan;
import dark.assembly.machine.TileEntityAssembly;
import dark.assembly.machine.belt.BlockConveyorBelt;
import dark.assembly.machine.encoder.BlockEncoder;
import dark.assembly.machine.encoder.ItemDisk;
import dark.assembly.machine.processor.BlockProcessor;
import dark.assembly.machine.red.BlockAdvancedHopper;
import dark.fluid.common.machines.BlockReleaseValve;
import dark.fluid.common.machines.BlockSink;
import dark.fluid.common.machines.BlockTank;
import dark.fluid.common.pipes.BlockPipe;
import dark.fluid.common.pipes.ItemBlockPipe;
import dark.fluid.common.pump.BlockConstructionPump;
import dark.fluid.common.pump.BlockDrain;
import dark.fluid.common.pump.BlockPumpMachine;
@ModstatInfo(prefix = "asmline")
@Mod(modid = AssemblyLine.MOD_ID, name = AssemblyLine.MOD_NAME, version = AssemblyLine.VERSION, dependencies = "required-after:DarkCore", useMetadata = true)
@ -110,6 +133,8 @@ public class AssemblyLine
public static boolean VINALLA_RECIPES = false;
public static int entitiesIds = 60;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
@ -151,6 +176,27 @@ public class AssemblyLine
FMLog.info("Loaded: " + TranslationHelper.loadLanguages(DarkCore.LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " languages.");
IndustryTabs.tabAutomation().setIconItemStack(new ItemStack(ALRecipeLoader.blockConveyorBelt));
if (ALRecipeLoader.itemParts != null)
{
for (Parts part : Parts.values())
{
OreDictionary.registerOre(part.name, new ItemStack(ALRecipeLoader.itemParts, 1, part.ordinal()));
}
}
if (ALRecipeLoader.itemMetals != null)
{
MinecraftForge.EVENT_BUS.register(ALRecipeLoader.itemMetals);
}
if (ALRecipeLoader.itemParts != null)
{
IndustryTabs.tabMining().itemStack = new ItemStack(ALRecipeLoader.itemParts.itemID, 1, ItemParts.Parts.MiningIcon.ordinal());
}
if (ALRecipeLoader.itemMetals != null)
{
IndustryTabs.tabIndustrial().itemStack = EnumMaterial.getStack(ALRecipeLoader.itemMetals, EnumMaterial.IRON, EnumOrePart.GEARS, 1);
ALRecipeLoader.parseOreNames(CONFIGURATION);
}
}
@EventHandler
@ -180,15 +226,47 @@ public class AssemblyLine
ALRecipeLoader.blockTurntable = CoreRegistry.createNewBlock("Turntable", AssemblyLine.MOD_ID, BlockTurntable.class);
ALRecipeLoader.processorMachine = CoreRegistry.createNewBlock("ALBlockProcessor", AssemblyLine.MOD_ID, BlockProcessor.class, ItemBlockHolder.class);
ALRecipeLoader.blockAdvancedHopper = CoreRegistry.createNewBlock("ALBlockHopper", AssemblyLine.MOD_ID, BlockAdvancedHopper.class, ItemBlockHolder.class);
ALRecipeLoader.blockPipe = CoreRegistry.createNewBlock("FMBlockPipe", AssemblyLine.MOD_ID, BlockPipe.class, ItemBlockPipe.class);
ALRecipeLoader.blockPumpMachine = CoreRegistry.createNewBlock("FMBlockPump", AssemblyLine.MOD_ID, BlockPumpMachine.class, ItemBlockHolder.class);
ALRecipeLoader.blockReleaseValve = CoreRegistry.createNewBlock("FMBlockReleaseValve", AssemblyLine.MOD_ID, BlockReleaseValve.class, ItemBlockHolder.class);
ALRecipeLoader.blockTank = CoreRegistry.createNewBlock("FMBlockTank", AssemblyLine.MOD_ID, BlockTank.class, ItemBlockPipe.class);
ALRecipeLoader.blockSink = CoreRegistry.createNewBlock("FMBlockSink", AssemblyLine.MOD_ID, BlockSink.class, ItemBlockHolder.class);
ALRecipeLoader.blockDrain = CoreRegistry.createNewBlock("FMBlockDrain", AssemblyLine.MOD_ID, BlockDrain.class, ItemBlockHolder.class);
ALRecipeLoader.blockConPump = CoreRegistry.createNewBlock("FMBlockConstructionPump", AssemblyLine.MOD_ID, BlockConstructionPump.class, ItemBlockHolder.class);
ALRecipeLoader.itemImprint = new ItemImprinter(CONFIGURATION.getItem("Imprint", DarkCore.getNextItemId()).getInt());
ALRecipeLoader.itemDisk = new ItemDisk(CONFIGURATION.getItem("Disk", DarkCore.getNextItemId()).getInt());
AssemblyLine.VINALLA_RECIPES = CONFIGURATION.get("general", "Vinalla_Recipes", false).getBoolean(false);
ALRecipeLoader.itemFluidCan = CoreRegistry.createNewItem("ItemFluidCan", AssemblyLine.MOD_ID, ItemFluidCan.class, true);
ALRecipeLoader.itemParts = CoreRegistry.createNewItem("DMCraftingParts", AssemblyLine.MOD_ID, ItemParts.class, true);
ALRecipeLoader.itemMetals = CoreRegistry.createNewItem("DMOreDirvParts", AssemblyLine.MOD_ID, ItemOreDirv.class, true);
TileEntityAssembly.refresh_diff = CONFIGURATION.get("TileSettings", "RefreshRandomRange", 9, "n = value of config, 1 + n, random number range from 1 to n that will be added to the lowest refresh value").getInt();
TileEntityAssembly.refresh_min_rate = CONFIGURATION.get("TileSettings", "RefreshLowestValue", 20, "Lowest value the refresh rate of the tile network will be").getInt();
if (AssemblyLine.CONFIGURATION.get("Override", "Eggs", true).getBoolean(true))
{
Item.itemsList[Item.egg.itemID] = null;
Item.egg = null;
Item.egg = new ItemFarmEgg(88);
GameRegistry.registerItem(Item.egg, "FTEgg", MOD_ID);
EntityRegistry.registerGlobalEntityID(EntityFarmEgg.class, "FarmEgg", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityFarmEgg.class, "FarmEgg", entitiesIds++, this, 64, 1, true);
BlockDispenser.dispenseBehaviorRegistry.putObject(Item.egg, new BehaviorDispenseEgg());
}
for (EnumBird bird : EnumBird.values())
{
if (bird != EnumBird.VANILLA_CHICKEN && CONFIGURATION.get("Entities", "Enable_" + bird.name(), true).getBoolean(true))
{
bird.register();
}
}
if (ALRecipeLoader.blockPipe != null)
{
IndustryTabs.tabHydraulic().setIconItemStack(FluidPartsMaterial.IRON.getStack());
}
CONFIGURATION.save();
}

View file

@ -1,4 +1,4 @@
package dark.fluid.common;
package dark.assembly;
import java.util.ArrayList;
import java.util.List;
@ -7,7 +7,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import dark.api.ColorCode;
import com.dark.helpers.ColorCode;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
/** Enum to hold info about each pipe material. Values are by default and some can change with pipe
@ -123,12 +125,12 @@ public enum FluidPartsMaterial
public ItemStack getStack(int s)
{
return new ItemStack(FMRecipeLoader.blockPipe, s, (this.ordinal() * spacing));
return new ItemStack(ALRecipeLoader.blockPipe, s, (this.ordinal() * spacing));
}
public ItemStack getStack(int s, ColorCode color)
{
return new ItemStack(FMRecipeLoader.blockPipe, s, (this.ordinal() * spacing) + color.ordinal() + 1);
return new ItemStack(ALRecipeLoader.blockPipe, s, (this.ordinal() * spacing) + color.ordinal() + 1);
}
public static int getDropItemMeta(World world, int x, int y, int z)

View file

@ -1,23 +1,47 @@
package dark.assembly.client;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.ALRecipeLoader;
import dark.assembly.CommonProxy;
import dark.assembly.client.gui.GuiEncoderCoder;
import dark.assembly.client.gui.GuiEncoderHelp;
import dark.assembly.client.gui.GuiEncoderInventory;
import dark.assembly.client.gui.GuiImprinter;
import dark.assembly.client.gui.GuiProcessor;
import dark.assembly.client.render.BlockRenderHelper;
import dark.assembly.client.render.BlockRenderingHandler;
import dark.assembly.client.render.ItemPipeRenderer;
import dark.assembly.client.render.ItemRenderFluidCan;
import dark.assembly.client.render.ItemTankRenderer;
import dark.assembly.client.render.RenderConstructionPump;
import dark.assembly.client.render.RenderPipe;
import dark.assembly.client.render.RenderPump;
import dark.assembly.client.render.RenderReleaseValve;
import dark.assembly.client.render.RenderSink;
import dark.assembly.client.render.RenderTank;
import dark.assembly.client.render.RenderTurkey;
import dark.assembly.entities.EntityFarmEgg;
import dark.assembly.entities.EntityTurkey;
import dark.assembly.imprinter.TileEntityImprinter;
import dark.assembly.machine.encoder.TileEntityEncoder;
import dark.assembly.machine.processor.TileEntityProcessor;
import dark.fluid.common.machines.TileEntityReleaseValve;
import dark.fluid.common.machines.TileEntitySink;
import dark.fluid.common.machines.TileEntityTank;
import dark.fluid.common.pipes.TileEntityPipe;
import dark.fluid.common.pump.TileEntityConstructionPump;
import dark.fluid.common.pump.TileEntityStarterPump;
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy
@ -28,12 +52,30 @@ public class ClientProxy extends CommonProxy
{
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler());
MinecraftForge.EVENT_BUS.register(SoundHandler.INSTANCE);
RenderingRegistry.registerEntityRenderingHandler(EntityTurkey.class, new RenderTurkey());
RenderingRegistry.registerEntityRenderingHandler(EntityFarmEgg.class, new RenderSnowball(Item.egg));
}
@Override
public void init()
{
super.init();
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPipe.class, new RenderPipe());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStarterPump.class, new RenderPump());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGenerator.class, new RenderGenerator());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReleaseValve.class, new RenderReleaseValve());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySink.class, new RenderSink());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConstructionPump.class, new RenderConstructionPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
MinecraftForgeClient.registerItemRenderer(ALRecipeLoader.blockPipe.blockID, new ItemPipeRenderer());
MinecraftForgeClient.registerItemRenderer(ALRecipeLoader.blockTank.blockID, new ItemTankRenderer());
MinecraftForgeClient.registerItemRenderer(ALRecipeLoader.blockReleaseValve.blockID, new ItemPipeRenderer());
RenderingRegistry.registerBlockHandler(new BlockRenderHelper());
if (ALRecipeLoader.itemFluidCan != null)
MinecraftForgeClient.registerItemRenderer(ALRecipeLoader.itemFluidCan.itemID, new ItemRenderFluidCan());
}
@Override

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -1,4 +1,4 @@
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -0,0 +1,126 @@
// Date: 11/27/2013 9:27:04 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelSmallFluidCan extends ModelBase
{
//fields
ModelRenderer body1;
ModelRenderer body2;
ModelRenderer body3;
ModelRenderer body4;
ModelRenderer edge1;
ModelRenderer edge2;
ModelRenderer edge3;
ModelRenderer edge4;
ModelRenderer glass1;
ModelRenderer glass2;
ModelRenderer glass3;
ModelRenderer glass4;
public ModelSmallFluidCan()
{
textureWidth = 64;
textureHeight = 32;
body1 = new ModelRenderer(this, 12, 28);
body1.addBox(-1.5F, 0F, -1.5F, 3, 1, 3);
body1.setRotationPoint(0F, 23F, 0F);
body1.setTextureSize(64, 32);
body1.mirror = true;
setRotation(body1, 0F, 0F, 0F);
body2 = new ModelRenderer(this, 10, 22);
body2.addBox(-2F, -1F, -2F, 4, 1, 4);
body2.setRotationPoint(0F, 23F, 0F);
body2.setTextureSize(64, 32);
body2.mirror = true;
setRotation(body2, 0F, 0F, 0F);
body3 = new ModelRenderer(this, 10, 5);
body3.addBox(-2F, -1F, -2F, 4, 1, 4);
body3.setRotationPoint(0F, 17F, 0F);
body3.setTextureSize(64, 32);
body3.mirror = true;
setRotation(body3, 0F, 0F, 0F);
body4 = new ModelRenderer(this, 12, 0);
body4.addBox(-1.5F, 0F, -1.5F, 3, 1, 3);
body4.setRotationPoint(0F, 15F, 0F);
body4.setTextureSize(64, 32);
body4.mirror = true;
setRotation(body4, 0F, 0F, 0F);
edge1 = new ModelRenderer(this, 21, 13);
edge1.addBox(-1.9F, -1F, -1.9F, 1, 5, 1);
edge1.setRotationPoint(0F, 18F, 0F);
edge1.setTextureSize(64, 32);
edge1.mirror = true;
setRotation(edge1, 0F, 0F, 0F);
edge2 = new ModelRenderer(this, 26, 13);
edge2.addBox(-2.1F, -1F, -1.9F, 1, 5, 1);
edge2.setRotationPoint(3F, 18F, 0F);
edge2.setTextureSize(64, 32);
edge2.mirror = true;
setRotation(edge2, 0F, 0F, 0F);
edge3 = new ModelRenderer(this, 10, 13);
edge3.addBox(-2.1F, -1F, 0.9F, 1, 5, 1);
edge3.setRotationPoint(3F, 18F, 0F);
edge3.setTextureSize(64, 32);
edge3.mirror = true;
setRotation(edge3, 0F, 0F, 0F);
edge4 = new ModelRenderer(this, 16, 13);
edge4.addBox(-1.9F, -1F, 0.9F, 1, 5, 1);
edge4.setRotationPoint(0F, 18F, 0F);
edge4.setTextureSize(64, 32);
edge4.mirror = true;
setRotation(edge4, 0F, 0F, 0F);
glass1 = new ModelRenderer(this, 2, 13);
glass1.addBox(-3.1F, -1F, 1.8F, 2, 5, 0);
glass1.setRotationPoint(2F, 18F, 0F);
glass1.setTextureSize(64, 32);
glass1.mirror = true;
setRotation(glass1, 0F, 0F, 0F);
glass2 = new ModelRenderer(this, 2, 13);
glass2.addBox(-3.1F, -1F, 0.2F, 2, 5, 0);
glass2.setRotationPoint(2F, 18F, -2F);
glass2.setTextureSize(64, 32);
glass2.mirror = true;
setRotation(glass2, 0F, 0F, 0F);
glass3 = new ModelRenderer(this, 2, 13);
glass3.addBox(-1.1F, -1F, -0.2F, 2, 5, 0);
glass3.setRotationPoint(2F, 18F, 0F);
glass3.setTextureSize(64, 32);
glass3.mirror = true;
setRotation(glass3, 0F, 1.570796F, 0F);
glass4 = new ModelRenderer(this, 2, 13);
glass4.addBox(-1.1F, -1F, 2.2F, 2, 5, 0);
glass4.setRotationPoint(-4F, 18F, 0F);
glass4.setTextureSize(64, 32);
glass4.mirror = true;
setRotation(glass4, 0F, 1.570796F, 0F);
}
public void render(float f5)
{
body1.render(f5);
body2.render(f5);
body3.render(f5);
body4.render(f5);
edge1.render(f5);
edge2.render(f5);
edge3.render(f5);
edge4.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.fluid.client.model;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -4,7 +4,7 @@
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package dark.farmtech.client.models;
package dark.assembly.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -1,4 +1,4 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
@ -14,11 +14,11 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelConstructionPump;
import dark.fluid.client.model.ModelPump;
import dark.fluid.client.model.ModelSink;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.FluidMech;
import dark.assembly.ALRecipeLoader;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelConstructionPump;
import dark.assembly.client.model.ModelPump;
import dark.assembly.client.model.ModelSink;
import dark.mech.client.model.ModelGearRod;
import dark.mech.client.model.ModelGenerator;
@ -37,41 +37,34 @@ public class BlockRenderHelper implements ISimpleBlockRenderingHandler
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{
GL11.glPushMatrix();
if (FMRecipeLoader.blockPumpMachine != null && block.blockID == FMRecipeLoader.blockPumpMachine.blockID && metadata < 4)
if (ALRecipeLoader.blockPumpMachine != null && block.blockID == ALRecipeLoader.blockPumpMachine.blockID && metadata < 4)
{
GL11.glTranslatef(0.0F, 1.1F, 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "pumps/WaterPump.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "pumps/WaterPump.png"));
modelPump.render(0.0725F);
modelPump.renderMotion(0.0725F, 0);
}
else if (FMRecipeLoader.blockSink != null && block.blockID == FMRecipeLoader.blockSink.blockID)
else if (ALRecipeLoader.blockSink != null && block.blockID == ALRecipeLoader.blockSink.blockID)
{
GL11.glTranslatef(0.0F, .8F, 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "Sink.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "Sink.png"));
sink.render(0.0565F);
}
else if (FMRecipeLoader.blockRod != null && block.blockID == FMRecipeLoader.blockRod.blockID)
else if (ALRecipeLoader.blockRod != null && block.blockID == ALRecipeLoader.blockRod.blockID)
{
GL11.glTranslatef(0.0F, 1.5F, 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "mechanical/GearRod.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "mechanical/GearRod.png"));
modelRod.render(0.0825F, 0);
}
else if (FMRecipeLoader.blockGenerator != null && block.blockID == FMRecipeLoader.blockGenerator.blockID)
{
GL11.glTranslatef(0.0F, 1.0F, 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "mechanical/Generator.png"));
modelGen.render(null);
}
else if (FMRecipeLoader.blockConPump != null && block.blockID == FMRecipeLoader.blockConPump.blockID && metadata < 4)
else if (ALRecipeLoader.blockConPump != null && block.blockID == ALRecipeLoader.blockConPump.blockID && metadata < 4)
{
GL11.glTranslatef(0.0F, 1.2F, 0.0F);
GL11.glRotatef(180f, 0f, 0f, 1f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "ConstructionPump.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "ConstructionPump.png"));
conPump.render(0.0725F);
conPump.renderMotor(0.0725F);

View file

@ -0,0 +1,56 @@
package dark.assembly.client.render;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import universalelectricity.core.vector.Vector3;
/** Used to store info on a block mainly used for rendering */
public class BlockRenderInfo
{
/** Block lower corner size */
public Vector3 min = new Vector3(0, 0, 0);
/** Block higher corner size */
public Vector3 max = new Vector3(1, 1, 1);
/** Block to pull info from */
public Block baseBlock = Block.sand;
/** Override render texture */
public Icon texture = null;
/** meta data to use for block the block */
public int meta = 0;
/** Gets the block brightness at the given location */
public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
{
return baseBlock.getBlockBrightness(iblockaccess, i, j, k);
}
/** Gets the block texture from the given side */
public Icon getBlockTextureFromSide(int side)
{
return this.getBlockIconFromSideAndMetadata(side, meta);
}
/** Gets the block texture from side and meta */
public Icon getBlockIconFromSideAndMetadata(int side, int meta)
{
return this.getIconSafe(baseBlock.getIcon(side, meta));
}
/** Gets the icon and does some safty checks */
public Icon getIconSafe(Icon par1Icon)
{
Icon icon = par1Icon;
if (this.texture != null)
{
icon = texture;
}
if (par1Icon == null)
{
icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
}
return icon;
}
}

View file

@ -0,0 +1,99 @@
package dark.assembly.client.render;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EntityFakeBlock extends Entity
{
@SideOnly(Side.CLIENT)
public Icon texture;
public float shadowSize = 0;
public float rotationX = 0;
public float rotationY = 0;
public float rotationZ = 0;
public double iSize, jSize, kSize;
private int brightness = -1;
public EntityFakeBlock(World world)
{
super(world);
preventEntitySpawning = false;
noClip = true;
isImmuneToFire = true;
}
public EntityFakeBlock(World world, double xPos, double yPos, double zPos)
{
super(world);
setPositionAndRotation(xPos, yPos, zPos, 0, 0);
}
public EntityFakeBlock(World world, double i, double j, double k, double iSize, double jSize, double kSize)
{
this(world);
this.iSize = iSize;
this.jSize = jSize;
this.kSize = kSize;
setPositionAndRotation(i, j, k, 0, 0);
this.motionX = 0.0;
this.motionY = 0.0;
this.motionZ = 0.0;
}
@Override
public void setPosition(double d, double d1, double d2)
{
super.setPosition(d, d1, d2);
boundingBox.minX = posX;
boundingBox.minY = posY;
boundingBox.minZ = posZ;
boundingBox.maxX = posX + iSize;
boundingBox.maxY = posY + jSize;
boundingBox.maxZ = posZ + kSize;
}
@Override
public void moveEntity(double d, double d1, double d2)
{
setPosition(posX + d, posY + d1, posZ + d2);
}
public void setBrightness(int brightness)
{
this.brightness = brightness;
}
@Override
protected void entityInit()
{
// TODO Auto-generated method stub
}
@Override
protected void readEntityFromNBT(NBTTagCompound data)
{
iSize = data.getDouble("iSize");
jSize = data.getDouble("jSize");
kSize = data.getDouble("kSize");
}
@Override
protected void writeEntityToNBT(NBTTagCompound data)
{
data.setDouble("iSize", iSize);
data.setDouble("jSize", jSize);
data.setDouble("kSize", kSize);
}
@Override
public int getBrightnessForRender(float par1)
{
return brightness > 0 ? brightness : super.getBrightnessForRender(par1);
}
}

View file

@ -1,4 +1,4 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
@ -12,10 +12,10 @@ import com.dark.DarkCore;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelReleaseValve;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.FluidMech;
import dark.fluid.common.FluidPartsMaterial;
import dark.assembly.ALRecipeLoader;
import dark.assembly.AssemblyLine;
import dark.assembly.FluidPartsMaterial;
import dark.assembly.client.model.ModelReleaseValve;
@SideOnly(Side.CLIENT)
public class ItemPipeRenderer implements IItemRenderer
@ -38,11 +38,11 @@ public class ItemPipeRenderer implements IItemRenderer
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if (item.itemID == FMRecipeLoader.blockPipe.blockID)
if (item.itemID == ALRecipeLoader.blockPipe.blockID)
{
this.renderPipeItem((RenderBlocks) data[0], item, type == ItemRenderType.EQUIPPED);
}
if (item.itemID == FMRecipeLoader.blockReleaseValve.blockID)
if (item.itemID == ALRecipeLoader.blockReleaseValve.blockID)
{
this.renderReleaseValve((RenderBlocks) data[0], item.getItemDamage(), type == ItemRenderType.EQUIPPED);
}
@ -76,7 +76,7 @@ public class ItemPipeRenderer implements IItemRenderer
public void renderReleaseValve(RenderBlocks renderer, int meta, boolean equ)
{
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(pipe.getTexture(FMRecipeLoader.blockPipe.blockID, 15));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(FluidPartsMaterial.STEEL, 0));
if (!equ)
{
GL11.glTranslatef(0.5F, -0.5F, 0.5F);
@ -91,7 +91,7 @@ public class ItemPipeRenderer implements IItemRenderer
pipe.SixPipe.renderBack();
pipe.SixPipe.renderMiddle();
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "ReleaseValve.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "ReleaseValve.png"));
GL11.glRotatef(180f, 0f, 0f, 1f);
if (!equ)
{

View file

@ -0,0 +1,112 @@
package dark.assembly.client.render;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import com.dark.DarkCore;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.ALRecipeLoader;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelSmallFluidCan;
import dark.assembly.machine.ItemFluidCan;
@SideOnly(Side.CLIENT)
public class ItemRenderFluidCan implements IItemRenderer
{
public static final ModelSmallFluidCan CAN_MODEL = new ModelSmallFluidCan();
public static final ResourceLocation CAN_TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "FluidCanA.png");
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if (ALRecipeLoader.itemFluidCan != null && item.itemID == ALRecipeLoader.itemFluidCan.itemID)
{
FluidStack liquid = ((ItemFluidCan) ALRecipeLoader.itemFluidCan).drain(item, Integer.MAX_VALUE, false);
if (liquid != null && liquid.amount > 100)
{
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, Minecraft.getMinecraft().theWorld, false);
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glScalef(0.4F, 1.5F, 0.4F);
if (type == ItemRenderType.ENTITY)
{
GL11.glTranslatef(-.5F, 0F, -.5F);
}
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(1.8F, 0.25F, 1.8F);
}
else if (type == ItemRenderType.EQUIPPED)
{
GL11.glTranslatef(0.9F, 0.4F, 1.2F);
}
else
{
GL11.glTranslatef(0.6F, 0F, 0.6F);
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture((RenderFluidHelper.getFluidSheet(liquid)));
int cap = ((ItemFluidCan) ALRecipeLoader.itemFluidCan).getCapacity(item);
if (liquid.getFluid().isGaseous())
{
cap = liquid.amount;
}
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (cap) * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(CAN_TEXTURE);
float scale = 1.8f;
GL11.glScalef(scale, scale, scale);
if (type == ItemRenderType.ENTITY)
{
GL11.glTranslatef(0F, -1F, 0F);
}
else if (type == ItemRenderType.EQUIPPED)
{
GL11.glTranslatef(0.3F, -0.7F, 0.37F);
}
else
{
GL11.glTranslatef(0.5F, -0.8F, 0.5F);
}
CAN_MODEL.render(0.0625F);
GL11.glPopMatrix();
}
}
}

View file

@ -1,4 +1,4 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
@ -12,11 +12,10 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelTankSide;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.FluidMech;
import dark.assembly.ALRecipeLoader;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelTankSide;
import dark.fluid.common.machines.BlockTank;
import dark.machines.client.renders.RenderBlockFluid;
@SideOnly(Side.CLIENT)
public class ItemTankRenderer implements IItemRenderer
@ -38,7 +37,7 @@ public class ItemTankRenderer implements IItemRenderer
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if (item.itemID == FMRecipeLoader.blockTank.blockID)
if (item.itemID == ALRecipeLoader.blockTank.blockID)
{
GL11.glPushMatrix();
@ -60,7 +59,7 @@ public class ItemTankRenderer implements IItemRenderer
GL11.glTranslatef(0.7F, .4F, 0.7F);
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(FluidMech.instance.DOMAIN, item.getItemDamage() == 1 ? "textures/blocks/obsidian.png" : "textures/blocks/iron_block.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(AssemblyLine.DOMAIN, item.getItemDamage() == 1 ? "textures/blocks/obsidian.png" : "textures/blocks/iron_block.png"));
GL11.glTranslatef(0.0F, -0.9F, 0.0F);
tank.render(0.0625F, false, false, false, false);
GL11.glRotatef(90f, 0f, 1f, 0f);
@ -80,7 +79,7 @@ public class ItemTankRenderer implements IItemRenderer
if (liquid != null && liquid.amount > 100)
{
int[] displayList = RenderBlockFluid.getFluidDisplayLists(liquid, Minecraft.getMinecraft().theWorld, false);
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, Minecraft.getMinecraft().theWorld, false);
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
@ -108,14 +107,14 @@ public class ItemTankRenderer implements IItemRenderer
GL11.glTranslatef(0.5F, .2F, 0.5F);
}
FMLClientHandler.instance().getClient().renderEngine.bindTexture((RenderBlockFluid.getFluidSheet(liquid)));
FMLClientHandler.instance().getClient().renderEngine.bindTexture((RenderFluidHelper.getFluidSheet(liquid)));
int cap = BlockTank.tankVolume * FluidContainerRegistry.BUCKET_VOLUME;
if (liquid.getFluid().isGaseous())
{
cap = liquid.amount;
}
GL11.glCallList(displayList[(int) Math.min(((float) liquid.amount / (float) (cap) * (RenderBlockFluid.DISPLAY_STAGES - 1)), displayList.length - 1)]);
GL11.glCallList(displayList[(int) Math.min(((float) liquid.amount / (float) (cap) * (RenderFluidHelper.DISPLAY_STAGES - 1)), displayList.length - 1)]);
GL11.glPopAttrib();
GL11.glPopMatrix();

View file

@ -0,0 +1,193 @@
package dark.assembly.client.render;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import universalelectricity.core.vector.Vector3;
public class RenderBlockEntity extends Render
{
public static RenderBlockEntity INSTANCE = new RenderBlockEntity();
private RenderBlockEntity()
{
}
@Override
public void doRender(Entity entity, double i, double j, double k, float f, float f1)
{
doRenderBlock((EntityFakeBlock) entity, i, j, k);
}
public void doRenderBlock(EntityFakeBlock entity, double i, double j, double k)
{
if (entity.isDead)
return;
shadowSize = entity.shadowSize;
World world = entity.worldObj;
BlockRenderInfo util = new BlockRenderInfo();
util.texture = entity.texture;
this.bindTexture(TextureMap.locationBlocksTexture);
for (int iBase = 0; iBase < entity.iSize; ++iBase)
{
for (int jBase = 0; jBase < entity.jSize; ++jBase)
{
for (int kBase = 0; kBase < entity.kSize; ++kBase)
{
util.min = new Vector3();
util.max = new Vector3();
double remainX = entity.iSize - iBase;
double remainY = entity.jSize - jBase;
double remainZ = entity.kSize - kBase;
util.max.x = (remainX > 1.0 ? 1.0 : remainX);
util.max.y = (remainY > 1.0 ? 1.0 : remainY);
util.max.z = (remainZ > 1.0 ? 1.0 : remainZ);
GL11.glPushMatrix();
GL11.glTranslatef((float) i, (float) j, (float) k);
GL11.glRotatef(entity.rotationX, 1, 0, 0);
GL11.glRotatef(entity.rotationY, 0, 1, 0);
GL11.glRotatef(entity.rotationZ, 0, 0, 1);
GL11.glTranslatef(iBase, jBase, kBase);
int lightX, lightY, lightZ;
lightX = (int) (Math.floor(entity.posX) + iBase);
lightY = (int) (Math.floor(entity.posY) + jBase);
lightZ = (int) (Math.floor(entity.posZ) + kBase);
GL11.glDisable(2896 /* GL_LIGHTING */);
renderBlock(util, world, lightX, lightY, lightZ, false, true);
GL11.glEnable(2896 /* GL_LIGHTING */);
GL11.glPopMatrix();
}
}
}
}
public void renderBlock(BlockRenderInfo block, IBlockAccess blockAccess, int x, int y, int z, boolean doLight, boolean doTessellating)
{
float f = 0.5F;
float f1 = 1.0F;
float f2 = 0.8F;
float f3 = 0.6F;
renderBlocks.renderMaxX = block.max.x;
renderBlocks.renderMinX = block.min.x;
renderBlocks.renderMaxY = block.max.y;
renderBlocks.renderMinY = block.min.y;
renderBlocks.renderMaxZ = block.max.z;
renderBlocks.renderMinZ = block.min.z;
renderBlocks.enableAO = false;
Tessellator tessellator = Tessellator.instance;
if (doTessellating)
{
tessellator.startDrawingQuads();
}
float f4 = 0, f5 = 0;
if (doLight)
{
f4 = block.getBlockBrightness(blockAccess, x, y, z);
f5 = block.getBlockBrightness(blockAccess, x, y, z);
if (f5 < f4)
{
f5 = f4;
}
tessellator.setColorOpaque_F(f * f5, f * f5, f * f5);
}
renderBlocks.renderFaceYNeg(null, 0, 0, 0, block.getBlockTextureFromSide(0));
if (doLight)
{
f5 = block.getBlockBrightness(blockAccess, x, y, z);
if (f5 < f4)
{
f5 = f4;
}
tessellator.setColorOpaque_F(f1 * f5, f1 * f5, f1 * f5);
}
renderBlocks.renderFaceYPos(null, 0, 0, 0, block.getBlockTextureFromSide(1));
if (doLight)
{
f5 = block.getBlockBrightness(blockAccess, x, y, z);
if (f5 < f4)
{
f5 = f4;
}
tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5);
}
renderBlocks.renderFaceZNeg(null, 0, 0, 0, block.getBlockTextureFromSide(2));
if (doLight)
{
f5 = block.getBlockBrightness(blockAccess, x, y, z);
if (f5 < f4)
{
f5 = f4;
}
tessellator.setColorOpaque_F(f2 * f5, f2 * f5, f2 * f5);
}
renderBlocks.renderFaceZPos(null, 0, 0, 0, block.getBlockTextureFromSide(3));
if (doLight)
{
f5 = block.getBlockBrightness(blockAccess, x, y, z);
if (f5 < f4)
{
f5 = f4;
}
tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5);
}
renderBlocks.renderFaceXNeg(null, 0, 0, 0, block.getBlockTextureFromSide(4));
if (doLight)
{
f5 = block.getBlockBrightness(blockAccess, x, y, z);
if (f5 < f4)
{
f5 = f4;
}
tessellator.setColorOpaque_F(f3 * f5, f3 * f5, f3 * f5);
}
renderBlocks.renderFaceXPos(null, 0, 0, 0, block.getBlockTextureFromSide(5));
if (doTessellating)
{
tessellator.draw();
}
}
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View file

@ -1,5 +1,6 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -9,16 +10,16 @@ import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelConstructionPump;
import dark.fluid.common.FluidMech;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelConstructionPump;
import dark.fluid.common.pump.TileEntityConstructionPump;
import dark.machines.client.renders.RenderTileMachine;
@SideOnly(Side.CLIENT)
public class RenderConstructionPump extends RenderTileMachine
public class RenderConstructionPump extends TileEntitySpecialRenderer
{
int type = 0;
private ModelConstructionPump model;
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "ConstructionPump.png");
public RenderConstructionPump()
{
@ -26,9 +27,9 @@ public class RenderConstructionPump extends RenderTileMachine
}
@Override
public void renderModel(TileEntity tileEntity, double d, double d1, double d2, float d3)
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
{
bindTexture(this.getTexture(0, 0));
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.45F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
@ -57,10 +58,4 @@ public class RenderConstructionPump extends RenderTileMachine
GL11.glPopMatrix();
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "ConstructionPump.png");
}
}

View file

@ -0,0 +1,125 @@
package dark.assembly.client.render;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
public class RenderFluidHelper
{
private static final ResourceLocation BLOCK_TEXTURE = TextureMap.locationBlocksTexture;
private static Map<Fluid, int[]> flowingRenderCache = new HashMap<Fluid, int[]>();
private static Map<Fluid, int[]> stillRenderCache = new HashMap<Fluid, int[]>();
public static final int DISPLAY_STAGES = 100;
private static final BlockRenderInfo liquidBlock = new BlockRenderInfo();
public static ResourceLocation getFluidSheet(FluidStack liquid)
{
return BLOCK_TEXTURE;
}
public static Icon getFluidTexture(Fluid fluid, boolean flowing)
{
if (fluid == null)
{
return null;
}
Icon icon = flowing ? fluid.getFlowingIcon() : fluid.getStillIcon();
if (icon == null)
{
icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
}
return icon;
}
public static void setColorForFluidStack(FluidStack fluidstack)
{
if (fluidstack == null)
{
return;
}
int color = fluidstack.getFluid().getColor(fluidstack);
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
GL11.glColor4f(red, green, blue, 1);
}
public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing)
{
if (fluidStack == null)
{
return null;
}
Fluid fluid = fluidStack.getFluid();
if (fluid == null)
{
return null;
}
Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
int[] diplayLists = cache.get(fluid);
if (diplayLists != null)
{
return diplayLists;
}
diplayLists = new int[DISPLAY_STAGES];
if (fluid.getBlockID() > 0)
{
liquidBlock.baseBlock = Block.blocksList[fluid.getBlockID()];
liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
}
else
{
liquidBlock.baseBlock = Block.waterStill;
liquidBlock.texture = getFluidTexture(fluidStack.getFluid(), flowing);
}
cache.put(fluid, diplayLists);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
for (int s = 0; s < DISPLAY_STAGES; ++s)
{
diplayLists[s] = GLAllocation.generateDisplayLists(1);
GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/);
liquidBlock.min.x = 0.01f;
liquidBlock.min.y = 0;
liquidBlock.min.z = 0.01f;
liquidBlock.max.x = 0.99f;
liquidBlock.max.y = (float) s / (float) DISPLAY_STAGES;
liquidBlock.max.z = 0.99f;
RenderBlockEntity.INSTANCE.renderBlock(liquidBlock, world, 0, 0, 0, false, true);
GL11.glEndList();
}
GL11.glColor4f(1, 1, 1, 1);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
return diplayLists;
}
}

View file

@ -1,5 +1,6 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -9,15 +10,15 @@ import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelFurnace;
import dark.fluid.common.FluidMech;
import dark.machines.client.renders.RenderTileMachine;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelFurnace;
@SideOnly(Side.CLIENT)
public class RenderFurnace extends RenderTileMachine
public class RenderFurnace extends TileEntitySpecialRenderer
{
int type = 0;
private ModelFurnace model;
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "Furnace.png");
public RenderFurnace()
{
@ -25,13 +26,13 @@ public class RenderFurnace extends RenderTileMachine
}
@Override
public void renderModel(TileEntity te, double d, double d1, double d2, float d3)
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
{
bindTextureByName(FluidMech.instance.PREFIX, DarkCore.MODEL_DIRECTORY + "Furnace.png");
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
int meta = tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
switch (meta)
{
case 0:
@ -50,12 +51,4 @@ public class RenderFurnace extends RenderTileMachine
model.genRender(0.0625F);
GL11.glPopMatrix();
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,5 +1,6 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -9,24 +10,24 @@ import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelGearPiston;
import dark.fluid.common.FluidMech;
import dark.machines.client.renders.RenderTileMachine;
import dark.mech.common.machines.TileEntitySteamPiston;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelGearPiston;
@SideOnly(Side.CLIENT)
public class RenderGearPiston extends RenderTileMachine
public class RenderGearPiston extends TileEntitySpecialRenderer
{
private ModelGearPiston model;
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "GearShaftPiston.png");
public RenderGearPiston()
{
model = new ModelGearPiston();
}
public void renderTileEntityAt(TileEntitySteamPiston tileEntity, double d, double d1, double d2, float d3)
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
{
bindTextureByName(FluidMech.instance.PREFIX, DarkCore.MODEL_DIRECTORY + "GearShaftPiston.png");
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
@ -57,18 +58,4 @@ public class RenderGearPiston extends RenderTileMachine
GL11.glPopMatrix();
}
@Override
public void renderModel(TileEntity var1, double d, double d1, double d2, float d3)
{
this.renderTileEntityAt(((TileEntitySteamPiston) var1), d, d1, d2, d3);
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,32 +1,38 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import java.util.HashMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.builtbroken.common.Pair;
import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelLargePipe;
import dark.fluid.common.FluidMech;
import dark.fluid.common.FluidPartsMaterial;
import dark.assembly.AssemblyLine;
import dark.assembly.FluidPartsMaterial;
import dark.assembly.client.model.ModelLargePipe;
import dark.fluid.common.pipes.EnumPipeType;
import dark.fluid.common.pipes.TileEntityPipe;
import dark.machines.client.renders.RenderTileMachine;
@SideOnly(Side.CLIENT)
public class RenderPipe extends RenderTileMachine
public class RenderPipe extends TileEntitySpecialRenderer
{
public ModelLargePipe SixPipe;
private static HashMap<Pair<FluidPartsMaterial, Integer>, ResourceLocation> TEXTURES = new HashMap<Pair<FluidPartsMaterial, Integer>, ResourceLocation>();
public static ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/Pipe.png");
public RenderPipe()
{
SixPipe = new ModelLargePipe();
}
public void renderAModelAt(TileEntity te, double d, double d1, double d2, float f)
@Override
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
{
// Texture file
GL11.glPushMatrix();
@ -51,24 +57,23 @@ public class RenderPipe extends RenderTileMachine
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/Pipe.png");
}
public static ResourceLocation getTexture(FluidPartsMaterial mat, int pipeID)
{
if (mat != null)
{
String s = "";
if (EnumPipeType.get(pipeID) != null)
Pair<FluidPartsMaterial, Integer> index = new Pair<FluidPartsMaterial, Integer>(mat, pipeID);
if (!TEXTURES.containsKey(index))
{
s = EnumPipeType.get(pipeID).getName(pipeID);
String pipeName = "";
if (EnumPipeType.get(pipeID) != null)
{
pipeName = EnumPipeType.get(pipeID).getName(pipeID);
}
TEXTURES.put(index, new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/" + mat.matName + "/" + pipeName + "Pipe.png"));
}
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/" + mat.matName + "/" + s + "Pipe.png");
return TEXTURES.get(index);
}
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/Pipe.png");
return TEXTURE;
}
public void render(FluidPartsMaterial mat, int pipeID, boolean[] side)
@ -101,10 +106,4 @@ public class RenderPipe extends RenderTileMachine
SixPipe.renderMiddle();
}
@Override
public void renderModel(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt(tileEntity, var2, var4, var6, var8);
}
}

View file

@ -1,5 +1,6 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -9,27 +10,28 @@ import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelPump;
import dark.fluid.common.FluidMech;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelPump;
import dark.fluid.common.pump.TileEntityStarterPump;
import dark.machines.client.renders.RenderTileMachine;
@SideOnly(Side.CLIENT)
public class RenderPump extends RenderTileMachine
public class RenderPump extends TileEntitySpecialRenderer
{
int type = 0;
private ModelPump model;
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "pumps/WaterPump.png");
public RenderPump()
{
model = new ModelPump();
}
public void renderAModelAt(TileEntityStarterPump te, double d, double d1, double d2, float f)
@Override
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
{
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
bindTexture(this.getTexture(te.getBlockType().blockID, te.getBlockMetadata()));
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
@ -49,24 +51,12 @@ public class RenderPump extends RenderTileMachine
break;
}
model.render(0.0625F);
model.renderMotion(0.0625F, te.rotation);
if (te instanceof TileEntityStarterPump)
{
model.renderMotion(0.0625F, ((TileEntityStarterPump) te).rotation);
}
GL11.glPopMatrix();
}
@Override
public void renderModel(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
if (tileEntity instanceof TileEntityStarterPump)
{
this.renderAModelAt((TileEntityStarterPump) tileEntity, var2, var4, var6, var8);
}
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "pumps/WaterPump.png");
}
}

View file

@ -1,5 +1,6 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@ -9,27 +10,28 @@ import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.ColorCode;
import dark.fluid.client.model.ModelLargePipe;
import dark.fluid.client.model.ModelReleaseValve;
import dark.fluid.common.FluidMech;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelLargePipe;
import dark.assembly.client.model.ModelReleaseValve;
import dark.fluid.common.machines.TileEntityReleaseValve;
import dark.machines.client.renders.RenderTileMachine;
@SideOnly(Side.CLIENT)
public class RenderReleaseValve extends RenderTileMachine
public class RenderReleaseValve extends TileEntitySpecialRenderer
{
private ModelLargePipe SixPipe;
private ModelReleaseValve valve;
private TileEntity[] ents = new TileEntity[6];
public static final ResourceLocation VALVE_TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "ReleaseValve.png");
public RenderReleaseValve()
{
SixPipe = new ModelLargePipe();
valve = new ModelReleaseValve();
}
public void renderAModelAt(TileEntity te, double d, double d1, double d2, float f)
@Override
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
{
// Texture file
GL11.glPushMatrix();
@ -39,7 +41,7 @@ public class RenderReleaseValve extends RenderTileMachine
{
ents = ((TileEntityReleaseValve) te).connected;
}
bindTexture(this.getTexture(te.getBlockType().blockID, te.getBlockMetadata()));
bindTexture(RenderPipe.TEXTURE);
if (ents[0] != null)
SixPipe.renderBottom();
if (ents[1] != null)
@ -53,27 +55,10 @@ public class RenderReleaseValve extends RenderTileMachine
if (ents[4] != null)
SixPipe.renderLeft();
SixPipe.renderMiddle();
bindTextureByName(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "ReleaseValve.png");
bindTexture(VALVE_TEXTURE);
if (ents[1] == null)
valve.render();
GL11.glPopMatrix();
}
public static String getPipeTexture(int meta)
{
return DarkCore.MODEL_DIRECTORY + "pipes/" + ColorCode.get(meta).getName() + "Pipe.png";
}
@Override
public void renderModel(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt(tileEntity, var2, var4, var6, var8);
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "pipes/" + ColorCode.get(15).getName() + "Pipe.png");
}
}

View file

@ -0,0 +1,59 @@
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelSink;
@SideOnly(Side.CLIENT)
public class RenderSink extends TileEntitySpecialRenderer
{
int type = 0;
private ModelSink model;
public static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "Sink.png");
public RenderSink()
{
model = new ModelSink();
}
@Override
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
{
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
bindTexture(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
switch (meta)
{
case 3:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 0:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 1:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
case 2:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
}
model.render(0.0625F);
//TODO render fluid using fluid renderer
GL11.glPopMatrix();
}
}

View file

@ -1,5 +1,6 @@
package dark.fluid.client.render;
package dark.assembly.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeDirection;
@ -7,16 +8,15 @@ import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import com.dark.helpers.ColorCode;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.ColorCode;
import dark.fluid.client.model.ModelTankSide;
import dark.assembly.client.model.ModelTankSide;
import dark.fluid.common.machines.TileEntityTank;
import dark.machines.client.renders.RenderBlockFluid;
import dark.machines.client.renders.RenderTileMachine;
@SideOnly(Side.CLIENT)
public class RenderTank extends RenderTileMachine
public class RenderTank extends TileEntitySpecialRenderer
{
private ModelTankSide model;
@ -43,7 +43,7 @@ public class RenderTank extends RenderTileMachine
if (liquid != null && liquid.amount > 100)
{
int[] displayList = RenderBlockFluid.getFluidDisplayLists(liquid, tileEntity.worldObj, false);
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, tileEntity.worldObj, false);
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
@ -52,12 +52,12 @@ public class RenderTank extends RenderTileMachine
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bindTexture(RenderBlockFluid.getFluidSheet(liquid));
bindTexture(RenderFluidHelper.getFluidSheet(liquid));
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glScalef(1.01F, 1.01F, 1.01F);
int cap = tileEntity instanceof TileEntityTank ? ((TileEntityTank) tileEntity).getTankInfo()[0].capacity : liquid.amount;
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (cap) * (RenderBlockFluid.DISPLAY_STAGES - 1))]);
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (cap) * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
GL11.glPopAttrib();
GL11.glPopMatrix();
@ -111,7 +111,6 @@ public class RenderTank extends RenderTileMachine
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
String texture = "";
@ -125,11 +124,4 @@ public class RenderTank extends RenderTileMachine
}
return new ResourceLocation(texture);
}
@Override
public void renderModel(TileEntity tileEntity, double x, double y, double z, float size)
{
// TODO Auto-generated method stub
}
}

View file

@ -1,4 +1,4 @@
package dark.farmtech.client.renders;
package dark.assembly.client.render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
@ -11,14 +11,14 @@ import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.farmtech.FarmTech;
import dark.farmtech.client.models.ModelTurkey;
import dark.farmtech.entities.EntityTurkey;
import dark.assembly.AssemblyLine;
import dark.assembly.client.model.ModelTurkey;
import dark.assembly.entities.EntityTurkey;
@SideOnly(Side.CLIENT)
public class RenderTurkey extends RenderLiving
{
private static final ResourceLocation TEXTURE = new ResourceLocation(FarmTech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "Turkey.png");
private static final ResourceLocation TEXTURE = new ResourceLocation(AssemblyLine.DOMAIN, DarkCore.MODEL_DIRECTORY + "Turkey.png");
public RenderTurkey()
{

View file

@ -1,4 +1,4 @@
package dark.farmtech.entities;
package dark.assembly.entities;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityAnimal;

View file

@ -1,4 +1,4 @@
package dark.farmtech.entities;
package dark.assembly.entities;
public class EntityMutantAnimal
{

View file

@ -1,4 +1,4 @@
package dark.farmtech.entities;
package dark.assembly.entities;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;

View file

@ -1,4 +1,4 @@
package dark.farmtech.entities;
package dark.assembly.entities;
import java.awt.Color;
@ -8,7 +8,7 @@ import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.common.registry.EntityRegistry;
import dark.farmtech.FarmTech;
import dark.assembly.AssemblyLine;
/** Enum of different birds that can be spawned by an egg or in the world threw normal spawning
*
@ -37,7 +37,7 @@ public enum EnumBird
public void register()
{
EntityRegistry.registerGlobalEntityID(EntityTurkey.class, "FTTurkey", EntityRegistry.findGlobalUniqueEntityId(), 5651507, Color.red.getRGB());
EntityRegistry.registerModEntity(EntityTurkey.class, "FTTurkey", FarmTech.entitiesIds++, FarmTech.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityTurkey.class, "FTTurkey", AssemblyLine.entitiesIds++, AssemblyLine.instance, 64, 1, true);
EntityRegistry.addSpawn(EntityTurkey.class, 3, 1, 10, EnumCreatureType.creature, BiomeGenBase.forest, BiomeGenBase.river);
}

View file

@ -1,4 +1,4 @@
package dark.farmtech.item;
package dark.assembly.item;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
@ -9,7 +9,7 @@ import net.minecraft.entity.IProjectile;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import dark.farmtech.entities.EntityFarmEgg;
import dark.assembly.entities.EntityFarmEgg;
public class BehaviorDispenseEgg extends BehaviorDefaultDispenseItem
{

View file

@ -1,4 +1,4 @@
package dark.farmtech.item;
package dark.assembly.item;
public class ItemDroneConfig
{

View file

@ -1,4 +1,4 @@
package dark.farmtech.item;
package dark.assembly.item;
import java.util.List;
@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.farmtech.FarmTech;
import dark.assembly.AssemblyLine;
/** Bucket containing compost for farming
*
@ -19,19 +19,19 @@ public class ItemFarmBucket extends ItemBucket
{
public ItemFarmBucket(int itemID, int blockID)
{
super(FarmTech.CONFIGURATION.getItem("Bucket", itemID).getInt(), blockID);
super(AssemblyLine.CONFIGURATION.getItem("Bucket", itemID).getInt(), blockID);
this.setCreativeTab(CreativeTabs.tabMisc);
this.setHasSubtypes(true);
this.setContainerItem(Item.bucketEmpty);
this.setUnlocalizedName("farmBucket");
this.setTextureName(FarmTech.instance.PREFIX + "farmBucket");
this.setTextureName(AssemblyLine.PREFIX + "farmBucket");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(FarmTech.instance.PREFIX + "compostBucket");
this.itemIcon = par1IconRegister.registerIcon(AssemblyLine.PREFIX + "compostBucket");
}
@SideOnly(Side.CLIENT)

View file

@ -1,11 +1,11 @@
package dark.farmtech.item;
package dark.assembly.item;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import dark.farmtech.entities.EntityFarmEgg;
import dark.assembly.entities.EntityFarmEgg;
public class ItemFarmEgg extends Item
{

View file

@ -1,4 +1,4 @@
package dark.farmtech.item;
package dark.assembly.item;
import java.util.List;
@ -22,11 +22,11 @@ import com.dark.helpers.ItemWorldHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.farmtech.FarmTech;
import dark.assembly.AssemblyLine;
/** Item for storing all kinds of food based items including meats, fruits, pies, cakes, breads, etc
* we have 1000s of meta to work with :)
*
*
* @author DarkGuardsman */
public class ItemFarmFood extends Item implements IExtraItemInfo
{
@ -35,7 +35,7 @@ public class ItemFarmFood extends Item implements IExtraItemInfo
public ItemFarmFood(int par1)
{
super(FarmTech.CONFIGURATION.getItem("Food", DarkCore.getNextID()).getInt());
super(AssemblyLine.CONFIGURATION.getItem("Food", DarkCore.getNextID()).getInt());
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabs.tabFood);
this.setUnlocalizedName("FarmFood");
@ -112,7 +112,7 @@ public class ItemFarmFood extends Item implements IExtraItemInfo
{
for (FarmFood food : FarmFood.values())
{
food.icon = par1IconRegister.registerIcon(FarmTech.instance.PREFIX + "food_" + food.name);
food.icon = par1IconRegister.registerIcon(AssemblyLine.PREFIX + "food_" + food.name);
}
}
@ -169,7 +169,7 @@ public class ItemFarmFood extends Item implements IExtraItemInfo
}
/** enum that stores data for each meta value that represents a food object for the item
*
*
* @Source http://urbanext.illinois.edu/herbs/list.cfm
* @author DarkGuardsman */
public static enum FarmFood
@ -250,7 +250,7 @@ public class ItemFarmFood extends Item implements IExtraItemInfo
}
/** IDs what the item is and determines how its used
*
*
* @author DarkGuardsman */
public static enum FoodType
{

View file

@ -0,0 +1,166 @@
package dark.assembly.item;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.oredict.OreDictionary;
import com.dark.DarkCore;
import com.dark.EnumMaterial;
import com.dark.EnumOrePart;
import com.dark.IExtraInfo.IExtraItemInfo;
import com.dark.LaserEvent;
import com.dark.prefab.ItemBasic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.AssemblyLine;
/** A series of items that are derived from a basic material
*
* @author DarkGuardsman */
public class ItemOreDirv extends ItemBasic implements IExtraItemInfo
{
public ItemOreDirv()
{
super(DarkCore.getNextItemId(), "Metal_Parts", AssemblyLine.CONFIGURATION);
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTabs.tabMaterials);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
if (itemStack != null)
{
return "item." + AssemblyLine.PREFIX + EnumOrePart.getFullName(itemStack.getItemDamage());
}
else
{
return this.getUnlocalizedName();
}
}
@Override
public Icon getIconFromDamage(int i)
{
return EnumMaterial.getIcon(i);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconRegister)
{
for (EnumMaterial mat : EnumMaterial.values())
{
mat.itemIcons = new Icon[EnumOrePart.values().length];
for (EnumOrePart part : EnumOrePart.values())
{
if (mat.shouldCreateItem(part))
{
mat.itemIcons[part.ordinal()] = iconRegister.registerIcon(AssemblyLine.PREFIX + mat.simpleName + part.simpleName);
}
}
}
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (EnumMaterial mat : EnumMaterial.values())
{
for (EnumOrePart part : EnumOrePart.values())
{
ItemStack stack = EnumMaterial.getStack(this, mat, part, 1);
if (stack != null && mat.shouldCreateItem(part) && mat.itemIcons[part.ordinal()] != null)
{
par3List.add(stack);
}
}
}
}
@Override
public boolean hasExtraConfigs()
{
return false;
}
@Override
public void loadExtraConfigs(Configuration config)
{
// TODO Auto-generated method stub
}
@Override
public void loadOreNames()
{
for (EnumMaterial mat : EnumMaterial.values())
{
for (EnumOrePart part : EnumOrePart.values())
{
if (mat.shouldCreateItem(part))
{
System.out.println(" N: " + mat.getOreName(part) + " R:" + mat.getOreNameReverse(part));
String B = mat.getOreNameReverse(part);
OreDictionary.registerOre(mat.getOreName(part), mat.getStack(this, part, 1));
OreDictionary.registerOre(mat.getOreNameReverse(part), mat.getStack(this, part, 1));
}
}
}
}
@ForgeSubscribe
public void LaserSmeltEvent(LaserEvent.LaserDropItemEvent event)
{
if (event.items != null)
{
for (int i = 0; i < event.items.size(); i++)
{
if (event.items.get(i).itemID == Block.blockIron.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9));
}
else if (event.items.get(i).itemID == Block.blockGold.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize * 9));
}
else if (event.items.get(i).itemID == Block.oreIron.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.IRON, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
}
else if (event.items.get(i).itemID == Block.oreGold.blockID)
{
event.items.set(i, EnumMaterial.getStack(this, EnumMaterial.GOLD, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
}
String oreName = OreDictionary.getOreName(OreDictionary.getOreID(event.items.get(i)));
if (oreName != null)
{
for (EnumMaterial mat : EnumMaterial.values())
{
if (oreName.equalsIgnoreCase("ore" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ore"))
{
event.items.set(i, mat.getStack(this, EnumOrePart.MOLTEN, event.items.get(i).stackSize + 1 + event.world.rand.nextInt(3)));
break;
}
else if (oreName.equalsIgnoreCase("ingot" + mat.simpleName) || oreName.equalsIgnoreCase(mat.simpleName + "ingot"))
{
event.items.set(i, mat.getStack(this, EnumOrePart.MOLTEN, event.items.get(i).stackSize));
break;
}
}
}
}
}
}
}

View file

@ -0,0 +1,138 @@
package dark.assembly.item;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.oredict.OreDictionary;
import com.dark.DarkCore;
import com.dark.IExtraInfo.IExtraItemInfo;
import com.dark.prefab.ItemBasic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.AssemblyLine;
/** A meta data item containing parts of various crafting recipes. These parts do not do anything but
* allow new crafting recipes to be created.
*
* @author DarkGuardsman */
public class ItemParts extends ItemBasic implements IExtraItemInfo
{
public ItemParts()
{
super(DarkCore.getNextItemId(), "DMParts", AssemblyLine.CONFIGURATION);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(64);
this.setCreativeTab(CreativeTabs.tabMaterials);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
if (itemStack != null && itemStack.getItemDamage() < Parts.values().length)
{
return "item." + Parts.values()[itemStack.getItemDamage()].name;
}
return super.getUnlocalizedName();
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta)
{
if (meta < Parts.values().length)
{
return Parts.values()[meta].icon;
}
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
super.registerIcons(iconRegister);
for (Parts part : Parts.values())
{
part.icon = iconRegister.registerIcon(AssemblyLine.PREFIX + "part." + part.name);
}
}
@Override
public int getMetadata(int meta)
{
return meta;
}
@Override
public void getSubItems(int blockID, CreativeTabs tab, List itemStackList)
{
for (Parts part : Parts.values())
{
if (part.show)
{
itemStackList.add(new ItemStack(this, 1, part.ordinal()));
}
}
}
public static enum Parts
{
Seal("leatherSeal"),
GasSeal("gasSeal"),
Tank("unfinishedTank"),
Valve("valvePart"),
MiningIcon("miningIcon", false),
CircuitBasic("circuitBasic"),
CircuitAdvanced("circuitAdvanced"),
CircuitElite("circuitElite"),
Motor("motor"),
IC("ic_chip"),
COIL("copperCoil"),
LASER("laserDiode");
public String name;
public Icon icon;
boolean show = true;
private Parts(String name)
{
this.name = name;
}
private Parts(String name, boolean show)
{
this(name);
this.show = show;
}
}
@Override
public boolean hasExtraConfigs()
{
return false;
}
@Override
public void loadExtraConfigs(Configuration config)
{
// TODO Auto-generated method stub
}
@Override
public void loadOreNames()
{
for (Parts part : Parts.values())
{
OreDictionary.registerOre(part.name, new ItemStack(this, 1, part.ordinal()));
}
}
}

View file

@ -0,0 +1,92 @@
package dark.assembly.machine;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.ItemFluidContainer;
import universalelectricity.core.item.ElectricItemHelper;
import com.dark.DarkCore;
import com.dark.IndustryTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.assembly.AssemblyLine;
/** Small fluid can that is designed to store up to one bucket of fluid. Doesn't work like a bucket
* as it is sealed with a pressure cap. This can is designed to work with tools or machines only.
*
* @author DarkGuardsman */
public class ItemFluidCan extends ItemFluidContainer
{
public static final String FLUID_NBT = "FluidStack";
@SideOnly(Side.CLIENT)
public Icon[] icons;
public ItemFluidCan()
{
super(AssemblyLine.CONFIGURATION.getItem("FluidCan", DarkCore.getNextItemId()).getInt());
this.setUnlocalizedName("FluidCan");
this.setCreativeTab(IndustryTabs.tabHydraulic());
this.setMaxStackSize(1);
this.setMaxDamage(100);
this.setNoRepair();
this.capacity = FluidContainerRegistry.BUCKET_VOLUME * 2;
this.setContainerItem(this);
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack)
{
FluidStack fluidStack = this.drain(par1ItemStack, Integer.MAX_VALUE, false);
if (fluidStack != null)
{
return false;
}
return true;
}
@Override
public String getItemDisplayName(ItemStack par1ItemStack)
{
String fluid = "";
FluidStack fluidStack = this.drain(par1ItemStack, Integer.MAX_VALUE, false);
if (fluidStack != null)
{
fluid = fluidStack.getFluid().getLocalizedName();
}
return ("" + (fluid + " " + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name"))).trim();
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
FluidStack fluidStack = this.drain(par1ItemStack, Integer.MAX_VALUE, false);
if (fluidStack != null)
{
par3List.add("Volume: " + fluidStack.amount + "mb");
}
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(ElectricItemHelper.getUncharged(new ItemStack(this)));
ItemStack waterCan = new ItemStack(this);
this.fill(waterCan, new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), true);
par3List.add(waterCan);
ItemStack lavaCan = new ItemStack(this);
this.fill(lavaCan, new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), true);
par3List.add(lavaCan);
}
}

View file

@ -0,0 +1,9 @@
package dark.assembly.machine;
/** Can that is used to store items such as food, parts, or solid fuels.
*
* @author DarkGuardsman */
public class ItemStorageCan
{
}

View file

@ -3,13 +3,14 @@ package dark.core.prefab.tilenetwork.fluid;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import com.dark.fluid.FluidHelper;
import com.dark.tilenetwork.INetworkPart;
import com.dark.tilenetwork.prefab.NetworkUpdateHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import dark.api.fluid.INetworkFluidPart;
/** Basically the same as network Fluid tiles class with the only difference being in how it stores

View file

@ -4,12 +4,6 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import com.dark.fluid.FluidHelper;
import com.dark.tilenetwork.INetworkPart;
import com.dark.tilenetwork.ITileNetwork;
import com.dark.tilenetwork.prefab.NetworkTileEntities;
import com.dark.tilenetwork.prefab.NetworkUpdateHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
@ -18,6 +12,13 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.dark.fluid.FluidHelper;
import com.dark.tilenetwork.INetworkPart;
import com.dark.tilenetwork.ITileNetwork;
import com.dark.tilenetwork.prefab.NetworkTileEntities;
import com.dark.tilenetwork.prefab.NetworkUpdateHandler;
import dark.api.fluid.INetworkFluidPart;
public class NetworkFluidTiles extends NetworkTileEntities

View file

@ -3,15 +3,15 @@ package dark.core.prefab.tilenetwork.fluid;
import java.util.EnumSet;
import java.util.Map.Entry;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import com.dark.fluid.FluidHelper;
import com.dark.tilenetwork.INetworkPart;
import com.dark.tilenetwork.prefab.NetworkUpdateHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import dark.api.fluid.INetworkPipe;
/** Extension on the fluid container network to provide a more advanced reaction to fluid passing

View file

@ -1,37 +0,0 @@
package dark.farmtech;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class CommonProxy implements IGuiHandler
{
public void preInit()
{
}
public void init()
{
}
public void postInit()
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
// TODO Auto-generated method stub
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,54 +0,0 @@
package dark.farmtech;
import java.util.Calendar;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import dark.core.prefab.ModPrefab;
import dark.core.prefab.RecipeLoader;
import dark.farmtech.item.ItemFarmFood;
import dark.farmtech.item.ItemFarmFood.FarmFood;
public class FTRecipeLoader extends RecipeLoader
{
private static FTRecipeLoader instance;
public static Item itemFood;
public static FTRecipeLoader instance()
{
if (instance == null)
{
instance = new FTRecipeLoader();
}
return instance;
}
@Override
public void loadRecipes()
{
super.loadRecipes();
this.loadFood();
}
public void loadFood()
{
if (itemFood instanceof ItemFarmFood)
{
FurnaceRecipes.smelting().addSmelting(itemFood.itemID, FarmFood.TurkeyRaw.ordinal(), new ItemStack(itemFood.itemID, 1, FarmFood.TurkeyCooked.ordinal()), 0.3f);
if (ModPrefab.getDate().getA() == Calendar.OCTOBER)
{
//TODO load up hollow eve foods
}
else if (ModPrefab.getDate().getA() == Calendar.NOVEMBER)
{
//TODO load up thanks giving foods
}
else if (ModPrefab.getDate().getA() == Calendar.DECEMBER)
{
//TODO load up xmas and other holiday foods
}
}
}
}

View file

@ -1,163 +0,0 @@
package dark.farmtech;
import java.io.File;
import java.util.Arrays;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.item.Item;
import net.minecraftforge.common.Configuration;
import universalelectricity.prefab.TranslationHelper;
import com.dark.DarkCore;
import com.dark.CoreRegistry;
import com.dark.prefab.ItemBlockHolder;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.Metadata;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.api.farm.CropAutomationHandler;
import dark.api.farm.DecayMatterList;
import dark.core.prefab.ModPrefab;
import dark.farmtech.blocks.BlockFarmSoil;
import dark.farmtech.entities.EntityFarmEgg;
import dark.farmtech.entities.EnumBird;
import dark.farmtech.item.BehaviorDispenseEgg;
import dark.farmtech.item.ItemFarmEgg;
import dark.machines.DarkMain;
@Mod(modid = FarmTech.MOD_ID, name = FarmTech.MOD_NAME, version = FarmTech.VERSION, dependencies = "after:DarkCore", useMetadata = true)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class FarmTech extends ModPrefab
{
public static final String MAJOR_VERSION = "@MAJOR@";
public static final String MINOR_VERSION = "@MINOR@";
public static final String REVIS_VERSION = "@REVIS@";
public static final String BUILD_VERSION = "@BUILD@";
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVIS_VERSION + "." + BUILD_VERSION;
public static final String MOD_ID = "FarmTech";
public static final String MOD_NAME = "Farm Tech";
@Metadata(FarmTech.MOD_ID)
public static ModMetadata meta;
/* SUPPORTED LANGS */
private static final String[] LANGUAGES_SUPPORTED = new String[] { "en_US" };
/* CONFIG FILE */
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir() + "/Dark/", MOD_NAME + ".cfg"));
/* BLOCKS */
public static Block blockFarmSoil;
@SidedProxy(clientSide = "dark.farmtech.client.ClientProxy", serverSide = "dark.farmtech.CommonProxy")
public static CommonProxy proxy;
@Instance(FarmTech.MOD_NAME)
public static FarmTech instance;
public static int entitiesIds = 60;
@Override
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
instance = this;
super.preInit(event);
proxy.preInit();
}
@Override
@EventHandler
public void init(FMLInitializationEvent event)
{
super.init(event);
proxy.init();
/* LANG LOADING */
FMLLog.info("[FarmTech] Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
}
@Override
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
super.postInit(event);
proxy.postInit();
DecayMatterList.triggerPostBlockAddition();
CropAutomationHandler.triggerPostBlockAddition();
}
@Override
public String getDomain()
{
return "ft";
}
@Override
public void registerObjects()
{
CONFIGURATION.load();
blockFarmSoil = CoreRegistry.createNewBlock("FTBlockFarmSoil", FarmTech.MOD_ID, BlockFarmSoil.class, ItemBlockHolder.class);
//String compostList = CONFIGURATION.get("DecayMatter", "List", "5::8000:1", "Items or blocks beyond the built in ones that can be turned into compost. Entries go BlockID:Meta:Time:Amount").getString();
//DecayMatterList.parseConfigString(compostList);
if (FarmTech.CONFIGURATION.get("Override", "Eggs", true).getBoolean(true))
{
Item.itemsList[Item.egg.itemID] = null;
Item.egg = null;
Item.egg = new ItemFarmEgg(88);
GameRegistry.registerItem(Item.egg, "FTEgg", MOD_ID);
EntityRegistry.registerGlobalEntityID(EntityFarmEgg.class, "FarmEgg", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityFarmEgg.class, "FarmEgg", entitiesIds++, this, 64, 1, true);
BlockDispenser.dispenseBehaviorRegistry.putObject(Item.egg, new BehaviorDispenseEgg());
}
for (EnumBird bird : EnumBird.values())
{
if (bird != EnumBird.VANILLA_CHICKEN && CONFIGURATION.get("Entities", "Enable_" + bird.name(), true).getBoolean(true))
{
bird.register();
}
}
CONFIGURATION.save();
}
@Override
public void loadModMeta()
{
meta.modId = MOD_ID;
meta.name = MOD_NAME;
meta.description = "Farming addon for Darks Core Machine";
meta.url = "http://www.universalelectricity.com/coremachine";
meta.logoFile = DarkCore.TEXTURE_DIRECTORY + "GP_Banner.png";
meta.version = DarkMain.VERSION;
meta.authorList = Arrays.asList(new String[] { "DarkGuardsman", "LiQuiD" });
meta.credits = "Please see the website.";
meta.autogenerated = false;
}
@Override
public void loadRecipes()
{
FTRecipeLoader.instance().loadRecipes();
}
}

View file

@ -1,40 +0,0 @@
package dark.farmtech.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import com.dark.DarkCore;
import dark.farmtech.FarmTech;
public class BlockCrops extends Block implements IPlantable
{
public BlockCrops()
{
super(FarmTech.CONFIGURATION.getBlock("Crop", DarkCore.getNextID()).getInt(), Material.vine);
this.setUnlocalizedName("FarmCrops");
}
@Override
public EnumPlantType getPlantType(World world, int x, int y, int z)
{
return EnumPlantType.Plains;
}
@Override
public int getPlantID(World world, int x, int y, int z)
{
return this.blockID;
}
@Override
public int getPlantMetadata(World world, int x, int y, int z)
{
return -1;
}
}

View file

@ -1,104 +0,0 @@
package dark.farmtech.blocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.IPlantable;
import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.farmtech.FarmTech;
/** Generic block set containing farm blocks: mulch, fertilizer, fertile dirt, mud
*
* mulch/fertilizer -> fertileDirt -> mud -> dirt
*
* @mulch is a decor version of fertilizer made from wood. decays very slowly when actually used for
* crops. Design is to be used with small plant for decor
*
* @fertilizer enriches the soil and is used to grow crops faster fertilizer can be created from
* anything using several means
*
* @author darkguardsman */
public class BlockFarmSoil extends Block
{
Icon mulch, mulch_top, fertilizer, fertileDirt, fertileDirt_top, mud, mud_top;
public BlockFarmSoil()
{
super(FarmTech.CONFIGURATION.getBlock("FarmSoil", DarkCore.getNextID()).getInt(), Material.clay);
this.setUnlocalizedName("FarmBlock");
this.setCreativeTab(CreativeTabs.tabBlock);
}
@Override
public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
{
//TODO change this a bit
return true;
}
@Override
public boolean isFertile(World world, int x, int y, int z)
{
if (blockID == tilledField.blockID)
{
return world.getBlockMetadata(x, y, z) > 0;
}
return false;
}
@Override
public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ)
{
if (blockID == grass.blockID)
{
world.setBlock(x, y, z, dirt.blockID, 0, 2);
}
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconReg)
{
super.registerIcons(iconReg);
this.mud = iconReg.registerIcon(FarmTech.instance.PREFIX + "mud");
this.fertilizer = iconReg.registerIcon(FarmTech.instance.PREFIX + "fertiliser");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
switch (meta)
{
//0 = mulch
case 1:
return this.fertilizer;
//2 = fertileDirt;
case 3:
return this.mud;
default:
return this.blockIcon;
}
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(this.blockID, 1, 1));
par3List.add(new ItemStack(this.blockID, 1, 3));
}
}

View file

@ -1,22 +0,0 @@
package dark.farmtech.client;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.farmtech.CommonProxy;
import dark.farmtech.client.renders.RenderTurkey;
import dark.farmtech.entities.EntityFarmEgg;
import dark.farmtech.entities.EntityTurkey;
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy
{
@Override
public void init()
{
RenderingRegistry.registerEntityRenderingHandler(EntityTurkey.class, new RenderTurkey());
RenderingRegistry.registerEntityRenderingHandler(EntityFarmEgg.class, new RenderSnowball(Item.egg));
}
}

View file

@ -1,10 +0,0 @@
package dark.farmtech.client;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiCompostBox
{
}

View file

@ -1,76 +0,0 @@
package dark.farmtech.machines;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockBasicFarmMachine extends BlockFT
{
Icon generic_side, wood_side, box_Top;
enum basicMachine
{
COMP_BOX("compostBox", TileEntityCompBox.class);
String name;
Class<? extends TileEntity> tile;
private basicMachine(String name, Class<? extends TileEntity> tile)
{
this.name = name;
this.tile = tile;
}
}
public BlockBasicFarmMachine(String name, Material material)
{
super(name, material);
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconReg)
{
super.registerIcons(iconReg);
//this.source = iconReg.registerIcon(DarkMain.getInstance().PREFIX + "infSource");
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
switch (meta)
{
default:
return this.blockIcon;
}
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
if (metadata < basicMachine.values().length)
{
try
{
return basicMachine.values()[metadata].tile.newInstance();
}
catch (Exception e)
{
e.printStackTrace();
}
}
return super.createTileEntity(world, metadata);
}
@Override
public TileEntity createNewTileEntity(World world)
{
return null;
}
}

View file

@ -1,115 +0,0 @@
package dark.farmtech.machines;
import java.util.List;
import java.util.Set;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.core.prefab.machine.BlockMachine;
import dark.farmtech.FarmTech;
/** Mostly for looks but yields better cooking results than a normal furnace. Plus can create large
* amounts of soup. This cooking pot should operate without a gui. Instead of using a gui a player
* will need to click the pot with the items. This also means adding wood to the bottom and starting
* it with a lighter. Water and food must also be added by hand.
*
*
* @author DarkGuardsman */
public class BlockCookingPot extends BlockMachine
{
public BlockCookingPot()
{
super(FarmTech.CONFIGURATION, "FTCookingPot", Material.iron);
}
@Override
public TileEntity createTileEntity(World world, int meta)
{
int type = meta / 4;
if (meta >= 0 && meta <= 3)
{
return CookingPots.values()[type].provider.createNewTileEntity(world);
}
return super.createTileEntity(world, meta);
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityCookingPot();
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("FTCookingPot", TileEntityCookingPot.class));
}
@Override
@SideOnly(Side.CLIENT)
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list)
{
}
@Override
public void loadExtraConfigs(Configuration config)
{
super.loadExtraConfigs(config);
}
public static enum CookingPots
{
STONE(new ITileEntityProvider()
{
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityCookingPot();
}
}),
IRON(new ITileEntityProvider()
{
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityCookingPot();
}
}),
STEEL(new ITileEntityProvider()
{
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityCookingPot();
}
}),
OBBY(new ITileEntityProvider()
{
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityHellCookingPot();
}
});
public final ITileEntityProvider provider;
private CookingPots(ITileEntityProvider provider)
{
this.provider = provider;
}
}
}

View file

@ -1,19 +0,0 @@
package dark.farmtech.machines;
import net.minecraft.block.material.Material;
import dark.core.prefab.machine.BlockMachine;
import dark.farmtech.FarmTech;
/** Prefab class for all farm blocks to remove the need for some configuration of the super class
*
* @author Darkguardsman */
public abstract class BlockFT extends BlockMachine
{
public BlockFT(String name, Material material)
{
super(FarmTech.CONFIGURATION, name, material);
}
}

View file

@ -1,6 +0,0 @@
package dark.farmtech.machines;
public class ContainerCompostBox
{
}

View file

@ -1,95 +0,0 @@
package dark.farmtech.machines;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import dark.api.farm.DecayMatterList;
import dark.core.interfaces.IInvBox;
import dark.core.prefab.invgui.InvChest;
import dark.core.prefab.machine.TileEntityEnergyMachine;
/** Simple box that turns matter into compost to grow plants with
*
* 6 slot input stores output as an float that then need to be converted to a bucket of compost
*
* @author DarkGuardsman */
public class TileEntityCompBox extends TileEntityEnergyMachine
{
/** Allow undead parts to be compost */
public static final boolean undeadCompost = false;
/** Process time left per slot before the item is processed */
int[] processTime = new int[6];
/** Amount of buckets worth of compost that are created */
float compostBuckets = 0;
@Override
public IInvBox getInventory()
{
if (inventory == null)
{
inventory = new InvChest(this, 6);
}
return inventory;
}
/** Converts one item in the slot into compost
*
* @param slot 0-5 */
public void process(int slot)
{
if (slot < processTime.length)
{
this.processTime[slot] = -1;
float output = DecayMatterList.getDecayOuput(this.getInventory().getStackInSlot(slot));
if (output >= 0)
{
this.compostBuckets += output;
}
}
}
/** Tests if the item in the slot is read to be processed
*
* @param slot 0-5 */
public boolean canProcess(int slot)
{
if (slot < processTime.length && DecayMatterList.isDecayMatter(this.getInventory().getStackInSlot(slot)))
{
if (processTime[slot] == -1)
{
processTime[slot] = DecayMatterList.getDecayTime(this.getInventory().getStackInSlot(slot));
}
else
{
if (processTime[slot] <= 0)
{
if (!outputSpace())
{
return false;
}
return true;
}
processTime[slot] = processTime[slot] - 1;
}
}
return false;
}
/** Is there space to output to */
public boolean outputSpace()
{
return false;
}
@Override
public boolean canStore(ItemStack stack, int slot, ForgeDirection side)
{
return stack != null && DecayMatterList.isDecayMatter(stack);
}
@Override
public boolean canRemove(ItemStack stack, int slot, ForgeDirection side)
{
return stack != null && !DecayMatterList.isDecayMatter(stack);
}
}

View file

@ -1,57 +0,0 @@
package dark.farmtech.machines;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import dark.core.interfaces.IBlockActivated;
import dark.core.prefab.machine.TileEntityMachine;
public class TileEntityCookingPot extends TileEntityMachine implements IBlockActivated
{
protected boolean hasWatter = false;
protected boolean hasWood = false;
protected boolean isWoodLit = false;
protected boolean isDone = false;
protected int cookTime = 0;
protected int fuelLeft = 0;
protected int slotOne = 0;
protected int slotTwo = 1;
protected int slotThree = 2;
protected int slotFour = 3;
protected int output = 4;
public TileEntityCookingPot()
{
this.invSlots = 5;
}
@Override
public boolean onActivated(EntityPlayer entityPlayer)
{
if (entityPlayer != null)
{
ItemStack stack = entityPlayer.getHeldItem();
if (stack != null)
{
if ((!this.hasWood || fuelLeft < 10) && stack.getItem().itemID == Block.wood.blockID)
{
//TODO add wood to fire under pot
return true;
}
else if (stack.getItem().itemID == Item.bowlEmpty.itemID && this.getStackInSlot(output) != null)
{
//TODO fill bowl
return true;
}
else
{
//TODO check item and see if its a valid ingredient to cook food, as well see if its valid to add but will destroy the food
}
}
}
return false;
}
}

View file

@ -1,10 +0,0 @@
package dark.farmtech.machines;
/** Exactly the same as a normal cooking pot but with completely different recipes that can only be
* used in the nether.
*
* @author DarkGuardsman */
public class TileEntityHellCookingPot extends TileEntityCookingPot
{
}

View file

@ -1,81 +0,0 @@
package dark.farmtech.machines;
import java.util.ArrayList;
import java.util.List;
import com.dark.prefab.tile.network.NetworkSharedPower;
import com.dark.tile.network.INetworkEnergyPart;
import com.dark.tile.network.ITileNetwork;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
/** Advanced version of the compBox that can link to other boxes and process matter at a higher rate.
* Cost some minor power and will have some mechanical animation of flipping dirt & items
*
* @author DarkGuardsman */
public class TileEntityMechCompBox extends TileEntityCompBox implements INetworkEnergyPart
{
List<TileEntity> connections = new ArrayList<TileEntity>();
public TileEntityMechCompBox()
{
this.MAX_JOULES_STORED = 100;
this.JOULES_PER_TICK = .001f; //1w
}
@Override
public List<TileEntity> getNetworkConnections()
{
if (this.connections == null)
{
this.connections = new ArrayList<TileEntity>();
}
return this.connections;
}
@Override
public void refresh()
{
// TODO Auto-generated method stub
}
@Override
public NetworkSharedPower getTileNetwork()
{
// TODO Auto-generated method stub
return null;
}
@Override
public void setTileNetwork(ITileNetwork fluidNetwok)
{
// TODO Auto-generated method stub
}
@Override
public boolean canTileConnect(Connection type, ForgeDirection dir)
{
return type != null && type == Connection.NETWORK;
}
@Override
public float getPartEnergy()
{
return this.energyStored;
}
@Override
public float getPartMaxEnergy()
{
return this.MAX_JOULES_STORED;
}
@Override
public void setPartEnergy(float energy)
{
this.energyStored = energy;
}
}

View file

@ -1,6 +0,0 @@
package dark.farmtech.machines.farmer;
public class BlockFarmBox
{
}

View file

@ -1,44 +0,0 @@
package dark.farmtech.machines.farmer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
import dark.api.farm.ICropHandler;
public class CropHandler implements ICropHandler
{
ItemStack blockStack;
public CropHandler(ItemStack blockStack)
{
this.blockStack = blockStack;
}
@Override
public void onCareUpdate(EntityFarmDrone drone, World world, Vector3 pos)
{
// TODO Auto-generated method stub
}
@Override
public boolean preHarvest(EntityFarmDrone drone, World world, Vector3 pos)
{
return true;
}
@Override
public boolean onHarvest(EntityFarmDrone drone, World world, Vector3 pos)
{
// TODO Auto-generated method stub
return true;
}
@Override
public void postHarvest(EntityFarmDrone drone, World world, Vector3 pos)
{
// TODO Grab items and place into drop instead of letting fall to the ground
}
}

View file

@ -1,23 +0,0 @@
package dark.farmtech.machines.farmer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
public class CropHandlerCactus extends CropHandler
{
public CropHandlerCactus(ItemStack blockStack)
{
super(blockStack);
// TODO Auto-generated constructor stub
}
@Override
public boolean preHarvest(EntityFarmDrone drone, World world, Vector3 pos)
{
// TODO check if the cactus is the lowest then harvest the block above it
return true;
}
}

View file

@ -1,27 +0,0 @@
package dark.farmtech.machines.farmer;
import universalelectricity.core.vector.Vector3;
public class DroneTask
{
Vector3 location;
EntityFarmDrone drone;
public DroneTask(final EntityFarmDrone drone, final Vector3 location)
{
this.drone = drone;
this.location = location;
}
/** Can the task be performed */
public boolean canDoTask()
{
return false;
}
/** Does the task */
public void doTask()
{
}
}

View file

@ -1,215 +0,0 @@
package dark.farmtech.machines.farmer;
import com.dark.helpers.ItemWorldHelper;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import universalelectricity.core.block.IElectricalStorage;
import universalelectricity.core.vector.Vector3;
public class EntityFarmDrone extends EntityLiving implements IElectricalStorage
{
/** Battery energy level */
private float energy = 0;
/** Running cost of drone */
private float wattPerTick = 0.1f;
/** current inv slots of the drone */
private int slots = 1;
public Vector3 location;
/** Drone inv */
public ItemStack[] inv = new ItemStack[3];
TileEntityFarmBox home;
private DroneTask task;
public EntityFarmDrone(World par1World)
{
super(par1World);
this.energy = 10;
location = new Vector3(this);
}
public EntityFarmDrone(World world, TileEntityFarmBox tileController)
{
this(world);
this.home = tileController;
}
@Override
public void onEntityUpdate()
{
super.onEntityUpdate();
location = new Vector3(this);
//TODO update AI logic
float homeCost = getTimeToHome() * this.wattPerTick;
if (this.getEnergyStored() < (this.getMaxEnergyStored() / 4) || this.getEnergyStored() <= homeCost + 1 || this.isInvFull())
{
//TODO stop work and return home
}
if (this.home == null || this.getEnergyStored() <= 0)
{
//TODO turn into block, or have go dormant
}
}
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
this.energy -= this.wattPerTick;
}
/** Get the amount of time it takes the drone to get home. Used by AI logic to stop work and
* return home for recharge */
public int getTimeToHome()
{
if (this.home != null)
{
//TODO calculate jump time, and rotation time
double distance = new Vector3(this).difference(new Vector3(this.home)).getMagnitudeSquared();
double speed = this.getMoveHelper().getSpeed();
return (int) Math.ceil(distance / speed) + 1;
}
return 1;
}
public void setTask(DroneTask task)
{
this.task = task;
}
public DroneTask getDroneTask()
{
return this.task;
}
/** Adds an item to the drones inventory or drops it on the ground if the drone is full
*
* @param location - location were the item was so to drop it there if the drone can't pick it
* up
* @param stack - stack to store or drop
*
* @return the itemstack if any of it is left */
public ItemStack pickUpItem(Vector3 location, ItemStack stack, boolean drop)
{
if (location == null)
{
location = this.location.clone();
}
ItemStack itemStack = stack.copy();
if (stack != null)
{
for (int i = 0; i < this.inv.length; i++)
{
if (this.inv[i] == null)
{
itemStack = null;
this.inv[i] = itemStack;
}
else if (this.inv[i].equals(itemStack))
{
int room = this.inv[i].getMaxStackSize() - this.inv[i].stackSize;
if (room >= itemStack.stackSize)
{
this.inv[i].stackSize += itemStack.stackSize;
itemStack = null;
}
else if (room <= itemStack.stackSize)
{
this.inv[i].stackSize += room;
itemStack.stackSize -= room;
}
}
if (itemStack == null || itemStack.stackSize <= 0)
{
return null;
}
}
if (drop && itemStack != null && itemStack.stackSize > 0)
{
return ItemWorldHelper.dropItemStack(this.worldObj, location, itemStack, true);
}
}
return itemStack;
}
/** Check if the inventory has items in all slots rather than if its actually 100% full */
public boolean isInvFull()
{
return this.inv[0] != null && this.inv[1] != null && this.inv[2] != null;
}
@Override
protected boolean canDespawn()
{
//TODO do calculations based on player distance to not have the drone do work or be spawned if the player is not near at all
return false;
}
@Override
public void setEnergyStored(float energy)
{
this.energy = energy;
}
@Override
public float getEnergyStored()
{
return this.energy;
}
@Override
public float getMaxEnergyStored()
{
return 50;
}
/** Used to store data on a drone. Mainly for saving the drone when stored in a tileEntity
*
* @author DarkGuardsman */
public static class DroneData
{
public float health = 0;
public float energy = 0;
public ItemStack[] inv = new ItemStack[3];
/** saves drone data to nbt */
public NBTTagCompound saveData(NBTTagCompound tag)
{
tag.setFloat("Health", health);
tag.setFloat("Energy", energy);
return tag;
}
public DroneData getDroneData(EntityFarmDrone drone)
{
this.health = drone.getHealth();
this.energy = drone.energy;
this.inv = drone.inv;
return this;
}
/** Loads drone data from nbt */
public DroneData loadData(NBTTagCompound tag)
{
this.health = tag.getFloat("Health");
this.energy = tag.getFloat("Energy");
return this;
}
/** Creates a new DroneData instances and load data from nbt into it */
public static DroneData createDroneDataNBT(NBTTagCompound tag)
{
return new DroneData().loadData(tag);
}
public static DroneData createDroneData(EntityFarmDrone drone)
{
return new DroneData().getDroneData(drone);
}
}
}

View file

@ -1,58 +0,0 @@
package dark.farmtech.machines.farmer;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import universalelectricity.core.vector.Vector3;
public class HarvestTask extends DroneTask
{
int harvestTick = 0;
int harvestTime = 50;
public HarvestTask(EntityFarmDrone drone, Vector3 location)
{
super(drone, location);
}
@Override
public boolean canDoTask()
{
if (this.drone.location.difference(this.location).getMagnitudeSquared() <= 0)
{
if (this.harvestTick++ >= this.harvestTime)
{
return true;
}
}
else
{
//TODO tell drone to move to target
this.harvestTick = 0;
}
return false;
}
@Override
public void doTask()
{
if (this.drone.location.difference(this.location).getMagnitudeSquared() <= 0)
{
int blockID = location.getBlockID(drone.worldObj);
int metaData = location.getBlockMetadata(drone.worldObj);
Block block = Block.blocksList[blockID];
if (block != null)
{
ArrayList<ItemStack> items = block.getBlockDropped(drone.worldObj, location.intX(), location.intY(), location.intZ(), metaData, 1);
for (ItemStack stack : items)
{
drone.pickUpItem(location, stack, true);
}
}
drone.worldObj.playAuxSFX(2001, location.intX(), location.intY(), location.intZ(), blockID + (metaData << 12));
//TODO do a few checks and method calls to simulate player like block harvesting as much as possible
location.setBlock(drone.worldObj, 0);
}
}
}

View file

@ -1,54 +0,0 @@
package dark.farmtech.machines.farmer;
import universalelectricity.core.vector.Vector3;
import dark.core.prefab.machine.TileEntityEnergyMachine;
import dark.farmtech.machines.farmer.EntityFarmDrone.DroneData;
public class TileEntityFarmBox extends TileEntityEnergyMachine
{
/** Current amount of drone slots this box has */
private int droneSlots = 1;
/** Stores drone data while the drone is stored in the block */
private DroneData[] droneData = new DroneData[4];
/** Stores drone instances as drones are active outside the block */
private EntityFarmDrone[] drones = new EntityFarmDrone[4];
public TileEntityFarmBox()
{
this.MAX_JOULES_STORED = 100;
this.JOULES_PER_TICK = 5;
}
@Override
public void updateEntity()
{
super.updateEntity();
//TODO generate field map
//Calculate crop status
//Set workers into motion
}
public void spawnDrone(int droneID)
{
if (droneID < droneData.length && droneID < drones.length)
{
if (drones[droneID] == null && droneData[droneID] != null)
{
EntityFarmDrone drone = new EntityFarmDrone(this.worldObj, this);
}
}
}
public Vector3 getClearSpot()
{
Vector3 loc = new Vector3(this);
return loc;
}
public void setTask(int droneID, DroneTask task)
{
}
}

View file

@ -1,59 +0,0 @@
package dark.fluid.client;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.client.render.ItemPipeRenderer;
import dark.fluid.client.render.ItemTankRenderer;
import dark.fluid.client.render.RenderConstructionPump;
import dark.fluid.client.render.RenderPipe;
import dark.fluid.client.render.RenderPump;
import dark.fluid.client.render.RenderReleaseValve;
import dark.fluid.client.render.RenderSink;
import dark.fluid.client.render.RenderTank;
import dark.fluid.common.CommonProxy;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.machines.TileEntityReleaseValve;
import dark.fluid.common.machines.TileEntitySink;
import dark.fluid.common.machines.TileEntityTank;
import dark.fluid.common.pipes.TileEntityPipe;
import dark.fluid.common.pump.TileEntityConstructionPump;
import dark.fluid.common.pump.TileEntityStarterPump;
@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy
{
@Override
public void preInit()
{
}
@Override
public void Init()
{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPipe.class, new RenderPipe());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStarterPump.class, new RenderPump());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRod.class, new RenderGearRod());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGenerator.class, new RenderGenerator());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReleaseValve.class, new RenderReleaseValve());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySink.class, new RenderSink());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConstructionPump.class, new RenderConstructionPump());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTank.class, new RenderTank());
MinecraftForgeClient.registerItemRenderer(FMRecipeLoader.blockPipe.blockID, new ItemPipeRenderer());
MinecraftForgeClient.registerItemRenderer(FMRecipeLoader.blockTank.blockID, new ItemTankRenderer());
MinecraftForgeClient.registerItemRenderer(FMRecipeLoader.blockReleaseValve.blockID, new ItemPipeRenderer());
RenderingRegistry.registerBlockHandler(new BlockRenderHelper());
}
@Override
public void postInit()
{
}
}

View file

@ -1,90 +0,0 @@
package dark.fluid.client.render;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import com.dark.DarkCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.model.ModelSink;
import dark.fluid.common.FluidMech;
import dark.fluid.common.machines.TileEntitySink;
import dark.machines.client.renders.RenderTileMachine;
@SideOnly(Side.CLIENT)
public class RenderSink extends RenderTileMachine
{
int type = 0;
private ModelSink model;
public RenderSink()
{
model = new ModelSink();
}
public void renderWater(FluidStack stack)
{
if (stack == null || stack.amount <= 1)
{
return;
}
//bindTextureByName(Block.waterStill.getBlockTextureFromSide(0) + "blue.png");
float p = 0;
if (stack.amount > 0)
p = 0.5f;
if (stack.amount > 500)
p = 1.5f;
if (stack.amount > 1000)
p = 2.5f;
if (stack.amount > 1500)
p = 3.5f;
model.renderLiquid(0.0625F, p);
}
public void renderAModelAt(TileEntitySink te, double d, double d1, double d2, float f)
{
int meta = te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
bindTexture(this.getTexture(te.getBlockType().blockID, te.getBlockMetadata()));
GL11.glPushMatrix();
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
switch (meta)
{
case 3:
GL11.glRotatef(90f, 0f, 1f, 0f);
break;
case 0:
GL11.glRotatef(180f, 0f, 1f, 0f);
break;
case 1:
GL11.glRotatef(270f, 0f, 1f, 0f);
break;
case 2:
GL11.glRotatef(0f, 0f, 1f, 0f);
break;
}
model.render(0.0625F);
renderWater(te.getTank().getFluid());
GL11.glPopMatrix();
}
@Override
public void renderModel(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntitySink) tileEntity, var2, var4, var6, var8);
}
@Override
public ResourceLocation getTexture(int block, int meta)
{
return new ResourceLocation(FluidMech.instance.DOMAIN, DarkCore.MODEL_DIRECTORY + "Sink.png");
}
}

View file

@ -1,38 +0,0 @@
package dark.fluid.common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class CommonProxy implements IGuiHandler
{
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
// TODO Auto-generated method stub
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
// TODO Auto-generated method stub
return null;
}
public void preInit()
{
}
public void Init()
{
}
public void postInit()
{
}
}

View file

@ -1,86 +0,0 @@
package dark.fluid.common;
import com.dark.prefab.RecipeLoader;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
import dark.api.ColorCode;
import dark.core.basics.EnumMaterial;
import dark.core.basics.EnumOrePart;
import dark.core.basics.ItemParts;
import dark.core.basics.ItemParts.Parts;
import dark.machines.CoreRecipeLoader;
public class FMRecipeLoader extends RecipeLoader
{
public static Block blockPipe;
public static Block blockTank;
public static Block blockPumpMachine;
public static Block blockRod;
public static Block blockGenerator;
public static Block blockReleaseValve;
public static Block blockSink;
public static Block blockDrain;
public static Block blockConPump;
public static Block blockHeater;
public static Block blockPiston;
public static Block blockBoiler;
public static Block blockWasteLiquid;
public static Block blockOilLiquid;
public static Block blockFuelLiquid;
@Override
public void loadRecipes()
{
super.loadRecipes();
this.registerPipes();
this.registerTanks();
// pump
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockPumpMachine, 1, 0), new Object[] { "C@C", "BMB", "@X@", '@', steelPlate, 'X', new ItemStack(blockPipe, 1), 'B', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()), 'C', circuit, 'M', "motor" }));
// construction pump
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConPump, 1, 0), new Object[] { "@C@", "BMB", "@@@", '@', steelPlate, 'B', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()), 'C', "advancedCircuit", 'M', "motor" }));
// Drain
GameRegistry.addRecipe(new ItemStack(blockDrain, 1, 0), new Object[] { "IGI", "SVS", " P ", 'I', Item.ingotIron, 'G', Block.dispenser, 'S', Block.stone, 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()) });
// release valve
GameRegistry.addRecipe(new ItemStack(blockReleaseValve, 1), new Object[] { "RPR", "PVP", "RPR", 'P', new ItemStack(blockPipe, 1), 'V', new ItemStack(CoreRecipeLoader.itemParts, 1, Parts.Valve.ordinal()), 'R', Item.redstone });
// sink
//GameRegistry.addRecipe(new ItemStack(blockSink, 1), new Object[] { "I I", "SIS", "SPS", 'P', new ItemStack(blockPipe, 1), 'I', Item.ingotIron, 'S', Block.stone });
}
public void registerTanks()
{
GameRegistry.addRecipe(new ItemStack(blockPumpMachine, 1, 0), new Object[] { "IXI", "X X", "IXI", 'I', Item.ingotIron, 'X', Block.glass });
}
public void registerPipes()
{
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.IRON.getStack(2), new Object[] { EnumMaterial.IRON.getOreName(EnumOrePart.TUBE), ItemParts.Parts.Seal.name }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.GOLD.getStack(2), new Object[] { EnumMaterial.GOLD.getOreName(EnumOrePart.TUBE), ItemParts.Parts.Seal.name }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.TIN.getStack(2), new Object[] { EnumMaterial.TIN.getOreName(EnumOrePart.TUBE), ItemParts.Parts.Seal.name }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.COPPER.getStack(2), new Object[] { EnumMaterial.COPPER.getOreName(EnumOrePart.TUBE), ItemParts.Parts.Seal.name }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.BRONZE.getStack(2), new Object[] { EnumMaterial.BRONZE.getOreName(EnumOrePart.TUBE), ItemParts.Parts.GasSeal.name }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.STEEL.getStack(2), new Object[] { EnumMaterial.STEEL.getOreName(EnumOrePart.TUBE), ItemParts.Parts.GasSeal.name }));
GameRegistry.addRecipe(new ShapelessOreRecipe(FluidPartsMaterial.OBBY.getStack(2), new Object[] { EnumMaterial.OBBY.getOreName(EnumOrePart.TUBE), Block.netherBrick, Block.netherBrick }));
GameRegistry.addRecipe(new ShapedOreRecipe(FluidPartsMaterial.HELL.getStack(4), new Object[] { "OOO", "BNB", "OOO", 'N', Block.netherBrick, 'B', Item.blazeRod, 'O', Block.obsidian }));
for (FluidPartsMaterial mat : FluidPartsMaterial.values())
{
for (ColorCode color : ColorCode.values())
{
GameRegistry.addRecipe(mat.getStack(color), new Object[] { " X ", "XIX", " X ", 'I', new ItemStack(Item.dyePowder, 1, color.ordinal()), 'X', blockPipe });
GameRegistry.addShapelessRecipe(mat.getStack(), new Object[] { mat.getStack(color) });
}
}
}
}

View file

@ -1,187 +0,0 @@
package dark.fluid.common;
import java.io.File;
import java.util.Arrays;
import java.util.logging.Logger;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.fluids.Fluid;
import org.modstats.ModstatInfo;
import universalelectricity.prefab.TranslationHelper;
import com.dark.DarkCore;
import com.dark.CoreRegistry;
import com.dark.IndustryTabs;
import com.dark.prefab.ItemBlockHolder;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.Metadata;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import dark.core.prefab.ModPrefab;
import dark.fluid.common.machines.BlockReleaseValve;
import dark.fluid.common.machines.BlockSink;
import dark.fluid.common.machines.BlockTank;
import dark.fluid.common.pipes.BlockPipe;
import dark.fluid.common.pipes.ItemBlockPipe;
import dark.fluid.common.pump.BlockConstructionPump;
import dark.fluid.common.pump.BlockDrain;
import dark.fluid.common.pump.BlockPumpMachine;
import dark.machines.CoreMachine;
@ModstatInfo(prefix = "fluidmech")
@Mod(modid = FluidMech.MOD_ID, name = FluidMech.MOD_NAME, version = FluidMech.VERSION, dependencies = "after:DarkCore", useMetadata = true)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class FluidMech extends ModPrefab
{
public static final String MAJOR_VERSION = "@MAJOR@";
public static final String MINOR_VERSION = "@MINOR@";
public static final String REVIS_VERSION = "@REVIS@";
public static final String BUILD_VERSION = "@BUILD@";
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVIS_VERSION + "." + BUILD_VERSION;
// @Mod
public static final String MOD_ID = "FluidMech";
public static final String MOD_NAME = "Fluid_Mechanics";
public static final String DOMAIN = "fm";
public static final String PREFIX = DOMAIN + ":";
public static String DIRECTORY_NO_SLASH = "assets/" + DOMAIN + "/";
public static String DIRECTORY = "/" + DIRECTORY_NO_SLASH;
public static String LANGUAGE_PATH = DIRECTORY + "languages/";
public static String SOUND_PATH = DIRECTORY + "audio/";
public static final String WASTE_FLUID_NAME = "mixedWaste";
public static final String OIL_FLUID_NAME = "oil";
public static final String FUEL_FLUID_NAME = "fuel";
public static final String BIO_FUEL_Name = "";
public static Fluid fmWaste, fmOil, fmFuel, fmBio;
public static Fluid waste, oil, fuel, bio;
@Metadata(FluidMech.MOD_ID)
public static ModMetadata meta;
/* SUPPORTED LANGS */
private static final String[] LANGUAGES_SUPPORTED = new String[] { "en_US", "de_DE" };
/* CONFIG FILE */
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir() + "/Dark/", FluidMech.MOD_NAME + ".cfg"));
/* BLOCKS */
@SidedProxy(clientSide = "dark.fluid.client.ClientProxy", serverSide = "dark.fluid.common.CommonProxy")
public static CommonProxy proxy;
@Instance(FluidMech.MOD_NAME)
public static FluidMech instance;
public static FMRecipeLoader recipeLoader;
/* LOGGER - EXTENDS FORGE'S LOG SYSTEM */
public static Logger FMLog = Logger.getLogger(FluidMech.MOD_NAME);
@Override
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
instance = this;
super.preInit(event);
/* BLOCK REGISTER CALLS */
proxy.preInit();
}
@Override
@EventHandler
public void init(FMLInitializationEvent event)
{
super.init(event);
proxy.Init();
/* LANG LOADING */
FMLog.info(" Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " Languages.");
if (FMRecipeLoader.blockPipe instanceof BlockPipe)
{
IndustryTabs.tabHydraulic().setIconItemStack(FluidPartsMaterial.IRON.getStack());
}
}
@Override
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
super.postInit(event);
proxy.postInit();
/* /******** RECIPES ************* */
recipeLoader.loadRecipes();
FMLog.info("Done Loading");
}
@Override
public void registerObjects()
{
if (recipeLoader == null)
{
recipeLoader = new FMRecipeLoader();
}
CONFIGURATION.load();
FMRecipeLoader.blockWasteLiquid = CoreRegistry.createNewFluidBlock(FluidMech.MOD_ID, FluidMech.CONFIGURATION, new Fluid(WASTE_FLUID_NAME).setUnlocalizedName("fluid.waste.name").setDensity(1300).setViscosity(1800));
FMRecipeLoader.blockOilLiquid = CoreRegistry.createNewFluidBlock(FluidMech.MOD_ID, FluidMech.CONFIGURATION, new Fluid(OIL_FLUID_NAME).setUnlocalizedName("fluid.oil.name").setDensity(1500).setViscosity(4700));
FMRecipeLoader.blockPipe = CoreRegistry.createNewBlock("FMBlockPipe", FluidMech.MOD_ID, BlockPipe.class, ItemBlockPipe.class);
FMRecipeLoader.blockPumpMachine = CoreRegistry.createNewBlock("FMBlockPump", FluidMech.MOD_ID, BlockPumpMachine.class, ItemBlockHolder.class);
FMRecipeLoader.blockReleaseValve = CoreRegistry.createNewBlock("FMBlockReleaseValve", FluidMech.MOD_ID, BlockReleaseValve.class, ItemBlockHolder.class);
FMRecipeLoader.blockTank = CoreRegistry.createNewBlock("FMBlockTank", FluidMech.MOD_ID, BlockTank.class, ItemBlockPipe.class);
FMRecipeLoader.blockSink = CoreRegistry.createNewBlock("FMBlockSink", FluidMech.MOD_ID, BlockSink.class, ItemBlockHolder.class);
FMRecipeLoader.blockDrain = CoreRegistry.createNewBlock("FMBlockDrain", FluidMech.MOD_ID, BlockDrain.class, ItemBlockHolder.class);
FMRecipeLoader.blockConPump = CoreRegistry.createNewBlock("FMBlockConstructionPump", FluidMech.MOD_ID, BlockConstructionPump.class, ItemBlockHolder.class);
CONFIGURATION.save();
}
@Override
public void loadModMeta()
{
/* MCMOD.INFO FILE BUILDER? */
meta.modId = FluidMech.MOD_ID;
meta.name = FluidMech.MOD_NAME;
meta.description = "Fluid Mechanics is a combination between supporting fluid handling and mechanical energy handling system. " + "Its designed to help other mods move there liquids using a universal liquid system managed by forge. As a bonus it also " + "comes with suppot to help mods move energy by means of mechanics motion along rods. This mod by itself doesn't offer much more " + "than basic liquid storage, placement, and removel in the world. Its suggest to download other mods that supports the Forge's " + "Fluid System. " + "\n\n" + "Suported Power systems: Universal Electric, BuildCraft, IndustrialCraft ";
meta.url = "http://www.universalelectricity.com/coremachine";
meta.logoFile = DarkCore.TEXTURE_DIRECTORY + "FM_Banner.png";
meta.version = CoreMachine.VERSION;
meta.authorList = Arrays.asList(new String[] { "DarkGuardsman AKA DarkCow" });
meta.credits = "Please see the website.";
meta.autogenerated = false;
}
@Override
public String getDomain()
{
return "fm";
}
@Override
public void loadRecipes()
{
// TODO Auto-generated method stub
}
}

View file

@ -1,17 +1,18 @@
package dark.fluid.common.machines;
import net.minecraft.block.material.Material;
import com.dark.IndustryTabs;
import com.dark.prefab.BlockMachine;
import net.minecraft.block.material.Material;
import dark.fluid.common.FluidMech;
import dark.assembly.AssemblyLine;
public abstract class BlockFM extends BlockMachine
{
public BlockFM(String name, Material material)
{
super(FluidMech.CONFIGURATION, name, material);
super(AssemblyLine.CONFIGURATION, name, material);
this.setCreativeTab(IndustryTabs.tabHydraulic());
}
}

View file

@ -14,9 +14,10 @@ import com.builtbroken.common.Pair;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.common.FMRecipeLoader;
import dark.assembly.ALRecipeLoader;
import dark.assembly.machine.BlockAssembly;
public class BlockReleaseValve extends BlockFM
public class BlockReleaseValve extends BlockAssembly
{
public BlockReleaseValve()
{
@ -79,7 +80,7 @@ public class BlockReleaseValve extends BlockFM
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
return new ItemStack(FMRecipeLoader.blockReleaseValve, 1, 0);
return new ItemStack(ALRecipeLoader.blockReleaseValve, 1, 0);
}
@Override

View file

@ -17,7 +17,7 @@ import com.dark.fluid.FluidHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.render.BlockRenderHelper;
import dark.assembly.client.render.BlockRenderHelper;
public class BlockSink extends BlockFM
{

View file

@ -20,8 +20,8 @@ import com.dark.helpers.ItemWorldHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.fluid.client.render.BlockRenderHelper;
import dark.fluid.common.FluidPartsMaterial;
import dark.assembly.FluidPartsMaterial;
import dark.assembly.client.render.BlockRenderHelper;
import dark.fluid.common.pipes.ItemBlockPipe;
import dark.fluid.common.pipes.TileEntityPipe;

View file

@ -1,15 +1,16 @@
package dark.fluid.common.machines;
import com.dark.helpers.ConnectionHelper;
import com.dark.tilenetwork.ITileConnector;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import dark.api.IToolReadOut;
import com.dark.helpers.ConnectionHelper;
import com.dark.interfaces.IToolReadOut;
import com.dark.tilenetwork.ITileConnector;
import dark.api.fluid.INetworkPipe;
import dark.core.prefab.tilenetwork.fluid.NetworkPipes;
import dark.fluid.common.prefab.TileEntityFluidDevice;

View file

@ -12,12 +12,12 @@ import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import universalelectricity.prefab.network.IPacketReceiver;
import com.dark.DarkCore;
import com.dark.helpers.ColorCode;
import com.dark.network.PacketHandler;
import com.google.common.io.ByteArrayDataInput;
import dark.api.ColorCode;
import dark.fluid.common.prefab.TileEntityFluidStorage;
import dark.machines.CoreMachine;
public class TileEntitySink extends TileEntityFluidStorage implements IPacketReceiver
{
@ -47,7 +47,7 @@ public class TileEntitySink extends TileEntityFluidStorage implements IPacketRec
{
stack = this.getTank().getFluid();
}
return PacketHandler.instance().getTilePacket(CoreMachine.CHANNEL, this, stack.writeToNBT(new NBTTagCompound()));
return PacketHandler.instance().getTilePacket(DarkCore.CHANNEL, this, stack.writeToNBT(new NBTTagCompound()));
}
@Override

View file

@ -1,10 +1,11 @@
package dark.fluid.common.machines;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import com.dark.tilenetwork.INetworkPart;
import com.dark.tilenetwork.ITileNetwork;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import dark.api.fluid.INetworkFluidPart;
import dark.core.prefab.tilenetwork.fluid.NetworkFluidContainers;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;

View file

@ -19,12 +19,12 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidTankInfo;
import com.builtbroken.common.Pair;
import com.dark.helpers.ColorCode;
import com.dark.helpers.ColorCode.IColorCoded;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.ColorCode;
import dark.api.ColorCode.IColorCoded;
import dark.fluid.common.FluidPartsMaterial;
import dark.assembly.FluidPartsMaterial;
import dark.fluid.common.machines.BlockFM;
public class BlockPipe extends BlockFM

View file

@ -1,7 +1,8 @@
package dark.fluid.common.pipes;
import dark.api.ColorCode;
import dark.api.ColorCode.IColoredId;
import com.dark.helpers.ColorCode;
import com.dark.helpers.ColorCode.IColoredId;
public enum EnumPipeType implements IColoredId
{

View file

@ -1,7 +1,8 @@
package dark.fluid.common.pipes;
import dark.api.ColorCode;
import dark.api.ColorCode.IColoredId;
import com.dark.helpers.ColorCode;
import com.dark.helpers.ColorCode.IColoredId;
public enum EnumTankTypes implements IColoredId
{

View file

@ -1,6 +1,7 @@
package dark.fluid.common.pipes;
import dark.api.ColorCode.IColoredId;
import com.dark.helpers.ColorCode.IColoredId;
public interface IPipeType extends IColoredId
{

View file

@ -15,8 +15,8 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import universalelectricity.core.vector.Vector3;
import dark.fluid.common.FMRecipeLoader;
import dark.fluid.common.FluidPartsMaterial;
import dark.assembly.ALRecipeLoader;
import dark.assembly.FluidPartsMaterial;
import dark.fluid.common.machines.TileEntityTank;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
@ -55,7 +55,7 @@ public class ItemBlockPipe extends ItemBlock
TileEntity entity = vec.getTileEntity(world);
if (entity instanceof TileEntityTank && ((TileEntityTank) entity).getTankInfo() != null && ((TileEntityTank) entity).getTankInfo()[0] != null)
{
ItemStack itemStack = new ItemStack(FMRecipeLoader.blockTank);
ItemStack itemStack = new ItemStack(ALRecipeLoader.blockTank);
FluidStack stack = ((TileEntityTank) entity).getTankInfo()[0].fluid;
if (itemStack.getTagCompound() == null)

View file

@ -1,19 +1,20 @@
package dark.fluid.common.pipes;
import com.dark.tilenetwork.ITileConnector;
import com.dark.tilenetwork.ITileNetwork;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import universalelectricity.core.vector.Vector3;
import dark.api.ColorCode;
import dark.api.ColorCode.IColorCoded;
import com.dark.helpers.ColorCode;
import com.dark.helpers.ColorCode.IColorCoded;
import com.dark.tilenetwork.ITileConnector;
import com.dark.tilenetwork.ITileNetwork;
import dark.api.fluid.INetworkPipe;
import dark.assembly.FluidPartsMaterial;
import dark.core.prefab.tilenetwork.fluid.NetworkPipes;
import dark.fluid.common.FluidPartsMaterial;
import dark.fluid.common.prefab.TileEntityFluidNetworkTile;
public class TileEntityPipe extends TileEntityFluidNetworkTile implements IColorCoded, INetworkPipe

Some files were not shown because too many files have changed in this diff Show more