NOT Working Version Compat.

This commit is contained in:
KAMKEEL committed 2022-06-14 22:47:57 -04:00
1 parent 18ad84e186
commit 188cb39769
3 files changed
+48 -6

No files matched your search

+16 -2
View File
@@ -72,7 +72,7 @@ public class ModelDataShared{
compound.setByte("Breasts", breasts);
compound.setTag("ExtraData", extra);
NBTTagList list = new NBTTagList();
for(String name : parts.keySet()){
NBTTagCompound item = parts.get(name).writeToNBT();
@@ -83,7 +83,7 @@ public class ModelDataShared{
return compound;
}
public void readFromNBT(NBTTagCompound compound){
setEntityClass(compound.getString("EntityClass"));
@@ -122,6 +122,20 @@ public class ModelDataShared{
}
public void readPartsFromNBT(NBTTagCompound compound){
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
NBTTagList list = compound.getTagList("Parts", 10);
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound item = list.getCompoundTagAt(i);
ModelPartData part = new ModelPartData();
part.readFromNBT(item);
parts.put(item.getString("PartName"), part);
}
this.parts = parts;
}
private void setEntityClass(String string) {
entityClass = null;
entity = null;
+3 -3
View File
@@ -36,9 +36,9 @@ public class ModelPartData {
color = compound.getInteger("Color");
texture = compound.getString("Texture");
// Disable MPM Dependency for Part Textures
if(VersionCompatibility.ModRev < 19){
texture = texture.replace("moreplayermodels:textures", "customnpcs:textures/parts");
}
// if(VersionCompatibility.ModRev < 19){
// texture = texture.replace("moreplayermodels:textures", "customnpcs:textures/parts");
// }
playerTexture = compound.getBoolean("PlayerTexture");
location = null;
}
@@ -9,11 +9,12 @@ import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.controllers.data.Line;
import noppes.npcs.controllers.data.Lines;
import noppes.npcs.entity.EntityCustomNpc;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.Sys;
public class VersionCompatibility {
public static int ModRev = 19;
public static int ModRev = 18;
public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){
if(npc.npcVersion == ModRev)
@@ -31,6 +32,33 @@ public class VersionCompatibility {
if(compound.hasKey("DialogDarkenScreen")){
compound.removeTag("DialogDarkenScreen");
}
// Remove MPM Texture Requirement
if(compound.hasKey("NpcModelData")) {
NBTTagCompound partData = compound.getCompoundTag("NpcModelData");
// Fix Leg MPM Dependency
if(partData.hasKey("LegParts")){
partData.setString("LegParts", partData.getCompoundTag("LegParts").getString("Texture").replace("moreplayermodels:textures", "customnpcs:textures/parts"));
}
// Fix Part MPM Dependency
if(partData.hasKey("Parts")){
NBTTagList list = partData.getTagList("Parts", 10);
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound item = list.getCompoundTagAt(i);
if(item.hasKey("Texture")){
item.setString("Texture", item.getString("Texture"));
}
list.func_150304_a(i, item);
}
partData.setTag("Parts", list);
}
compound.setTag("NpcModelData", partData);
((EntityCustomNpc)npc).readEntityFromNBT(compound);
}
}
if(npc.npcVersion < 12){
CompatabilityFix(compound, npc.advanced.writeToNBT(new NBTTagCompound()));