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 | |
Initial commit
Diffstat (limited to 'ihl/worldgen')
| -rw-r--r-- | ihl/worldgen/IHLWorldGenerator.java | 255 | ||||
| -rw-r--r-- | ihl/worldgen/WorldGenLiquidOre.java | 86 | ||||
| -rw-r--r-- | ihl/worldgen/WorldGenMinableMeta.java | 128 | ||||
| -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 |
9 files changed, 1296 insertions, 0 deletions
diff --git a/ihl/worldgen/IHLWorldGenerator.java b/ihl/worldgen/IHLWorldGenerator.java new file mode 100644 index 0000000..71478b3 --- /dev/null +++ b/ihl/worldgen/IHLWorldGenerator.java @@ -0,0 +1,255 @@ +package ihl.worldgen;
+
+import ihl.IHLMod;
+import ihl.utils.IHLUtils;
+import ihl.worldgen.ores.IHLFluid;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.IChunkProvider;
+import cpw.mods.fml.common.IWorldGenerator;
+
+public class IHLWorldGenerator implements IWorldGenerator {
+
+ private WorldGenMinableMeta
+ apatiteGenerator,
+ saltpeterGenerator,
+ limestoneGenerator,
+ gypsumGenerator,
+ potassiumFeldsparGenerator,
+ tronaGenerator,
+ gyubneraGenerator,
+ rocksaltGenerator,
+ cinnabarGenerator,
+ bauxiteGenerator,
+ chromiteGenerator,
+ muscoviteGenerator,
+ oilGenerator,
+ datoliteGenerator,
+ saltwaterGenerator,
+ bischofiteGenerator;
+ private WorldGenMinableMeta currentGenerator;
+ protected final Map<Long,Set<int[]>> oreCoordinatesToChunkCoordinates = new HashMap();
+ protected final Map<Long,WorldGenMinableMeta> blockToOreCoordinates = new HashMap();
+ public final Set<Long> precalculatedChunkChache = new HashSet();
+ public static IHLWorldGenerator instance;
+
+
+ public IHLWorldGenerator()
+ {
+ super();
+ apatiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates, IHLUtils.getOreDictBlock("oreApatite"), 0, 360, new Block[] {Blocks.stone,Blocks.gravel});
+ saltpeterGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreSaltpeter"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
+ limestoneGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreLimestone"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
+ gypsumGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreGypsum"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
+ potassiumFeldsparGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("orePotassiumFeldspar"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
+ tronaGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreTrona"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
+ gyubneraGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreGyubnera"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
+ rocksaltGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreRockSalt"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
+ cinnabarGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreCinnabar"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
+ bauxiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreBauxite"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
+ chromiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreChromite"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
+ muscoviteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreMica"), 0, 140, new Block[] {Blocks.stone,Blocks.gravel});
+ oilGenerator = new WorldGenLiquidOre(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLFluid.getBlock("oil"),Blocks.clay, 0, 32, 0, 8, new Block[] {Blocks.lava,Blocks.clay});
+ datoliteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreDatolite"), 0, 700, new Block[] {Blocks.stone,Blocks.gravel});
+ saltwaterGenerator = new WorldGenLiquidOre(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLFluid.getBlock("saltwater"),Blocks.sandstone, 0, 32, 62, 62, new Block[] {Blocks.sand,Blocks.sandstone});
+ bischofiteGenerator = new WorldGenMinableMeta(precalculatedChunkChache,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,IHLUtils.getOreDictBlock("oreBischofite"), 0, 1400, new Block[] {Blocks.stone,Blocks.gravel});
+ instance=this;
+ }
+
+ @Override
+ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
+ {
+ int x1 = 0,y1 = 0,z1 = 0;
+ for(int ix=-16+chunkX;ix<=16+chunkX;ix++)
+ {
+ for(int iz=-16+chunkZ;iz<=16+chunkZ;iz++)
+ {
+ long chunkKey = (ix<<16)+iz;
+ if(!this.precalculatedChunkChache.contains(chunkKey))
+ {
+ if(!world.getChunkProvider().chunkExists(ix, iz) || (ix==chunkX && iz==chunkZ))
+ {
+ currentGenerator = switchCurrentOreGenerator(world, random, ix, iz);
+ if(currentGenerator!=null)
+ {
+ if(currentGenerator.generateNewVein(random, ix, iz))
+ {
+
+ }
+ }
+ }
+ this.precalculatedChunkChache.add(chunkKey);
+ }
+ }
+ }
+ long chunkKey = (chunkX<<16)+chunkZ;
+ if(this.precalculatedChunkChache.contains(chunkKey))
+ {
+ Set<int[]> oreCoordinatesSet = this.oreCoordinatesToChunkCoordinates.get(chunkKey);
+ if(oreCoordinatesSet!=null)
+ {
+ Object[] oreCoordinatesSetA = oreCoordinatesSet.toArray();
+ for(int i=0;i<oreCoordinatesSetA.length;i++)
+ {
+ int[] oreCoordinate = (int[]) oreCoordinatesSetA[i];
+ int x0 = oreCoordinate[0];
+ int y0 = oreCoordinate[1];
+ int z0 = oreCoordinate[2];
+ long oreCoordinatesKey = (x0<<30)+(y0<<15)+z0;
+ if(this.blockToOreCoordinates.get(oreCoordinatesKey).generate(world, random, x0, y0, z0))
+ {
+ x1=x0;y1=y0;z1=z0;
+ }
+ }
+ }
+ }
+ }
+
+ private WorldGenMinableMeta switchCurrentOreGenerator(World world, Random random, int chunkX, int chunkZ)
+ {
+ switch(random.nextInt(1000))
+ {
+ case 0:
+ if (IHLMod.config.generateApatiteOre)
+ {
+ if (random.nextFloat() < 0.25f)
+ {
+ return apatiteGenerator;
+ }
+ }
+ break;
+ case 1:
+ if (IHLMod.config.generateSaltpeterOre)
+ {
+ if (random.nextFloat() < 0.25f)
+ {
+ return saltpeterGenerator;
+ }
+ }
+ break;
+ case 2:
+ if (IHLMod.config.generateGyubnera)
+ {
+ if (random.nextFloat() < 0.25f)
+ {
+ return gyubneraGenerator;
+ }
+ }
+ break;
+ case 3:
+ if (IHLMod.config.generateCinnabar)
+ {
+ if (random.nextFloat() < 0.25f)
+ {
+ return cinnabarGenerator;
+ }
+ }
+ break;
+ case 4:
+ if (IHLMod.config.generateRocksalt)
+ {
+ if (random.nextFloat() < 0.2F)
+ {
+ return rocksaltGenerator;
+ }
+ }
+ break;
+ case 5:
+ if (IHLMod.config.generateLimestone)
+ {
+ return limestoneGenerator;
+ }
+ break;
+ case 6:
+ if (IHLMod.config.generateGypsum)
+ {
+ return gypsumGenerator;
+ }
+ break;
+ case 7:
+ if (IHLMod.config.generatePotassiumFeldspar)
+ {
+ return potassiumFeldsparGenerator;
+ }
+ break;
+ case 8:
+ if (IHLMod.config.generateTrona)
+ {
+ return tronaGenerator;
+ }
+ break;
+ case 9:
+ if (IHLMod.config.generateBauxite)
+ {
+ if (random.nextFloat() < 0.25F)
+ {
+ return bauxiteGenerator;
+ }
+ }
+ break;
+ case 10:
+ if (IHLMod.config.generateChromite)
+ {
+ if (random.nextFloat() < 0.25F)
+ {
+ return chromiteGenerator;
+ }
+ }
+ break;
+ case 11:
+ if (IHLMod.config.generateMuscovite)
+ {
+ return muscoviteGenerator;
+ }
+ break;
+ case 12:
+ if (IHLMod.config.generateOil)
+ {
+ return oilGenerator;
+ }
+ break;
+ case 13:
+ case 16:
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ if (IHLMod.config.generateSaltwater)
+ {
+ BiomeGenBase biome = world.getBiomeGenForCoords(chunkX<<4, chunkZ<<4);
+ if(biome.temperature > 1.9f && biome.rainfall==0f)
+ {
+ return saltwaterGenerator;
+ }
+ }
+ break;
+ case 14:
+ if (IHLMod.config.generateDatolite)
+ {
+ if (random.nextFloat() < 0.25F)
+ {
+ return datoliteGenerator;
+ }
+ }
+ break;
+ case 15:
+ if (IHLMod.config.generateBischofite)
+ {
+ if (random.nextFloat() < 0.25F)
+ {
+ return bischofiteGenerator;
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/ihl/worldgen/WorldGenLiquidOre.java b/ihl/worldgen/WorldGenLiquidOre.java new file mode 100644 index 0000000..f59fb2e --- /dev/null +++ b/ihl/worldgen/WorldGenLiquidOre.java @@ -0,0 +1,86 @@ +package ihl.worldgen;
+
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+
+public class WorldGenLiquidOre extends WorldGenMinableMeta {
+
+ public WorldGenLiquidOre(Set<Long> precalculatedChunkChache1,Map<Long, WorldGenMinableMeta> blockToOreCoordinates, Map<Long, Set<int[]>> oreCoordinatesToChunkCoordinates, Block block, Block liquidBedBlock1, int meta, int numberOfBlocks1, int veinMinHeightLimit1, int veinMaxHeightLimit1, Block... replacedBlock1)
+ {
+ super(precalculatedChunkChache1,blockToOreCoordinates, oreCoordinatesToChunkCoordinates,block, liquidBedBlock1, meta, numberOfBlocks1, veinMinHeightLimit1, veinMaxHeightLimit1, replacedBlock1);
+ }
+
+ @Override
+ public boolean generate(World world, Random random, int x, int y, int z)
+ {
+ if(replaceableBlocks.contains(world.getBlock(x, y, z)))
+ {
+ if(y<44 || world.getBlock(x, y+1, z).isAir(world, x, y+1, z) || world.getBlock(x, y+1, z).equals(Blocks.air))
+ {
+ world.setBlock(x, y, z, mineableBlock, mineableBlockMeta, 2);
+ int x1,y1,z1;
+ int xyz[] = {0,0,1,0,0,-1,0,0};
+ Block block;
+ for(int i=0;i<=5;i++)
+ {
+ x1=x+xyz[i];
+ y1=y+xyz[i+1];
+ z1=z+xyz[i+2];
+ block = world.getBlock(x1,y1,z1);
+ if(block!=mineableBlock)
+ {
+ if(block.getMaterial()==Material.lava)
+ {
+ world.setBlock(x1, y1, z1, Blocks.obsidian, 0, 2);
+ }
+ else if(!block.isAir(world, x1, y1, z1) || xyz[i+1]<=0)
+ {
+ world.setBlock(x1, y1, z1, liquidBedBlock, 0, 2);
+ }
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean generateNewVein(Random random, int chunkX1, int chunkZ1)
+ {
+ int chunkX = chunkX1;
+ int chunkZ = chunkZ1;
+ int x0=chunkX << 4;
+ int z0=chunkZ << 4;
+ long chunkKey = (chunkX<<16)+chunkZ;
+ for(int ix=x0-this.numberOfBlocks/2;ix<x0+this.numberOfBlocks/2;ix++)
+ {
+ for(int iz=z0-this.numberOfBlocks/2;iz<z0+this.numberOfBlocks/2;iz++)
+ {
+ for(int iy=this.veinMinHeightLimit;iy<=this.veinMaxHeightLimit;iy++)
+ {
+ if((ix-x0)*(ix-x0)+(iz-z0)*(iz-z0) < this.numberOfBlocks*this.numberOfBlocks/4)
+ {
+ int[] oreCoordinatesArray = new int[] {ix,iy,iz};
+ long oreCoordinatesKey = (ix<<30)+(iy<<15)+iz;
+ {
+ chunkX=x0>>4;
+ chunkZ=z0>>4;
+ chunkKey = (chunkX<<16)+chunkZ;
+ updateOreCoordinatesToChunkCoordinates(chunkKey, oreCoordinatesArray);
+ this.blockToOreCoordinates.put(oreCoordinatesKey, this);
+ this.precalculatedChunkChache.add(chunkKey);
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/ihl/worldgen/WorldGenMinableMeta.java b/ihl/worldgen/WorldGenMinableMeta.java new file mode 100644 index 0000000..3c5f094 --- /dev/null +++ b/ihl/worldgen/WorldGenMinableMeta.java @@ -0,0 +1,128 @@ +package ihl.worldgen;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenerator;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class WorldGenMinableMeta extends WorldGenerator {
+
+ protected final Block mineableBlock;
+ protected final Set<Block> replaceableBlocks=new HashSet();
+ protected final Block liquidBedBlock;
+ protected final int mineableBlockMeta;
+ protected final int numberOfBlocks;
+ protected int blockCounter;
+ protected final int veinMaxHeightLimit;
+ protected final int veinMinHeightLimit;
+
+ public boolean maxBlockReached=false;
+ public int lastX=-1;
+ public int lastY=64;
+ public int lastZ=-1;
+ protected ForgeDirection veinDirection = ForgeDirection.SOUTH;//EAST
+ protected final Map<Long, Set<int[]>> oreCoordinatesToChunkCoordinates;
+ protected final Map<Long,WorldGenMinableMeta> blockToOreCoordinates;
+ protected final Set<Long> precalculatedChunkChache;
+
+ public WorldGenMinableMeta(Set<Long> precalculatedChunkChache1, Map<Long,WorldGenMinableMeta> blockToOreCoordinates1, Map<Long, Set<int[]>> oreCoordinatesToChunkCoordinates2, Block block, int meta, int numberOfBlocks1, Block... blocks) {
+ this(precalculatedChunkChache1 ,blockToOreCoordinates1, oreCoordinatesToChunkCoordinates2, block, Blocks.clay, meta, numberOfBlocks1, 0, 128, blocks);
+ }
+
+ public WorldGenMinableMeta(Set<Long> precalculatedChunkChache1, Map<Long,WorldGenMinableMeta> blockToOreCoordinates1, Map<Long,Set<int[]>> oreCoordinatesToChunkCoordinates1, Block block, Block liquidBedBlock1, int meta, int numberOfBlocks1, int veinMinHeightLimit1, int veinMaxHeightLimit1, Block... replacedBlock1)
+ {
+ precalculatedChunkChache=precalculatedChunkChache1;
+ blockToOreCoordinates=blockToOreCoordinates1;
+ oreCoordinatesToChunkCoordinates=oreCoordinatesToChunkCoordinates1;
+ mineableBlock = block;
+ replaceableBlocks.addAll(Arrays.asList(replacedBlock1));
+ mineableBlockMeta = meta;
+ liquidBedBlock=liquidBedBlock1;
+ numberOfBlocks = numberOfBlocks1;
+ veinMaxHeightLimit=veinMaxHeightLimit1;
+ veinMinHeightLimit=veinMinHeightLimit1;
+ }
+
+ @Override
+ public boolean generate(World world, Random random, int x, int y, int z)
+ {
+ boolean success=false;
+ int chunkX = x>>4;
+ int chunkZ = z>>4;
+ int xyz[] = {0,0,1,0,0,-1,0,0};
+ for(int i=0;i<=5;i++)
+ {
+ int x0 = x+xyz[i];
+ int y0 = y+xyz[i+1];
+ int z0 = z+xyz[i+2];
+ if(x0>>4==chunkX && z0>>4==chunkZ)
+ {
+ if(replaceableBlocks.contains(world.getBlock(x0, y0, z0)))
+ {
+ world.setBlock(x0, y0, z0, mineableBlock, mineableBlockMeta, 2);
+ success=true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean generateNewVein(Random random, int chunkX1, int chunkZ1)
+ {
+ Vec3 veinVector = Vec3.createVectorHelper(random.nextFloat()*2-1f, random.nextFloat()-0.5f, random.nextFloat()*2-1f);
+ veinVector.normalize();
+ int chunkX = chunkX1;
+ int chunkZ = chunkZ1;
+ int x0=chunkX << 4;
+ int z0=chunkZ << 4;
+ int y0=random.nextInt(veinMaxHeightLimit);
+ //System.out.println("generated new vein with height="+y0);
+ float fx=x0;
+ float fy=y0;
+ float fz=z0;
+ long chunkKey = (chunkX<<16)+chunkZ;
+ for(int i=0;i<this.numberOfBlocks;i++)
+ {
+ int[] oreCoordinatesArray = new int[] {x0,y0,z0};
+ long oreCoordinatesKey = (x0<<30)+(y0<<15)+z0;
+ {
+ chunkX=x0>>4;
+ chunkZ=z0>>4;
+ chunkKey = (chunkX<<16)+chunkZ;
+ updateOreCoordinatesToChunkCoordinates(chunkKey, oreCoordinatesArray);
+ this.blockToOreCoordinates.put(oreCoordinatesKey, this);
+ this.precalculatedChunkChache.add(chunkKey);
+ }
+ fx+=veinVector.xCoord+random.nextFloat()*0.25f;
+ fy+=veinVector.yCoord+random.nextFloat()*0.25f;
+ fz+=veinVector.zCoord+random.nextFloat()*0.25f;
+ x0=Math.round(fx);
+ y0=Math.round(fy);
+ z0=Math.round(fz);
+ }
+ return true;
+ }
+
+ protected void updateOreCoordinatesToChunkCoordinates(long chunkKey, int[] oreCoordinates)
+ {
+ if(this.oreCoordinatesToChunkCoordinates.containsKey(chunkKey))
+ {
+ this.oreCoordinatesToChunkCoordinates.get(chunkKey).add(oreCoordinates);
+ }
+ else
+ {
+ Set<int[]> oreCoordinatesS = new HashSet();
+ oreCoordinatesS.add(oreCoordinates);
+ this.oreCoordinatesToChunkCoordinates.put(chunkKey, oreCoordinatesS);
+ }
+ }
+
+}
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;
+ }
+ }
+
+}
|
