Posted May 1, 201411 yr Hello guys. I have one problem. There is a mod for Minecraft 1.7.2 and the problem is that I want to downgrade it to 1.6.4, because its easier to downgrade it instead of working with the buggy 1.6.4 source and because of many guys from the community want a 1.6.4 version. (well it takes not so much time...) Oh and aswell, its allowed from the mod creators. So my problem: In Minecraft Forge 1.7.2 there is a class called "net.minecraftforge.common.util.Constants". https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/common/util/Constants.java I want now to know if such a class exits in 1.6.4 and if not what must I change here? @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); this.cityName = nbtTagCompound.getString("cityName"); NBTTagList nbtTagOwnersList = nbtTagCompound.getTagList("owners", Constants.NBT.TAG_COMPOUND); this.owners = new ArrayList<UUID>(); for(int i = 0; i < nbtTagOwnersList.tagCount(); i++) { NBTTagCompound nbtTagOwnersCompound = nbtTagOwnersList.getCompoundTagAt(i); UUID uuid = UUID.fromString(nbtTagOwnersCompound.getString("owner")); owners.add(i, uuid); System.out.println("UUID Size = " + this.owners.size()); System.out.println("UUID name = " + this.owners.get(i).toString()); } } Oh and is it right that I must change "UUID" to EntityPlayer? Bektor Developer of Primeval Forest.
May 1, 201411 yr I know it's easier but UUID? Wtf is that? What are you trying to do? Developer of MechanicalCraft. Sadly not available to public yet
May 2, 201411 yr Author I know it's easier but UUID? Wtf is that? What are you trying to do? Read up on the newest updates by Mojang. Players are no longer identified by their username, but by a UUID (google it if you don't know what it is -.-), to ultimately support changing your username. @OP: The Constants class is not present in 1.6.4 yet, because it's not technically needed. Only in 1.7 take NBTTagLists their component type. With UUIDs, yes, use usernames for that in 1.6. Ok, thanks. But which class must I use for the usernames? I think its EntityPlayer, but I'm not 100% sure and so I want not to test it out, because if it isn't EntityPlayer then I have to change a log of code. Oh and how must then this line look like? NBTTagList nbtTagOwnersList = nbtTagCompound.getTagList("owners", Constants.NBT.TAG_COMPOUND); Must I only remove the "Constants.NBT.TAG_COMPOUND" or must I replace it with something different or change it? And if yes, in what must I change this line? Developer of Primeval Forest.
May 2, 201411 yr Author Ok, I found some other things that are different from 1.7 to 1.6. So how must look like this code in 1.6? @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); this.cityName = nbtTagCompound.getString("cityName"); NBTTagList nbtTagOwnersList = nbtTagCompound.getTagList("owners", Constants.NBT.TAG_COMPOUND); this.owners = new ArrayList<UUID>(); for(int i = 0; i < nbtTagOwnersList.tagCount(); i++) { NBTTagCompound nbtTagOwnersCompound = nbtTagOwnersList.getCompoundTagAt(i); UUID uuid = UUID.fromString(nbtTagOwnersCompound.getString("owner")); owners.add(i, uuid); System.out.println("UUID Size = " + this.owners.size()); System.out.println("UUID name = " + this.owners.get(i).toString()); } } I hope that you guys can help me! Bektor Developer of Primeval Forest.
May 2, 201411 yr Author I won't give you fully working code, you need to do some work yourself. UUIDs are Strings in 1.6 (containing the username). And for getTagList you can just remove the 2nd parameter. Ok, but what is with "getCompoundTagAt"? NBTTagCompound nbtTagOwnersCompound = nbtTagOwnersList.getCompoundTagAt(i); Developer of Primeval Forest.
May 2, 201411 yr Author The method name probably changed. Search "getTag" or similar. Well I searched already but I dindn't find a method that do the same thing, only methods for 1.7 but nothing for 1.6. Developer of Primeval Forest.
May 2, 201411 yr Author Please, use your brain. It's called tagAt in 1.6. Ok, thanks. Well now I don't get an error after I changed some more lines that gaves me an error after I used tagAt . I hope that this will work, because I can't test it, because there I need to add many many other lines... "Old" code: (1.7.2) @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); this.cityName = nbtTagCompound.getString("cityName"); NBTTagList nbtTagOwnersList = nbtTagCompound.getTagList("owners", Constants.NBT.TAG_COMPOUND); this.owners = new ArrayList<UUID>(); for(int i = 0; i < nbtTagOwnersList.tagCount(); i++) { NBTTagCompound nbtTagOwnersCompound = nbtTagOwnersList.getCompoundTagAt(i); UUID uuid = UUID.fromString(nbtTagOwnersCompound.getString("owner")); owners.add(i, uuid); System.out.println("UUID Size = " + this.owners.size()); System.out.println("UUID name = " + this.owners.get(i).toString()); } } Changed code: (1.6.4) @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); this.cityName = nbtTagCompound.getString("cityName"); NBTTagList nbtTagOwnersList = nbtTagCompound.getTagList("owners"); this.owners = new ArrayList<UUID>(); for(int i = 0; i < nbtTagOwnersList.tagCount(); i++) { NBTBase nbtTagOwnersCompound = nbtTagOwnersList.tagAt(i); UUID uuid = UUID.fromString(((NBTTagCompound) nbtTagOwnersCompound).getString("owner")); owners.add(i, uuid); System.out.println("UUID Size = " + this.owners.size()); System.out.println("UUID name = " + this.owners.get(i).toString()); } } Developer of Primeval Forest.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.