Remove some benchmarking and fix loading of settings.

This commit is contained in:
scorbett123 2022-05-31 14:56:23 +01:00
parent af1eb58bb8
commit 2dad6262cf
2 changed files with 6 additions and 15 deletions

View File

@ -1305,7 +1305,9 @@ public final class Settings {
public void set(T value) {
this.value = value;
BaritoneAPI.getProvider().getAllBaritones().forEach(iBaritone -> iBaritone.getGameEventHandler().onSettingChanged(new SettingChangedEvent(this)));
if (BaritoneAPI.getProvider() != null) {
BaritoneAPI.getProvider().getAllBaritones().forEach(iBaritone -> iBaritone.getGameEventHandler().onSettingChanged(new SettingChangedEvent(this)));
}
}
public final String getName() {

View File

@ -149,6 +149,7 @@ public class PrecomputedData { // TODO add isFullyPassable
try { // A dodgy catch-all at the end, for most blocks with default behaviour this will work, however where blocks are special this will error out, and we can handle it when we have this information
return Optional.of(block.isPassable(null, null));
} catch (NullPointerException exception) {
System.out.println("Error");
return Optional.empty();
}
}, (bsi, x, y, z, blockState) -> {
@ -181,10 +182,6 @@ public class PrecomputedData { // TODO add isFullyPassable
return block.isPassable(bsi.access, bsi.isPassableBlockPos.setPos(x, y, z));
});
long endTime = System.nanoTime();
System.out.println(endTime - startTime);
Thread.dumpStack();
}
public boolean canWalkOn(BlockStateInterface bsi, int x, int y, int z, IBlockState state) {
@ -223,15 +220,7 @@ public class PrecomputedData { // TODO add isFullyPassable
* Refresh the precomputed data, for use when settings have changed etc.
*/
public void refresh() {
long startTime = System.nanoTime();
for (int i = 0; i < 10; i++) {
canWalkThrough.refresh();
canWalkOn.refresh();
}
long endTime = System.nanoTime();
System.out.println(endTime - startTime);
canWalkThrough.refresh();
canWalkOn.refresh();
}
}