Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 4dafb5c

Browse files
author
CiroZDP
committed
Update to 24r04
1 parent bbd65b6 commit 4dafb5c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+356
-347
lines changed

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/JOSL.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opcraft/logs/latest.log

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
[12:50:33] [main/INFO]: Initializing the game...
2-
[12:50:33] [main/INFO]: Game initializated!
1+
[22:25:35] [main/INFO]: OpenCraft 24r03 started!

src/main/java/net/opencraft/client/Game.java

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
import static net.opencraft.LoggerConfig.handle;
55
import static net.opencraft.renderer.display.DisplayManager.destroyDisplay;
66

7-
import java.awt.Graphics;
87
import java.awt.image.BufferedImage;
98
import java.io.IOException;
109
import java.util.Locale;
1110
import java.util.logging.Logger;
1211

1312
import net.opencraft.config.GameConfig;
1413
import net.opencraft.config.GameExperiments;
15-
import net.opencraft.config.Workspace;
14+
import net.opencraft.data.packs.DefaultPack;
1615
import net.opencraft.data.packs.Pack;
1716
import net.opencraft.renderer.RenderDragon;
1817
import net.opencraft.renderer.Screen;
@@ -22,17 +21,17 @@
2221
public class Game implements Runnable {
2322

2423
public static final String NAME = "OpenCraft";
25-
public static final String VERSION = "24r03";
26-
public static final String TITLE = NAME + ' ' + VERSION;
24+
public static final String VERSION = "24r04";
25+
public static final String TITLE = NAME + ((char) 0x20) + VERSION;
2726

2827
public static final int NANOSECONDS = 1000000000;
29-
public static final double NANO_PER_TICK = NANOSECONDS / GameConfig.TICK_RATE;
30-
31-
private static Game instance;
32-
private static Pack selected_pack;
28+
public static final double NANO_PER_TICK = (double) NANOSECONDS / GameConfig.TICK_RATE;
3329

30+
private static final Game instance = new Game();
3431
private static final Logger logger = Logger.getLogger("main");
3532

33+
private static Pack selected_pack = DefaultPack.getDefaultPack();
34+
3635
private boolean running = false;
3736
private Screen screen;
3837

@@ -41,12 +40,21 @@ public class Game implements Runnable {
4140
System.setProperty("java.util.logging.SimpleFormatter.format", LOG_FORMAT);
4241
handle(logger);
4342
}
43+
44+
public void init() {
45+
Thread.currentThread().setName("main");
46+
47+
RenderDragon.init();
48+
this.screen = RenderDragon.getScreen();
49+
Scene.setCurrent(Scene.LOAD_SCENE);
50+
51+
running = true;
52+
}
4453

4554
@Override
4655
public void run() {
47-
logger.info("Initializing the game...");
4856
init();
49-
logger.info("Game initializated!");
57+
logger.info(Game.TITLE + " started!");
5058

5159
long lastUpdate = System.nanoTime();
5260

@@ -74,8 +82,8 @@ public void run() {
7482
}
7583

7684
public void render() {
77-
Graphics g = this.screen.getGraphics();
78-
Scene.renderCurrent(g);
85+
BufferedImage img = this.screen.getImage();
86+
Scene.renderCurrent(img);
7987
RenderDragon.update();
8088
}
8189

@@ -91,18 +99,6 @@ public void stop() {
9199
destroyDisplay();
92100
}
93101

94-
public void init() {
95-
Thread.currentThread().setName("main");
96-
97-
Workspace.create();
98-
99-
RenderDragon.init();
100-
screen = RenderDragon.getScreen();
101-
Scene.setCurrent(Scene.LOAD_SCENE);
102-
103-
running = true;
104-
}
105-
106102
public static Locale getLanguage() {
107103
return GameConfig.LANGUAGE;
108104
}
@@ -132,7 +128,7 @@ public static void selectPack(Pack pack) {
132128
}
133129

134130
public static void useDefaultPack() {
135-
selectPack(null);
131+
selectPack(DefaultPack.getDefaultPack());
136132
}
137133

138134
public static Pack getResourcePack() {
@@ -144,15 +140,14 @@ public static Game getInstance() {
144140
}
145141

146142
public static boolean isDefaultPackSelected() {
147-
return selected_pack == null;
143+
return selected_pack instanceof DefaultPack;
148144
}
149145

150146
public static BufferedImage screenshot() {
151-
Game game = getInstance();
152-
return game.screen.screenshot();
147+
return getInstance().screen.screenshot();
153148
}
154149

155150
public static void main(String[] args) throws IOException {
156-
new Thread(instance = new Game()).start();
151+
new Thread(instance).start();
157152
}
158153
}

src/main/java/net/opencraft/config/GameConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ public class GameConfig {
1010
public static byte TICK_RATE = 60;
1111
public static boolean UNICODE = false;
1212
public static Pack PACK_SELECTED = null;
13+
public static String GAME_DIR = "opcraft";
1314

1415
}

src/main/java/net/opencraft/config/GameExperiments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ private GameExperiments() {
4343
* This experiment skip completly the load screen.<br>
4444
* Recommended for developers!
4545
* */
46-
public static final boolean SKIP_LOAD_SCENE = false;
46+
public static final boolean SKIP_LOAD_SCENE = true;
4747

4848
}

0 commit comments

Comments
 (0)