mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-24 05:54:34 +00:00
Change FluidType to a more appropriate class
This commit is contained in:
1 parent
3de90bded2
commit
c79ddf869c
36 files changed
+222
-250
No files matched your search
@@ -54,17 +54,7 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
|
||||
if (itemstack1 == null)
|
||||
{
|
||||
par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); // Forge:
|
||||
// Vanilla
|
||||
// bug
|
||||
// fix
|
||||
// associated
|
||||
// with
|
||||
// fixed
|
||||
// setCurrentItemOrArmor
|
||||
// indexs
|
||||
// for
|
||||
// players.
|
||||
par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy());
|
||||
par1ItemStack.stackSize = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,102 +1,67 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
public enum FluidType
|
||||
public class FluidType
|
||||
{
|
||||
/** Vanilla Water Smelting **/
|
||||
Water(Blocks.snow, 0, 20, FluidRegistry.getFluid("water"), false),
|
||||
/** Iron Smelting **/
|
||||
Iron(Blocks.iron_block, 0, 600, TinkerSmeltery.moltenIronFluid, true),
|
||||
/** Gold Smelting **/
|
||||
Gold(Blocks.gold_block, 0, 400, TinkerSmeltery.moltenGoldFluid, false),
|
||||
/** Tin Smelting **/
|
||||
Tin(TinkerWorld.metalBlock, 5, 400, TinkerSmeltery.moltenTinFluid, false),
|
||||
/** Copper Smelting **/
|
||||
Copper(TinkerWorld.metalBlock, 3, 550, TinkerSmeltery.moltenCopperFluid, true),
|
||||
/** Aluminum Smelting **/
|
||||
Aluminum(TinkerWorld.metalBlock, 6, 350, TinkerSmeltery.moltenAluminumFluid, false),
|
||||
/** Natural Aluminum Smelting **/
|
||||
NaturalAluminum(TinkerWorld.oreSlag, 6, 350, TinkerSmeltery.moltenAluminumFluid, false),
|
||||
/** Cobalt Smelting **/
|
||||
Cobalt(TinkerWorld.metalBlock, 0, 650, TinkerSmeltery.moltenCobaltFluid, true),
|
||||
/** Ardite Smelting **/
|
||||
Ardite(TinkerWorld.metalBlock, 1, 650, TinkerSmeltery.moltenArditeFluid, true),
|
||||
/** AluminumBrass Smelting **/
|
||||
AluminumBrass(TinkerWorld.metalBlock, 7, 350, TinkerSmeltery.moltenAlubrassFluid, false),
|
||||
/** Alumite Smelting **/
|
||||
Alumite(TinkerWorld.metalBlock, 8, 800, TinkerSmeltery.moltenAlumiteFluid, true),
|
||||
/** Manyullyn Smelting **/
|
||||
Manyullyn(TinkerWorld.metalBlock, 2, 750, TinkerSmeltery.moltenManyullynFluid, true),
|
||||
/** Bronze Smelting **/
|
||||
Bronze(TinkerWorld.metalBlock, 4, 500, TinkerSmeltery.moltenBronzeFluid, true),
|
||||
/** Steel Smelting **/
|
||||
Steel(TinkerWorld.metalBlock, 9, 700, TinkerSmeltery.moltenSteelFluid, true),
|
||||
/** Nickel Smelting **/
|
||||
Nickel(TinkerWorld.metalBlock, 0, 400, TinkerSmeltery.moltenNickelFluid, false),
|
||||
/** Lead Smelting **/
|
||||
Lead(TinkerWorld.metalBlock, 0, 400, TinkerSmeltery.moltenLeadFluid, false),
|
||||
/** Silver Smelting **/
|
||||
Silver(TinkerWorld.metalBlock, 0, 400, TinkerSmeltery.moltenSilverFluid, false),
|
||||
/** Platinum Smelting **/
|
||||
Platinum(TinkerWorld.metalBlock, 0, 400, TinkerSmeltery.moltenShinyFluid, false),
|
||||
/** Invar Smelting **/
|
||||
Invar(TinkerWorld.metalBlock, 0, 400, TinkerSmeltery.moltenInvarFluid, false),
|
||||
/** Electrum Smelting **/
|
||||
Electrum(TinkerWorld.metalBlock, 0, 400, TinkerSmeltery.moltenElectrumFluid, false),
|
||||
/** Obsidian Smelting **/
|
||||
Obsidian(Blocks.obsidian, 0, 750, TinkerSmeltery.moltenObsidianFluid, true),
|
||||
/** Ender Smelting **/
|
||||
Ender(TinkerWorld.metalBlock, 10, 500, TinkerSmeltery.moltenEnderFluid, false),
|
||||
/** Glass Smelting **/
|
||||
Glass(Blocks.sand, 0, 625, TinkerSmeltery.moltenGlassFluid, false),
|
||||
/** Stone Smelting **/
|
||||
Stone(Blocks.stone, 0, 800, TinkerSmeltery.moltenStoneFluid, true),
|
||||
/** Emerald Smelting **/
|
||||
Emerald(Blocks.emerald_ore, 0, 575, TinkerSmeltery.moltenEmeraldFluid, false),
|
||||
/** Slime Smelting **/
|
||||
Slime(TinkerWorld.slimeGel, 0, 250, TinkerWorld.blueSlimeFluid, false),
|
||||
/** Pigiron Smelting **/
|
||||
PigIron(TinkerWorld.meatBlock, 0, 610, TinkerSmeltery.pigIronFluid, true),
|
||||
/** Glue Smelting **/
|
||||
Glue(TinkerSmeltery.glueBlock, 0, 125, TinkerSmeltery.glueFluid, false);
|
||||
|
||||
public final Block renderBlock;
|
||||
public final int renderMeta;
|
||||
public final int baseTemperature;
|
||||
public final Fluid fluid;
|
||||
public final boolean isToolpart;
|
||||
|
||||
public static HashMap<String, FluidType> fluidTypes = new HashMap<String, FluidType>();
|
||||
|
||||
FluidType(Block b, int meta, int baseTemperature, Fluid fluid, boolean isToolpart)
|
||||
public FluidType(Block block, int meta, int baseTemperature, Fluid fluid, boolean isToolpart)
|
||||
{
|
||||
this.renderBlock = b;
|
||||
this.renderBlock = block;
|
||||
this.renderMeta = meta;
|
||||
this.baseTemperature = baseTemperature;
|
||||
this.fluid = fluid;
|
||||
this.isToolpart = isToolpart;
|
||||
}
|
||||
|
||||
public static void registerFluidType(String name, FluidType type)
|
||||
{
|
||||
fluidTypes.put(name, type);
|
||||
}
|
||||
|
||||
public static void registerFluidType(String name, Block block, int meta, int baseTemperature, Fluid fluid, boolean isToolpart)
|
||||
{
|
||||
FluidType type = new FluidType(block, meta, baseTemperature, fluid, isToolpart);
|
||||
registerFluidType(name, type);
|
||||
}
|
||||
|
||||
public static FluidType getFluidType(String typeName)
|
||||
{
|
||||
return fluidTypes.get(typeName);
|
||||
}
|
||||
|
||||
public static FluidType getFluidType (Fluid searchedFluid)
|
||||
{
|
||||
for (FluidType ft : values())
|
||||
Iterator iter = fluidTypes.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
if (ft.fluid == searchedFluid)
|
||||
return ft;
|
||||
Map.Entry pairs = (Map.Entry) iter.next();
|
||||
if (((FluidType)pairs.getValue()).fluid.equals(searchedFluid))
|
||||
return (FluidType) pairs.getValue();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getTemperatureByFluid (Fluid searchedFluid)
|
||||
{
|
||||
for (FluidType ft : values())
|
||||
Iterator iter = fluidTypes.entrySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
if (ft.fluid == searchedFluid)
|
||||
return ft.baseTemperature;
|
||||
Map.Entry pairs = (Map.Entry) iter.next();
|
||||
if (((FluidType)pairs.getValue()).fluid.equals(searchedFluid))
|
||||
return ((FluidType) pairs.getValue()).baseTemperature;
|
||||
}
|
||||
return 800;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -25,13 +26,9 @@ public class Smeltery
|
||||
* Smeltery.addMelting(Block.oreIron, 0, 600, new
|
||||
* FluidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 0));
|
||||
*
|
||||
* @param stack
|
||||
* The itemstack to liquify
|
||||
* @param temperature
|
||||
* How hot the block should be before liquifying. Max temp in the
|
||||
* Smeltery is 800, other structures may vary
|
||||
* @param output
|
||||
* The result of the process in liquid form
|
||||
* @param stack The itemstack to liquify
|
||||
* @param temperature How hot the block should be before liquifying. Max temp in the Smeltery is 800, other structures may vary
|
||||
* @param output The result of the process in liquid form
|
||||
*/
|
||||
public static void addMelting0 (ItemStack stack, int temperature, FluidStack output)
|
||||
{
|
||||
@@ -43,15 +40,10 @@ public class Smeltery
|
||||
* Smeltery.addMelting(Block.oreIron, 0, 600, new
|
||||
* FluidStack(liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 0));
|
||||
*
|
||||
* @param blockID
|
||||
* The ID of the block to liquify and render
|
||||
* @param metadata
|
||||
* The metadata of the block to liquify and render
|
||||
* @param temperature
|
||||
* How hot the block should be before liquifying. Max temp in the
|
||||
* Smeltery is 800, other structures may vary
|
||||
* @param output
|
||||
* The result of the process in liquid form
|
||||
* @param blockID The ID of the block to liquify and render
|
||||
* @param metadata The metadata of the block to liquify and render
|
||||
* @param temperature How hot the block should be before liquifying. Max temp in the Smeltery is 800, other structures may vary
|
||||
* @param output The result of the process in liquid form
|
||||
*/
|
||||
public static void addMelting (Block block, int metadata, int temperature, FluidStack output)
|
||||
{
|
||||
@@ -64,16 +56,11 @@ public class Smeltery
|
||||
* 0, 600, new FluidStack(liquidMetalStill.blockID,
|
||||
* TConstruct.ingotLiquidValue * 2, 0));
|
||||
*
|
||||
* @param input
|
||||
* The item to liquify
|
||||
* @param blockID
|
||||
* The ID of the block to render
|
||||
* @param metadata
|
||||
* The metadata of the block to render
|
||||
* @param temperature
|
||||
* How hot the block should be before liquifying
|
||||
* @param liquid
|
||||
* The result of the process
|
||||
* @param input The item to liquify
|
||||
* @param blockID The ID of the block to render
|
||||
* @param metadata The metadata of the block to render
|
||||
* @param temperature How hot the block should be before liquifying
|
||||
* @param liquid The result of the process
|
||||
*/
|
||||
public static void addMelting (ItemStack input, Block blockID, int metadata, int temperature, FluidStack liquid)
|
||||
{
|
||||
@@ -88,11 +75,8 @@ public class Smeltery
|
||||
* FluidStack(tinID, 1, 0)); The example mixes 3 copper with 1 tin to make 2
|
||||
* bronze
|
||||
*
|
||||
* @param result
|
||||
* The output of the combination of mixers. The quantity is used
|
||||
* for amount of a successful mix
|
||||
* @param mixers
|
||||
* the liquids to be mixed. Quantities are used as ratios
|
||||
* @param result The output of the combination of mixers. The quantity is used for amount of a successful mix
|
||||
* @param mixers the liquids to be mixed. Quantities are used as ratios
|
||||
*/
|
||||
public static void addAlloyMixing (FluidStack result, FluidStack... mixers)
|
||||
{
|
||||
@@ -106,8 +90,7 @@ public class Smeltery
|
||||
/**
|
||||
* Used to get the resulting temperature from a source ItemStack
|
||||
*
|
||||
* @param item
|
||||
* The Source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result temperature
|
||||
*/
|
||||
public static Integer getLiquifyTemperature (ItemStack item)
|
||||
@@ -125,8 +108,7 @@ public class Smeltery
|
||||
/**
|
||||
* Used to get the resulting temperature from a source Block
|
||||
*
|
||||
* @param item
|
||||
* The Source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public static Integer getLiquifyTemperature (int blockID, int metadata)
|
||||
@@ -137,8 +119,7 @@ public class Smeltery
|
||||
/**
|
||||
* Used to get the resulting ItemStack from a source ItemStack
|
||||
*
|
||||
* @param item
|
||||
* The Source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public static FluidStack getSmelteryResult (ItemStack item)
|
||||
@@ -155,8 +136,7 @@ public class Smeltery
|
||||
/**
|
||||
* Used to get the resulting ItemStack from a source Block
|
||||
*
|
||||
* @param item
|
||||
* The Source ItemStack
|
||||
* @param item The Source ItemStack
|
||||
* @return The result ItemStack
|
||||
*/
|
||||
public static FluidStack getSmelteryResult (int blockID, int metadata)
|
||||
@@ -209,14 +189,10 @@ public class Smeltery
|
||||
*
|
||||
* @author samtrion
|
||||
*
|
||||
* @param type
|
||||
* Type of Fluid
|
||||
* @param input
|
||||
* The item to liquify
|
||||
* @param temperatureDifference
|
||||
* Difference between FluidType BaseTemperature
|
||||
* @param fluidAmount
|
||||
* Amount of Fluid
|
||||
* @param type Type of Fluid
|
||||
* @param input The item to liquify
|
||||
* @param temperatureDifference Difference between FluidType BaseTemperature
|
||||
* @param fluidAmount Amount of Fluid
|
||||
*/
|
||||
public static void addMelting (FluidType type, ItemStack input, int temperatureDifference, int fluidAmount)
|
||||
{
|
||||
@@ -224,7 +200,10 @@ public class Smeltery
|
||||
if (temp <= 20)
|
||||
temp = type.baseTemperature;
|
||||
|
||||
addMelting(input, type.renderBlock, type.renderMeta, type.baseTemperature + temperatureDifference, new FluidStack(type.fluid, fluidAmount));
|
||||
if (input.getItem() instanceof ItemBlock)
|
||||
addMelting(input, ((ItemBlock) input.getItem()).field_150939_a, type.renderMeta, type.baseTemperature + temperatureDifference, new FluidStack(type.fluid, fluidAmount));
|
||||
else
|
||||
addMelting(input, type.renderBlock, type.renderMeta, type.baseTemperature + temperatureDifference, new FluidStack(type.fluid, fluidAmount));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,14 +211,10 @@ public class Smeltery
|
||||
*
|
||||
* @author samtrion
|
||||
*
|
||||
* @param oreName
|
||||
* oreDictionary name e.g. oreIron
|
||||
* @param type
|
||||
* Type of Fluid
|
||||
* @param temperatureDifference
|
||||
* Difference between FluidType BaseTemperature
|
||||
* @param fluidAmount
|
||||
* Amount of Fluid
|
||||
* @param oreName oreDictionary name e.g. oreIron
|
||||
* @param type Type of Fluid
|
||||
* @param temperatureDifference Difference between FluidType BaseTemperature
|
||||
* @param fluidAmount Amount of Fluid
|
||||
*/
|
||||
public static void addDictionaryMelting (String oreName, FluidType type, int temperatureDifference, int fluidAmount)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user