Fix potential shading issue in GuiEditArrayEntries. Closes #3247
This commit is contained in:
parent
45097fed0c
commit
b879cc9b73
2 changed files with 19 additions and 16 deletions
|
@ -64,7 +64,7 @@
|
|||
+ if (this.capabilities != null)
|
||||
+ {
|
||||
+ NBTTagCompound cnbt = this.capabilities.serializeNBT();
|
||||
+ if (!cnbt.func_82582_d()) p_77955_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
|
||||
+ if (!cnbt.func_82582_d()) p_77955_1_.func_74782_a("ForgeCaps", cnbt);
|
||||
+ }
|
||||
+
|
||||
return p_77955_1_;
|
||||
|
|
|
@ -43,7 +43,6 @@ import static net.minecraftforge.fml.client.config.GuiUtils.VALID;
|
|||
public class GuiEditArrayEntries extends GuiListExtended
|
||||
{
|
||||
protected GuiEditArray owningGui;
|
||||
public Minecraft mc;
|
||||
public IConfigElement configElement;
|
||||
public List<IArrayEntry> listEntries;
|
||||
public boolean isDefault;
|
||||
|
@ -57,7 +56,6 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
{
|
||||
super(mc, parent.width, parent.height, parent.titleLine2 != null ? (parent.titleLine3 != null ? 43 : 33) : 23, parent.height - 32, 20);
|
||||
this.owningGui = parent;
|
||||
this.mc = mc;
|
||||
this.configElement = configElement;
|
||||
this.beforeValues = beforeValues;
|
||||
this.currentValues = currentValues;
|
||||
|
@ -281,6 +279,11 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
entry.drawToolTip(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public Minecraft getMC()
|
||||
{
|
||||
return this.mc;
|
||||
}
|
||||
|
||||
/**
|
||||
* IGuiListEntry Inner Classes
|
||||
*/
|
||||
|
@ -405,7 +408,7 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
public StringEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
this.textFieldValue = new GuiTextField(0, owningEntryList.mc.fontRendererObj, owningEntryList.width / 4 + 1, 0, owningEntryList.controlWidth - 3, 16);
|
||||
this.textFieldValue = new GuiTextField(0, owningEntryList.getMC().fontRendererObj, owningEntryList.width / 4 + 1, 0, owningEntryList.controlWidth - 3, 16);
|
||||
this.textFieldValue.setMaxStringLength(10000);
|
||||
this.textFieldValue.setText(value.toString());
|
||||
this.isValidated = configElement.getValidationPattern() != null;
|
||||
|
@ -499,15 +502,15 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
this.btnValue.displayString = String.valueOf(value);
|
||||
btnValue.packedFGColour = value ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
|
||||
|
||||
this.btnValue.drawButton(owningEntryList.mc, mouseX, mouseY);
|
||||
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int index, int x, int y, int mouseEvent, int relativeX, int relativeY)
|
||||
{
|
||||
if (this.btnValue.mousePressed(owningEntryList.mc, x, y))
|
||||
if (this.btnValue.mousePressed(owningEntryList.getMC(), x, y))
|
||||
{
|
||||
btnValue.playPressSound(owningEntryList.mc.getSoundHandler());
|
||||
btnValue.playPressSound(owningEntryList.getMC().getSoundHandler());
|
||||
value = !value;
|
||||
owningEntryList.recalculateState();
|
||||
return true;
|
||||
|
@ -566,10 +569,10 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
|
||||
{
|
||||
if (this.getValue() != null && this.isValidated)
|
||||
owningEntryList.mc.fontRendererObj.drawString(
|
||||
owningEntryList.getMC().fontRendererObj.drawString(
|
||||
isValidValue ? TextFormatting.GREEN + VALID : TextFormatting.RED + INVALID,
|
||||
listWidth / 4 - owningEntryList.mc.fontRendererObj.getStringWidth(VALID) - 2,
|
||||
y + slotHeight / 2 - owningEntryList.mc.fontRendererObj.FONT_HEIGHT / 2,
|
||||
listWidth / 4 - owningEntryList.getMC().fontRendererObj.getStringWidth(VALID) - 2,
|
||||
y + slotHeight / 2 - owningEntryList.getMC().fontRendererObj.FONT_HEIGHT / 2,
|
||||
16777215);
|
||||
|
||||
int half = listWidth / 2;
|
||||
|
@ -578,7 +581,7 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
this.btnAddNewEntryAbove.visible = true;
|
||||
this.btnAddNewEntryAbove.xPosition = half + ((half / 2) - 44);
|
||||
this.btnAddNewEntryAbove.yPosition = y;
|
||||
this.btnAddNewEntryAbove.drawButton(owningEntryList.mc, mouseX, mouseY);
|
||||
this.btnAddNewEntryAbove.drawButton(owningEntryList.getMC(), mouseX, mouseY);
|
||||
}
|
||||
else
|
||||
this.btnAddNewEntryAbove.visible = false;
|
||||
|
@ -588,7 +591,7 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
this.btnRemoveEntry.visible = true;
|
||||
this.btnRemoveEntry.xPosition = half + ((half / 2) - 22);
|
||||
this.btnRemoveEntry.yPosition = y;
|
||||
this.btnRemoveEntry.drawButton(owningEntryList.mc, mouseX, mouseY);
|
||||
this.btnRemoveEntry.drawButton(owningEntryList.getMC(), mouseX, mouseY);
|
||||
}
|
||||
else
|
||||
this.btnRemoveEntry.visible = false;
|
||||
|
@ -607,16 +610,16 @@ public class GuiEditArrayEntries extends GuiListExtended
|
|||
@Override
|
||||
public boolean mousePressed(int index, int x, int y, int mouseEvent, int relativeX, int relativeY)
|
||||
{
|
||||
if (this.btnAddNewEntryAbove.mousePressed(owningEntryList.mc, x, y))
|
||||
if (this.btnAddNewEntryAbove.mousePressed(owningEntryList.getMC(), x, y))
|
||||
{
|
||||
btnAddNewEntryAbove.playPressSound(owningEntryList.mc.getSoundHandler());
|
||||
btnAddNewEntryAbove.playPressSound(owningEntryList.getMC().getSoundHandler());
|
||||
owningEntryList.addNewEntry(index);
|
||||
owningEntryList.recalculateState();
|
||||
return true;
|
||||
}
|
||||
else if (this.btnRemoveEntry.mousePressed(owningEntryList.mc, x, y))
|
||||
else if (this.btnRemoveEntry.mousePressed(owningEntryList.getMC(), x, y))
|
||||
{
|
||||
btnRemoveEntry.playPressSound(owningEntryList.mc.getSoundHandler());
|
||||
btnRemoveEntry.playPressSound(owningEntryList.getMC().getSoundHandler());
|
||||
owningEntryList.removeEntry(index);
|
||||
owningEntryList.recalculateState();
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue