Skip to content

Commit

Permalink
0.1.5 patches + run stuff
Browse files Browse the repository at this point in the history
The game is now run in its own run directory.
  • Loading branch information
Juuxel committed May 25, 2020
1 parent 51f57b1 commit c08960e
Show file tree
Hide file tree
Showing 30 changed files with 1,086 additions and 106 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ out/
.gradle/
*.zip
!gradle/wrapper/gradle-wrapper.jar
/run/
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'java'
id 'application'
id 'org.jetbrains.gradle.plugin.idea-ext' version '0.7'
}

mainClassName = 'tk.valoeghese.fc0.client.Main'
Expand Down Expand Up @@ -31,6 +32,11 @@ configurations {
def gameJar = project.file("2fc0f18-${version}.jar")
def mappingsDir = project.file('mappings')
def intermediaryJar = project.file("build/intermediary-${gameJar.name}")
def runDirectory = project.file('run')

if (!runDirectory.exists()) {
runDirectory.mkdir()
}

dependencies {
game files(gameJar)
Expand Down Expand Up @@ -155,6 +161,11 @@ task runUnmoddedGame(type: JavaExec) {
group = "fc0"
classpath = configurations.game
main = "tk.valoeghese.fc0.client.Main"
workingDir = runDirectory
}

run {
workingDir = runDirectory
}

build.dependsOn modJar, fullPatchZip
Expand All @@ -177,3 +188,19 @@ task enigma(dependsOn: intermediary) {
}
}
}

