Skip to content

Commit f258013

Browse files
committed
slime calculates all coords through finish of slime jump
1 parent 7cce2a8 commit f258013

File tree

4 files changed

+88
-80
lines changed

4 files changed

+88
-80
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ Make sure the `JAVA_HOME` environment variable is set to version 11 or greater.
1414
(default is the right side of the editor) and navigate to `Plugins > compiler > compiler:compile` and run
1515
with `Plugins > javafx > javafx:run`.
1616

17+
To create and exe, make sure [wix tooling](https://wixtoolset.org/) is installed and run `Plugins > javafx > javafx:jlink` and then `Parkour Tool > jpackage > jpackage:jpackage`.
18+
19+
## Prebuilt binaries
20+
There are prebuilt binaries for Windows (and Linux soon). Simply download `ParkourTool-x-x-x.exe` and run it. It
21+
currently installs into `C:\Program Files\ParkourTool`.
22+
1723
## Future features
1824
* Node based gui for plug and play capability
1925
* Inverse jump solver
@@ -24,7 +30,6 @@ with `Plugins > javafx > javafx:run`.
2430
* Add general Minecraft parkour functionality
2531
* Add jump check box for blip calculator
2632
* Prevent "Offsets: " from being printed when blip is not possible
27-
* Add slime calculator
2833

2934
### Completed
3035

@@ -33,6 +38,7 @@ with `Plugins > javafx > javafx:run`.
3338
* Have entrance co-ordinates print for all coordinates
3439
* Correct blip calculation (1;1;1 => yes when should be no, doesn't work for starting heights a less than blip bottom
3540
height)
41+
* Add slime calculator
3642

3743
### Dropped
3844

pom.xml

+33-33
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>girraiffe</groupId>
88
<artifactId>ParkourTool</artifactId>
9-
<version>0.0.1</version>
9+
<version>0.0.2</version>
1010
<name>ParkourTool</name>
1111

1212
<properties>
@@ -17,12 +17,12 @@
1717
<dependency>
1818
<groupId>org.openjfx</groupId>
1919
<artifactId>javafx-controls</artifactId>
20-
<version>17.0.2</version>
20+
<version>18.0.2</version>
2121
</dependency>
2222
<dependency>
2323
<groupId>org.openjfx</groupId>
2424
<artifactId>javafx-fxml</artifactId>
25-
<version>17.0.2</version>
25+
<version>18.0.2</version>
2626
</dependency>
2727
</dependencies>
2828

@@ -44,24 +44,24 @@
4444
<artifactId>javafx-maven-plugin</artifactId>
4545
<version>0.0.8</version>
4646
<configuration>
47-
<!-- <compress>2</compress>-->
48-
<!-- <noHeaderFiles>true</noHeaderFiles>-->
49-
<!-- <stripDebug>true</stripDebug>-->
50-
<!-- <noManPages>true</noManPages>-->
51-
<!-- <launcher>ParkourTool</launcher>-->
47+
<compress>2</compress>
48+
<noHeaderFiles>true</noHeaderFiles>
49+
<stripDebug>true</stripDebug>
50+
<noManPages>true</noManPages>
51+
<launcher>ParkourTool</launcher>
5252
<mainClass>girraiffe.App</mainClass>
53-
<!-- <jlinkImageName>ParkourTool</jlinkImageName>-->
54-
<!-- <jlinkZipName>ParkourTool</jlinkZipName>-->
53+
<jlinkImageName>ParkourTool</jlinkImageName>
54+
<jlinkZipName>ParkourTool</jlinkZipName>
5555
</configuration>
5656
</plugin>
5757
<plugin>
5858
<groupId>org.panteleyev</groupId>
5959
<artifactId>jpackage-maven-plugin</artifactId>
6060
<version>1.5.2</version>
6161
<configuration>
62-
<!-- https://dev.to/cherrychain/javafx-jlink-and-jpackage-h9-->
62+
<!-- https://dev.to/cherrychain/javafx-jlink-and-jpackage-h9-->
6363
<name>ParkourTool</name>
64-
<appVersion>0.0.1</appVersion>
64+
<appVersion>0.0.2</appVersion>
6565
<vendor>girraiffe</vendor>
6666
<destination>target/exe</destination>
6767
<module>girraiffe.parkourTool/girraiffe.App</module>
@@ -71,27 +71,27 @@
7171
</javaOptions>
7272
</configuration>
7373
</plugin>
74-
<!-- <plugin>-->
75-
<!-- <groupId>org.apache.maven.plugins</groupId>-->
76-
<!-- <artifactId>maven-shade-plugin</artifactId>-->
77-
<!-- <version>3.3.0</version>-->
78-
<!-- <executions>-->
79-
<!-- <execution>-->
80-
<!-- <goals>-->
81-
<!-- <goal>shade</goal>-->
82-
<!-- </goals>-->
83-
<!-- <configuration>-->
84-
<!-- <shadedArtifactAttached>true</shadedArtifactAttached>-->
85-
<!-- <transformers>-->
86-
<!-- <transformer implementation=-->
87-
<!-- "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">-->
88-
<!-- <mainClass>girraiffe.App</mainClass>-->
89-
<!-- </transformer>-->
90-
<!-- </transformers>-->
91-
<!-- </configuration>-->
92-
<!-- </execution>-->
93-
<!-- </executions>-->
94-
<!-- </plugin>-->
74+
<!-- <plugin>-->
75+
<!-- <groupId>org.apache.maven.plugins</groupId>-->
76+
<!-- <artifactId>maven-shade-plugin</artifactId>-->
77+
<!-- <version>3.3.0</version>-->
78+
<!-- <executions>-->
79+
<!-- <execution>-->
80+
<!-- <goals>-->
81+
<!-- <goal>shade</goal>-->
82+
<!-- </goals>-->
83+
<!-- <configuration>-->
84+
<!-- <shadedArtifactAttached>true</shadedArtifactAttached>-->
85+
<!-- <transformers>-->
86+
<!-- <transformer implementation=-->
87+
<!-- "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">-->
88+
<!-- <mainClass>girraiffe.App</mainClass>-->
89+
<!-- </transformer>-->
90+
<!-- </transformers>-->
91+
<!-- </configuration>-->
92+
<!-- </execution>-->
93+
<!-- </executions>-->
94+
<!-- </plugin>-->
9595
</plugins>
9696
</build>
9797
</project>

src/main/java/girraiffe/Controller.java

+25-24
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
public class Controller {
1717

18+
private Console bcConsole;
19+
private Console tcConsole;
20+
private Console bscConsole;
21+
private Console jcConsole;
22+
private Console sConsole;
1823
//menu
1924
@FXML private CheckMenuItem alwaysOnTopCmi;
2025
//blip calculator
@@ -61,11 +66,6 @@ public class Controller {
6166
@FXML private TextArea sOutputTa;
6267
//global
6368
@FXML private TabPane tabPane;
64-
private Console bcConsole;
65-
private Console tcConsole;
66-
private Console bscConsole;
67-
private Console jcConsole;
68-
private Console sConsole;
6969

7070
@FXML
7171
private void initialize() {
@@ -100,6 +100,21 @@ private void initOutputPaneListener() {
100100
});
101101
}
102102

103+
@FXML
104+
private void clearCurrentOutput(ActionEvent e) {
105+
e.consume();
106+
Tab currentTab = tabPane.getSelectionModel().getSelectedItem();
107+
switch (currentTab.getText()) {
108+
case "Backwards Speed Block" -> bscConsole.console.clear();
109+
// case "Backwards Speed Input" -> bsiConsole.console.clear();
110+
case "Jump" -> jcConsole.console.clear();
111+
case "Tier" -> tcConsole.console.clear();
112+
case "Slime" -> sConsole.console.clear();
113+
// case "Landing" -> lConsole.console.clear();
114+
default -> bcConsole.console.clear();
115+
}
116+
}
117+
103118
private void initComboBoxes() {
104119
bscMmTypeCb
105120
.getItems()
@@ -150,31 +165,13 @@ private void clearAllOutputs(ActionEvent e) {
150165
try {
151166
Method clear = field.getType().getDeclaredMethod("clear");
152167
clear.invoke(field.get(this));
153-
} catch (NoSuchMethodException ex) {
154-
throw new RuntimeException(ex);
155-
} catch (IllegalAccessException ex) {
156-
throw new RuntimeException(ex);
157-
} catch (InvocationTargetException ex) {
168+
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
158169
throw new RuntimeException(ex);
159170
}
160171
}
161172
}
162173
}
163174

164-
@FXML
165-
private void clearCurrentOutput(ActionEvent e) {
166-
e.consume();
167-
Tab currentTab = tabPane.getSelectionModel().getSelectedItem();
168-
switch (currentTab.getText()) {
169-
case "Backwards Speed Block" -> bscConsole.console.clear();
170-
// case "Backwards Speed Input" -> bsiConsole.console.clear();
171-
case "Jump" -> jcConsole.console.clear();
172-
case "Tier" -> tcConsole.console.clear();
173-
// case "Slime" -> sConsole.console.clear();
174-
// case "Landing" -> lConsole.console.clear();
175-
default -> bcConsole.console.clear();
176-
}
177-
}
178175
private void setStandardOut(PrintStream printStream) {
179176
System.setErr(printStream);
180177
System.setOut(printStream);
@@ -290,5 +287,9 @@ public void appendText(String valueOf) {
290287
public void write(int b) {
291288
appendText(String.valueOf((char) b));
292289
}
290+
291+
public void clear(){
292+
Platform.runLater(console::clear);
293+
}
293294
}
294295
}

src/main/java/girraiffe/SlimeCalculator.java

+23-22
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,52 @@ public SlimeCalculator(float startingHeight, float slimeHeight, boolean jump) {
1919
* each bounce, and print function will call tier helper to print offsets down to y = 0
2020
*/
2121
public void calculateSlime() {
22-
ArrayList<Float> apexOffsetArray = new ArrayList<>();
23-
apexOffsetArray.add(startingHeight);
22+
ArrayList<Float> apexArray = new ArrayList<>();
23+
List<String> positions = new ArrayList<>();
24+
apexArray.add(startingHeight);
25+
positions.add("Bounce: 1");
2426
float momentum = jump ? 0.42f : 0.0f;
27+
float nextMomentum;
2528
final double MM_CUTOFF_1_8 = 0.005;
2629
float position = startingHeight;
2730

2831
while (true) {
29-
momentum -= 0.08f;
30-
momentum *= 0.98f;
32+
momentum = (momentum - 0.08f) * 0.98f;
33+
nextMomentum = (momentum - 0.08f) * 0.98f;
3134

3235
// Inertia, unnecessary?
3336
if (Math.abs(momentum) < MM_CUTOFF_1_8) {
3437
momentum = 0;
3538
}
3639

37-
if(position == slimeHeight && position + momentum < slimeHeight) {
38-
System.out.println("end condition");
40+
// checks for local maximum
41+
if (position < position + momentum
42+
&& position + momentum > position + momentum + nextMomentum) {
43+
apexArray.add(position + momentum);
44+
positions.add("Bounce: " + (apexArray.size()));
45+
}
46+
47+
// slime is finished bouncing
48+
if (position == slimeHeight && position + momentum < slimeHeight) {
3949
break;
4050
}
4151

4252
position += momentum;
53+
if (position > 0) {
54+
positions.add(format(position));
55+
}
4356

4457
if ((position < slimeHeight)) {
4558
momentum = -momentum;
4659
position = slimeHeight;
4760
}
4861
}
62+
positions.forEach(System.out::println);
63+
System.out.println();
4964
}
5065

51-
/**
52-
* prints the entrances for each jump off of the slime
53-
*
54-
* @param apexes the apex of each jump
55-
*/
56-
private void print(List<Float> apexes) {
57-
// should only be true for the first one
66+
private String format(float height) {
5867
TierHelper tierHelper = new TierHelper();
59-
int size = apexes.size();
60-
tierHelper.offsetList(apexes.get(0), jump);
61-
// functional way? need to check if bigger than one then loop. filter out the first from
62-
// list and store that maybe...
63-
if (size > 1) {
64-
for (int i = 1; i < size - 1; i++) {
65-
tierHelper.offsetList(apexes.get(i), false);
66-
}
67-
}
68+
return tierHelper.entranceGenerator(height, false);
6869
}
6970
}

0 commit comments

Comments
 (0)