Mekanism-tilera-Edition/src/minecraft/mekanism/client/ClientProxy.java

140 lines
5.1 KiB
Java
Raw Normal View History

package mekanism.client;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.TextureFXManager;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.TickRegistry;
import mekanism.common.CommonProxy;
import mekanism.common.EntityObsidianTNT;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
import mekanism.common.TileEntityAdvancedElectricMachine;
import mekanism.common.TileEntityCombiner;
import mekanism.common.TileEntityControlPanel;
import mekanism.common.TileEntityCrusher;
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
import mekanism.common.TileEntityElectricMachine;
import mekanism.common.TileEntityEnrichmentChamber;
import mekanism.common.TileEntityGasTank;
import mekanism.common.TileEntityPlatinumCompressor;
import mekanism.common.TileEntityPowerUnit;
import mekanism.common.TileEntityTheoreticalElementizer;
import net.minecraft.client.Minecraft;
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
import net.minecraft.src.*;
import net.minecraftforge.client.MinecraftForgeClient;
/**
* Client proxy for the Mekanism mod.
* @author AidanBrady
*
*/
public class ClientProxy extends CommonProxy
{
@Override
public int getArmorIndex(String string)
{
return RenderingRegistry.addNewArmourRendererPrefix(string);
}
@Override
public void registerRenderInformation()
{
System.out.println("[Mekanism] Beginning render initiative...");
//Preload block/item textures
MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/items.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/terrain.png");
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
//Preload animated textures
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CompressorFront.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/CombinerFront.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerFront.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerBack.png");
MinecraftForgeClient.preloadTexture("/resources/mekanism/animate/ElementizerSide.png");
//Register animated TextureFX
try {
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CompressorFront.png", Mekanism.ANIMATED_TEXTURE_INDEX));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/CombinerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+1));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerFront.png", Mekanism.ANIMATED_TEXTURE_INDEX+2));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerBack.png", Mekanism.ANIMATED_TEXTURE_INDEX+3));
TextureFXManager.instance().addAnimation(new TextureAnimatedFX("/resources/mekanism/animate/ElementizerSide.png", Mekanism.ANIMATED_TEXTURE_INDEX+4));
} catch (IOException e) {
System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage());
}
//Register entity rendering handlers
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNT());
System.out.println("[Mekanism] Render initiative complete.");
}
@Override
public World getClientWorld()
{
return FMLClientHandler.instance().getClient().theWorld;
}
@Override
public void loadUtilities()
{
System.out.println("[Mekanism] Beginning utility initiative...");
new ThreadSendData();
System.out.println("[Mekanism] Utility initiative complete.");
}
@Override
public GuiScreen getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
{
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
switch(ID)
{
case 0:
return new GuiStopwatch(player);
case 1:
return new GuiCredits();
case 2:
return new GuiWeatherOrb(player);
case 3:
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
return new GuiElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
case 4:
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
return new GuiAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 5:
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
return new GuiAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 6:
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
return new GuiElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
case 7:
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
return new GuiTheoreticalElementizer(player.inventory, (TileEntityTheoreticalElementizer)tileEntity);
case 8:
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
return new GuiPowerUnit(player.inventory, (TileEntityPowerUnit)tileEntity);
case 9:
return new GuiControlPanel((TileEntityControlPanel)tileEntity, player, world);
case 10:
return new GuiGasTank(player.inventory, (TileEntityGasTank)tileEntity);
}
return null;
}
@Override
public void loadTickHandler()
{
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
}
@Override
public void loadSoundHandler()
{
Mekanism.audioHandler = new SoundHandler();
}
}