2012-11-05 20:29:04 +01:00
|
|
|
package mekanism.client;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.Properties;
|
|
|
|
|
2012-08-31 01:27:35 +02:00
|
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
2012-10-09 22:27:10 +02:00
|
|
|
import cpw.mods.fml.client.TextureFXManager;
|
2012-10-25 23:55:32 +02:00
|
|
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
2012-08-15 22:41:41 +02:00
|
|
|
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;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.CommonProxy;
|
|
|
|
import mekanism.common.EntityObsidianTNT;
|
|
|
|
import mekanism.common.Mekanism;
|
|
|
|
import mekanism.common.MekanismUtils;
|
2012-11-15 21:04:12 +01:00
|
|
|
import mekanism.common.TileEntityAdvancedElectricMachine;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.TileEntityCombiner;
|
2012-11-21 16:14:35 +01:00
|
|
|
import mekanism.common.TileEntityControlPanel;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.TileEntityCrusher;
|
2012-11-15 21:04:12 +01:00
|
|
|
import mekanism.common.TileEntityElectricMachine;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.TileEntityEnrichmentChamber;
|
2012-11-21 16:14:35 +01:00
|
|
|
import mekanism.common.TileEntityGasTank;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.TileEntityPlatinumCompressor;
|
2012-11-28 16:33:34 +01:00
|
|
|
import mekanism.common.TileEntityEnergyCube;
|
2012-11-05 20:29:04 +01:00
|
|
|
import mekanism.common.TileEntityTheoreticalElementizer;
|
2012-08-15 22:41:41 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2012-11-15 21:04:12 +01:00
|
|
|
import net.minecraft.src.*;
|
2012-08-15 22:41:41 +02:00
|
|
|
import net.minecraftforge.client.MinecraftForgeClient;
|
|
|
|
|
|
|
|
/**
|
2012-11-05 20:29:04 +01:00
|
|
|
* Client proxy for the Mekanism mod.
|
2012-08-15 22:41:41 +02:00
|
|
|
* @author AidanBrady
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class ClientProxy extends CommonProxy
|
|
|
|
{
|
2012-11-28 16:33:34 +01:00
|
|
|
public static int RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-31 01:27:35 +02:00
|
|
|
public int getArmorIndex(String string)
|
|
|
|
{
|
|
|
|
return RenderingRegistry.addNewArmourRendererPrefix(string);
|
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void registerRenderInformation()
|
|
|
|
{
|
|
|
|
//Preload block/item textures
|
2012-11-07 21:01:46 +01:00
|
|
|
MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/items.png");
|
|
|
|
MinecraftForgeClient.preloadTexture("/resources/mekanism/textures/terrain.png");
|
2012-10-09 22:27:10 +02:00
|
|
|
|
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
|
2012-10-09 22:27:10 +02:00
|
|
|
try {
|
2012-11-07 21:01:46 +01:00
|
|
|
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));
|
2012-10-09 22:27:10 +02:00
|
|
|
} catch (IOException e) {
|
2012-11-05 20:29:04 +01:00
|
|
|
System.err.println("[Mekanism] Error registering animation with FML: " + e.getMessage());
|
2012-10-09 22:27:10 +02:00
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
|
|
|
|
//Register entity rendering handlers
|
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNT());
|
2012-11-21 16:14:35 +01:00
|
|
|
|
2012-11-28 16:33:34 +01:00
|
|
|
//Register item handler
|
|
|
|
MinecraftForgeClient.registerItemRenderer(Mekanism.energyCubeID, new ItemRenderingHandler());
|
|
|
|
|
|
|
|
System.out.println("[Mekanism] Render registrations complete.");
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-09-03 18:11:25 +02:00
|
|
|
public World getClientWorld()
|
|
|
|
{
|
|
|
|
return FMLClientHandler.instance().getClient().theWorld;
|
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void loadUtilities()
|
|
|
|
{
|
2012-11-05 20:29:04 +01:00
|
|
|
System.out.println("[Mekanism] Beginning utility initiative...");
|
2012-09-08 18:48:24 +02:00
|
|
|
new ThreadSendData();
|
2012-11-05 20:29:04 +01:00
|
|
|
System.out.println("[Mekanism] Utility initiative complete.");
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public GuiScreen getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
|
|
|
{
|
2012-11-15 21:04:12 +01:00
|
|
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
|
|
|
|
2012-08-15 22:41:41 +02:00
|
|
|
switch(ID)
|
|
|
|
{
|
2012-09-25 21:15:47 +02:00
|
|
|
case 0:
|
2012-08-15 22:41:41 +02:00
|
|
|
return new GuiStopwatch(player);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 1:
|
2012-08-15 22:41:41 +02:00
|
|
|
return new GuiCredits();
|
2012-09-25 21:15:47 +02:00
|
|
|
case 2:
|
2012-08-15 22:41:41 +02:00
|
|
|
return new GuiWeatherOrb(player);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 3:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new GuiElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 4:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new GuiAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 5:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new GuiAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 6:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new GuiElectricMachine(player.inventory, (TileEntityElectricMachine)tileEntity);
|
2012-09-25 21:15:47 +02:00
|
|
|
case 7:
|
2012-11-15 21:04:12 +01:00
|
|
|
return new GuiTheoreticalElementizer(player.inventory, (TileEntityTheoreticalElementizer)tileEntity);
|
2012-10-02 20:39:40 +02:00
|
|
|
case 8:
|
2012-11-28 16:33:34 +01:00
|
|
|
return new GuiEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity);
|
2012-10-28 23:18:23 +01:00
|
|
|
case 9:
|
2012-11-21 16:14:35 +01:00
|
|
|
return new GuiControlPanel((TileEntityControlPanel)tileEntity, player, world);
|
2012-11-25 16:45:00 +01:00
|
|
|
case 10:
|
2012-11-21 16:14:35 +01:00
|
|
|
return new GuiGasTank(player.inventory, (TileEntityGasTank)tileEntity);
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-08-15 22:41:41 +02:00
|
|
|
public void loadTickHandler()
|
|
|
|
{
|
|
|
|
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
|
|
|
|
}
|
2012-11-05 16:52:56 +01:00
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-11-05 16:52:56 +01:00
|
|
|
public void loadSoundHandler()
|
|
|
|
{
|
2012-11-05 20:29:04 +01:00
|
|
|
Mekanism.audioHandler = new SoundHandler();
|
2012-11-05 16:52:56 +01:00
|
|
|
}
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|