Jump to content

Crash with arraylist [SOLVED]


yorkeMC

Recommended Posts

So, I am using Vazkii's Lexica Botania code (with his permission).

 

The bookmark feature for some reason crashes when you remove a bookmark, and I cannot figure out why. For some reason it is trying to remove -1 from an array list even when it shouldn't be told to.

 

Here is the GUI code (modified version of vazkii's, slightly messy ATM)

 

 

/**

* This class was created by <Vazkii>. It's distributed as

* part of the Botania Mod. Get the Source Code in github:

* https://github.com/Vazkii/Botania

*

* Botania is Open Source and distributed under the

* Botania License: http://botaniamod.net/license.php

*

* File Created @ [Jan 14, 2014, 6:48:05 PM (GMT)]

*/

package yorkeMC.clockwork.client.gui.lexicon;

 

import java.util.ArrayList;

import java.util.Collections;

import java.util.HashMap;

import java.util.List;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.audio.PositionedSoundRecord;

import net.minecraft.client.gui.FontRenderer;

import net.minecraft.client.gui.GuiButton;

import net.minecraft.client.gui.GuiScreen;

import net.minecraft.item.ItemStack;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.ChatAllowedCharacters;

import net.minecraft.util.EnumChatFormatting;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.StatCollector;

 

import org.lwjgl.input.Keyboard;

import org.lwjgl.opengl.GL11;

 

import yorkeMC.clockwork.api.ClockworkAPI;

import yorkeMC.clockwork.api.lexicon.LexiconCategory;

import yorkeMC.clockwork.client.gui.lexicon.button.GuiButtonBookmark;

import yorkeMC.clockwork.client.gui.lexicon.button.GuiButtonCategory;

import yorkeMC.clockwork.client.gui.lexicon.button.GuiButtonHistory;

import yorkeMC.clockwork.client.gui.lexicon.button.GuiButtonInvisible;

import yorkeMC.clockwork.client.gui.lexicon.button.GuiButtonNotes;

import yorkeMC.clockwork.client.handler.ClientTickHandler;

import yorkeMC.clockwork.client.handler.PersistentVariableHelper;

import yorkeMC.clockwork.common.items.ItemLexicon;

import yorkeMC.clockwork.common.lexicon.page.PageText;

 

public class GuiLexicon extends GuiScreen

{

 

public static GuiLexicon currentOpenLexicon = new GuiLexicon();

public static ItemStack stackUsed;

 

public static HashMap<String, String> notes = new HashMap();

 

private static final String TAG_TYPE = "type";

 

private static final int[] KONAMI_CODE = { 200, 200, 208, 208, 203, 205, 203, 205, 48, 30 };

 

public static final int BOOKMARK_START = 1337;

public static final int NOTES_BUTTON_ID = 1336; // random button tho

public static final int MAX_BOOKMARK_COUNT = 8;

 

public static List<GuiLexicon> bookmarks = new ArrayList();

public static List<String> bookmarkKeys = new ArrayList();

boolean bookmarksNeedPopulation = false;

 

public static final ResourceLocation texture = new ResourceLocation("clockwork:textures/gui/gui_lexicon.png");

 

public float lastTime = 0F;

public float partialTicks = 0F;

public float timeDelta = 0F;

 

int konamiIndex;

 

private static final int NOTE_TWEEN_TIME = 5;

public static boolean notesEnabled;

static int notesMoveTime;

public String note = "";

public String categoryHighlight = "";

 

List<LexiconCategory> allCategories;

 

String title;

int guiWidth = 146;

int guiHeight = 180;

int left, top;

 

@Override

public final void initGui()

{

super.initGui();

 

if (PersistentVariableHelper.firstLoad)

{

PersistentVariableHelper.firstLoad = false;

PersistentVariableHelper.saveSafe();

}

 

String key = getNotesKey();

if (notes.containsKey(key))

note = notes.get(key);

 

onInitGui();

}

 

public void onInitGui()

{

allCategories = new ArrayList(ClockworkAPI.getAllCategories());

Collections.sort(allCategories);

 

lastTime = ClientTickHandler.ticksInGame;

 

title = stackUsed.getDisplayName();

currentOpenLexicon = this;

 

left = width / 2 - guiWidth / 2;

top = height / 2 - guiHeight / 2;

 

buttonList.clear();

if (isIndex())

{

int x = 18;

for (int i = 0; i < 12; i++)

{

int y = 16 + i * 12;

buttonList.add(new GuiButtonInvisible((GuiLexiconIndex) this, i, left + x, top + y, 110, 10, ""));

}

populateIndex();

}

else if (isCategoryIndex())

{

int categories = allCategories.size();

for (int i = 0; i < categories + 1; i++)

{

LexiconCategory category = null;

category = i >= categories ? null : allCategories.get(i);

int perline = 5;

int x = i % perline;

int y = i / perline;

 

int size = 22;

GuiButtonCategory button = new GuiButtonCategory(i, left + 18 + x * size, top + 50 + y * size, this, category);

buttonList.add(button);

}

}

populateBookmarks();

buttonList.add(new GuiButtonNotes(this, NOTES_BUTTON_ID, left - 4, top - 4));

}

 

@Override

public void updateScreen()

{

if (notesEnabled && notesMoveTime < NOTE_TWEEN_TIME)

notesMoveTime++;

else if (!notesEnabled && notesMoveTime > 0)

notesMoveTime--;

}

 

@Override

public void drawScreen(int par1, int par2, float par3)

{

float time = ClientTickHandler.ticksInGame + par3;

timeDelta = time - lastTime;

lastTime = time;

partialTicks = par3;

 

GL11.glColor4f(1F, 1F, 1F, 1F);

mc.renderEngine.bindTexture(texture);

drawNotes(par3);

 

GL11.glColor4f(1F, 1F, 1F, 1F);

mc.renderEngine.bindTexture(texture);

drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);

 

drawBookmark(left + guiWidth / 2, top - getTitleHeight(), getTitle(), true);

String subtitle = getSubtitle();

if (subtitle != null)

{

GL11.glScalef(0.5F, 0.5F, 1F);

drawCenteredString(fontRendererObj, subtitle, left * 2 + guiWidth,

(top - getTitleHeight() + 11) * 2, 0x00FF00);

GL11.glScalef(2F, 2F, 1F);

}

 

if (isMainPage())

drawHeader();

 

if (bookmarksNeedPopulation)

{

populateBookmarks();

bookmarksNeedPopulation = false;

}

 

super.drawScreen(par1, par2, par3);

}

 

public void drawNotes(float part)

{

int size = 105;

 

float time = notesMoveTime;

if (notesMoveTime < NOTE_TWEEN_TIME && notesEnabled)

time += part;

else if (notesMoveTime > 0 && !notesEnabled)

time -= part;

 

int drawSize = (int) (size * time / NOTE_TWEEN_TIME);

int x = left - drawSize;

int y = top + 10;

 

drawTexturedModalRect(x, y, 146, 0, drawSize, 125);

 

String noteDisplay = note;

if (notesEnabled && ClientTickHandler.ticksInGame % 20 < 10)

noteDisplay += "&r_";

 

fontRendererObj.drawString(

StatCollector.translateToLocal("lexicon.notes"), x + 5,

y - 7, 0x666666);

 

boolean unicode = fontRendererObj.getUnicodeFlag();

fontRendererObj.setUnicodeFlag(true);

 

PageText.renderText(x + 5, y - 3, 92, 120, 0, noteDisplay);

fontRendererObj.setUnicodeFlag(unicode);

}

 

public void drawBookmark(int x, int y, String s, boolean drawLeft)

{

drawBookmark(x, y, s, drawLeft, 0x111111);

}

 

public void drawBookmark(int x, int y, String s, boolean drawLeft, int color)

{

// This function is called from the buttons so I can't use fontRendererObj

FontRenderer font = Minecraft.getMinecraft().fontRenderer;

boolean unicode = font.getUnicodeFlag();

font.setUnicodeFlag(true);

int l = font.getStringWidth(s);

int fontOff = 0;

 

if (!drawLeft)

{

x += l / 2;

fontOff = 2;

}

 

Minecraft.getMinecraft().renderEngine.bindTexture(texture);

 

GL11.glColor4f(1F, 1F, 1F, 1F);

drawTexturedModalRect(x + l / 2 + 3, y - 1, 54, 180, 6, 11);

if (drawLeft)

drawTexturedModalRect(x - l / 2 - 9, y - 1, 61, 180, 6, 11);

for (int i = 0; i < l + 6; i++)

drawTexturedModalRect(x - l / 2 - 3 + i, y - 1, 60, 180, 1, 11);

 

font.drawString(s, x - l / 2 + fontOff, y, color, false);

font.setUnicodeFlag(unicode);

}

 

void drawHeader()

{

GL11.glPushMatrix();

GL11.glColor4f(1F, 1F, 1F, 1F);

Minecraft.getMinecraft().renderEngine.bindTexture(texture);

drawTexturedModalRect(left - 8, top + 9, 0, 224, 140, 31);

 

int color = 0xffd200;

boolean unicode = fontRendererObj.getUnicodeFlag();

fontRendererObj.drawString(title, left + 6, top + 13, color);

fontRendererObj.setUnicodeFlag(true);

fontRendererObj.drawString(String.format(StatCollector.translateToLocal("lexicon.edition"), ItemLexicon.getEdition()), left + 24, top + 22, color);

 

String s = EnumChatFormatting.BOLD + categoryHighlight;

fontRendererObj.drawString(s, left + guiWidth / 2 - fontRendererObj.getStringWidth(s) / 2, top + 36, 0);

 

fontRendererObj.setUnicodeFlag(unicode);

GL11.glPopMatrix();

 

categoryHighlight = "";

}

 

boolean isMainPage()

{

return true;

}

 

@Override

protected void actionPerformed(GuiButton par1GuiButton)

{

if(par1GuiButton.id >= BOOKMARK_START)

{

if(par1GuiButton.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT)

{

mc.displayGuiScreen(new GuiLexiconHistory());

ClientTickHandler.notifyPageChange();

}

else handleBookmark(par1GuiButton);

}

else if(par1GuiButton instanceof GuiButtonCategory)

{

LexiconCategory category = ((GuiButtonCategory) par1GuiButton).getCategory();

 

mc.displayGuiScreen(new GuiLexiconIndex(category));

ClientTickHandler.notifyPageChange();

}

else switch(par1GuiButton.id)

{

case NOTES_BUTTON_ID :

notesEnabled = !notesEnabled;

break;

}

}

 

public void handleBookmark(GuiButton par1GuiButton)

{

boolean modified = false;

int i = par1GuiButton.id - BOOKMARK_START;

String key = getNotesKey();

if(i == bookmarks.size()) {

if(!bookmarkKeys.contains(key)) {

bookmarks.add(this.copy());

bookmarkKeys.add(key);

modified = true;

}

} else {

if(isShiftKeyDown()) {

int index = bookmarkKeys.indexOf(key);

bookmarks.remove(index);

bookmarkKeys.remove(index);

 

modified = true;

} else {

GuiLexicon bookmark = bookmarks.get(i).copy();

if(!bookmark.getTitle().equals(getTitle())) {

Minecraft.getMinecraft().displayGuiScreen(bookmark);

if(bookmark instanceof IParented)

((IParented) bookmark).setParent(this);

ClientTickHandler.notifyPageChange();

}

}

}

 

bookmarksNeedPopulation = true;

if(modified)

PersistentVariableHelper.saveSafe();

}

 

@Override

public boolean doesGuiPauseGame()

{

return false;

}

 

public int bookmarkWidth(String b)

{

if (fontRendererObj == null)

fontRendererObj = Minecraft.getMinecraft().fontRenderer;

 

boolean unicode = fontRendererObj.getUnicodeFlag();

fontRendererObj.setUnicodeFlag(true);

int width = fontRendererObj.getStringWidth(b) + 15;

fontRendererObj.setUnicodeFlag(unicode);

return width;

}

 

String getTitle()

{

return title;

}

 

String getSubtitle()

{

return null;

}

 

int getTitleHeight()

{

return getSubtitle() == null ? 12 : 16;

}

 

boolean isIndex()

{

return false;

}

 

boolean isChallenge()

{

return false;

}

 

boolean isCategoryIndex()

{

return true;

}

 

void populateIndex()

{

List<LexiconCategory> categoryList = ClockworkAPI.getAllCategories();

int shift = 2;

for (int i = shift; i < 12; i++)

{

int i_ = i - shift;

GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);

LexiconCategory category = i_ >= categoryList.size() ? null

: categoryList.get(i_);

if (category != null)

button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName());

else

{

button.displayString = StatCollector.translateToLocal("lexicon.category.index");

break;

}

}

}

 

