Skip to content

Commit

Permalink
Some patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Sep 12, 2024
1 parent c443ba7 commit 64f25df
Show file tree
Hide file tree
Showing 171 changed files with 2,955 additions and 536 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
13 changes: 7 additions & 6 deletions patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
}

this.checkStatus();
@@ -258,4 +_,27 @@
@@ -257,5 +_,28 @@

public int getDepthTextureId() {
return this.depthBufferId;
}
+ }
+
+ /*================================ FORGE START ================================================*/
+ // Neo: Injected stencil control
+ private boolean stencilEnabled = false;
+
+ /**
+ * Attempts to enable 8 bits of stencil buffer on this FrameBuffer.
+ * Modders must call this directly to set things up.
Expand All @@ -46,11 +48,10 @@
+ }
+
+ /**
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * Returns whether this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled() {
+ return this.stencilEnabled;
+ }
+ /*================================ FORGE END ================================================*/
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
@@ -127,7 +_,7 @@
private void drawIcons(GuiGraphics p_282966_) {
int i = this.numberOfPendingInvites;
int j = 24;
- int k = this.height / 4 + 48;
+ int k = this.height / 4 + (inTitleScreen() ? 32 : 48);
int l = this.width / 2 + 100;
int i1 = k + 48 + 2;
int j1 = l - 3;
10 changes: 8 additions & 2 deletions patches/net/minecraft/CrashReportCategory.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
return this.stackTrace.length;
}
}
@@ -165,16 +_,16 @@
@@ -165,16 +_,22 @@

if (this.stackTrace != null && this.stackTrace.length > 0) {
p_128169_.append("\nStacktrace:");
Expand All @@ -30,8 +30,14 @@
return this.stackTrace;
+ }
+
+ /** @deprecated Neo: Use {@link #setStackTrace(StackTraceElement[])} instead. */
+ @Deprecated(forRemoval = true, since = "1.21.1")
+ public void applyStackTrace(Throwable t) {
+ this.stackTrace = t.getStackTrace();
+ setStackTrace(t.getStackTrace());
+ }
+
+ public void setStackTrace(StackTraceElement[] stackTrace) {
+ this.stackTrace = stackTrace;
}

public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
12 changes: 7 additions & 5 deletions patches/net/minecraft/client/KeyMapping.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,18 @@
}

public String saveString() {
@@ -177,4 +_,84 @@
@@ -176,5 +_,86 @@

public void setDown(boolean p_90846_) {
this.isDown = p_90846_;
}
+ }
+
+ /****************** Forge Start *****************************/
+ // Neo: Injected Key Mapping controls
+ private net.neoforged.neoforge.client.settings.KeyModifier keyModifierDefault = net.neoforged.neoforge.client.settings.KeyModifier.NONE;
+ private net.neoforged.neoforge.client.settings.KeyModifier keyModifier = net.neoforged.neoforge.client.settings.KeyModifier.NONE;
+ private net.neoforged.neoforge.client.settings.IKeyConflictContext keyConflictContext = net.neoforged.neoforge.client.settings.KeyConflictContext.UNIVERSAL;
+
+ // Neo: Injected Key Mapping constructors to assist modders
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
Expand Down Expand Up @@ -146,6 +148,7 @@
+ CATEGORIES.add(category);
+ }
+
+ // Neo: Implemented IKeyMappingExtension methods into vanilla
+ @Override
+ public InputConstants.Key getKey() {
+ return this.key;
Expand Down Expand Up @@ -179,6 +182,5 @@
+ MAP.remove(this);
+ this.keyModifier = keyModifier;
+ MAP.put(keyCode, this);
+ }
+ /****************** Forge End *****************************/
}
}
20 changes: 0 additions & 20 deletions patches/net/minecraft/client/KeyboardHandler.java.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -366,7 +_,9 @@
}
}

