More cleanups, now to update to forge build 931

This commit is contained in:
Aidan C. Brady committed 2013-10-14 14:25:04 -04:00
1 parent 5dbfd15a0e
commit fb2be7df86
9 files changed
+42 -40

No files matched your search

@@ -5,7 +5,10 @@ import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import net.minecraft.client.renderer.IImageBuffer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class CapeBufferDownload implements IImageBuffer
{
private int[] imageData;
@@ -21,10 +21,7 @@ public class ClientConnectionHandler implements IConnectionHandler
public VoiceClient voiceClient = new VoiceClient();
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
}
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {}
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
@@ -49,6 +46,7 @@ public class ClientConnectionHandler implements IConnectionHandler
@Override
public void connectionClosed(INetworkManager manager)
{
System.out.println("Left");
voiceClient.stop();
Mekanism.proxy.unloadSoundHandler();
}
@@ -8,7 +8,10 @@ import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class MekanismKeyHandler extends KeyHandler
{
public static KeyBinding modeSwitch = new KeyBinding("Mekanism Mode Switch", Keyboard.KEY_M);
@@ -3,14 +3,18 @@ package mekanism.client.render.tileentity;
import mekanism.client.model.ModelTransmitter;
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.TransporterUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.util.TransporterUtils;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
{
private ModelTransmitter model = new ModelTransmitter();
+7 -18
View File
@@ -4,25 +4,14 @@ import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.InetAddress;
import java.net.Socket;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
import mekanism.client.MekanismKeyHandler;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class VoiceClient
{
public Socket socket;
@@ -39,7 +28,7 @@ public class VoiceClient
public void start(String ip, int port)
{
System.out.println("Started client connection.");
System.out.println("[Mekanism] VoiceServer: Starting client connection...");
try {
socket = new Socket(ip, port);
@@ -51,14 +40,14 @@ public class VoiceClient
(outputThread = new VoiceOutput(this)).start();
(inputThread = new VoiceInput(this)).start();
} catch(Exception e) {
System.err.println("Error in core client initiation.");
System.err.println("[Mekanism] VoiceServer: Error while starting client connection.");
e.printStackTrace();
}
}
public void stop()
{
System.out.println("Stopped client connection.");
System.out.println("[Mekanism] VoiceServer: Stopping client connection...");
try {
inputThread.interrupt();
@@ -78,7 +67,7 @@ public class VoiceClient
socket = null;
running = false;
} catch(Exception e) {
System.err.println("Error while ending client connection.");
System.err.println("[Mekanism] VoiceServer: Error while stopping client connection.");
e.printStackTrace();
}
}
+6 -2
View File
@@ -6,18 +6,22 @@ import javax.sound.sampled.DataLine;
import javax.sound.sampled.TargetDataLine;
import mekanism.client.MekanismKeyHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class VoiceInput extends Thread
{
public VoiceClient voiceClient;
public DataLine.Info microphone = new DataLine.Info(TargetDataLine.class, voiceClient.format, 2200);
public DataLine.Info microphone;
public TargetDataLine targetLine;
public VoiceInput(VoiceClient client)
{
voiceClient = client;
microphone = new DataLine.Info(TargetDataLine.class, voiceClient.format, 2200);
setDaemon(true);
setName("VoiceServer Client Input Thread");
@@ -76,7 +80,7 @@ public class VoiceInput extends Thread
audioInput.close();
} catch(Exception e) {
System.err.println("Error while running microphone loop.");
System.err.println("[Mekanism] VoiceServer: Error while running client input thread.");
e.printStackTrace();
}
}
@@ -4,17 +4,22 @@ import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class VoiceOutput extends Thread
{
public VoiceClient voiceClient;
public DataLine.Info speaker = new DataLine.Info(SourceDataLine.class, voiceClient.format, 2200);
public DataLine.Info speaker;
public SourceDataLine sourceLine;
public VoiceOutput(VoiceClient client)
{
voiceClient = client;
speaker = new DataLine.Info(SourceDataLine.class, voiceClient.format, 2200);
setDaemon(true);
setName("VoiceServer Client Output Thread");
@@ -37,7 +42,7 @@ public class VoiceOutput extends Thread
sourceLine.write(audioData, 0, audioData.length);
}
} catch(Exception e) {
System.err.println("Error while running speaker loop.");
System.err.println("[Mekanism] VoiceServer: Error while running client output thread.");
e.printStackTrace();
}
}
@@ -56,7 +56,7 @@ public class VoiceConnection
}
}
} catch(Exception e) {
System.err.println("Error while starting server-based connection.");
System.err.println("[Mekanism] VoiceServer: Error while starting server-based connection.");
e.printStackTrace();
open = false;
}
@@ -76,7 +76,6 @@ public class VoiceConnection
if(byteCount > 0)
{
System.out.println("Got data");
Mekanism.voiceManager.sendToPlayers(byteCount, audioData, VoiceConnection.this);
}
} catch(Exception e) {
@@ -101,7 +100,7 @@ public class VoiceConnection
Mekanism.voiceManager.connections.remove(this);
} catch(Exception e) {
System.err.println("Error while stopping server-based connection.");
System.err.println("[Mekanism] VoiceServer: Error while stopping server-based connection.");
e.printStackTrace();
}
}
@@ -119,7 +118,7 @@ public class VoiceConnection
output.flush();
} catch(Exception e) {
System.err.println("Error while sending data to player.");
System.err.println("[Mekanism] VoiceServer: Error while sending data to player.");
e.printStackTrace();
}
}
@@ -26,7 +26,7 @@ public class VoiceServerManager
public void start()
{
System.out.println("Starting up voice server.");
System.out.println("[Mekanism] VoiceServer: Starting up server...");
try {
serverSocket = new ServerSocket(36123);
@@ -44,14 +44,14 @@ public class VoiceServerManager
serverSocket.close();
serverSocket = null;
System.out.println("Shutting down voice server.");
System.out.println("[Mekanism] VoiceServer: Shutting down server...");
} catch(SocketException e) {
if(!e.getLocalizedMessage().toLowerCase().equals("socket closed"))
{
e.printStackTrace();
}
} catch(Exception e) {
System.err.println("Error while stopping voice server.");
System.err.println("[Mekanism] VoiceServer: Error while shutting down server.");
e.printStackTrace();
}
@@ -101,14 +101,11 @@ public class VoiceServerManager
VoiceConnection connection = new VoiceConnection(s);
connections.add(connection);
System.out.println("Accepted new connection.");
System.out.println("[Mekanism] VoiceServer: Accepted new connection.");
} catch(SocketException e) {
if(!e.getLocalizedMessage().toLowerCase().equals("socket closed"))
{
e.printStackTrace();
}
} catch(NullPointerException e) {
} catch(Exception e) {
System.err.println("Error while accepting connection.");
System.err.println("[Mekanism] VoiceServer: Error while accepting connection.");
e.printStackTrace();
}
}