void populateBookmarks()

{

List remove = new ArrayList();

List<GuiButton> buttons = buttonList;

for(GuiButton button : buttons)

if(button.id >= BOOKMARK_START)

remove.add(button);

buttonList.removeAll(remove);

 

int len = bookmarks.size();

boolean thisExists = false;

for(GuiLexicon lex : bookmarks)

if(lex.getTitle().equals(getTitle()))

thisExists = true;

 

boolean addEnabled = len < MAX_BOOKMARK_COUNT && this instanceof IParented && !thisExists;

for(int i = 0; i < len + (addEnabled ? 1 : 0); i++) {

boolean isAdd = i == bookmarks.size();

GuiLexicon gui = isAdd ? null : bookmarks.get(i);

buttonList.add(new GuiButtonBookmark(BOOKMARK_START + i, left + 138, top + 18 + 14 * i, gui == null ? this : gui, gui == null ? "+" : gui.getTitle()));

}

 

if(isMainPage())

buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, StatCollector.translateToLocal("lexicon.history"), this));

}

 

boolean closeScreenOnInvKey()

{

return true;

}

 

@Override

protected void keyTyped(char par1, int par2)

{

handleNoteKey(par1, par2);

 

if (!notesEnabled && closeScreenOnInvKey()

&& mc.gameSettings.keyBindInventory.getKeyCode() == par2)

{

mc.displayGuiScreen(null);

mc.setIngameFocus();

}

 

if (par2 == KONAMI_CODE[konamiIndex])

{

konamiIndex++;

if (konamiIndex >= KONAMI_CODE.length)

{

mc.getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation("botania:way")));

konamiIndex = 0;

}

} else

