Jump to content

Recommended Posts

Posted

I got this when I closed my GUI.

 

 

[10:59:23] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: ---- Minecraft Crash Report ----

// I just don't know what went wrong :(

 

Time: 07/07/15 10:59

Description: Updating screen events

 

java.util.ConcurrentModificationException

at com.google.common.collect.HashBiMap$Itr.checkForConcurrentModification(HashBiMap.java:339)

at com.google.common.collect.HashBiMap$Itr.hasNext(HashBiMap.java:345)

at net.minecraft.client.audio.SoundManager.resumeAllSounds(SoundManager.java:483)

at net.minecraft.client.audio.SoundHandler.resumeSounds(SoundHandler.java:261)

at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:988)

at net.minecraft.client.Minecraft.setIngameFocus(Minecraft.java:1431)

at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:989)

at com.fredtargaryen.floocraft.client.gui.GuiTeleport.actionPerformed(GuiTeleport.java:119)

at com.fredtargaryen.floocraft.client.gui.GuiTeleport.actionPerformed(GuiTeleport.java:153)

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

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

at com.fredtargaryen.floocraft.client.gui.GuiTeleport.handleMouseInput(GuiTeleport.java:243)

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

 

 

But here's the GuiTeleport file:

 

 

package com.fredtargaryen.floocraft.client.gui;

import com.fredtargaryen.floocraft.DataReference;
import com.fredtargaryen.floocraft.FloocraftBase;
import com.fredtargaryen.floocraft.network.PacketHandler;
import com.fredtargaryen.floocraft.network.messages.MessageFireplaceList;
import com.fredtargaryen.floocraft.network.messages.MessageFireplaceListRequest;
import com.fredtargaryen.floocraft.network.messages.MessageTeleportEntity;
import com.fredtargaryen.floocraft.proxy.ClientProxy;
import com.google.common.collect.Lists;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@SideOnly(Side.CLIENT)
public class GuiTeleport extends GuiScreen
{
/** The title string that is displayed in the top-centre of the screen. */ protected String screenTitle = "===Choose a destination===";
private String status;

//"Go!".
private GuiButton goBtn;
//"Cancel"
private GuiButton cancelBtn;

private List<String> placenamelist = new ArrayList<String>();
private List<Integer> xcoordlist = new ArrayList<Integer>();
private List<Integer> ycoordlist = new ArrayList<Integer>();
private List<Integer> zcoordlist = new ArrayList<Integer>();
private List<Boolean> enabledlist = new ArrayList<Boolean>();

private boolean receivedLists;

private PlaceList scrollWindow;

private int initX, initY, initZ;

public GuiTeleport(int x, int y, int z)
{
this.initX = x;
this.initY = y;
this.initZ = z;
this.refresh();
}

/** * Adds the buttons (and other controls) to the screen in question. */ public void initGui()
{
this.buttonList.clear();
Keyboard.enableRepeatEvents(true);
GuiButton refreshButton = new GuiButton(-2, this.width - 100, 0, 98, 20, "Refresh");
refreshButton.enabled = false;
this.buttonList.add(this.goBtn = new GuiButton(-3, this.width / 2 - 100, this.height / 4 + 144, 98, 20, "Go!"));
this.goBtn.enabled = false;
this.buttonList.add(this.cancelBtn = new GuiButton(-1, this.width / 2 + 2, this.height / 4 + 144, 98, 20, "Cancel"));
if (receivedLists)
{
refreshButton.enabled = true;
this.scrollWindow = new PlaceList();
}
this.buttonList.add(refreshButton);
}

/** * Called when the screen is unloaded. Used to disable keyboard repeat events */ public void onGuiClosed()
{
ClientProxy proxy = (ClientProxy) FloocraftBase.proxy;
Keyboard.enableRepeatEvents(false);
proxy.overrideTicker.start();
}

/** * Called from the main game loop to update the screen. */ public void updateScreen()
{
super.updateScreen();
if (!this.receivedLists)
{
this.status = "Loading...";
}
else //if the lists were received...
{
//if they are empty...
if (this.placenamelist.size() == 0) {
this.status = "No places found";
} else {
this.status = "";
}
}
}

/** * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). */ protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.enabled)
{
//Cancel
if (par1GuiButton.id == -1)
{
((ClientProxy) FloocraftBase.proxy).overrideTicker.start();
this.mc.displayGuiScreen(null);
}
//Refresh
else if(par1GuiButton.id == -2)
{
this.refresh();
}
//Go!
else if(par1GuiButton.id == -3)
{
int initX = this.initX;
int initY = this.initY;
int initZ = this.initZ;
int destX = xcoordlist.get(this.scrollWindow.getSelectedElement());
int destY = ycoordlist.get(this.scrollWindow.getSelectedElement());
int destZ = zcoordlist.get(this.scrollWindow.getSelectedElement());
try
{
if(!(initX == destX && initY == destY && initZ == destZ))
{
MessageTeleportEntity m = new MessageTeleportEntity();
m.initX = initX;
m.initY = initY;
m.initZ = initZ;
m.destX = destX;
m.destY = destY;
m.destZ = destZ;
PacketHandler.INSTANCE.sendToServer(m);
}
}
catch(Exception e)
{
e.printStackTrace();
}
this.actionPerformed(GuiTeleport.this.cancelBtn);
}
}
}

/** * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ protected void keyTyped(char par1, int par2)
{
if (par2 == 1)
{
this.actionPerformed(this.cancelBtn);
}
}

/** * Draws the screen and all the components in it. */ @Override
@SideOnly(Side.CLIENT)
public void drawScreen(int mousex, int mousey, float partialticks)
{
this.drawCenteredString(this.fontRendererObj,
this.status,
this.width / 2,
this.height / 4 + 48,
13158600);
GL11.glPushMatrix();
GL11.glTranslatef((float) (this.width / 2), 0.0F, 50.0F);
float f1 = 93.75F;
GL11.glScalef(-f1, -f1, -f1);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glPopMatrix();
if (this.scrollWindow != null) {
this.scrollWindow.drawScreen(mousex, mousey, partialticks);
}
this.drawCenteredString(this.fontRendererObj,
this.screenTitle,
this.width / 2,
15,
16777215);
super.drawScreen(mousex, mousey, partialticks);
}

private void refresh()
{
this.placenamelist.clear();
this.xcoordlist.clear();
this.ycoordlist.clear();
this.zcoordlist.clear();
this.enabledlist.clear();
this.receivedLists = false;
this.initGui();
PacketHandler.INSTANCE.sendToServer(new MessageFireplaceListRequest());
}

public void onMessageReceived(MessageFireplaceList m)
{
try
{
this.placenamelist = m.placenamelist;
this.xcoordlist = m.xcoordlist;
this.ycoordlist = m.ycoordlist;
this.zcoordlist = m.zcoordlist;
this.enabledlist = m.enabledlist;
this.receivedLists = true;
}
catch(Exception ex)
{
ex.printStackTrace();
}
this.initGui();
}

/** * Returns true if this GUI should pause the game when it is displayed in single-player */ @Override
public boolean doesGuiPauseGame()
{
return false;
}

@Override
public void handleMouseInput()
{
try
{
this.scrollWindow.handleMouseInput();
super.handleMouseInput();
}
catch(IOException e)
{
e.printStackTrace();
}
}

@SideOnly(Side.CLIENT)
class PlaceList extends GuiSlot
{
private final java.util.List l = Lists.newArrayList();
private static final String __OBFID = "CL_00000699";

public PlaceList()
{
super(GuiTeleport.this.mc, GuiTeleport.this.width, GuiTeleport.this.height, 32, GuiTeleport.this.height - 65 + 4, 18);
this.setShowSelectionBox(true);
}

protected int getSize()
{
return GuiTeleport.this.placenamelist.size();
}

/** * The element in the slot that was clicked, boolean for whether it was double clicked or not */ protected void elementClicked(int id, boolean isDoubleClick, int mousex, int mousey)
{
GuiTeleport.this.goBtn.enabled = GuiTeleport.this.enabledlist.get(id);
}

/** * Returns true if the element passed in is currently selected */ protected boolean isSelected(int id)
{
return id == this.selectedElement;
}

/** * Return the height of the content being scrolled */ @Override
protected int getContentHeight()
{
return this.getSize() * 18;
}

@Override
protected void drawBackground(){}

@Override
protected void drawSlot(int id, int p_148126_2_, int p_148126_3_, int p_148126_4_, int p_148126_6_, int p_148126_7_)
{
GuiTeleport.this.drawCenteredString(GuiTeleport.this.fontRendererObj, GuiTeleport.this.placenamelist.get(id), this.width / 2, p_148126_3_ + 1, GuiTeleport.this.enabledlist.get(id) ? 65280 : 16711680);
}

@Override
public void drawScreen(int i, int j, float f)
{
super.drawScreen(i, j, f);
this.flooverlayBackground(0, this.top);
this.flooverlayBackground(this.bottom, this.height);
}
/** * Overlays the background to hide scrolled items */ private void flooverlayBackground(int p_148136_1_, int p_148136_2_)
{
WorldRenderer wr = Tessellator.getInstance().getWorldRenderer();
GuiTeleport.this.mc.getTextureManager().bindTexture(DataReference.TP_BACKGROUND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f = 32.0F;
wr.startDrawingQuads();
wr.addVertexWithUV((double)this.left, (double)p_148136_2_, 0.0D, 0.0D, (double)((float)p_148136_2_ / f));
wr.addVertexWithUV((double)(this.left + this.width), (double)p_148136_2_, 0.0D, (double)((float)this.width / f), (double)((float)p_148136_2_ / f));
wr.addVertexWithUV((double) (this.left + this.width), (double) p_148136_1_, 0.0D, (double) ((float) this.width / f), (double) ((float)p_148136_1_ / f));
wr.addVertexWithUV((double) this.left, (double) p_148136_1_, 0.0D, 0.0D, (double) ((float)p_148136_1_ / f));
Tessellator.getInstance().draw();
}

@Override
protected void drawContainerBackground(Tessellator tessellator)
{
}

public int getSelectedElement()
{
return this.selectedElement;
}
}
}

 

 

So I don't understand what I could have done wrong... Please can someone help?

 

Thanks for reading.

Posted

Are you using custom packets of some sort? You'd have to take nto account that packets are on another thread now, so you'd have to do something to make them work.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

It has nothing to do with sounds, at least not directly - ConcurrentModificationException happens when a single object is being modified from more than one place at the same time. This can happen especially easily with Collections (e.g. List), for example, even something as simple as the following might throw a CoMod:

List<String> list = new ArrayList<String>();
list.add("One");
list.add("Two");
for (String s : list) {
list.remove(s);
}

It only gets more likely if you have the same object being manipulated from more places, especially if you start involving other threads, and the same strategies apply for dealing with it.

 

In your particular case, your crash log pointed to #actionPerformed in your GUI class, instigated by a mouse click: com.fredtargaryen.floocraft.client.gui.GuiTeleport.actionPerformed(GuiTeleport.java:119)

 

I would look through all of the code that you call before and after that section, as well as if you have any other code operating on these (e.g. a tick handler) to see if you are modifying Collections somewhere, as that is probably the most common cause of CoMod exceptions.

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.