Skip to content

Commit

Permalink
Allow disabling text shadow in EditBox (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 authored Jul 18, 2024
1 parent 4f659c5 commit bfac3fb
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions patches/net/minecraft/client/gui/components/EditBox.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
--- a/net/minecraft/client/gui/components/EditBox.java
+++ b/net/minecraft/client/gui/components/EditBox.java
@@ -56,6 +_,7 @@
@Nullable
private Component hint;
private long focusedTime = Util.getMillis();
+ private boolean textShadow = true; // Neo: Allow modders to disable the default shadow for the text.

public EditBox(Font p_294485_, int p_294264_, int p_295938_, Component p_294624_) {
this(p_294485_, 0, 0, p_294264_, p_295938_, p_294624_);
@@ -383,7 +_,7 @@
int i1 = Mth.clamp(this.highlightPos - this.displayPos, 0, s.length());
if (!s.isEmpty()) {
String s1 = flag ? s.substring(0, i) : s;
- l = p_283252_.drawString(this.font, this.formatter.apply(s1, this.displayPos), j, k, l1);
+ l = p_283252_.drawString(this.font, this.formatter.apply(s1, this.displayPos), j, k, l1, this.textShadow);
}

boolean flag2 = this.cursorPos < this.value.length() || this.value.length() >= this.getMaxLength();
@@ -396,22 +_,22 @@
}

if (!s.isEmpty() && flag && i < s.length()) {
- p_283252_.drawString(this.font, this.formatter.apply(s.substring(i), this.cursorPos), l, k, l1);
+ p_283252_.drawString(this.font, this.formatter.apply(s.substring(i), this.cursorPos), l, k, l1, this.textShadow);
}

if (this.hint != null && s.isEmpty() && !this.isFocused()) {
- p_283252_.drawString(this.font, this.hint, l, k, l1);
+ p_283252_.drawString(this.font, this.hint, l, k, l1, this.textShadow);
}

if (!flag2 && this.suggestion != null) {
- p_283252_.drawString(this.font, this.suggestion, j1 - 1, k, -8355712);
+ p_283252_.drawString(this.font, this.suggestion, j1 - 1, k, -8355712, this.textShadow);
}

if (flag1) {
if (flag2) {
p_283252_.fill(RenderType.guiOverlay(), j1, k - 1, j1 + 1, k + 1 + 9, -3092272);
} else {
- p_283252_.drawString(this.font, "_", j1, k, l1);
+ p_283252_.drawString(this.font, "_", j1, k, l1, this.textShadow);
}
}

@@ -552,5 +_,13 @@

public void setHint(Component p_259584_) {
this.hint = p_259584_;
+ }
+
+ public void setTextShadow(boolean textShadow) {
+ this.textShadow = textShadow;
+ }
+
+ public boolean getTextShadow() {
+ return this.textShadow;
}
}

0 comments on commit bfac3fb

Please sign in to comment.