konamiIndex = 0;

 

super.keyTyped(par1, par2);

}

 

public void handleNoteKey(char par1, int par2)

{

if (notesEnabled)

{

Keyboard.enableRepeatEvents(true);

boolean changed = false;

 

if (par2 == 14 && note.length() > 0)

{

if (isCtrlKeyDown())

note = "";

else

{

if (note.endsWith("<br>"))

note = note.substring(0, note.length() - 4);

else

note = note.substring(0, note.length() - 1);

}

changed = true;

}

 

if ((ChatAllowedCharacters.isAllowedCharacter(par1) || par2 == 28)

&& note.length() < 250)

{

note += par2 == 28 ? "<br>" : par1;

changed = true;

}

 

if (changed)

{

notes.put(getNotesKey(), note);

PersistentVariableHelper.saveSafe();

}

} else

Keyboard.enableRepeatEvents(false);

}

 

public static GuiLexicon create(NBTTagCompound cmp)

{

String type = cmp.getString(TAG_TYPE);

try

{

GuiLexicon lex = (GuiLexicon) Class.forName(type).newInstance();

if (lex != null)

lex.load(cmp);

if (isValidLexiconGui(lex))

return lex;

return null;

} catch (Exception e)

{

e.printStackTrace();

return null;

}

}

 

