Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void dumpSizes() {
- Map<Integer, Integer> sizes = new HashMap<>();
- for (int id = 0; id < 6756; id++) {
- EntityDef entity = forID(id);
- if (entity == null) {
- continue;
- }
- int size = entity.aByte68;
- sizes.put(id, size);
- }
- File file = new File("npc_sizes.txt");
- if (!file.exists()) {
- try {
- file.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- List<Entry<Integer, Integer>> sortedSizes = new ArrayList<>(sizes.entrySet());
- sortedSizes.sort(new Comparator<Entry<Integer, Integer>>() {
- @Override
- public int compare(Entry<Integer, Integer> o1,
- Entry<Integer, Integer> o2) {
- if (o1.getKey() < o2.getKey()) {
- return -1;
- }
- if (o1.getKey() > o2.getKey()) {
- return 1;
- }
- return 0;
- }
- });
- try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
- for (Entry<Integer, Integer> entry : sortedSizes) {
- writer.write(entry.getKey() + "\t" + entry.getValue());
- writer.newLine();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement