I've recently started updating this old mod I found I've updated alot of code already but there are still a few things that I don't know how to fix. It might look like I'm asking alot but trust me I have fixed alot of errors but I'm not able to fix these yet so a little help would be nice
(I know the code looks messy with al the pars in it but that will be changed when everything is working!)
[Solved]NBTTagIntArray
@SideOnly(Side.CLIENT)
public class GuiName extends GuiContainer {
private GuiButton nextPageButton;
private GuiButton prevPageButton;
int listWidth = 96;
List<File> fileList = new ArrayList();
List<int[]> lines = new ArrayList();
int selected = 0;
int showing = -1;
int xSize = 176;
int ySize = 225;
long lastClicked = 0;
int page = 0;
int item_num_per_page = 12;
I'm updating from 1.5.2 to 1.7.10 I know ID arn't used anymore but these errors i'm getting can't just simply be fixed with removing the .ItemID.
also the errors are:
1. Same as 4 (Note: I edited the onneighborblockchange since I fixed something)
2. NBTTagIntArray: The method tagAt(int) is undefined for the type NBTTagList
3. ItemStack (when ItemID is changed to .getItem()): The left-hand side of an assignment must be a variable
4. Int: - Config cannot be resolved to a variable - blockID cannot be resolved or is not a field (Because I removed the id's from the config since 1.7.10 doesn't use this anymore)
I added more code for the NBTTagIntArray also the .getIntArrayAt(i) didn't work just like all the other methods from NBTTagList however I just found out that 'func_150306_c' is .getIntArrayAt(i) but then I get this error:
- Type mismatch: cannot convert from int[] to NBTTagIntArray
but this is the way it has to be to make the rest work right?
@SideOnly(Side.CLIENT)
public class GuiName extends GuiContainer {
private GuiButton nextPageButton;
private GuiButton prevPageButton;
int listWidth = 96;
List<File> fileList = new ArrayList();
List<int[]> lines = new ArrayList();
int selected = 0;
int showing = -1;
int xSize = 176;
int ySize = 225;
long lastClicked = 0;
int page = 0;
int item_num_per_page = 12;
Hello,
I've recently started updating this old mod I found I've updated alot of code already but there are still a few things that I don't know how to fix. It might look like I'm asking alot but trust me I have fixed alot of errors but I'm not able to fix these yet so a little help would be nice
(I know the code looks messy with al the pars in it but that will be changed when everything is working!)
[Solved]NBTTagIntArray
public class GuiName extends GuiContainer {
private GuiButton nextPageButton;
private GuiButton prevPageButton;
int listWidth = 96;
List<File> fileList = new ArrayList();
List<int[]> lines = new ArrayList();
int selected = 0;
int showing = -1;
int xSize = 176;
int ySize = 225;
long lastClicked = 0;
int page = 0;
int item_num_per_page = 12;
ItemStack itemStack = null;
public GuiName(InventoryPlayer inventory, ItemStack itemStack) {
super(new Container() {
@Override
public boolean canInteractWith(EntityPlayer var1) {
return false;
}
});
this.itemStack = itemStack;
if(this.itemStack.hasTagCompound()) {
NBTTagCompound tag = this.itemStack.getTagCompound();
if(tag.hasKey("Lines")) {
NBTTagList tagLines = tag.getTagList("Lines", Constants.NBT.TAG_COMPOUND);
for(int i = 0; i < tagLines.tagCount(); ++i) {
NBTTagIntArray tagLine = (NBTTagIntArray) tagLines.tagAt(i);
int[] line = tagLine.func_150302_c();
this.lines.add(line);
}
}
}
}
Solution:
int[] tagLine = tagLines.func_150306_c(i);
int[] line = new int[tagLine.length];
this.lines.add(line);
[Solved]Integer (how to convert it to 1.7.10 without the id's.)
int IntName = block.blockID + 2 - Config.blocknameId;
Solution:
int IntName = world.getBlockMetadata(x, y, z);
-Nick
Specifically, what errors are you getting and from what version are you updating from and what version are you updating to?
Hello kovu,
I'm updating from 1.5.2 to 1.7.10 I know ID arn't used anymore but these errors i'm getting can't just simply be fixed with removing the .ItemID.
also the errors are:
1. Same as 4 (Note: I edited the onneighborblockchange since I fixed something)
2. NBTTagIntArray: The method tagAt(int) is undefined for the type NBTTagList
3. ItemStack (when ItemID is changed to .getItem()): The left-hand side of an assignment must be a variable
4. Int: - Config cannot be resolved to a variable - blockID cannot be resolved or is not a field (Because I removed the id's from the config since 1.7.10 doesn't use this anymore)
-Nick
Hello Hirvio,
I added more code for the NBTTagIntArray also the .getIntArrayAt(i) didn't work just like all the other methods from NBTTagList however I just found out that 'func_150306_c' is .getIntArrayAt(i) but then I get this error:
- Type mismatch: cannot convert from int[] to NBTTagIntArray
but this is the way it has to be to make the rest work right?
@SideOnly(Side.CLIENT)
public class GuiName extends GuiContainer {
private GuiButton nextPageButton;
private GuiButton prevPageButton;
int listWidth = 96;
List<File> fileList = new ArrayList();
List<int[]> lines = new ArrayList();
int selected = 0;
int showing = -1;
int xSize = 176;
int ySize = 225;
long lastClicked = 0;
int page = 0;
int item_num_per_page = 12;
ItemStack itemStack = null;
public GuiName(InventoryPlayer inventory, ItemStack itemStack) {
super(new Container() {
@Override
public boolean canInteractWith(EntityPlayer var1) {
return false;
}
});
this.itemStack = itemStack;
if(this.itemStack.hasTagCompound()) {
NBTTagCompound tag = this.itemStack.getTagCompound();
if(tag.hasKey("Lines")) {
NBTTagList tagLines = tag.getTagList("Lines", Constants.NBT.TAG_COMPOUND);
for(int i = 0; i < tagLines.tagCount(); ++i) {
NBTTagIntArray tagLine = (NBTTagIntArray)tagLines.func_150306_c(i);
int[] line = tagLine.func_150302_c();
this.lines.add(line);
}
}
}
}
-Nick
bump
What would you suggest me changing it intro since if I would change it the other lines get an error :/