Skip to content

Commit

Permalink
refactoring and improved fixed explosionTick detection
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazingTwist committed Mar 28, 2021
1 parent ced82df commit 504be7c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.1.3'
version = '1.1.4'
group = 'blazingtwist.cannontracer' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'cannontracer'

Expand Down Expand Up @@ -108,7 +108,7 @@ dependencies {
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.15.2-31.2.47'

provided name: 'JumperCommons', version: '1.1.0'
provided name: 'JumperCommons', version: '1.1.1'

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/the_dark_jumper/cannontracer/Update.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Update {
public static final String OUTDATED_MSG = "is outdated, please update using the button on the config screen!";
public static final String MOD_NAME = "CannonTracer ";

public static final String VERSION = "1.1.3";
public static final String VERSION = "1.1.4";

public static void sendUpdateMessageIfNeeded() {
if(checkUpdateAvailable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ public void load() {
System.err.println("Collected lines to String: " + json);
Path path = Paths.get(configPathGNS.get());
long size = Files.size(path);
System.err.println("Filesize is: " + size + " | at Path: " + path.toString());
File configFile = new File(configPathGNS.get());
System.err.println("Filesize is: " + size + " | at Path: " + path.toString() + " | exists? " + configFile.isFile());

ObjectMapper mapper = getObjectMapper();
//this.tracerConfig = mapper.readValue(json, TracerConfig.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import jumpercommons.GetterAndSetter;
import net.minecraft.client.Minecraft;
import the_dark_jumper.cannontracer.Main;
Expand Down Expand Up @@ -83,7 +84,7 @@ public void findPreviousDespawnTick(boolean b) {
int max = main.moduleManager.getMaxDisplayTickMP();
int currentTick = startTick;
while ((currentTick = currentTick - 1) != startTick) {
if(currentTick < 0){
if (currentTick < 0) {
currentTick = max;
}
if (despawnTicks.contains(currentTick)) {
Expand All @@ -99,11 +100,10 @@ public HashSet<Integer> getDespawnTicks() {
HashSet<Integer> result = new HashSet<>();
for (SingleTickMoveData moveData : main.entityTracker.tracingHistory) {
for (HashMap<Integer, Boolean> tickData : moveData.tickData.values()) {
for (int key : tickData.keySet()) {
if (tickData.get(key)) {
result.add(key);
}
}
tickData.entrySet().stream()
.filter(Map.Entry::getValue) // filter for despawn ticks
.map(Map.Entry::getKey) // get ticks
.forEach(result::add);
}
}
return result;
Expand All @@ -114,27 +114,27 @@ public void showFirstTick(boolean b) {
for (SingleTickMoveData singleTickMoveData : main.entityTracker.tracingHistory) {
for (HashMap<Integer, Boolean> tickData : singleTickMoveData.tickData.values()) {
int minTick = tickData.keySet().stream().min(Integer::compareTo).orElse(Integer.MAX_VALUE);
if(minTick < first){
if (minTick < first) {
first = minTick;
}
}
}
if(first < main.moduleManager.getMaxDisplayTickMP()){
if (first < main.moduleManager.getMaxDisplayTickMP()) {
renderTickGNS.set(first);
}
}

public void showLastTick(boolean b){
public void showLastTick(boolean b) {
int last = Integer.MIN_VALUE;
for (SingleTickMoveData singleTickMoveData : main.entityTracker.tracingHistory) {
for (HashMap<Integer, Boolean> tickData : singleTickMoveData.tickData.values()) {
int maxTick = tickData.keySet().stream().max(Integer::compareTo).orElse(Integer.MIN_VALUE);
if(maxTick > last){
if (maxTick > last) {
last = maxTick;
}
}
}
if(last >= 0){
if (last >= 0) {
renderTickGNS.set(last);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ loaderVersion="[31,)"
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]]
modId="cannontracer"
version="1.1.3"
version="1.1.4"
displayName="Cannon Tracer"
credits="Thanks for this mod goes to my no longer existing will to live"
authors="The_Dark_Jumper"
Expand Down

0 comments on commit 504be7c

Please sign in to comment.