idea {
project.settings {
delegateActions {
delegateBuildRunToGradle = false
}

runConfigurations {
"Run"(org.jetbrains.gradle.ext.Application) {
mainClass = application.mainClassName
workingDirectory = runDirectory.absolutePath
moduleName = module.name + ".main"
}
}
}
}
45 changes: 35 additions & 10 deletions patches/tk/valoeghese/fc0/client/Fc0.patch
Original file line number Diff line number Diff line change
@@ -1,39 +1,64 @@
--- a/tk/valoeghese/fc0/client/Fc0.java
+++ b/tk/valoeghese/fc0/client/Fc0.java
@@ -70,5 +70,5 @@
@@ -93,5 +93,5 @@
@Override
public final void run() {
- Object object = this;
+ Fc0 object = this;
GL11.glEnable(2929);
GL11.glClearColor(0.3f, 0.5f, 0.9f, 1.0f);
@@ -85,6 +85,5 @@
((Fc0)object).player.getCamera().addYaw((float)java.lang.Math.PI);
@@ -109,6 +109,5 @@
((Fc0)object).ecozoneOverlay = new Text(((Fc0)object).i18n.translate("ecozone.temperate_grassland"), -0.85f, 0.8f, 1.0f);
while (true) {
- object = this.window;
- if (!(!GLFW.glfwWindowShouldClose(((Window)object).pointer))) break;
+ if (!(!GLFW.glfwWindowShouldClose(window.pointer))) break;
+ if (!(!GLFW.glfwWindowShouldClose((window.pointer)))) break;
long l = System.currentTimeMillis();
if (l >= this.field_106) {
@@ -170,12 +169,10 @@
@@ -118,5 +117,5 @@
fc0.player.getCamera().addYaw(0.002f);
}
- Object object2 = fc0;
+ Fc0 object2 = fc0;
if (((Fc0)object2).field_169) {
if (Keybinds.DESTROY.isPressed()) {
@@ -223,10 +222,10 @@
}
fc0.player.tick();
- object2 = ChunkGenerator.getEcozone(fc0.player.getX(), fc0.player.getZ());
- if (!fc0.field_169 && object2 != fc0.player.currentEcozone) {
- fc0.player.currentEcozone = object2;
- object2 = fc0.i18n.translate(((Ecozone)object2).toString());
- System.out.println((String)object2);
- fc0.ecozoneOverlay.method_198((String)object2);
+ Ecozone ecozone = ChunkGenerator.getEcozone(fc0.player.getX(), fc0.player.getZ());
+ if (!fc0.field_169 && ecozone != fc0.player.currentEcozone) {
+ fc0.player.currentEcozone = ecozone;
+ String translated = fc0.i18n.translate(((Ecozone)ecozone).toString());
+ System.out.println((String)translated);
+ fc0.ecozoneOverlay.method_198((String)translated);
}
++fc0.field_170;
@@ -234,6 +233,5 @@
GL11.glClear(16640);
this.method_128();
this.render();
- object = this.window;
- GLFW.glfwSwapBuffers(((Window)object).pointer);
+ GLFW.glfwSwapBuffers(window.pointer);
GLFW.glfwPollEvents();
if (!Keybinds.ESCAPE.isPressed()) continue;
GLFW.glfwSetWindowShouldClose(this.window.pointer, true);
@@ -248,6 +246,5 @@
this.field_169 = true;
}
- object = this.window;
- GLFW.glfwDestroyWindow(((Window)object).pointer);
+ GLFW.glfwDestroyWindow(window.pointer);
ALC10.alcCloseDevice(GuiVertex.getAudioDevice());
}

@@ -191,5 +188,5 @@
@@ -264,5 +261,5 @@
f2 /= 2.0f;
f2 = 0.125f + f2 * 1.025f;
- f2 = f > 1.15f ? 1.15f : (f2 < 0.125f ? 0.125f : f2);
+ f2 = f2 > 1.15f ? 1.15f : (f2 < 0.125f ? 0.125f : f2);
GL11.glClearColor(0.35f * f2, 0.55f * f2, 0.95f * f2, 1.0f);
Player.terrainShader.apply();
GuiVertex.terrainShader.apply();
14 changes: 3 additions & 11 deletions patches/tk/valoeghese/fc0/client/Player.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
--- a/tk/valoeghese/fc0/client/Player.java
+++ b/tk/valoeghese/fc0/client/Player.java
@@ -135,5 +135,5 @@
@@ -77,5 +77,5 @@
f2 = (f2 > f5 ? f2 - f12 : f13 - f2) * f8;
f3 = (f3 > f6 ? f3 - f14 : f15 - f3) * f9;
- Object object2 = new ArrayList<TilePos>();
+ ArrayList<TilePos> object2 = new ArrayList<>();
int n7 = 0;
while ((double)n7 < 10.0) {
@@ -159,31 +159,31 @@
@@ -101,31 +101,31 @@
n8 = ((TilePos)object2.get((int)(n7 - 1))).y - tilePos.y;
int n10 = ((TilePos)object2.get((int)(n7 - 1))).z - tilePos.z;
- object2 = null;
Expand All @@ -31,8 +31,7 @@
- object2 = Direction.NORTH;
+ direction = Direction.NORTH;
}
- if (object2 == null) {
+ if (direction == null) {
if (object2 == null) {
throw new RuntimeException("tf\n//I blame p0nki.");
}
- if (n9 != ((Direction)object2).getX()) {
Expand All @@ -54,10 +53,3 @@
+ return new RaycastResult(new TilePos(tilePos.x, tilePos.y, tilePos.z), (Direction)direction);
}
++n7;
@@ -215,5 +215,5 @@

public static void initAudio() {
- field_173 = ALC10.alcOpenDevice(null);
+ field_173 = ALC10.alcOpenDevice((ByteBuffer) null);
ALCCapabilities aLCCapabilities = ALC.createCapabilities(field_173);
IntBuffer intBuffer = BufferUtils.createIntBuffer(16);
9 changes: 9 additions & 0 deletions patches/tk/valoeghese/fc0/client/gui/Gui.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/tk/valoeghese/fc0/client/gui/Gui.java
+++ b/tk/valoeghese/fc0/client/gui/Gui.java
@@ -67,5 +67,5 @@
GL20.glEnableVertexAttribArray(1);
GL30.glBindVertexArray(0);
- this.vertices.add(new GuiVertex(n3, arrn.length, 0));
+ this.vertices.add(new GuiVertex(n3, arrn.length, (byte) 0));
}

9 changes: 9 additions & 0 deletions patches/tk/valoeghese/fc0/client/gui/GuiVertex.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/tk/valoeghese/fc0/client/gui/GuiVertex.java
+++ b/tk/valoeghese/fc0/client/gui/GuiVertex.java
@@ -45,5 +45,5 @@

public static void initAudio() {
- audioDevice = ALC10.alcOpenDevice(null);
+ audioDevice = ALC10.alcOpenDevice((ByteBuffer) null);
ALCCapabilities aLCCapabilities = ALC.createCapabilities(audioDevice);
IntBuffer intBuffer = BufferUtils.createIntBuffer(16);
56 changes: 56 additions & 0 deletions patches/tk/valoeghese/fc0/client/gui/I18n.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
--- a/tk/valoeghese/fc0/client/gui/I18n.java
+++ b/tk/valoeghese/fc0/client/gui/I18n.java
@@ -18,7 +18,7 @@
private final String parent;
private Properties translations;
- public static final I18n INSTANCE = new I18n("en.gb", "British English");
+ public static final I18n INSTANCE;

- private I18n(String string, String string2) {
+ private I18n(String string, String string2) throws Throwable {
this(string, string2, null);
}
@@ -29,11 +29,12 @@
* Enabled aggressive exception aggregation
*/
- private I18n(String object, String object2, @Nullable String object3) {
+ private I18n(String id, String name, @Nullable String parent) throws Throwable {
Throwable throwable;
+ Object object = this;
+ Object object2 = null;
+ Object object3;
block19: {
- this.id = object;
- this.parent = object3;
- object = this;
- object2 = null;
+ this.id = id;
+ this.parent = parent;
if (((I18n)object).parent != null) {
object2 = new Properties();
@@ -49,5 +50,5 @@
object = throwable2;
throwable = throwable2;
- throw object;
+ throw (Throwable) object;
}
catch (Throwable throwable3) {
@@ -86,5 +87,5 @@
object = throwable5;
throwable = throwable5;
- throw object;
+ throw (Throwable) object;
}
catch (Throwable throwable6) {
@@ -118,5 +119,10 @@

static {
- new I18n("en.us", "American English", "en.gb");
+ try {
+ INSTANCE = new I18n("en.gb", "British English");
+ new I18n("en.us", "American English", "en.gb");
+ } catch (Throwable t) {
+ throw new RuntimeException("Could not load languages", t);
+ }
}
}
9 changes: 0 additions & 9 deletions patches/tk/valoeghese/fc0/client/render/OtherTesselator.patch

This file was deleted.

23 changes: 0 additions & 23 deletions patches/tk/valoeghese/fc0/client/render/Overlay.patch

This file was deleted.

21 changes: 0 additions & 21 deletions patches/tk/valoeghese/fc0/client/render/RenderChunk.patch

This file was deleted.

6 changes: 3 additions & 3 deletions patches/tk/valoeghese/fc0/client/render/Shader.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
}

- public Shader(String object, String string) {
+ public Shader(String path, String string) {
+ public Shader(String object2, String string) {
int n = GL20.glCreateShader(35633);
try {
- GL20.glShaderSource(n, (CharSequence)ResourceLoader.readResource((String)object));
+ GL20.glShaderSource(n, (CharSequence)ResourceLoader.readResource((String)path));
- GL20.glShaderSource(n, (CharSequence)ResourceLoader.read((String)object));
+ GL20.glShaderSource(n, (CharSequence)ResourceLoader.read((String)object2));
}
catch (IOException iOException) {
@@ -39,7 +39,7 @@
Expand Down
8 changes: 3 additions & 5 deletions patches/tk/valoeghese/fc0/client/render/TerrainRenderer.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
--- a/tk/valoeghese/fc0/client/render/TerrainRenderer.java
+++ b/tk/valoeghese/fc0/client/render/TerrainRenderer.java
@@ -15,7 +15,7 @@
@@ -15,7 +15,5 @@
public TerrainRenderer(List<TileRenderer> object) {
super(35048, Player.terrainShader);
super(35048, GuiVertex.terrainShader);
- object = object.iterator();
- while (object.hasNext()) {
- TileRenderer tileRenderer = (TileRenderer)object.next();
+ java.util.Iterator<TileRenderer> iter = object.iterator();
+ while (iter.hasNext()) {
+ TileRenderer tileRenderer = (TileRenderer)iter.next();
+ for (TileRenderer tileRenderer : object) {
tileRenderer.apply(this);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/tk/valoeghese/fc0/client/render/WorldRenderer.java
+++ b/tk/valoeghese/fc0/client/render/WorldRenderer.java
@@ -65,5 +65,5 @@
@@ -70,5 +70,5 @@
GL20.glEnableVertexAttribArray(2);
GL30.glBindVertexArray(0);
- this.vertices.add(new WorldVertex(n3, arrn.length, 0));
Expand Down
14 changes: 14 additions & 0 deletions patches/tk/valoeghese/fc0/client/world/ClientChunk.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/tk/valoeghese/fc0/client/world/ClientChunk.java
+++ b/tk/valoeghese/fc0/client/world/ClientChunk.java
@@ -28,10 +28,7 @@
}
super.setAndUpdateTile(n, n2, n3, by);
- int n5 = n4;
- n4 = by;
- by = (byte)n5;
ClientChunk clientChunk3 = this;
if (clientChunk3.renderer != null) {
- clientChunk3.renderer.setTile(by, (byte)n4);
+ clientChunk3.renderer.setTile(n4, by);
}
if (n == 0) {
20 changes: 5 additions & 15 deletions patches/tk/valoeghese/fc0/io/ResourceLoader.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
--- a/tk/valoeghese/fc0/io/ResourceLoader.java
+++ b/tk/valoeghese/fc0/io/ResourceLoader.java
@@ -5,4 +5,5 @@

import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -14,10 +15,10 @@
@@ -18,7 +18,7 @@
}

- public static String readResource(String object) {
+ public static String readResource(String object) throws IOException {
- public static String read(String object) {
+ public static String read(String location) throws java.io.IOException {
int n;
- object = ResourceLoader.class.getClassLoader().getResourceAsStream((String)object);
+ InputStream in = ResourceLoader.class.getClassLoader().getResourceAsStream((String)object);
- object = ResourceLoader.load((String)object);
+ InputStream object = ResourceLoader.load((String)location);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] arrby = new byte[16384];
- while ((n = ((InputStream)object).read(arrby, 0, 16384)) != -1) {
+ while ((n = in.read(arrby, 0, 16384)) != -1) {
byteArrayOutputStream.write(arrby, 0, n);
}
Loading

0 comments on commit c08960e

Please sign in to comment.