More error fixes, down to 11!

This commit is contained in:
Aidan C. Brady 2014-06-02 20:04:10 +02:00
parent 1933723b52
commit 295efab7b2
8 changed files with 42 additions and 51 deletions

View file

@ -17,17 +17,16 @@ public class ClientConnectionHandler
{ {
if(event.isLocal) if(event.isLocal)
{ {
connectionOpened(); localConnection();
} }
else else {
{
//TODO this is probably wrong //TODO this is probably wrong
connectionOpened(event.manager.getSocketAddress().toString()); remoteConnection(event.manager.getSocketAddress().toString());
} }
} }
/* Remote */ /* Remote */
public void connectionOpened(String server) public void remoteConnection(String server)
{ {
if(Mekanism.voiceServerEnabled) if(Mekanism.voiceServerEnabled)
{ {
@ -38,7 +37,7 @@ public class ClientConnectionHandler
} }
/* Integrated */ /* Integrated */
public void connectionOpened() public void localConnection()
{ {
if(Mekanism.voiceServerEnabled) if(Mekanism.voiceServerEnabled)
{ {

View file

@ -480,10 +480,6 @@ public class ClientProxy extends CommonProxy
{ {
super.loadUtilities(); super.loadUtilities();
NetworkRegistry.registerConnectionHandler(new ClientConnectionHandler());
KeyBindingRegistry.registerKeyBinding(new MekanismKeyHandler());
HolidayManager.init(); HolidayManager.init();
} }

View file

@ -26,12 +26,12 @@ public abstract class MekKeyHandler
* @param keyBindings * @param keyBindings
* @param repeatings * @param repeatings
*/ */
public MekKeyHandler(KeyBinding[] keyBindings, boolean[] repeatings) public MekKeyHandler(KeyBinding[] bindings, boolean[] rep)
{ {
assert keyBindings.length == repeatings.length : "You need to pass two arrays of identical length"; assert keyBindings.length == repeatings.length : "You need to pass two arrays of identical length";
this.keyBindings = keyBindings; keyBindings = bindings;
this.repeatings = repeatings; repeatings = rep;
this.keyDown = new boolean[keyBindings.length]; keyDown = new boolean[keyBindings.length];
} }
/** /**
@ -40,48 +40,52 @@ public abstract class MekKeyHandler
* *
* @param keyBindings * @param keyBindings
*/ */
public MekKeyHandler(KeyBinding[] keyBindings) public MekKeyHandler(KeyBinding[] bindings)
{ {
this.keyBindings = keyBindings; keyBindings = bindings;
this.isDummy = true; isDummy = true;
} }
public KeyBinding[] getKeyBindings () public KeyBinding[] getKeyBindings ()
{ {
return this.keyBindings; return keyBindings;
} }
@SubscribeEvent @SubscribeEvent
public void onTick(ClientTickEvent event) public void onTick(ClientTickEvent event)
{ {
if (event.side == Side.CLIENT) if(event.side == Side.CLIENT)
{ {
if (event.phase == Phase.START) if(event.phase == Phase.START)
{
keyTick(event.type, false); keyTick(event.type, false);
else if (event.phase == Phase.END) }
else if(event.phase == Phase.END)
{
keyTick(event.type, true); keyTick(event.type, true);
}
} }
} }
public void keyTick(Type type, boolean tickEnd) public void keyTick(Type type, boolean tickEnd)
{ {
for (int i = 0; i < keyBindings.length; i++) for(int i = 0; i < keyBindings.length; i++)
{ {
KeyBinding keyBinding = keyBindings[i]; KeyBinding keyBinding = keyBindings[i];
int keyCode = keyBinding.getKeyCode(); int keyCode = keyBinding.getKeyCode();
boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode)); boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode));
if (state != keyDown[i] || (state && repeatings[i]))
if(state != keyDown[i] || (state && repeatings[i]))
{ {
if (state) if(state)
{ {
keyDown(type, keyBinding, tickEnd, state != keyDown[i]); keyDown(type, keyBinding, tickEnd, state != keyDown[i]);
} }
else else {
{
keyUp(type, keyBinding, tickEnd); keyUp(type, keyBinding, tickEnd);
} }
if (tickEnd)
if(tickEnd)
{ {
keyDown[i] = state; keyDown[i] = state;
} }
@ -103,7 +107,7 @@ public abstract class MekKeyHandler
* @param isRepeat * @param isRepeat
* is it a repeat key event * is it a repeat key event
*/ */
public abstract void keyDown (Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat); public abstract void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat);
/** /**
* Fired once when the key changes state from down to up * Fired once when the key changes state from down to up
@ -115,6 +119,6 @@ public abstract class MekKeyHandler
* @param tickEnd * @param tickEnd
* was it an end or start tick which fired the key * was it an end or start tick which fired the key
*/ */
public abstract void keyUp (Type types, KeyBinding kb, boolean tickEnd); public abstract void keyUp(Type types, KeyBinding kb, boolean tickEnd);
} }

View file

@ -142,11 +142,13 @@ public class RenderPartTransmitter implements IIconSelfRegister
public void renderItem(TransmitterType type) public void renderItem(TransmitterType type)
{ {
CCRenderState.reset(); CCRenderState.reset();
CCRenderState.startDrawing(7); CCRenderState.startDrawing();
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{ {
renderSide(side, type); renderSide(side, type);
} }
CCRenderState.draw(); CCRenderState.draw();
} }
@ -240,8 +242,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
GL11.glPushMatrix(); GL11.glPushMatrix();
CCRenderState.reset(); CCRenderState.reset();
CCRenderState.useNormals = true; CCRenderState.useNormals = true;
CCRenderState.useModelColours(true); CCRenderState.startDrawing();
CCRenderState.startDrawing(7);
GL11.glTranslated(pos.x, pos.y, pos.z); GL11.glTranslated(pos.x, pos.y, pos.z);
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
@ -306,7 +307,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
} }
else if(pipe.getConnectionType(side) != ConnectionType.NONE) { else if(pipe.getConnectionType(side) != ConnectionType.NONE) {
GL11.glCullFace(GL11.GL_FRONT); GL11.glCullFace(GL11.GL_FRONT);
CCRenderState.startDrawing(7); CCRenderState.startDrawing();
renderFluidInOut(side, pipe); renderFluidInOut(side, pipe);
CCRenderState.draw(); CCRenderState.draw();
GL11.glCullFace(GL11.GL_BACK); GL11.glCullFace(GL11.GL_BACK);
@ -471,8 +472,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
GL11.glPushMatrix(); GL11.glPushMatrix();
CCRenderState.reset(); CCRenderState.reset();
CCRenderState.useNormals = true; CCRenderState.useNormals = true;
CCRenderState.useModelColours(true); CCRenderState.startDrawing();
CCRenderState.startDrawing(7);
GL11.glTranslated(pos.x, pos.y, pos.z); GL11.glTranslated(pos.x, pos.y, pos.z);
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
@ -494,7 +494,6 @@ public class RenderPartTransmitter implements IIconSelfRegister
{ {
TextureUtils.bindAtlas(0); TextureUtils.bindAtlas(0);
CCRenderState.reset(); CCRenderState.reset();
CCRenderState.useModelColours(true);
CCRenderState.setBrightness(transmitter.world(), transmitter.x(), transmitter.y(), transmitter.z()); CCRenderState.setBrightness(transmitter.world(), transmitter.x(), transmitter.y(), transmitter.z());
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)

View file

@ -40,11 +40,11 @@ public class VoiceInput extends Thread
while(voiceClient.running) while(voiceClient.running)
{ {
if(MekanismKeyHandler.voiceKey.pressed) if(MekanismKeyHandler.voiceKey.getIsKeyPressed())
{ {
targetLine.flush(); targetLine.flush();
while(voiceClient.running && MekanismKeyHandler.voiceKey.pressed) while(voiceClient.running && MekanismKeyHandler.voiceKey.getIsKeyPressed())
{ {
try { try {
int availableBytes = audioInput.available(); int availableBytes = audioInput.available();

View file

@ -308,12 +308,14 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass) public boolean renderStatic(Vector3 pos, int pass)
{ {
if(pass == 1) if(pass == 1)
{ {
RenderPartTransmitter.getInstance().renderStatic(this, olm); RenderPartTransmitter.getInstance().renderStatic(this);
} }
return true;
} }
@Override @Override

View file

@ -315,7 +315,7 @@ public class TileEntitySalinationController extends TileEntitySalinationTank imp
{ {
if(!temperatureSet) if(!temperatureSet)
{ {
biomeTemp = worldObj.getBiomeGenForCoordsBody(xCoord, zCoord).getFloatTemperature(); biomeTemp = worldObj.getBiomeGenForCoordsBody(xCoord, zCoord).getFloatTemperature(xCoord, yCoord, zCoord);
temperatureSet = true; temperatureSet = true;
} }

View file

@ -269,15 +269,6 @@ public final class MekanismUtils
return null; return null;
} }
/**
* Sends the defined message to all players.
* @param msg - message to send
*/
public static void sendChatMessageToAllPlayers(String msg)
{
PacketDispatcher.sendPacketToAllPlayers(new Packet3Chat(msg));
}
/** /**
* Checks if the mod doesn't need an update. * Checks if the mod doesn't need an update.
* @return if mod doesn't need an update * @return if mod doesn't need an update