- if (p_90897_ == 1 && (!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
+
+ if ((!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
+ if (p_90897_ == 1) {
if (this.minecraft.options.keyFullscreen.matches(p_90895_, p_90896_)) {
this.minecraft.getWindow().toggleFullScreen();
this.minecraft.options.fullscreen().set(this.minecraft.getWindow().isFullscreen());
@@ -384,6 +_,8 @@
);
return;
}
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof KeyBindsScreen && net.neoforged.neoforge.client.settings.KeyModifier.getActiveModifier() != net.neoforged.neoforge.client.settings.KeyModifier.NONE)
+ ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers.
}

if (p_90897_ != 0) {
@@ -407,9 +_,13 @@
Screen.wrapScreenError(() -> {
if (p_90897_ == 1 || p_90897_ == 2) {
Expand Down
13 changes: 6 additions & 7 deletions patches/net/minecraft/client/Minecraft.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,11 @@
);
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
}
@@ -663,6 +_,11 @@
@@ -663,6 +_,8 @@
runnable = () -> this.setScreen(screen);
}

+ if (net.neoforged.neoforge.client.loading.ClientModLoader.completeModLoading())
+ {
+ runnable = () -> { }; //Forge: Do not override the error screen
+ }
+ runnable = net.neoforged.neoforge.client.loading.ClientModLoader.completeModLoading(runnable);
+
return runnable;
}
Expand Down Expand Up @@ -329,14 +326,16 @@
}

private boolean isLevelRunningNormally() {
@@ -2056,6 +_,7 @@
@@ -2056,7 +_,8 @@
}

public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_341652_) {
- this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_341652_));
+ if (this.level != null) net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(new net.neoforged.neoforge.event.level.LevelEvent.Unload(this.level));
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_341652_));
+ this.updateScreenAndTick(net.neoforged.neoforge.client.DimensionTransitionScreenManager.getScreenFromLevel(p_91157_, this.level).create(() -> false, p_341652_));
this.level = p_91157_;
this.updateLevelInEngines(p_91157_);
if (!this.isLocalServer) {
@@ -2093,6 +_,7 @@
IntegratedServer integratedserver = this.singleplayerServer;
this.singleplayerServer = null;
Expand Down
28 changes: 26 additions & 2 deletions patches/net/minecraft/client/gui/Gui.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@
int j;
if (this.animateOverlayMessageColor) {
j = Mth.hsvToArgb(f / 50.0F, 0.7F, 0.6F, i);
@@ -323,9 +_,19 @@
private void renderChat(GuiGraphics p_316307_, DeltaTracker p_348631_) {
if (!this.chat.isChatFocused()) {
Window window = this.minecraft.getWindow();
+ // Neo: Allow customizing position of chat component
+ var chatBottomMargin = 40; // See ChatComponent#BOTTOM_MARGIN (used in translate calls in ChatComponent#render)
+ var event = net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(
+ new net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.Chat(window, p_316307_, p_348631_, 0, p_316307_.guiHeight() - chatBottomMargin)
+ );
+
+ // The event is given the absolute Y position; account for chat component's own offsetting here
+ p_316307_.pose().pushPose();
+ p_316307_.pose().translate(event.getPosX(), (event.getPosY() - p_316307_.guiHeight() + chatBottomMargin) / this.chat.getScale(), 0.0F);
int i = Mth.floor(this.minecraft.mouseHandler.xpos() * (double)window.getGuiScaledWidth() / (double)window.getScreenWidth());
int j = Mth.floor(this.minecraft.mouseHandler.ypos() * (double)window.getGuiScaledHeight() / (double)window.getScreenHeight());
this.chat.render(p_316307_, this.tickCount, i, j, false);
+ p_316307_.pose().popPose();
}
}

@@ -441,6 +_,8 @@
List<Runnable> list = Lists.newArrayListWithExpectedSize(collection.size());

Expand Down Expand Up @@ -242,7 +262,7 @@

private void renderDemoOverlay(GuiGraphics p_281825_, DeltaTracker p_348679_) {
- if (this.minecraft.isDemo()) {
+ if (this.minecraft.isDemo() && !this.getDebugOverlay().showDebugScreen()) { // NEO: Hide demo timer when F3 debug overlay is open; fixes MC-271166
+ if (this.minecraft.isDemo() && !this.getDebugOverlay().showDebugScreen()) { // Neo: Hide demo timer when F3 debug overlay is open; fixes MC-271166
this.minecraft.getProfiler().push("demo");
Component component;
if (this.minecraft.level.getGameTime() >= 120500L) {
Expand Down Expand Up @@ -370,14 +390,18 @@
this.toolHighlightTimer = (int)(40.0 * this.minecraft.options.notificationDisplayTime().get());
} else if (this.toolHighlightTimer > 0) {
this.toolHighlightTimer--;
@@ -1292,8 +_,13 @@
@@ -1292,8 +_,17 @@
}
}

+ @org.jetbrains.annotations.ApiStatus.Internal
+ public void initModdedOverlays() {
+ this.layerManager.initModdedLayers();
+ }
+
+ public int getLayerCount() {
+ return this.layerManager.getLayerCount();
+ }
+
@OnlyIn(Dist.CLIENT)
- public static enum HeartType {
Expand Down
9 changes: 8 additions & 1 deletion patches/net/minecraft/client/gui/GuiGraphics.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
}

@@ -894,7 +_,15 @@
@@ -894,7 +_,22 @@
}

public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
Expand All @@ -78,6 +78,13 @@
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.neoforged.neoforge.client.ClientHooks.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
+ this.tooltipStack = ItemStack.EMPTY;
+ }
+
+ public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) {
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.neoforged.neoforge.client.ClientHooks.gatherTooltipComponentsFromElements(stack, elements, mouseX, guiWidth(), guiHeight(), font);
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
+ this.tooltipStack = ItemStack.EMPTY;
}

Expand Down
13 changes: 13 additions & 0 deletions patches/net/minecraft/client/gui/MapRenderer.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/net/minecraft/client/gui/MapRenderer.java
+++ b/net/minecraft/client/gui/MapRenderer.java
@@ -122,6 +_,10 @@

for (MapDecoration mapdecoration : this.data.getDecorations()) {
if (!p_93294_ || mapdecoration.renderOnFrame()) {
+ if (net.neoforged.neoforge.client.gui.map.MapDecorationRendererManager.render(mapdecoration, p_93292_, p_93293_, data, MapRenderer.this.decorationTextures, p_93294_, p_93295_, k)) {
+ k++;
+ continue;
+ }
p_93292_.pushPose();
p_93292_.translate(0.0F + (float)mapdecoration.x() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.y() / 2.0F + 64.0F, -0.02F);
p_93292_.mulPose(Axis.ZP.rotationDegrees((float)(mapdecoration.rot() * 360) / 16.0F));
Original file line number Diff line number Diff line change
@@ -1,42 +1,60 @@
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
@@ -135,8 +_,13 @@
@@ -135,8 +_,15 @@
this.block = entity.pick(20.0, 0.0F, false);
this.liquid = entity.pick(20.0, 0.0F, true);
p_281427_.drawManaged(() -> {
- this.drawGameInformation(p_281427_);
- this.drawSystemInformation(p_281427_);
+ final List<String> gameInformation = new java.util.ArrayList<>();
+ final List<String> systemInformation = new java.util.ArrayList<>();
+ final List<String> gameInformation = this.collectGameInformationText();
+ final List<String> systemInformation = this.collectSystemInformationText();
+
+ var event = new net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.DebugText(minecraft.getWindow(), p_281427_, minecraft.getTimer(), gameInformation, systemInformation);
+ net.neoforged.neoforge.common.NeoForge.EVENT_BUS.post(event);
+
+ this.drawGameInformation(p_281427_, gameInformation);
+ this.drawSystemInformation(p_281427_, systemInformation);
+ this.renderLines(p_281427_, gameInformation, true);
+ this.renderLines(p_281427_, systemInformation, false);
+
if (this.renderFpsCharts) {
int i = p_281427_.guiWidth();
int j = i / 2;
@@ -161,7 +_,7 @@
@@ -161,7 +_,11 @@
this.minecraft.getProfiler().pop();
}

- protected void drawGameInformation(GuiGraphics p_281525_) {
+ protected void drawGameInformation(GuiGraphics p_281525_, List<String> gameInformation) {
+ /**
+ * Neo: Extracted body of {@link DebugScreenOverlay#drawGameInformation} to return game information
+ * without drawing for {@link net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.DebugText} to modify
+ */
+ protected List<String> collectGameInformationText() {
List<String> list = this.getGameInformation();
list.add("");
boolean flag = this.minecraft.getSingleplayerServer() != null;
@@ -176,11 +_,13 @@
@@ -176,11 +_,25 @@
+ (this.renderNetworkCharts ? " visible" : " hidden")
);
list.add("For help: press F3 + Q");
+ list.addAll(gameInformation);
+ return list;
+ }
+
+ protected void drawGameInformation(GuiGraphics p_281525_) {
+ List<String> list = this.collectGameInformationText();
this.renderLines(p_281525_, list, true);
}

- protected void drawSystemInformation(GuiGraphics p_281261_) {
+ protected void drawSystemInformation(GuiGraphics p_281261_, List<String> systemInformation) {
+ /**
+ * Neo: Extracted body of {@link DebugScreenOverlay#drawSystemInformation} to return system information
+ * without drawing for {@link net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.DebugText} to modify
+ */
+ protected List<String> collectSystemInformationText() {
List<String> list = this.getSystemInformation();
+ list.addAll(systemInformation);
+ return list;
+ }
+
+ protected void drawSystemInformation(GuiGraphics p_281261_) {
+ List<String> list = this.collectSystemInformationText();
this.renderLines(p_281261_, list, false);
}

Expand Down
Loading

0 comments on commit 64f25df

Please sign in to comment.