Fixed invalid web servers, teleporter clearing, desktop input misplace

This commit is contained in:
Anuken 2018-03-08 21:56:20 -05:00
parent b0086082d0
commit 2a306d70be
4 changed files with 18 additions and 8 deletions

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Thu Mar 08 18:52:47 EST 2018
#Thu Mar 08 20:46:47 EST 2018
version=release
androidBuildCode=356
androidBuildCode=357
name=Mindustry
code=3.4
build=33

View File

@ -23,10 +23,10 @@ public class DesktopInput extends InputHandler{
private boolean beganBreak;
private boolean rotated = false, rotatedAlt, zoomed;
@Override public float getCursorEndX(){ return endx; }
@Override public float getCursorEndY(){ return endy; }
@Override public float getCursorX(){ return (int)(Graphics.screen(mousex, mousey).x + 2); }
@Override public float getCursorY(){ return (int)(Gdx.graphics.getHeight() - 1 - Graphics.screen(mousex, mousey).y); }
@Override public float getCursorEndX(){ return select() ? getCursorX() : endx; }
@Override public float getCursorEndY(){ return select() ? getCursorY() : endy; }
@Override public float getCursorX(){ return (int)(Graphics.screen(mousex, mousey).x); }
@Override public float getCursorY(){ return (int)(Gdx.graphics.getHeight() - Graphics.screen(mousex, mousey).y); }
@Override public boolean drawPlace(){ return !beganBreak; }
@Override
@ -156,6 +156,10 @@ public class DesktopInput extends InputHandler{
}
boolean select(){
return !Inputs.keyDown("select") && !Inputs.keyRelease("select");
}
public int tilex(){
return (recipe != null && recipe.result.isMultiblock() &&
recipe.result.width % 2 == 0) ?

View File

@ -19,6 +19,7 @@ import io.anuke.ucore.util.Strings;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Arrays;
import static io.anuke.mindustry.Vars.syncBlockState;
@ -55,6 +56,7 @@ public class Teleporter extends PowerBlock{
TeleporterEntity entity = tile.entity();
if(entity != null){
entity.color = data;
Arrays.fill(entity.items, 0);
}
}

View File

@ -114,8 +114,12 @@ public class WebsocketClient implements ClientProvider {
@Override
public void onMessage(String msg) {
Host host = NetworkIO.readServerData(address, ByteBuffer.wrap(Base64Coder.decode(msg)));
valid.accept(host);
byte[] bytes = Base64Coder.decode(msg);
Host host = NetworkIO.readServerData(address, ByteBuffer.wrap(bytes));
if(bytes.length != 128)
valid.accept(new Host("Unknown", address, "Unknown", 0, 0, 0));
else
valid.accept(host);
accepted[0] = true;
socket.close();
}