public void serialize(NBTTagCompound cmp)

{

cmp.setString(TAG_TYPE, getClass().getName());

}

 

public String getNotesKey()

{

return "index";

}

 

public void load(NBTTagCompound cmp)

{

// NO-OP

}

 

public GuiLexicon copy()

{

return new GuiLexicon();

}

 

public static boolean isValidLexiconGui(GuiLexicon gui)

{

if (gui == null)

return false;

if (gui.isCategoryIndex() || gui.isChallenge())

return true;

if (gui.isIndex())

{

GuiLexiconIndex indexGui = (GuiLexiconIndex) gui;

if (indexGui.category == null)

return true;

return ClockworkAPI.getAllCategories().contains(indexGui.category);

}

 

GuiLexiconEntry entryGui = (GuiLexiconEntry) gui;

if (!ClockworkAPI.getAllEntries().contains(entryGui.entry))

return false;

 

return entryGui.page < entryGui.entry.pages.size();

}

}

 

 

 

 

And the crash...

 

 

crash-2015-11-28_20.15.04-client.txt

 

---- Minecraft Crash Report ----

// I let you down. Sorry :(

 

Time: 28/11/15 8:15 PM

Description: Updating screen events

 

java.lang.ArrayIndexOutOfBoundsException: -1

at java.util.ArrayList.elementData(Unknown Source)

