Skip to content

Commit

Permalink
Added a different way to view snitch lists for certain snitches
Browse files Browse the repository at this point in the history
  • Loading branch information
MrLittleKitty committed Dec 3, 2016
1 parent 9bbda52 commit d1e9c53
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gmail.nuclearcat1337.snitch_master.gui;

import com.gmail.nuclearcat1337.snitch_master.snitches.Snitch;
import com.gmail.nuclearcat1337.snitch_master.snitches.SnitchList;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;

Expand Down Expand Up @@ -45,6 +46,14 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks)
temp.add(snitch.getWorld());
drawHoveringText(temp,mouseX,mouseY);
}
else if(mouseX >= snitchesGui.getNameLeftBound() && mouseX <= snitchesGui.getNameRightBound())
{
List<String> temp = new ArrayList<>(snitch.getAttachedSnitchLists().size()+1);
temp.add("Snitch Lists:");
for(SnitchList list : snitch.getAttachedSnitchLists())
temp.add(list.getListName());
drawHoveringText(temp,mouseX,mouseY);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class SnitchGui extends GuiListExtended
private final int coordsLeftBound;
private final int coordsRightBound;

private final int nameLeftBound;
private final int nameRightBound;

private int xOffset;

public SnitchGui(EditSnitchesGui parentScreen, Collection<Snitch> snitchesToDisplay)
Expand Down Expand Up @@ -90,6 +93,10 @@ public SnitchGui(EditSnitchesGui parentScreen, Collection<Snitch> snitchesToDisp
+ X_COLUMN_WIDTH + GuiConstants.SMALL_SEPARATION_DISTANCE
+ Y_COLUMN_WIDTH + GuiConstants.SMALL_SEPARATION_DISTANCE
+ Z_COLUMN_WIDTH;

this.nameLeftBound = 0;

this.nameRightBound = nameLeftBound + NAME_COLUMN_WIDTH;
//this.snitchListNameColumnLeftBound = entryWidth - SNITCH_LIST_COLUMN_WIDTH;
}

Expand Down Expand Up @@ -180,6 +187,16 @@ public int getCoordsRightBound()
return xOffset+coordsRightBound;
}

public int getNameLeftBound()
{
return xOffset + nameLeftBound;
}

public int getNameRightBound()
{
return xOffset + nameRightBound;
}

public Snitch getSnitchForIndex(int i)
{
return getListEntry(i).snitch;
Expand Down Expand Up @@ -262,13 +279,16 @@ public boolean mousePressed(int index, int xPos, int yPos, int mouseEvent, int r
{
if(mouseEvent == 1) //If its a right click
{
// int rightBound = snitchListNameColumnLeftBound + SNITCH_LIST_COLUMN_WIDTH;
// if(xPos >= snitchListNameColumnLeftBound && xPos <= rightBound) //Check if they right clicked in the name column
// {
// //Sorry im cheating by using the static instance but im lazy and its only 1 line right? right? :(
// mc.displayGuiScreen(new EditSnitchListsGui(cancelToScreen,SnitchMaster.instance,snitch.getAttachedSnitchLists(),false));
// return true;
// }
if(xPos >= getNameLeftBound() && xPos <= getNameRightBound()) //Check if they right clicked in the name column
{
//If this snitch has attached snitch lists and they right click on the name then display them
if(snitch.getAttachedSnitchLists().size() > 0)
{
//Sorry im cheating by using the static instance but im lazy and its only 1 line right? right? :(
mc.displayGuiScreen(new EditSnitchListsGui(cancelToScreen, SnitchMaster.instance, snitch.getAttachedSnitchLists(), false));
return true;
}
}
return false;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void chatParser(ClientChatReceivedEvent event)
String msgText = msg.getUnformattedText();
if(msgText != null)
{
SnitchMaster.logger.warning("Temp message " + msgText);
//Check if its the tps message (this is quick)
if(msgText.contains(tpsMessage))
parseTPS(msgText);
Expand Down

0 comments on commit d1e9c53

Please sign in to comment.