From dc3df3edd5843bde0c1335d6a8e460b2c832aa48 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Sat, 17 Jun 2017 08:12:18 +0300 Subject: full project files --- ihl/worldgen/IHLWorldGenerator.java | 101 ------- ihl/worldgen/WorldGeneratorBase.java | 90 ------- ihl/worldgen/WorldGeneratorSurfaceLake.java | 42 --- ihl/worldgen/WorldGeneratorUndergroundLake.java | 60 ----- ihl/worldgen/WorldGeneratorVein.java | 26 -- ihl/worldgen/ores/BlockOre.java | 137 ---------- ihl/worldgen/ores/DebugScannerBlock.java | 46 ---- ihl/worldgen/ores/DebugScannerContainer.java | 49 ---- ihl/worldgen/ores/DebugScannerGui.java | 69 ----- ihl/worldgen/ores/DebugScannerTileEntity.java | 157 ----------- ihl/worldgen/ores/IHLFluid.java | 333 ------------------------ 11 files changed, 1110 deletions(-) delete mode 100644 ihl/worldgen/IHLWorldGenerator.java delete mode 100644 ihl/worldgen/WorldGeneratorBase.java delete mode 100644 ihl/worldgen/WorldGeneratorSurfaceLake.java delete mode 100644 ihl/worldgen/WorldGeneratorUndergroundLake.java delete mode 100644 ihl/worldgen/WorldGeneratorVein.java delete mode 100644 ihl/worldgen/ores/BlockOre.java delete mode 100644 ihl/worldgen/ores/DebugScannerBlock.java delete mode 100644 ihl/worldgen/ores/DebugScannerContainer.java delete mode 100644 ihl/worldgen/ores/DebugScannerGui.java delete mode 100644 ihl/worldgen/ores/DebugScannerTileEntity.java delete mode 100644 ihl/worldgen/ores/IHLFluid.java (limited to 'ihl/worldgen') diff --git a/ihl/worldgen/IHLWorldGenerator.java b/ihl/worldgen/IHLWorldGenerator.java deleted file mode 100644 index a6f3b6b..0000000 --- a/ihl/worldgen/IHLWorldGenerator.java +++ /dev/null @@ -1,101 +0,0 @@ -package ihl.worldgen; - -import java.util.HashSet; -import java.util.Random; -import java.util.Set; - -import cpw.mods.fml.common.IWorldGenerator; -import ihl.IHLMod; -import ihl.utils.IHLUtils; -import ihl.worldgen.ores.IHLFluid; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.chunk.IChunkProvider; - -public class IHLWorldGenerator implements IWorldGenerator { - - private static final Block[] replaceableMinerals = new Block[] { Blocks.stone, Blocks.gravel , Blocks.gold_ore, Blocks.coal_ore, Blocks.iron_ore, Blocks.lapis_ore, Blocks.clay, Blocks.diamond_ore, Blocks.redstone_ore, Blocks.emerald_ore}; - private static final Block[] replaceableSand = new Block[] { Blocks.sand }; - private static final Block[] replaceableForOil = new Block[] { Blocks.lava, Blocks.flowing_lava, Blocks.obsidian}; - public static IHLWorldGenerator instance; - private final Set generators = new HashSet(8); - - public IHLWorldGenerator() - { - super(); - if (IHLMod.config.generateApatiteOre) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreApatite"), replaceableMinerals)); - } - if (IHLMod.config.generateSaltpeterOre) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreSaltpeter"), replaceableMinerals)); - } - if (IHLMod.config.generateGyubnera) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreGyubnera"), replaceableMinerals)); - } - if (IHLMod.config.generateCinnabar) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreCinnabar"), replaceableMinerals)); - } - if (IHLMod.config.generateRocksalt) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreRockSalt"), replaceableMinerals)); - } - if (IHLMod.config.generateLimestone) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreLimestone"), replaceableMinerals)); - } - if (IHLMod.config.generateGypsum) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreGypsum"), replaceableMinerals)); - } - if (IHLMod.config.generatePotassiumFeldspar) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("orePotassiumFeldspar"), replaceableMinerals)); - } - if (IHLMod.config.generateTrona) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreTrona"), replaceableMinerals)); - } - if (IHLMod.config.generateBauxite) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreBauxite"), replaceableMinerals)); - } - if (IHLMod.config.generateChromite) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreChromite"), replaceableMinerals)); - } - if (IHLMod.config.generateMuscovite) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreMica"), replaceableMinerals)); - } - if (IHLMod.config.generateOil) - { - generators.add(new WorldGeneratorUndergroundLake(IHLFluid.getBlock("oil"), Blocks.obsidian, replaceableForOil)); - } - if (IHLMod.config.generateSaltwater) - { - generators.add(new WorldGeneratorSurfaceLake(IHLFluid.getBlock("saltwater"), replaceableSand)); - } - if (IHLMod.config.generateDatolite) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreDatolite"), replaceableMinerals)); - } - if (IHLMod.config.generateBischofite) - { - generators.add(new WorldGeneratorVein(IHLUtils.getOreDictBlock("oreBischofite"), replaceableMinerals)); - } - instance=this; - } - - @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, - IChunkProvider chunkProvider) { - for (WorldGeneratorBase generator : generators) { - generator.generate(world, chunkX, chunkZ); - } - } -} diff --git a/ihl/worldgen/WorldGeneratorBase.java b/ihl/worldgen/WorldGeneratorBase.java deleted file mode 100644 index dc68135..0000000 --- a/ihl/worldgen/WorldGeneratorBase.java +++ /dev/null @@ -1,90 +0,0 @@ -package ihl.worldgen; - -import java.util.HashSet; -import java.util.Random; -import java.util.Set; - -import ihl.utils.IHLUtils; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.storage.ExtendedBlockStorage; - -public abstract class WorldGeneratorBase { - private final Random random = new Random(); - protected final Block ore; - protected final Set replaceableBlocks = new HashSet(2); - - public WorldGeneratorBase(Block oreIn, Block... replaceableBlocksIn) { - ore = oreIn; - for (Block block : replaceableBlocksIn) { - replaceableBlocks.add(block); - } - } - - public void generate(World world, int chunkX, int chunkZ) { - int[] centralPOI = this.getPOI(world, chunkX, chunkZ, 0, 0); - int[] xz = new int[] { 0, 1, 0, -1, 0 }; - for (int i = 0; i < 4; i++) { - int[] surroundPOI = this.getPOI(world, chunkX + xz[i], chunkZ + xz[i + 1], xz[i], xz[i + 1]); - this.replaceBlocks(world, centralPOI, surroundPOI, chunkX << 4, chunkZ << 4); - } - } - - protected abstract void replaceBlocks(World world, final int[] centralPOI, final int[] surroundPOI, - final int startX, final int startZ); - - protected boolean replace(World world, int absX, int absY, int absZ, final Block block) { - if (!world.getChunkProvider().chunkExists(absX >> 4, absZ >> 4)) { - throw new IllegalStateException("quered chunk is not yet generated!"); - } - Chunk chunk = world.getChunkFromBlockCoords(absX, absZ); - ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[absY >> 4]; - if (ebs != null && replaceableBlocks.contains(ebs.getBlockByExtId(absX & 15, absY & 15, absZ & 15))) { - IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, block); - return true; - } - return false; - } - - protected boolean replaceAll(World world, int absX, int absY, int absZ, final Block block) { - if (!world.getChunkProvider().chunkExists(absX >> 4, absZ >> 4)) { - throw new IllegalStateException("quered chunk is not yet generated!"); - } - Chunk chunk = world.getChunkFromBlockCoords(absX, absZ); - ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[absY >> 4]; - if (ebs != null) { - IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, block); - return true; - } - return false; - } - - protected boolean replaceAllExceptOre(World world, int absX, int absY, int absZ, final Block block) { - if (!world.getChunkProvider().chunkExists(absX >> 4, absZ >> 4)) { - throw new IllegalStateException("quered chunk is not yet generated!"); - } - Chunk chunk = world.getChunkFromBlockCoords(absX, absZ); - ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[absY >> 4]; - if (ebs != null) { - Block olblock = ebs.getBlockByExtId(absX & 15, absY & 15, absZ & 15); - if(!olblock.equals(ore) && - !olblock.equals(Blocks.bedrock) && - !olblock.equals(Blocks.netherrack) && - !olblock.equals(Blocks.stone) && - !olblock.equals(Blocks.clay)) { - IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, block); - return true; - } - } - return false; - } - - private int[] getPOI(World world, int chunkX, int chunkZ, int xOffset, int zOffset) { - long seed = (long) chunkX << 16 ^ chunkZ << 8 ^ Block.getIdFromBlock(ore); - random.setSeed(seed); - return new int[] { random.nextInt(16) + xOffset * 16, random.nextInt(world.getActualHeight() / 2), - random.nextInt(16) + zOffset * 16 }; - } -} diff --git a/ihl/worldgen/WorldGeneratorSurfaceLake.java b/ihl/worldgen/WorldGeneratorSurfaceLake.java deleted file mode 100644 index 11abf5e..0000000 --- a/ihl/worldgen/WorldGeneratorSurfaceLake.java +++ /dev/null @@ -1,42 +0,0 @@ -package ihl.worldgen; - -import ihl.utils.IHLMathUtils; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - -public class WorldGeneratorSurfaceLake extends WorldGeneratorBase { - - public WorldGeneratorSurfaceLake(Block oreIn, Block[] replaceableBlocksIn) { - super(oreIn, replaceableBlocksIn); - } - - @Override - protected void replaceBlocks(World world, int[] centralPOI, int[] surroundPOI, int startX, int startZ) { - BiomeGenBase biome = world.getBiomeGenForCoords(startX, startZ); - if (biome.temperature < 1.9f || biome.rainfall != 0f) { - return; - } - int x = centralPOI[0], y = centralPOI[1], z = centralPOI[2]; - for (int ix = x; ix < 16 && ix >= 0; ix += IHLMathUtils.sign(surroundPOI[0] - x)) { - int y2 = y += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y); - for (int iz = z; iz < 16 && iz >= 0; iz += IHLMathUtils.sign(surroundPOI[2] - z)) { - y2 += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y2); - int dx = ix-x; - int dz = iz-z; - int d = dx*dx+dz*dz; - if (d < 64 && y2 > world.getActualHeight() * 3 / 8 - && world.getBlock(ix + startX, 63, iz + startZ) == Blocks.air) { - this.replace(world, ix + startX, 62, iz + startZ, ore); - } - if (surroundPOI[2] == z) { - break; - } - } - if (surroundPOI[0] == x) { - break; - } - } - } -} diff --git a/ihl/worldgen/WorldGeneratorUndergroundLake.java b/ihl/worldgen/WorldGeneratorUndergroundLake.java deleted file mode 100644 index 7abee8e..0000000 --- a/ihl/worldgen/WorldGeneratorUndergroundLake.java +++ /dev/null @@ -1,60 +0,0 @@ -package ihl.worldgen; - -import ihl.utils.IHLMathUtils; -import ihl.utils.IHLUtils; -import net.minecraft.block.Block; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.storage.ExtendedBlockStorage; - -public class WorldGeneratorUndergroundLake extends WorldGeneratorBase { - - private final Block clayBlock; - - public WorldGeneratorUndergroundLake(Block oreIn, Block clayIn, Block[] replaceableBlocksIn) { - super(oreIn, replaceableBlocksIn); - clayBlock = clayIn; - } - - @Override - protected void replaceBlocks(World world, int[] centralPOI, int[] surroundPOI, int startX, int startZ) { - int x = centralPOI[0], y = centralPOI[1] - world.getActualHeight() / 4, z = centralPOI[2]; - for (int ix = x; ix < 16 && ix >= 0; ix += IHLMathUtils.sign(surroundPOI[0] - x)) { - int y2 = y += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y); - nextZ:for (int iz = z; iz < 16 && iz >= 0; iz += IHLMathUtils.sign(surroundPOI[2] - z)) { - y2 += IHLMathUtils.sign(surroundPOI[1] - world.getActualHeight() / 4 - y2); - int dx = ix - x; - int dz = iz - z; - int d = dx * dx + dz * dz; - if (y2 > 1 && d < 64) { - for (int iy = y2; iy > 0; iy--) { - int absX = ix + startX; - int absZ = iz + startZ; - int absY = iy; - Chunk chunk = world.getChunkFromBlockCoords(absX, absZ); - ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[absY >> 4]; - if (ebs != null && replaceableBlocks.contains(ebs.getBlockByExtId(absX & 15, absY & 15, absZ & 15))) { - int[] xyz = new int[] { 0, 0, -1, 0, 0, 1, 0, 0 }; - for (int i = 2; i < xyz.length; i++) { - int absX2 = absX + xyz[i - 2]; - int absZ2 = absZ + xyz[i]; - if (!world.getChunkProvider().chunkExists(absX2 >> 4, absZ2 >> 4)) { - continue nextZ; - } - this.replaceAllExceptOre(world, absX2, iy + xyz[i - 1], absZ2, clayBlock); - } - IHLUtils.setBlockRaw(ebs, absX & 15, absY & 15, absZ & 15, ore); - } - } - } - if (surroundPOI[2] == z) { - break; - } - } - if (surroundPOI[0] == x) { - break; - } - } - } - -} diff --git a/ihl/worldgen/WorldGeneratorVein.java b/ihl/worldgen/WorldGeneratorVein.java deleted file mode 100644 index 3be74e0..0000000 --- a/ihl/worldgen/WorldGeneratorVein.java +++ /dev/null @@ -1,26 +0,0 @@ -package ihl.worldgen; - -import ihl.utils.IHLMathUtils; -import net.minecraft.block.Block; -import net.minecraft.world.World; - -public class WorldGeneratorVein extends WorldGeneratorBase { - - public WorldGeneratorVein(Block oreIn, Block[] replaceableBlocksIn) { - super(oreIn, replaceableBlocksIn); - } - - @Override - protected void replaceBlocks(World world, int[] centralPOI, int[] surroundPOI, int startX, int startZ) { - int x = centralPOI[0], y = centralPOI[1], z = centralPOI[2]; - while (x < 16 && x >= 0 && y >= 0 && y < world.getActualHeight() && z >= 0 && z < 16) { - this.replace(world, x + startX, y, z + startZ, ore); - x += IHLMathUtils.sign(surroundPOI[0] - x); - y += IHLMathUtils.sign(surroundPOI[1] - y); - z += IHLMathUtils.sign(surroundPOI[2] - z); - if (IHLMathUtils.sign(surroundPOI[0] - x) == 0 && IHLMathUtils.sign(surroundPOI[1] - y) == 0 - && IHLMathUtils.sign(surroundPOI[2] - z) == 0) - break; - } - } -} diff --git a/ihl/worldgen/ores/BlockOre.java b/ihl/worldgen/ores/BlockOre.java deleted file mode 100644 index 00a8bcc..0000000 --- a/ihl/worldgen/ores/BlockOre.java +++ /dev/null @@ -1,137 +0,0 @@ -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 cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import ihl.IHLCreativeTab; -import ihl.IHLModInfo; -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 instances = new ArrayList(); - private static Map 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 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 getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ArrayList drops = new ArrayList(); - 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 deleted file mode 100644 index a934f60..0000000 --- a/ihl/worldgen/ores/DebugScannerBlock.java +++ /dev/null @@ -1,46 +0,0 @@ -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 deleted file mode 100644 index 1413ddb..0000000 --- a/ihl/worldgen/ores/DebugScannerContainer.java +++ /dev/null @@ -1,49 +0,0 @@ -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 deleted file mode 100644 index 56be263..0000000 --- a/ihl/worldgen/ores/DebugScannerGui.java +++ /dev/null @@ -1,69 +0,0 @@ -package ihl.worldgen.ores; - -import java.util.List; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.util.ResourceLocation; - -@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) { - List ode = container.tileEntity.oreDictionaryEntries; - int verticalOffset = 31; - for(int i=0;i38) - { - 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 deleted file mode 100644 index b32f3e8..0000000 --- a/ihl/worldgen/ores/DebugScannerTileEntity.java +++ /dev/null @@ -1,157 +0,0 @@ -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 ic2.core.ContainerBase; -import ic2.core.IC2; -import ic2.core.IHasGui; -import ic2.core.block.TileEntityInventory; -import ic2.core.block.invslot.InvSlot; -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.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; -import net.minecraftforge.oredict.OreDictionary; - -public class DebugScannerTileEntity extends TileEntityInventory implements IHasGui { - public final InvSlot itemsSlot; - private ItemStack lastItem; - public List 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(); - FluidStack fluid = null; - this.oreDictionaryEntries.add("Fluid related item type:"); - if (this.itemsSlot.get(1).getItem() instanceof IFluidContainerItem) { - this.oreDictionaryEntries.add(" IFluidContainerItem"); - fluid = ((IFluidContainerItem) this.itemsSlot.get(1).getItem()).getFluid(this.itemsSlot.get(1)); - } else if (FluidContainerRegistry.isContainer(this.itemsSlot.get(1))) { - this.oreDictionaryEntries.add(" FluidContainerRegistry entry"); - if (FluidContainerRegistry.isBucket(this.itemsSlot.get(1))) { - this.oreDictionaryEntries.add("This is bucket."); - } else { - this.oreDictionaryEntries.add("This is not a bucket."); - } - ItemStack emptyContainer = FluidContainerRegistry.drainFluidContainer(this.itemsSlot.get(1)); - if (emptyContainer != null) { - this.oreDictionaryEntries.add("This container could return empty container:"); - this.oreDictionaryEntries.add(" " + emptyContainer.getDisplayName()); - } else { - this.oreDictionaryEntries.add("This container has no empty version."); - } - fluid = FluidContainerRegistry.getFluidForFilledItem(this.itemsSlot.get(1)); - } else { - this.oreDictionaryEntries.add(" none"); - } - 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(" "); - } - this.oreDictionaryEntries.add("Fluid flowing icon:"); - if (fluid.getFluid().getFlowingIcon() != null) { - this.oreDictionaryEntries.add(" " + fluid.getFluid().getFlowingIcon().getIconName()); - } else { - this.oreDictionaryEntries.add(" "); - } - } - 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 deleted file mode 100644 index 5e2e08b..0000000 --- a/ihl/worldgen/ores/IHLFluid.java +++ /dev/null @@ -1,333 +0,0 @@ -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 cpw.mods.fml.common.registry.GameRegistry; -import ic2.core.Ic2Items; -import ihl.IHLCreativeTab; -import ihl.IHLModInfo; -import ihl.items_blocks.IHLFluidBlock; -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.renderer.texture.TextureMap; -import net.minecraft.init.Items; -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 fluidInstances = new ArrayList(); - private static Map localFluidRegistry = new HashMap(); - private static Map realDensityMap = new HashMap(); - private static Map condensationMap = new HashMap(); - private static Map> 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.setUnlocalizedName(type.fluidRegistryName.replaceFirst("fluid", "")); - this.setGaseous(type.isGaseous); - Fluid instance = this; - if (!FluidRegistry.registerFluid(instance)) { - instance = FluidRegistry.getFluid(type.fluidRegistryName); - } - if (instance.getBlock() == null) { - instance.setBlock(new IHLFluidBlock(instance, type.blockMaterial, type.textureName, - "fluid" + type.fluidName.replaceFirst("fluid", "")).setFlammable(type.flammable) - .setBlockName("block" + type.fluidName).setCreativeTab(IHLCreativeTab.tab)); - } - instance.setGaseous(type.isGaseous); - 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); - bucket.setContainerItem(Items.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 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 { - return 373; - } - } - - public enum IHLFluidType { - // Methane("Methane","fluidAcetylene",10047, 293, 249, 373, 1150, - // "methane", Material.water, false, false, false, false), - NitroGlyceryl("NitroGlycerin", 10052, 293, 291, 583, 1595, "nitroglycerin", Material.water, true, false, true), - Ammonia("Ammonia", 10051, 273, 273 - 78, 273 - - 33, 0.772F, "ammonia", new MaterialLiquid(MapColor.airColor), true, false, true), - Acetaldehyde("Acetaldehyde", 10050, 273, 273 - - 123, 294, 784, "acetaldehyde", Material.water, false, false, false), - Formaldehyde("Formaldehyde", 10049, 254, 273 - - 118, 254, 815, "formaldehyde", Material.water, false, false, false), - TarWater("TarWater", 10048, 293, 176, 338, 1032, "tarwater", Material.water, false, false, false), - Methanol("Methanol", 10047, 293, 176, 338, 792, "methanol", Material.water, true, 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", "fluidOil", 10032, 293, 284, 773, 850f, "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", "fluidSaltWater", 10028, 293, 253, 373, 1360f, "saltwater", Material.water, true, false, false), - 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", "fluidRubberTreeSap", 10019, 293, 273, 393, 1200f, "fluidrubbertreesap", Material.water, true, true, false), - SpruceResin("SpruceResin","fluidSpruceResin", 10018, 293, 273, 533, 1080, "spruceresin", Material.water, true, true, true), - CablingColophony("CablingColophony", 10017, 363, 363, 533, 1070, "cablingcolophony", Material.water, true, false, true), - Glycerol("Glycerol", 10016, 293, 291, 583, 1261, "glycerol", 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), - MoltenPotassium("MoltenPotassium", "fluidMolten", 10042, 336, 336, 1047, 856, "molten.potassium", Material.lava, false, false, false), - MoltenLithium("MoltenLithium", "fluidMolten", 10042, 454, 454, 1613, 512, "molten.lithium", Material.lava, false, false, false), - MoltenPotassiumChloride("MoltenPotassiumChloride", "fluidMolten", 10006, 776 + 273, 776 + 273, 1407 - + 273, 1556, "molten.potassiumchloride", 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), - 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), - 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; - } - - public String fluidName; - public String fluidRegistryName; - public String cellName; - public String textureName; - int temperature; - float density; - boolean isGaseous; - boolean flammable = 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; - } - - @SuppressWarnings("deprecation") - 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; - } - } - -} -- cgit v1.2.3