at java.util.ArrayList.remove(Unknown Source)

at yorkeMC.clockwork.client.gui.lexicon.GuiLexicon.handleBookmark(GuiLexicon.java:327)

at yorkeMC.clockwork.client.gui.lexicon.GuiLexicon.actionPerformed(GuiLexicon.java:296)

at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:252)

at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:344)

at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1732)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1040)

at net.minecraft.client.Minecraft.run(Minecraft.java:962)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at java.util.ArrayList.elementData(Unknown Source)

at java.util.ArrayList.remove(Unknown Source)

at yorkeMC.clockwork.client.gui.lexicon.GuiLexicon.handleBookmark(GuiLexicon.java:327)

at yorkeMC.clockwork.client.gui.lexicon.GuiLexicon.actionPerformed(GuiLexicon.java:296)

at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:252)

at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:344)

at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)

 

-- Affected screen --

Details:

Screen name: yorkeMC.clockwork.client.gui.lexicon.GuiLexicon

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['AwesomeBlock2000'/267, l='MpServer', x=-249.33, y=5.62, z=214.72]]

Chunk stats: MultiplayerChunkCache: 441, 441

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: World: (-296,4,306), Chunk: (at 8,0,2 in -19,19; contains blocks -304,0,304 to -289,255,319), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 129420 game time, 129420 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 88 total; [EntityPig['Pig'/256, l='MpServer', x=-185.22, y=4.00, z=217.16], EntityCow['Cow'/257, l='MpServer', x=-187.81, y=4.00, z=213.09], EntityPig['Pig'/259, l='MpServer', x=-191.09, y=4.00, z=238.03], EntityCow['Cow'/260, l='MpServer', x=-179.22, y=4.00, z=236.97], EntityCow['Cow'/261, l='MpServer', x=-177.25, y=4.00, z=249.69], EntitySlime['Slime'/140, l='MpServer', x=-261.16, y=4.00, z=150.88], EntityClientPlayerMP['AwesomeBlock2000'/267, l='MpServer', x=-249.33, y=5.62, z=214.72], EntityItem['item.item.wheat'/141, l='MpServer', x=-263.31, y=5.13, z=184.19], EntityItem['item.item.seeds'/142, l='MpServer', x=-263.34, y=5.13, z=185.19], EntityItem['item.item.seeds'/143, l='MpServer', x=-262.72, y=5.13, z=183.97], EntityItem['item.item.carrots'/144, l='MpServer', x=-265.88, y=5.13, z=189.03], EntitySlime['Slime'/145, l='MpServer', x=-258.88, y=6.06, z=197.94], EntitySlime['Slime'/146, l='MpServer', x=-261.25, y=5.00, z=198.84], EntityItem['item.item.potato'/147, l='MpServer', x=-269.94, y=5.13, z=195.81], EntityItem['item.item.potato'/148, l='MpServer', x=-271.03, y=5.13, z=194.25], EntitySlime['Slime'/149, l='MpServer', x=-259.31, y=5.81, z=197.06], EntityCreeper['Creeper'/150, l='MpServer', x=-275.93, y=4.00, z=207.05], EntityVillager['Villager'/151, l='MpServer', x=-255.14, y=5.00, z=211.50], EntitySlime['Slime'/152, l='MpServer', x=-267.31, y=6.00, z=222.31], EntityBat['Bat'/153, l='MpServer', x=-256.72, y=7.10, z=218.19], EntityBat['Bat'/154, l='MpServer', x=-229.58, y=7.89, z=216.11], EntitySlime['Slime'/155, l='MpServer', x=-272.69, y=6.00, z=221.88], EntitySlime['Slime'/156, l='MpServer', x=-268.69, y=4.05, z=233.69], EntitySlime['Slime'/157, l='MpServer', x=-265.81, y=6.00, z=224.38], EntitySlime['Slime'/158, l='MpServer', x=-259.31, y=4.00, z=248.69], EntitySlime['Slime'/37166, l='MpServer', x=-280.50, y=4.95, z=265.72], EntitySlime['Slime'/180, l='MpServer', x=-270.00, y=4.00, z=176.72], EntityVillager['Villager'/181, l='MpServer', x=-245.88, y=4.00, z=192.41], EntitySlime['Slime'/182, l='MpServer', x=-251.78, y=4.00, z=200.88], EntityCreeper['Creeper'/183, l='MpServer', x=-241.44, y=9.00, z=196.06], EntityVillager['Villager'/184, l='MpServer', x=-249.75, y=4.00, z=212.28], EntityZombie['Zombie'/185, l='MpServer', x=-251.50, y=3.85, z=228.31], EntitySlime['Slime'/186, l='MpServer', x=-251.22, y=5.00, z=232.22], EntitySlime['Slime'/187, l='MpServer', x=-244.63, y=4.00, z=232.38], EntitySlime['Slime'/188, l='MpServer', x=-249.00, y=5.81, z=232.38], EntitySlime['Slime'/53436, l='MpServer', x=-247.95, y=4.00, z=286.23], EntitySlime['Slime'/189, l='MpServer', x=-247.51, y=6.00, z=236.13], EntitySlime['Slime'/190, l='MpServer', x=-241.78, y=4.00, z=228.22], EntitySlime['Slime'/191, l='MpServer', x=-251.78, y=4.00, z=251.22], EntitySlime['Slime'/53439, l='MpServer', x=-239.22, y=4.00, z=285.16], EntitySlime['Slime'/192, l='MpServer', x=-248.29, y=4.00, z=251.63], EntityBat['Bat'/193, l='MpServer', x=-255.28, y=8.10, z=248.59], EntityItem['item.item.wheat'/194, l='MpServer', x=-242.75, y=5.13, z=263.94], EntityItem['item.item.seeds'/195, l='MpServer', x=-242.56, y=5.13, z=264.34], EntityItem['item.item.wheat'/196, l='MpServer', x=-247.03, y=4.13, z=266.13], EntityItem['item.item.potato'/197, l='MpServer', x=-246.19, y=5.13, z=267.25], EntitySlime['Slime'/198, l='MpServer', x=-255.31, y=4.85, z=256.31], EntitySlime['Slime'/199, l='MpServer', x=-244.30, y=4.18, z=251.63], EntitySlime['Slime'/200, l='MpServer', x=-227.84, y=4.00, z=264.28], EntityPig['Pig'/209, l='MpServer', x=-237.81, y=4.00, z=175.06], EntitySlime['Slime'/210, l='MpServer', x=-228.78, y=4.00, z=205.78], EntitySlime['Slime'/211, l='MpServer', x=-220.03, y=4.61, z=177.07], EntitySlime['Slime'/212, l='MpServer', x=-236.38, y=4.00, z=215.63], EntitySlime['Slime'/213, l='MpServer', x=-228.78, y=5.96, z=217.67], EntitySlime['Slime'/214, l='MpServer', x=-236.38, y=4.96, z=218.91], EntitySlime['Slime'/215, l='MpServer', x=-236.38, y=4.18, z=217.33], EntityPig['Pig'/87, l='MpServer', x=-317.19, y=4.00, z=284.03], EntitySlime['Slime'/216, l='MpServer', x=-234.85, y=4.81, z=216.38], EntitySlime['Slime'/217, l='MpServer', x=-227.65, y=4.47, z=215.85], EntitySlime['Slime'/218, l='MpServer', x=-233.65, y=4.00, z=221.63], EntitySlime['Slime'/219, l='MpServer', x=-226.14, y=4.05, z=216.63], EntityItem['item.item.slimeball'/220, l='MpServer', x=-236.78, y=4.13, z=220.81], EntitySlime['Slime'/221, l='MpServer', x=-235.80, y=4.00, z=222.26], EntitySlime['Slime'/222, l='MpServer', x=-239.70, y=5.00, z=232.69], EntitySlime['Slime'/223, l='MpServer', x=-236.38, y=5.00, z=233.38], EntitySlime['Slime'/224, l='MpServer', x=-233.78, y=5.00, z=232.78], EntitySlime['Slime'/225, l='MpServer', x=-238.83, y=5.00, z=232.69], EntitySlime['Slime'/226, l='MpServer', x=-235.78, y=5.99, z=228.53], EntitySlime['Slime'/227, l='MpServer', x=-227.05, y=4.00, z=226.13], EntityHorse['Donkey'/228, l='MpServer', x=-231.97, y=4.00, z=262.88], EntityChicken['Chicken'/229, l='MpServer', x=-234.31, y=4.00, z=285.66], EntitySlime['Slime'/106, l='MpServer', x=-308.84, y=4.99, z=214.34], EntitySlime['Slime'/236, l='MpServer', x=-233.65, y=4.14, z=167.59], EntitySlime['Slime'/237, l='MpServer', x=-220.66, y=4.00, z=208.69], EntitySlime['Slime'/238, l='MpServer', x=-217.61, y=4.00, z=208.38], EntitySlime['Slime'/239, l='MpServer', x=-212.75, y=4.00, z=200.90], EntitySlime['Slime'/240, l='MpServer', x=-211.06, y=4.00, z=210.31], EntitySlime['Slime'/241, l='MpServer', x=-219.43, y=4.00, z=208.36], EntitySlime['Slime'/242, l='MpServer', x=-195.94, y=4.00, z=225.75], EntityHorse['Donkey'/243, l='MpServer', x=-212.72, y=4.00, z=273.88], EntitySlime['Slime'/116, l='MpServer', x=-272.31, y=4.00, z=233.69], EntitySlime['Slime'/117, l='MpServer', x=-273.66, y=5.85, z=226.50], EntitySlime['Slime'/118, l='MpServer', x=-278.13, y=6.00, z=271.31], EntitySlime['Slime'/119, l='MpServer', x=-276.69, y=6.00, z=269.88], EntityCow['Cow'/248, l='MpServer', x=-190.19, y=4.00, z=235.81], EntitySlime['Slime'/120, l='MpServer', x=-270.59, y=5.00, z=277.97], EntitySlime['Slime'/249, l='MpServer', x=-189.02, y=4.00, z=288.24], EntitySlime['Slime'/250, l='MpServer', x=-200.89, y=4.00, z=284.35]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2567)

