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