mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed 32-bit version not working due to Discord integration
This commit is contained in:
parent
6f55870a1f
commit
cba42d2f19
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sun Feb 18 12:38:19 EST 2018
|
||||
#Mon Feb 19 11:31:19 EST 2018
|
||||
version=beta
|
||||
androidBuildCode=238
|
||||
androidBuildCode=241
|
||||
name=Mindustry
|
||||
code=3.3
|
||||
build=24
|
||||
build=custom build
|
||||
|
@ -378,6 +378,5 @@ public class Control extends Module{
|
||||
Timers.update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class TileEntity extends Entity{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
synchronized (tile) {
|
||||
synchronized (Tile.tileSetLock) {
|
||||
if (health != 0 && health < tile.block().health && !(tile.block() instanceof Wall) &&
|
||||
Mathf.chance(0.009f * Timers.delta() * (1f - health / tile.block().health))) {
|
||||
|
||||
|
@ -12,6 +12,7 @@ import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
|
||||
public class Tile{
|
||||
public static final Object tileSetLock = new Object();
|
||||
private static final Array<Tile> tmpArray = new Array<>();
|
||||
|
||||
/**Packed block data. Left is floor, right is block.*/
|
||||
@ -120,18 +121,21 @@ public class Tile{
|
||||
}
|
||||
|
||||
public void setBlock(Block type, int rotation){
|
||||
if(rotation < 0) rotation = (-rotation + 2);
|
||||
rotation %= 4;
|
||||
iSetBlock(type);
|
||||
setRotation((byte)rotation);
|
||||
this.link = 0;
|
||||
changed();
|
||||
synchronized (tileSetLock) {
|
||||
if(rotation < 0) rotation = (-rotation + 2);
|
||||
iSetBlock(type);
|
||||
setRotation((byte) (rotation % 4));
|
||||
this.link = 0;
|
||||
changed();
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlock(Block type){
|
||||
iSetBlock(type);
|
||||
this.link = 0;
|
||||
changed();
|
||||
synchronized (tileSetLock) {
|
||||
iSetBlock(type);
|
||||
this.link = 0;
|
||||
changed();
|
||||
}
|
||||
}
|
||||
|
||||
public void setFloor(Block type){
|
||||
@ -260,7 +264,7 @@ public class Tile{
|
||||
}
|
||||
|
||||
public void changed(){
|
||||
synchronized (this) {
|
||||
synchronized (tileSetLock) {
|
||||
if (entity != null) {
|
||||
entity.remove();
|
||||
entity = null;
|
||||
|
@ -8,6 +8,7 @@ import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import javax.swing.*;
|
||||
@ -20,16 +21,18 @@ import java.util.Locale;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class DesktopPlatform extends Platform {
|
||||
DateFormat format = SimpleDateFormat.getDateTimeInstance();
|
||||
DiscordRPC lib = DiscordRPC.INSTANCE;
|
||||
final static boolean useDiscord = UCore.getPropertyNotNull("sun.arch.data.model").equals("64");
|
||||
final static String applicationId = "398246104468291591";
|
||||
final static DateFormat format = SimpleDateFormat.getDateTimeInstance();
|
||||
String[] args;
|
||||
|
||||
public DesktopPlatform(String[] args){
|
||||
this.args = args;
|
||||
String applicationId = "398246104468291591";
|
||||
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
||||
|
||||
lib.Discord_Initialize(applicationId, handlers, true, "");
|
||||
if(useDiscord) {
|
||||
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
||||
DiscordRPC.INSTANCE.Discord_Initialize(applicationId, handlers, true, "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,6 +57,8 @@ public class DesktopPlatform extends Platform {
|
||||
|
||||
@Override
|
||||
public void updateRPC() {
|
||||
if(!useDiscord) return;
|
||||
|
||||
DiscordRichPresence presence = new DiscordRichPresence();
|
||||
|
||||
if(!state.is(State.menu)){
|
||||
@ -75,12 +80,12 @@ public class DesktopPlatform extends Platform {
|
||||
|
||||
presence.largeImageKey = "logo";
|
||||
|
||||
lib.Discord_UpdatePresence(presence);
|
||||
DiscordRPC.INSTANCE.Discord_UpdatePresence(presence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGameExit() {
|
||||
lib.Discord_Shutdown();
|
||||
if(useDiscord) DiscordRPC.INSTANCE.Discord_Shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user