NBT Editor

NBT Editor

30k Downloads

Optimization and improvement

Xantrisse opened this issue ยท 7 comments

commented

I suggest optimizing the modification. When opening medium-sized items, my ping increases significantly. When expanding a small item, fps drops significantly (this is about expanding the entire NBT data). If you don't know what I mean, I can simulate the situation. Another thing that can be improved is adding a scroll bar on all larger screens because some people may have a damaged scroll on their mouse.
20240114151226213606-image

THX :D

commented

I don't see the sliders on the selected NBT edit screen (For example, after clicking the expand button)

commented

For the performance stuff, that's covered in #59. I'm not sure why the ping would increase, though. If the client is freezing when opening the item, then that might increase the ping as the client isn't responding.
I'm not sure which screen(s) are missing a scrollbar; can you specify which?

commented

I've now added scrollbars to the multi-line text fields in v1.13.0, which seems to have been the only scrollable GUI missing them. In the process, I also took the chance to improve scrollbars in general, so you can now move your mouse away from the bar.

Thanks for keeping the language file constantly updated btw! It's pretty cool being able to support other languages.

commented

New translation for https://github.com/mega12345mega/NBT-Editor/actions/runs/7579421678
https://github.com/Xantrisse/NBT-Editor-Mod-Polish-translation

From now on, I use my own program for translation, so there will be no spaces between lines for some time. I will try to improve this program :D

commented

I've just added (theoretically) the last lang entries before this update, so if you could translate those that would be great!
For the spacing, I've just written a somewhat janky formatter that assumes all the keys are in the same order. If you're interested in adding it directly to your program, here it is:

Expand
public static void main(String[] args) throws IOException {
	if (args.length < 2) {
		System.out.println("Usage: <path/en_us.json> <path/lang_to_format.json>");
		return;
	}
	
	File ref = new File(args[0]);
	File toFormat = new File(args[1]);
	
	if (!ref.exists() || !toFormat.exists() || !ref.isFile() || !toFormat.isFile()) {
		System.out.println("Make sure both files exist and are files!");
		return;
	}
	
	String[] refLines = Files.readString(ref.toPath()).replace("\r", "").split("\n");
	List<String> formattedLines = Stream.of(Files.readString(toFormat.toPath()).replace("\r", "").split("\n")).collect(Collectors.toList());
	
	for (int i = 0; i < refLines.length; i++) {
		if (refLines[i].isBlank())
			formattedLines.add(i, "\t");
		else {
			String formattedLine = formattedLines.get(i);
			if (!formattedLine.startsWith("\t") && !formattedLine.equals("{") && !formattedLine.equals("}")) {
				while (formattedLine.startsWith(" "))
					formattedLine = formattedLine.substring(1);
				formattedLines.set(i, "\t" + formattedLine);
			}
		}
	}
	
	Files.writeString(toFormat.toPath(), String.join(System.lineSeparator(), formattedLines));
}
commented

I use python... :D

commented

I've just added (theoretically) the last lang entries before this update, so if you could translate those that would be great!

Updated :D
The link is in the previous comment

image