Maintain order on mod support API

This commit is contained in:
Mike Primm 2021-10-02 19:31:46 -05:00
parent cbfbfb4d58
commit 7f719bcead
3 changed files with 8 additions and 7 deletions

View File

@ -2,7 +2,7 @@ package org.dynmap.modsupport;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.LinkedHashMap;
import org.dynmap.Log; import org.dynmap.Log;
import org.dynmap.modsupport.impl.ModModelDefinitionImpl; import org.dynmap.modsupport.impl.ModModelDefinitionImpl;
@ -12,7 +12,7 @@ import org.dynmap.modsupport.impl.ModTextureDefinitionImpl;
* Implementation of ModSupportAPI * Implementation of ModSupportAPI
*/ */
public class ModSupportImpl extends ModSupportAPI { public class ModSupportImpl extends ModSupportAPI {
private HashMap<String, ModTextureDefinitionImpl> txtDefsByModID = new HashMap<String, ModTextureDefinitionImpl>(); private LinkedHashMap<String, ModTextureDefinitionImpl> txtDefsByModID = new LinkedHashMap<String, ModTextureDefinitionImpl>();
/** /**
* Initialize mod support API * Initialize mod support API

View File

@ -4,7 +4,7 @@ import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.Locale; import java.util.Locale;
import org.dynmap.hdmap.HDBlockModels; import org.dynmap.hdmap.HDBlockModels;
@ -29,7 +29,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
private boolean published = false; private boolean published = false;
private ArrayList<BlockModelImpl> blkModel = new ArrayList<BlockModelImpl>(); private ArrayList<BlockModelImpl> blkModel = new ArrayList<BlockModelImpl>();
private ArrayList<PatchDefinition> blkPatch = new ArrayList<PatchDefinition>(); private ArrayList<PatchDefinition> blkPatch = new ArrayList<PatchDefinition>();
private HashMap<String, PatchDefinition> blkPatchMap = new HashMap<String, PatchDefinition>(); private LinkedHashMap<String, PatchDefinition> blkPatchMap = new LinkedHashMap<String, PatchDefinition>();
private PatchDefinitionFactory pdf; private PatchDefinitionFactory pdf;
public ModModelDefinitionImpl(ModTextureDefinitionImpl txtDef) { public ModModelDefinitionImpl(ModTextureDefinitionImpl txtDef) {

View File

@ -4,7 +4,7 @@ import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.LinkedHashMap;
import org.dynmap.modsupport.BigChestTextureFile; import org.dynmap.modsupport.BigChestTextureFile;
import org.dynmap.modsupport.BiomeTextureFile; import org.dynmap.modsupport.BiomeTextureFile;
@ -27,7 +27,7 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
private final String modver; private final String modver;
private ModModelDefinitionImpl modDef = null; private ModModelDefinitionImpl modDef = null;
private String texturePath; private String texturePath;
private HashMap<String, TextureFileImpl> txtFileByID = new HashMap<String, TextureFileImpl>(); private LinkedHashMap<String, TextureFileImpl> txtFileByID = new LinkedHashMap<String, TextureFileImpl>();
private ArrayList<BlockTextureRecordImpl> blkTextureRec = new ArrayList<BlockTextureRecordImpl>(); private ArrayList<BlockTextureRecordImpl> blkTextureRec = new ArrayList<BlockTextureRecordImpl>();
private ArrayList<CopyBlockTextureRecordImpl> blkCopyTextureRec = new ArrayList<CopyBlockTextureRecordImpl>(); private ArrayList<CopyBlockTextureRecordImpl> blkCopyTextureRec = new ArrayList<CopyBlockTextureRecordImpl>();
private boolean published = false; private boolean published = false;
@ -272,7 +272,8 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
String s = "modname:" + this.modid; String s = "modname:" + this.modid;
fw.write(s + "\n\n"); fw.write(s + "\n\n");
// Loop through textures // Loop through textures
for (TextureFileImpl tfi : txtFileByID.values()) { for (String tid : txtFileByID.keySet()) {
TextureFileImpl tfi = txtFileByID.get(tid);
String line = tfi.getLine(); String line = tfi.getLine();
if (line != null) { if (line != null) {
fw.write(line + "\n"); fw.write(line + "\n");