diff --git a/core/assets/version.properties b/core/assets/version.properties index 95e745be59..a43c657acd 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -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 diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 1e6d7cb362..0cffe6365d 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -378,6 +378,5 @@ public class Control extends Module{ Timers.update(); } } - } } diff --git a/core/src/io/anuke/mindustry/entities/TileEntity.java b/core/src/io/anuke/mindustry/entities/TileEntity.java index 8c89b8b58b..bc32564341 100644 --- a/core/src/io/anuke/mindustry/entities/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/TileEntity.java @@ -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))) { diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index f61b3e3ca9..8b39f4bf08 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -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 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; diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java index f925c59602..b119bdd820 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java @@ -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