Changed alignment to a byte type, will add a centered alignment later.

This commit is contained in:
Luis C.M committed 2023-06-07 18:18:20 -05:00
1 parent 8fe331d621
commit 327fa061cc
2 files changed
+8 -5

No files matched your search

@@ -503,7 +503,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
int height = count - totalRows + lineOffset;
int screenPos = optionStart;
int y = (height * ClientProxy.Font.height()) + screenPos + scrollY;
if (!dialog.bottomAligned) {
if (dialog.alignment == 0) {
height = count - totalRows + lineOffset + 1;
screenPos = optionStart - dialog.textHeight + ClientProxy.Font.height() + (totalRows - lineOffset);
@@ -515,7 +515,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
}
if (block.titlePos == 0 || mainDialogText) {
if (!dialog.bottomAligned) {
if (dialog.alignment == 0) {
if (y < optionStart - dialog.textHeight || y > optionStart - ClientProxy.Font.height()/2f) {
return;
}
@@ -584,7 +584,7 @@ public class GuiDialogInteract extends GuiNPCInterface implements IGuiClose
textSoundEnabled = !textSoundEnabled;
}
if (!dialog.bottomAligned && totalRows * ClientProxy.Font.height() > dialog.textHeight) {
if (dialog.alignment == 0 && totalRows * ClientProxy.Font.height() > dialog.textHeight) {
if ((i == mc.gameSettings.keyBindBack.getKeyCode() || i == 201) && scrollY < totalRows * ClientProxy.Font.height()) {//Page up
scrollY += ClientProxy.Font.height() * 2;
}
@@ -38,7 +38,9 @@ public class Dialog implements ICompatibilty, IDialog {
public boolean disableEsc = false;
public boolean darkenScreen = true;
public boolean showOptionLine = true;
public boolean bottomAligned = false;
//0 - Top, 1 - Bottom, 2 (Not implemented yet) - Center
public byte alignment = 0;
public boolean renderGradual = false;
public boolean showPreviousBlocks = true;
@@ -97,7 +99,7 @@ public class Dialog implements ICompatibilty, IDialog {
darkenScreen = true;
}
bottomAligned = compound.getBoolean("DialogScrollUpwards");
alignment = compound.getByte("DialogAlignment");
NBTTagList options = compound.getTagList("Options", 10);
@@ -263,6 +265,7 @@ public class Dialog implements ICompatibilty, IDialog {
dialog.renderGradual = renderGradual;
dialog.showPreviousBlocks = showPreviousBlocks;
dialog.showOptionLine = showOptionLine;
dialog.alignment = alignment;
dialog.textSound = textSound;
dialog.textPitch = textPitch;
dialog.textWidth = textWidth;