mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-26 23:03:15 +00:00
Fix clicking on things that change the page also processing the new page for clicks, resulting in double-forwards with one click
This commit is contained in:
1 parent
72ebc15a1e
commit
94cbdffb02
1 file changed
+10
-2
@@ -1,5 +1,7 @@
|
||||
package slimeknights.mantle.client.gui.book;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -20,6 +22,7 @@ import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -558,9 +561,14 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
|
||||
}
|
||||
|
||||
// Not foreach to prevent conmodification crashes
|
||||
for(int i = 0; right ? i < rightElements.size() : i < leftElements.size(); i++) {
|
||||
BookElement element = right ? rightElements.get(i) : leftElements.get(i);
|
||||
int oldPage = page;
|
||||
List<BookElement> elementList = ImmutableList.copyOf(right ? rightElements: leftElements);
|
||||
for(BookElement element : elementList) {
|
||||
element.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
// if we changed page stop so we don't act on the new page
|
||||
if(page != oldPage) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user