diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2016-04-11 19:44:54 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2016-04-11 19:44:54 +0300 |
| commit | 05c78126859231a68e199dc34613689bd0978e2f (patch) | |
| tree | 050bea104a18c72905095d29f31bec2935a27a24 /ihl/worldgen/ores | |
Initial commit
Diffstat (limited to 'ihl/worldgen/ores')
| -rw-r--r-- | ihl/worldgen/ores/BlockOre.java | 137 | ||||
| -rw-r--r-- | ihl/worldgen/ores/DebugScannerBlock.java | 46 | ||||
| -rw-r--r-- | ihl/worldgen/ores/DebugScannerContainer.java | 49 | ||||
| -rw-r--r-- | ihl/worldgen/ores/DebugScannerGui.java | 71 | ||||
| -rw-r--r-- | ihl/worldgen/ores/DebugScannerTileEntity.java | 161 | ||||
| -rw-r--r-- | ihl/worldgen/ores/IHLFluid.java | 363 |
6 files changed, 827 insertions, 0 deletions
diff --git a/ihl/worldgen/ores/BlockOre.java b/ihl/worldgen/ores/BlockOre.java new file mode 100644 index 0000000..a88f3b7 --- /dev/null +++ b/ihl/worldgen/ores/BlockOre.java @@ -0,0 +1,137 @@ +package ihl.worldgen.ores;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class BlockOre extends Block
+{
+ private Type type;
+ private static List<BlockOre> instances = new ArrayList();
+ private static Map<Type, IIcon> iconMap = new HashMap();
+
+ public BlockOre(Type type1)
+ {
+ super(Material.rock);
+ this.type=type1;
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.setBlockName(type.unLocalizedName);
+ instances.add(this);
+ this.setHardness(2.0F).setResistance(4.0F);
+ }
+
+ public static void init()
+ {
+ Type[] var1 = Type.values();
+ for(int i=0;i<var1.length;i++)
+ {
+ new BlockOre(var1[i]);
+ }
+ Iterator<BlockOre> ii = instances.iterator();
+ while(ii.hasNext())
+ {
+ BlockOre instance = ii.next();
+ GameRegistry.registerBlock(instance,instance.type.unLocalizedName);
+ OreDictionary.registerOre(instance.type.unLocalizedName, instance);
+ }
+ }
+
+ @Override
+ public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int flag)
+ {
+ super.dropBlockAsItemWithChance(world, x, y, z, meta, chance, flag);
+ if(this.type.fortuneAffectsDrops)
+ {
+ this.dropXpOnBlockBreak(world, x, y, z, MathHelper.getRandomIntegerInRange(world.rand, 1, 4));
+ }
+ }
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
+ ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
+ int fortmod = world.rand.nextInt(fortune + 2) - 1;
+ if (fortmod < 0 || !type.fortuneAffectsDrops)fortmod = 0;
+ ItemStack drop = null;
+ int amount = 1;
+ amount = (type.amountFrom + (type.amountTo>0?world.rand.nextInt(type.amountTo):0)) * (fortmod + 1);
+ drop = OreDictionary.getOres(type.oreDrop).get(0);
+ if (drop != null && amount > 0)
+ {
+ drop.stackSize=amount;
+ drops.add(drop);
+ }
+ return drops;
+ }
+
+
+ public enum Type
+ {
+ Bischofite("oreBischofite", "dustBischofite",1,2),
+ Datolite("oreDatolite", "dustDatolite",1,2),
+ Stibnite("oreStibnite"),
+ Chromite("oreChromite"),
+ Muscovite("oreMica"),
+ Bauxite("oreBauxite"),
+ Cinnabar("oreCinnabar"),
+ RockSalt("oreRockSalt", "dustRockSalt",1,2),
+ Limestone("oreLimestone", "dustCalcite",1,2),
+ Gypsum("oreGypsum"),
+ Gyubnera("oreGyubnera"),//(Mn,Fe)WO4 Mn:Fe 5/1
+ OreTrona("oreTrona", "dustTrona",1,2),
+ PotassiumFeldspar("orePotassiumFeldspar"),
+ Apatite("oreApatite", "gemApatite",2,5),
+ Saltpeter("oreSaltpeter", "dustSaltpeter",1,2);
+ Type(String unlocalizedName1, String oreDrop1, int amountFrom1, int amountTo1 )
+ {
+ unLocalizedName=unlocalizedName1;
+ oreDrop=oreDrop1;
+ amountFrom=amountFrom1;
+ amountTo=amountTo1;
+ }
+ Type(String unlocalizedName1)
+ {
+ unLocalizedName=unlocalizedName1;
+ oreDrop=unlocalizedName1;
+ amountFrom=1;
+ amountTo=0;
+ fortuneAffectsDrops=false;
+ }
+ String unLocalizedName;
+ String oreDrop;
+ int amountFrom;
+ int amountTo;
+ boolean fortuneAffectsDrops=true;
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister register)
+ {
+ iconMap.put(this.type, register.registerIcon(IHLModInfo.MODID + ":"+this.type.unLocalizedName));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int i, int j)
+ {
+ return iconMap.get(type);
+ }
+}
diff --git a/ihl/worldgen/ores/DebugScannerBlock.java b/ihl/worldgen/ores/DebugScannerBlock.java new file mode 100644 index 0000000..a934f60 --- /dev/null +++ b/ihl/worldgen/ores/DebugScannerBlock.java @@ -0,0 +1,46 @@ +package ihl.worldgen.ores;
+
+import ihl.IHLCreativeTab;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class DebugScannerBlock extends Block implements ITileEntityProvider{
+
+ public DebugScannerBlock(Material material)
+ {
+ super(material);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2) {
+ return new DebugScannerTileEntity();
+ }
+
+ @Override
+ public boolean hasTileEntity(int metadata)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer entityPlayer,int i,float pos_x,float pos_y,float pos_z){
+ TileEntity te = world.getTileEntity(x,y,z);
+ if(te instanceof DebugScannerTileEntity)
+ {
+ DebugScannerTileEntity bte = (DebugScannerTileEntity)te;
+ if (bte == null || entityPlayer.isSneaking()) {
+ return false;
+ }
+ else
+ {
+ return bte.getGui(entityPlayer);
+ }
+ }
+ return false;
+ }
+}
diff --git a/ihl/worldgen/ores/DebugScannerContainer.java b/ihl/worldgen/ores/DebugScannerContainer.java new file mode 100644 index 0000000..52d4990 --- /dev/null +++ b/ihl/worldgen/ores/DebugScannerContainer.java @@ -0,0 +1,49 @@ +package ihl.worldgen.ores;
+
+import ic2.core.ContainerBase;
+import ic2.core.slot.SlotInvSlot;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Slot;
+
+public class DebugScannerContainer extends ContainerBase {
+
+ protected DebugScannerTileEntity tileEntity;
+ public int lastFluidAmount = -1;
+ public int lastFuel = -1;
+ public short lastProgress = -1;
+ public final static int height=256;
+ public final static int width=248;
+
+ public DebugScannerContainer(EntityPlayer entityPlayer, DebugScannerTileEntity tileEntity1){
+ super(tileEntity1);
+ this.tileEntity = tileEntity1;
+ int col,row;
+
+ for (row = 0; row < 3; ++row)
+ {
+ for (col = 0; col < 13; ++col)
+ {
+ int slotnum = col + row * 13 + 9;
+ if(slotnum < entityPlayer.inventory.getSizeInventory()-4)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, slotnum, 8 + col * 18, 196 + row * 18));
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ for (col = 0; col < 9; ++col)
+ {
+ this.addSlotToContainer(new Slot(entityPlayer.inventory, col, 80 + col * 18, 232));
+ }
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.itemsSlot, 0, 8, 8));
+ this.addSlotToContainer(new SlotInvSlot(tileEntity1.itemsSlot, 1, 8+18, 8));
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer var1) {
+ return tileEntity.isUseableByPlayer(var1);
+ }
+}
diff --git a/ihl/worldgen/ores/DebugScannerGui.java b/ihl/worldgen/ores/DebugScannerGui.java new file mode 100644 index 0000000..9d379fe --- /dev/null +++ b/ihl/worldgen/ores/DebugScannerGui.java @@ -0,0 +1,71 @@ +package ihl.worldgen.ores;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(Side.CLIENT)
+public class DebugScannerGui extends GuiContainer {
+ private static final ResourceLocation background = new ResourceLocation("ihl", "textures/gui/GUIDebugScanner.png");
+ private DebugScannerContainer container;
+
+ public DebugScannerGui (DebugScannerContainer container1)
+ {
+ super(container1);
+ this.container=container1;
+ this.ySize=DebugScannerContainer.height;
+ this.xSize=DebugScannerContainer.width;
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ int xOffset = (this.width - xSize) / 2;
+ int yOffset = (this.height - ySize) / 2;
+ List<String> ode = container.tileEntity.oreDictionaryEntries;
+ int verticalOffset = 31;
+ for(int i=0;i<ode.size();i++)
+ {
+ int colorIndex = 16777215;
+ String string = ode.get(i);
+ if(string.startsWith(" "))
+ {
+ colorIndex = 15658734;
+ }
+ if(string.startsWith(" -"))
+ {
+ colorIndex = 14540253;
+ }
+ if(string.startsWith(" "))
+ {
+ colorIndex = 13421772;
+ }
+ if(string.length()>38)
+ {
+ String string1=string.substring(0,38);
+ String string2=string.substring(38);
+ fontRendererObj.drawStringWithShadow(string1, 9, i*10+verticalOffset, colorIndex);
+ verticalOffset+=10;
+ fontRendererObj.drawStringWithShadow(string2, 9, i*10+verticalOffset, colorIndex);
+ }
+ else
+ {
+ fontRendererObj.drawStringWithShadow(string, 9, i*10+verticalOffset, colorIndex);
+ }
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2,
+ int par3) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.renderEngine.bindTexture(background);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
\ No newline at end of file diff --git a/ihl/worldgen/ores/DebugScannerTileEntity.java b/ihl/worldgen/ores/DebugScannerTileEntity.java new file mode 100644 index 0000000..2102cf0 --- /dev/null +++ b/ihl/worldgen/ores/DebugScannerTileEntity.java @@ -0,0 +1,161 @@ +package ihl.worldgen.ores;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
+import net.minecraftforge.oredict.OreDictionary;
+import ic2.core.ContainerBase;
+import ic2.core.IC2;
+import ic2.core.IHasGui;
+import ic2.core.block.TileEntityInventory;
+import ic2.core.block.invslot.InvSlot;
+
+public class DebugScannerTileEntity extends TileEntityInventory implements IHasGui
+{
+ public final InvSlot itemsSlot;
+ private ItemStack lastItem;
+ public List<String> oreDictionaryEntries = new ArrayList();
+
+ public DebugScannerTileEntity()
+ {
+ this.itemsSlot = new InvSlot(this, "drainInput", 0, InvSlot.Access.I, 2);
+ }
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
+ return this.getFacing()!=(short)side && side!=0 && side!=1;
+ }
+
+ @Override
+ public void updateEntityClient()
+ {
+ if(IC2.platform.isRendering())
+ {
+ if(this.itemsSlot.get(0)!=null && this.itemsSlot.get(0)!=lastItem)
+ {
+ this.oreDictionaryEntries.clear();
+ int[] ids = OreDictionary.getOreIDs(this.itemsSlot.get());
+ String itemNameFromIR = Item.itemRegistry.getNameForObject(this.itemsSlot.get().getItem());
+ this.oreDictionaryEntries.add("ItemRegistry entry:");
+ this.oreDictionaryEntries.add(" "+itemNameFromIR);
+ this.oreDictionaryEntries.add("Item damage: " + this.itemsSlot.get().getItemDamage());
+ this.oreDictionaryEntries.add("Item class:");
+ this.oreDictionaryEntries.add(" "+this.itemsSlot.get().getItem().getClass().getCanonicalName());
+ if(this.itemsSlot.get().stackTagCompound!=null)
+ {
+ this.oreDictionaryEntries.add("NBT keys:");
+ Iterator iterator = this.itemsSlot.get().stackTagCompound.func_150296_c().iterator();
+ while(iterator.hasNext())
+ {
+ String entry = (String) iterator.next();
+ if(this.itemsSlot.get().stackTagCompound.getTag(entry) instanceof NBTTagCompound)
+ {
+ this.oreDictionaryEntries.add(" "+entry);
+ NBTTagCompound ct = this.itemsSlot.get().stackTagCompound.getCompoundTag(entry);
+ if(ct!=null && ct.func_150296_c()!=null && !ct.func_150296_c().isEmpty())
+ {
+ this.oreDictionaryEntries.add(" -NBT compound tag subkeys:");
+ Iterator stIterator = ct.func_150296_c().iterator();
+ while(stIterator.hasNext())
+ {
+ String entry2 = (String) stIterator.next();
+ this.oreDictionaryEntries.add(" "+entry2+"="+ct.getString(entry2));
+ }
+ }
+ }
+ else
+ {
+ this.oreDictionaryEntries.add(" "+entry+"="+this.itemsSlot.get().stackTagCompound.getString(entry));
+ }
+ }
+ }
+ if(ids.length>0)
+ {
+ this.oreDictionaryEntries.add("Ore dict. entries:");
+ for(int i=0;i<ids.length;i++)
+ {
+ this.oreDictionaryEntries.add(" "+OreDictionary.getOreName(ids[i]));
+ }
+ }
+ lastItem=this.itemsSlot.get(0);
+ }
+ if(this.itemsSlot.get(1)!=null && this.itemsSlot.get(1)!=lastItem)
+ {
+ this.oreDictionaryEntries.clear();
+ if(this.itemsSlot.get(1).getItem() instanceof IFluidContainerItem)
+ {
+ FluidStack fluid = ((IFluidContainerItem)this.itemsSlot.get(1).getItem()).getFluid(this.itemsSlot.get(1));
+ if(fluid!=null)
+ {
+ this.oreDictionaryEntries.add("Internal fluid name:");
+ this.oreDictionaryEntries.add(" "+fluid.getFluid().getName());
+ this.oreDictionaryEntries.add("Fluid class:");
+ this.oreDictionaryEntries.add(" "+fluid.getFluid().getClass().getName());
+ this.oreDictionaryEntries.add("Fluid id:");
+ this.oreDictionaryEntries.add(" "+fluid.getFluid().getID());
+ this.oreDictionaryEntries.add("Fluid still icon:");
+ if(fluid.getFluid().getStillIcon()!=null)
+ {
+ this.oreDictionaryEntries.add(" "+fluid.getFluid().getStillIcon().getIconName());
+ }
+ else
+ {
+ this.oreDictionaryEntries.add(" <missing icon> ");
+ }
+ this.oreDictionaryEntries.add("Fluid flowing icon:");
+ if(fluid.getFluid().getFlowingIcon()!=null)
+ {
+ this.oreDictionaryEntries.add(" "+fluid.getFluid().getFlowingIcon().getIconName());
+ }
+ else
+ {
+ this.oreDictionaryEntries.add(" <missing icon> ");
+ }
+ }
+ }
+ lastItem=this.itemsSlot.get(1);
+ }
+ }
+ }
+
+ /**
+ * Returns the name of the inventory
+ */
+ @Override
+ public String getInventoryName()
+ {
+ return "debugScanner";
+ }
+
+ @Override
+ public ContainerBase getGuiContainer(EntityPlayer entityPlayer)
+ {
+ return new DebugScannerContainer(entityPlayer, this);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public GuiScreen getGui(EntityPlayer entityPlayer, boolean isAdmin)
+ {
+ return new DebugScannerGui(new DebugScannerContainer(entityPlayer, this));
+ }
+
+ @Override
+ public void onGuiClosed(EntityPlayer entityPlayer) {}
+
+
+ public boolean getGui(EntityPlayer player)
+ {
+ return this instanceof IHasGui ? (IC2.platform.isSimulating() ? IC2.platform.launchGui(player, this) : true) : false;
+ }
+ }
\ No newline at end of file diff --git a/ihl/worldgen/ores/IHLFluid.java b/ihl/worldgen/ores/IHLFluid.java new file mode 100644 index 0000000..804a52c --- /dev/null +++ b/ihl/worldgen/ores/IHLFluid.java @@ -0,0 +1,363 @@ +package ihl.worldgen.ores;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import ic2.core.Ic2Items;
+import ihl.IHLCreativeTab;
+import ihl.IHLModInfo;
+import ihl.items_blocks.IHLFluidBlock;
+import cpw.mods.fml.common.registry.GameRegistry;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.MapColor;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.material.MaterialLiquid;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBucket;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class IHLFluid extends Fluid
+{
+ private IHLFluidType type;
+ private static List<Fluid> fluidInstances = new ArrayList();
+ private static Map<String, IHLFluidType> localFluidRegistry = new HashMap();
+ private static Map<String, Float> realDensityMap = new HashMap();
+ private static Map<String, String> condensationMap = new HashMap();
+ private static Map<String, List<String>> solutionMap = new HashMap();
+ public static final int maxGaseousStateVapoursDensity = 40;
+
+ public IHLFluid(IHLFluidType type1) {
+ super(type1.fluidRegistryName);
+ type=type1;
+ this.setTemperature(type.temperature);
+ this.setDensity(Math.round(type.density));
+ realDensityMap.put(type1.fluidRegistryName, type.density);
+ this.setGaseous(type.isGaseous);
+ this.setUnlocalizedName(type.fluidRegistryName.replaceFirst("fluid", ""));
+ Fluid instance = this;
+ if (!FluidRegistry.registerFluid(instance))
+ {
+ instance = FluidRegistry.getFluid(type.fluidRegistryName);
+ }
+ if(instance.getBlock()==null && !type.noBlock)
+ {
+ instance.setBlock(new IHLFluidBlock(instance, type.blockMaterial, type.textureName, "fluid"+type.fluidName.replaceFirst("fluid", "")).setFlammable(type.flammable).setBlockName("block"+type.fluidName).setCreativeTab(IHLCreativeTab.tab));
+ }
+ if(type.haveBucket)
+ {
+ Item bucket = new ItemBucket(block).setTextureName(IHLModInfo.MODID+":bucket_"+type.fluidName).setUnlocalizedName("bucket_"+type.fluidName).setCreativeTab(IHLCreativeTab.tab);
+ GameRegistry.registerItem(bucket, "bucket_"+type.fluidName);
+ FluidContainerRegistry.registerFluidContainer(instance, new ItemStack(bucket), FluidContainerRegistry.EMPTY_BUCKET);
+ }
+ type.fluid=instance;
+ localFluidRegistry.put(type1.fluidRegistryName, type);
+ fluidInstances.add(this);
+ }
+
+ public static void init()
+ {
+ IHLFluidType[] var1 = IHLFluidType.values();
+ for(int i=0;i<var1.length;i++)
+ {
+ new IHLFluid(var1[i]);
+ }
+ condensationMap.put("steam", "ic2distilledwater");
+ condensationMap.put("ic2steam", "ic2distilledwater");
+ condensationMap.put("ic2superheatedsteam", "ic2distilledwater");
+ condensationMap.put("vapour.sulfuricacid", "sulfuricacid");
+ solutionMap.put("water", Arrays.asList(new String [] {"aquaregia","sulfuricacid","solution.nickelsulfate","solution.bluevitriol"}));
+ solutionMap.put("ic2distilledwater", Arrays.asList(new String [] {"aquaregia","sulfuricacid","solution.nickelsulfate","solution.bluevitriol"}));
+ }
+
+ public static void registerIcons(TextureMap iconRegistry)
+ {
+ Iterator<Fluid> ii = fluidInstances.iterator();
+ while(ii.hasNext())
+ {
+ Fluid instance = ii.next();
+ IHLFluidType instanceType = localFluidRegistry.get(instance.getName());
+ instance.setIcons(
+ iconRegistry.registerIcon(IHLModInfo.MODID + ":" + instanceType.textureName + "Still")
+ ,iconRegistry.registerIcon(IHLModInfo.MODID + ":" + instanceType.textureName + "Flowing")
+ );
+ }
+ }
+
+ public static ItemStack getCell(String fluidname1)
+ {
+ ItemStack filledCell = FluidContainerRegistry.fillFluidContainer(new FluidStack(FluidRegistry.getFluid(fluidname1), FluidContainerRegistry.BUCKET_VOLUME),Ic2Items.cell.copy());
+ return filledCell;
+ }
+
+ public static Block getBlock(String fluidname)
+ {
+ return localFluidRegistry.get(fluidname).fluid.getBlock();
+ }
+
+ public static int getMeltingPoint(Fluid fluid)
+ {
+ if(localFluidRegistry.get(fluid.getName())!=null)
+ {
+ IHLFluidType type = localFluidRegistry.get(fluid.getName());
+ return type.meltingPoint;
+ }
+ else
+ {
+ if(fluid.isGaseous())
+ {
+ return fluid.getTemperature()>100?fluid.getTemperature()-100:0;
+ }
+ else
+ {
+ return fluid.getTemperature();
+ }
+ }
+ }
+
+ public static int getBoilingPoint(Fluid fluid)
+ {
+ if(localFluidRegistry.containsKey(fluid.getName()))
+ {
+ IHLFluidType type = localFluidRegistry.get(fluid.getName());
+ return type.boilingPoint;
+ }
+ else
+ {
+ if(fluid.getName()=="steam" || fluid.getName()=="ic2steam" || fluid.getName()=="ic2superheatedsteam")
+ {
+ return 373;
+ }
+ else if(fluid.isGaseous())
+ {
+ return fluid.getTemperature();
+ }
+ else
+ {
+ return fluid.getTemperature()+100;
+ }
+ }
+ }
+
+ public enum IHLFluidType
+ {
+ //Methane("Methane","fluidAcetylene",10047, 293, 249, 373, 1150, "methane", Material.water, false, false, false, false),
+ LithiumChloride("LithiumChlorideDissolvedInWater",10046, 293, 249, 373, 1530, "solution.lithiumchloride", Material.water, false, false, false),
+ CalciumChloride("CalciumChlorideDissolvedInWater",10045, 293, 249, 373, 1630, "solution.calciumchloride", Material.water, false, false, false),
+ ZeolitePulp("ZeolitePulp","fluidPulpZeolite",10044, 293, 249, 373, 1150, "pulp.sodiumzeolite", Material.water, false, false, false),
+ MoltenTarPitch("MoltenTarPitch","fluidOil",10043, 373, 373, 800, 1250, "molten.tarpitch", Material.lava, false, false, false),
+ CrackingGas("CrackingGas","fluidAcetylene",10042, 293, 135, 273, 2.27f, "crackinggas",new MaterialLiquid(MapColor.blackColor), false, false, false),
+ Trichlorosilane("Trichlorosilane","fluidHydrogenChloride", 10041, 293, 147, 305, 1342, "trichlorosilane", new MaterialLiquid(MapColor.greenColor), true, false, false),
+ SiliconTetrachloride("SiliconTetrachloride","fluidChlorine", 10040, 293, 204, 330, 584, "silicontetrachloride", new MaterialLiquid(MapColor.cyanColor), true, false, false),
+ Chlorine("Chlorine", 10039, 293, 172, 238, 3.21F),
+ BoricAcid("BoricAcid",10038, 373, 249, 373, 1275, "boricacid", Material.water, false, false, false),
+ MicaPulp("PulpMica",10037, 293, 249, 373, 1150, "pulp.mica", Material.water, false, false, false),
+ CellulosePulp("PulpCellulose",10036, 293, 249, 373, 1075, "pulp.cellulose", Material.water, false, false, false),
+ Fuel("Fuel", 10035, 293, 268, 633, 840, "fuel", Material.water, true, false, true),
+ MineralOil("MineralOil", 10034, 293, 238, 704, 845, "mineraloil", Material.water, true, false, true),
+ FuelOil("FuelOil", 10033, 293, 293, 693, 991, "fueloil", Material.water, true, false, true),
+ Oil("Oil", 10032, 293, 284, 773, 850, "oil", Material.water, true, false, true),
+ Mercury("Mercury", 10031, 293, 234, 630, 13546),
+ VapourMercury("VapourMercury",10030, 630, 234, 630, 9.229F, "vapour.mercury", new MaterialLiquid(MapColor.cyanColor), false, false, false),
+ Hydrogen("Hydrogen", 10029, 293, 14, 20, 0.046F, "hydrogen", new MaterialLiquid(MapColor.blueColor), true, false, true),
+ SaltWater("SaltWater", 10028, 293, 253, 373, 1360),
+ HydrogenChloride("HydrogenChloride", 10027, 293, 159, 188, 1.477F, "hydrogenchloride", new MaterialLiquid(MapColor.yellowColor), true, false, true),
+ NatriumTungstate("NatriumTungstateDissolvedInWater",10026, 293, 249, 373, 1730, "solution.natriumtungstate", Material.water, true, false, false),
+ Turpentine("Turpentine",10025, 293, 217, 453, 1470, "turpentine", Material.water, true, false, true),
+ Air("Air", 293, 55, 93, 1.292F, Ic2Items.airCell),
+ Nitrogen("Nitrogen", 10024, 92, 56, 92, 1.251F, "nitrogen", new MaterialLiquid(MapColor.airColor), true, false, true),
+ Acetylene("Acetylene", 10023, 293, 17, 190, 1.173F, "acetylene", Material.water, true, false, true),
+ Oxygen("Oxygen", 10022, 93, 55, 93, 1.429F, "oxygen", new MaterialLiquid(MapColor.airColor), true, false, true),
+ NatriumHydroxide("NatriumHydroxideDissolvedInWater",10021, 293, 249, 373, 1525, "solution.natriumhydroxide", Material.water, true, false, false),
+ LiquidGlass("LiquidGlass",10020, 293, 253, 373, 2400),
+ fluidRubberTreeSap("fluidRubberTreeSap",10019, 293, 273, 393, 1200, "fluidrubbertreesap", Material.water, true, true, false),
+ SpruceResin("SpruceResin",10018, 293, 273, 533, 1080, "spruceresin", Material.water, true, true, true),
+ CablingColophony("CablingColophony",10017, 363, 363, 533, 1070, "cablingcolophony", Material.water, true, false, true),
+ Glyceryl("Glyceryl",10016, 293, 291, 583, 1261, "glyceryl", Material.water, true, false, true),
+ SeedOil("SeedOil",10015, 293, 256, 583, 920, "seedoil", Material.water, true, false, true),
+ AquaRegia("AquaRegia",10014, 293, 231, 356, 1060),
+ SodiumPeroxide("SodiumPeroxide",10013, 950, 950, 2223, 1800),
+ OsmiumTetroxide("OsmiumTetroxide",10012, 313, 313, 403, 9),
+ OleicAcid("OleicAcid",10011, 293, 288, 633, 895, "oleicacid", Material.water, true, false, true),
+ Limemilk("Limemilk",10010, 293, 250, 373, 1020),
+ NickelSulfateDissolvedInWater("NickelSulfateDissolvedInWater",10009, 293, 253, 373, 1220, "solution.nickelsulfate", Material.water, true, false, false),
+ BlueVitriolDissolvedInWater("BlueVitriolDissolvedInWater",10008, 293, 253, 373, 1180, "solution.bluevitriol", Material.water, true, false, false),
+ MoltenRubberWithSulfur("MoltenRubberWithSulfur",10007, 600, 600, 1000, 1200, "molten.rubber", Material.lava, false, false, true),
+ MoltenLithium("MoltenLithium","fluidMolten",10042, 454, 454, 1613, 512, "molten.lithium", Material.lava, false, false, false),
+ MoltenSodiumChloride("MoltenSodiumChloride","fluidMolten",10006, 1273, 1273, 1740, 1556, "molten.sodiumchloride", Material.lava, false, false, false),
+ MoltenGlass("MoltenGlass","fluidMolten",10048, 600, 600, 1950, 2270, "molten.glass", Material.lava, false, false, false, true),
+ MoltenMagnesium("MoltenMagnesium","fluidMolten",10006, 923, 923, 1623, 1584, "molten.magnesium", Material.lava, false, false, false),
+ MoltenSteel("MoltenSteel","fluidMolten",10006, 1800, 1800, 3134, 6980, "molten.steel", Material.lava, false, false, false),
+ MoltenCopper("MoltenCopper","fluidMolten",10048, 1356, 1356, 2840, 8920, "molten.copper", Material.lava, false, false, false),
+ MoltenBronze("MoltenBronze",10005, 940, 940, 2840, 8000, "molten.bronze", Material.lava, false, false, false),
+ MoltenGold("MoltenGold",10005, 1337, 1337, 3129, 17310, "molten.gold", Material.lava, false, false, false),
+ VapourSulfuricAcid("VapourSulfuricAcid",10004, 610, 283, 610, 4.522F, "vapour.sulfuricacid", new MaterialLiquid(MapColor.redColor), false, false, false),
+ SulfuricAnhydride("SulfuricAnhydride",10003, 45, 17, 45, 2, "sulfuricanhydride", new MaterialLiquid(MapColor.redColor), true, false, false),
+ SulfuricAcid("SulfuricAcid",10002, 293, 283, 610, 1836),
+ NitricAcid("NitricAcid",10001, 293, 231, 356, 1100);
+ IHLFluidType(String fluidName1, int celldamage, int temperature1, int meltingPoint1, int boilingPoint1, float density1)
+ {
+ fluidName=fluidName1;
+ fluidRegistryName=fluidName.toLowerCase();
+ textureName="fluid"+fluidName.replaceFirst("fluid", "");
+ temperature=temperature1;
+ density=density1;
+ cellName="itemCell"+fluidName;
+ haveBucket=false;
+ isGaseous=density1<maxGaseousStateVapoursDensity;
+ boilingPoint=boilingPoint1;
+ meltingPoint=meltingPoint1;
+ damage=celldamage;
+ }
+ IHLFluidType(String fluidName1, int temperature1, int meltingPoint1, int boilingPoint1, float density1, ItemStack cell1)
+ {
+ fluidName=fluidName1;
+ fluidRegistryName=fluidName.toLowerCase();
+ textureName="fluid"+fluidName.replaceFirst("fluid", "");
+ temperature=temperature1;
+ density=density1;
+ cellName="itemCell"+fluidName;
+ haveBucket=false;
+ isGaseous=density1<maxGaseousStateVapoursDensity;
+ boilingPoint=boilingPoint1;
+ meltingPoint=meltingPoint1;
+ damage=99999;
+ hasCell=false;
+ cell=cell1;
+ }
+
+ IHLFluidType(String fluidName1, int celldamage, int temperature1, int meltingPoint1, int boilingPoint1, float density1, String fluidRegistryName1, Material blockMaterial1, boolean hasCell1, boolean haveBucket1, boolean flammable1)
+ {
+ fluidName=fluidName1;
+ fluidRegistryName=fluidRegistryName1;
+ textureName="fluid"+fluidName.replaceFirst("fluid", "");
+ temperature=temperature1;
+ density=density1;
+ cellName="itemCell"+fluidName;
+ haveBucket=haveBucket1;
+ flammable=flammable1;
+ isGaseous=density1<maxGaseousStateVapoursDensity;
+ blockMaterial=blockMaterial1;
+ boilingPoint=boilingPoint1;
+ meltingPoint=meltingPoint1;
+ hasCell=hasCell1;
+ damage=celldamage;
+ }
+ IHLFluidType(String fluidName1, String textureName1, int celldamage, int temperature1, int meltingPoint1, int boilingPoint1, float density1, String fluidRegistryName1, Material blockMaterial1, boolean hasCell1, boolean haveBucket1, boolean flammable1)
+ {
+ fluidName=fluidName1;
+ fluidRegistryName=fluidRegistryName1;
+ textureName=textureName1;
+ temperature=temperature1;
+ density=density1;
+ cellName="itemCell"+fluidName;
+ haveBucket=haveBucket1;
+ flammable=flammable1;
+ isGaseous=density1<maxGaseousStateVapoursDensity;
+ blockMaterial=blockMaterial1;
+ boilingPoint=boilingPoint1;
+ meltingPoint=meltingPoint1;
+ hasCell=hasCell1;
+ damage=celldamage;
+ }
+ IHLFluidType(String fluidName1, String textureName1, int celldamage, int temperature1, int meltingPoint1, int boilingPoint1, float density1, String fluidRegistryName1, Material blockMaterial1, boolean hasCell1, boolean haveBucket1, boolean flammable1, boolean noBlock1)
+ {
+ noBlock=noBlock1;
+ fluidName=fluidName1;
+ fluidRegistryName=fluidRegistryName1;
+ textureName=textureName1;
+ temperature=temperature1;
+ density=density1;
+ cellName="itemCell"+fluidName;
+ haveBucket=haveBucket1;
+ flammable=flammable1;
+ isGaseous=density1<maxGaseousStateVapoursDensity;
+ blockMaterial=blockMaterial1;
+ boilingPoint=boilingPoint1;
+ meltingPoint=meltingPoint1;
+ hasCell=hasCell1;
+ damage=celldamage;
+ }
+ public String fluidName;
+ public String fluidRegistryName;
+ public String cellName;
+ public String textureName;
+ int temperature;
+ float density;
+ boolean isGaseous;
+ boolean flammable=false;
+ boolean noBlock=false;
+ boolean haveBucket;
+ Material blockMaterial = Material.water;
+ int meltingPoint;
+ int boilingPoint;
+ public boolean hasCell=true;
+ public ItemStack cell;
+ public Fluid fluid;
+ public final int damage;
+ }
+
+ public static FluidStack getCondensationResult(FluidStack condensatedGas)
+ {
+ String fluidname = condensationMap.get(condensatedGas.getFluid().getName());
+ Fluid fluid = FluidRegistry.getFluid(fluidname);
+ if(fluid!=null)
+ {
+ int quantity=Math.round(condensatedGas.amount*getCondensationConversionRate(condensatedGas.getFluid()));
+ if(quantity>0)
+ {
+ return new FluidStack(fluid.getID(),quantity);
+ }
+ }
+ return null;
+ }
+ public static float getCondensationConversionRate(Fluid gas)
+ {
+ String fluidname = condensationMap.get(gas.getName());
+ Fluid fluid = FluidRegistry.getFluid(fluidname);
+ if(fluid!=null)
+ {
+ float rate = (float)gas.getDensity()/(float)fluid.getDensity();
+ if(gas.getDensity()<0)
+ {
+ //IC2 steam density -800, 100 mb steam from 1 mb water
+ rate=(-8000F/gas.getDensity())/fluid.getDensity();
+ }
+ return rate;
+ }
+ return 0F;
+ }
+
+ public static boolean canBeDissolvedIn(FluidStack solvent, String impurity)
+ {
+ return solutionMap.get(solvent.getFluid().getName()).contains(impurity);
+ }
+
+ public static float getRealDensity(Fluid gas)
+ {
+ if(realDensityMap.containsKey(gas.getName()))
+ {
+ return realDensityMap.get(gas.getName());
+ }
+ else
+ {
+ float density = gas.getDensity();
+ if(gas.getDensity()<0)
+ {
+ //IC2 steam density -800, 100 mb steam from 1 mb water
+ density=-8000F/gas.getDensity();
+ }
+ return density;
+ }
+ }
+
+}
|