at net.minecraft.client.Minecraft.run(Minecraft.java:983)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_60, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 694474048 bytes (662 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)

UCHIJAAAA Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)

UCHIJAAAA ClockworkTinkering{0.0} [Clockwork Tinkering] (bin)

GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 354.35' Renderer: 'GeForce GTX 860M/PCIe/SSE2'

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: GeForce GTX 860M/PCIe/SSE2 GL version 4.5.0 NVIDIA 354.35, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

 

while(awake)

{

    coffee++;

}

Link to comment
Share on other sites

ArrayList#indexOf

will return -1 if the list doesn't contain the element. Calling

ArrayList#remove

with -1 will throw an exception (as you've seen).

 

You need to figure out why

bookmarkKeys

doesn't contain the return value of

getNotesKey()

or at least correctly handle the list not containing the element.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

ArrayList#indexOf

will return -1 if the list doesn't contain the element. Calling

ArrayList#remove

with -1 will throw an exception (as you've seen).

 

You need to figure out why

bookmarkKeys

doesn't contain the return value of

getNotesKey()

or at least correctly handle the list not containing the element.

 

I have absolutely no idea why the arraylist is not containing the return for getNotesKey()... I can't find it :L

while(awake)

{

    coffee++;

}

Link to comment
Share on other sites

Debug it. Take a look at where the content should have been added and find out why it isn't being added. This method is slow, but it alwayes works in the end.  :P

I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.