mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ccfaf4812 | ||
|
|
3ed3d2b9cf | ||
|
|
3d374fe732 | ||
|
|
a02f3f9841 | ||
|
|
c5e462f7d2 | ||
|
|
d1f79d6655 | ||
|
|
9d5e81b1a9 | ||
|
|
a1c275df46 | ||
|
|
4ef7fe8bd8 | ||
|
|
ce8838e721 | ||
|
|
b7e2593d48 | ||
|
|
33d177f02e | ||
|
|
5d2186df63 | ||
|
|
77af36b807 | ||
|
|
54eeca0aed | ||
|
|
3de0566425 | ||
|
|
a5ebf3b645 | ||
|
|
63d0496cc4 | ||
|
|
31f623e794 | ||
|
|
eb001a6382 | ||
|
|
504dcad849 | ||
|
|
81f7f029c3 | ||
|
|
207c1997c9 | ||
|
|
e348ae5b84 | ||
|
|
0f3b8ee830 | ||
|
|
b4b6e48a7a | ||
|
|
d50a3b5ab7 | ||
|
|
88904a1d09 | ||
|
|
b864faf0ef | ||
|
|
c97eabc0c4 |
No files matched your search
+1
-3
@@ -92,7 +92,7 @@ final String MAVEN_PATH = ext.MAVEN_PATH
|
||||
final String BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.2.0:fatjar'
|
||||
final String INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.3'
|
||||
final String FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.6'
|
||||
final String S2S_TOOL = 'net.minecraftforge:Srg2Source:8.1.0:fatjar'
|
||||
final String S2S_TOOL = 'net.minecraftforge:Srg2Source:8.1.1:fatjar'
|
||||
|
||||
configurations {
|
||||
// Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it.
|
||||
@@ -209,7 +209,6 @@ patcher {
|
||||
'--all',
|
||||
'--validate',
|
||||
'--output', rootProject.file('src/main/generated/'),
|
||||
'--validate',
|
||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||
'--assetsDir', downloadAssets.output,
|
||||
'--assetIndex', "{asset_index}"
|
||||
@@ -232,7 +231,6 @@ patcher {
|
||||
args '--launchTarget', 'forge_dev_client_data',
|
||||
'--mod', 'forge',
|
||||
'--all',
|
||||
'--validate',
|
||||
'--output', rootProject.file('src/main/generated/'),
|
||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||
'--assetsDir', downloadAssets.output,
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ tasks.withType(JavaCompile).configureEach {
|
||||
dependsOn 'processResources' // Needed because we merge the output of this with the output of the compile task. And gradle detects downstream tasks using the output without a hard dep
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
options.warnings = false // Shutup deprecated for removal warnings
|
||||
options.forkOptions.jvmArgs += '-Xmx3G' // Needed to make compiling faster, and not run out of heap space in some cases.
|
||||
options.forkOptions.jvmArgs += '-Xmx6G' // Needed to make compiling faster, and not run out of heap space in some cases.
|
||||
}
|
||||
|
||||
// Merge the resources and classes into the same directory. We'll need to split them at runtime because
|
||||
|
||||
+8
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[][Download]
|
||||
[][Download]
|
||||
[][Download] [][Discord] [][Patreon]
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
@@ -70,6 +70,11 @@ Please ensure you have a valid email address associated with your GitHub account
|
||||
to use and modify. However, it costs money to run such a large project as this, so please consider
|
||||
[becoming a patron][Patreon].*
|
||||
|
||||
### Thanks
|
||||
[](https://www.yourkit.com/)
|
||||
|
||||
YourKit for providing us accesss to their [YourKit Java Profiler] which helps identify bottlenecks and places for improvment.
|
||||
|
||||
[Contributing]: ./CONTRIBUTING.md
|
||||
[CLA]: https://cla-assistant.io/MinecraftForge/MinecraftForge
|
||||
|
||||
@@ -93,3 +98,4 @@ Please ensure you have a valid email address associated with your GitHub account
|
||||
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
|
||||
|
||||
[Patreon]: https://www.patreon.com/LexManos
|
||||
[YourKit Java Profiler]: https://www.yourkit.com/java/profiler/
|
||||
@@ -25,7 +25,18 @@ import java.util.function.Supplier;
|
||||
* <li>When you want to call one thing on one side, another thing on the other and return a result {@link #safeRunForDist(Supplier, Supplier)}</li>
|
||||
* <li>When you want to run something on one side {@link #safeRunWhenOn(Dist, Supplier)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @deprecated Historically, this allowed for safe execution of code on the correct side by exploiting a low-level
|
||||
* detail in Java 8, but in newer versions a simple if check is enough.
|
||||
* <br>
|
||||
* For example:
|
||||
* <pre>{@code
|
||||
* if (FMLEnvironment.dist.isClient()) {
|
||||
* // client code here
|
||||
* }
|
||||
* }</pre>
|
||||
*/
|
||||
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||
public final class DistExecutor
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
+11
-12
@@ -90,7 +90,12 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
// The GL ID of the window. Used for all operations
|
||||
private long window;
|
||||
// The thread that contains and ticks the window while Forge is loading mods
|
||||
private ScheduledExecutorService renderScheduler;
|
||||
private static final ScheduledExecutorService renderScheduler = Executors.newSingleThreadScheduledExecutor(r -> {
|
||||
final var thread = Executors.defaultThreadFactory().newThread(r);
|
||||
thread.setName("EarlyDisplay");
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
});
|
||||
private int fbWidth;
|
||||
private int fbHeight;
|
||||
private int fbScale;
|
||||
@@ -149,7 +154,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
}
|
||||
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
|
||||
|
||||
StartupNotificationManager.modLoaderConsumer().ifPresent(c->c.accept("Forge loading " + forgeVersion));
|
||||
StartupNotificationManager.modLoaderConsumer().ifPresent(c->c.accept("Forge loading " + FMLLoader.versionInfo().forgeVersion()));
|
||||
performanceInfo = new PerformanceInfo();
|
||||
return start(mcVersion, forgeVersion);
|
||||
}
|
||||
@@ -238,7 +243,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
|
||||
var date = Calendar.getInstance();
|
||||
if (FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SQUIR) || (date.get(Calendar.MONTH) == Calendar.APRIL && date.get(Calendar.DAY_OF_MONTH) == 1))
|
||||
this.elements.add(0, RenderElement.squir());
|
||||
this.elements.addFirst(RenderElement.squir());
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -287,12 +292,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
* Start the window and Render Thread; we're ready to go.
|
||||
*/
|
||||
public Runnable start(@Nullable String mcVersion, final String forgeVersion) {
|
||||
renderScheduler = Executors.newSingleThreadScheduledExecutor(r -> {
|
||||
final var thread = Executors.defaultThreadFactory().newThread(r);
|
||||
thread.setName("EarlyDisplay");
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
});
|
||||
initWindow(mcVersion);
|
||||
this.initializationFuture = renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
||||
return this::periodicTick;
|
||||
@@ -304,7 +303,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
return this.glVersion;
|
||||
}
|
||||
|
||||
private void crashElegantly(String errorDetails) {
|
||||
private static void crashElegantly(String errorDetails) {
|
||||
StringBuilder msgBuilder = new StringBuilder(2000);
|
||||
msgBuilder.append("Failed to initialize graphics window with current settings.\n");
|
||||
msgBuilder.append("\n\n");
|
||||
@@ -512,7 +511,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
this.winY = y;
|
||||
}
|
||||
}
|
||||
private void handleLastGLFWError(BiConsumer<Integer, String> handler) {
|
||||
private static void handleLastGLFWError(BiConsumer<Integer, String> handler) {
|
||||
try (MemoryStack memorystack = MemoryStack.stackPush()) {
|
||||
PointerBuffer pointerbuffer = memorystack.mallocPointer(1);
|
||||
int error = glfwGetError(pointerbuffer);
|
||||
@@ -640,7 +639,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
}
|
||||
|
||||
public void addMojangTexture(final int textureId) {
|
||||
this.elements.add(0, RenderElement.mojang(textureId, framecount));
|
||||
this.elements.addFirst(RenderElement.mojang(textureId, framecount));
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
||||
+30
-29
@@ -22,8 +22,8 @@ public class RenderElement {
|
||||
static int globalAlpha = 255;
|
||||
private int retireCount;
|
||||
|
||||
@FunctionalInterface
|
||||
interface Renderer {
|
||||
|
||||
void accept(SimpleBufferBuilder bb, DisplayContext context, int frame);
|
||||
|
||||
default Renderer then(Renderer r) {
|
||||
@@ -38,6 +38,9 @@ public class RenderElement {
|
||||
interface TextureRenderer {
|
||||
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link Renderer} directly. This was always eagerly resolved, making it an unnecessary wrapper. */
|
||||
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||
@FunctionalInterface
|
||||
interface Initializer extends Supplier<Renderer> {}
|
||||
|
||||
@@ -56,11 +59,18 @@ public class RenderElement {
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link RenderElement#RenderElement(Renderer)} instead */
|
||||
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||
public RenderElement(final Initializer rendererInitializer) {
|
||||
this.bb = new SimpleBufferBuilder(1);
|
||||
this.renderer = rendererInitializer.get();
|
||||
}
|
||||
|
||||
public RenderElement(Renderer renderer) {
|
||||
this.bb = new SimpleBufferBuilder(1);
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public boolean render(DisplayContext ctx, int count) {
|
||||
this.renderer.accept(bb, ctx, count);
|
||||
return this.retireCount == 0 || this.retireCount < count;
|
||||
@@ -75,7 +85,7 @@ public class RenderElement {
|
||||
List<SimpleFont.DisplayText> texts = new ArrayList<>();
|
||||
for (int i = messages.size() - 1; i >= 0; i--) {
|
||||
final StartupNotificationManager.AgeMessage pair = messages.get(i);
|
||||
final float fade = clamp((4000.0f - (float) pair.age() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
|
||||
final float fade = Math.clamp((4000.0f - (float) pair.age() - ( i - 4 ) * 1000.0f) / 5000.0f, 0.0f, 1.0f);
|
||||
if (fade <0.01f) continue;
|
||||
Message msg = pair.message();
|
||||
int colour = Math.min((int)(fade * 255f), globalAlpha) << 24 | 0xFFFFFF;
|
||||
@@ -86,7 +96,7 @@ public class RenderElement {
|
||||
}
|
||||
|
||||
public static RenderElement mojang(final int textureId, final int frameStart) {
|
||||
return new RenderElement(()->(bb, ctx, frame) -> {
|
||||
return new RenderElement((bb, ctx, frame) -> {
|
||||
var size = 256 * ctx.scale();
|
||||
var x0 = (ctx.scaledWidth() - 2 * size) / 2;
|
||||
var y0 = 64 * ctx.scale() + 32;
|
||||
@@ -138,11 +148,11 @@ public class RenderElement {
|
||||
}));
|
||||
}
|
||||
public static RenderElement progressBars(SimpleFont font) {
|
||||
return new RenderElement(() -> (bb, ctx, frame) -> RenderElement.startupProgressBars(font, bb, ctx, frame));
|
||||
return new RenderElement((bb, ctx, frame) -> RenderElement.startupProgressBars(font, bb, ctx, frame));
|
||||
}
|
||||
|
||||
public static RenderElement performanceBar(SimpleFont font) {
|
||||
return new RenderElement(() -> (bb, ctx, frame) -> RenderElement.memoryInfo(font, bb, ctx, frame));
|
||||
return new RenderElement((bb, ctx, frame) -> RenderElement.memoryInfo(font, bb, ctx, frame));
|
||||
}
|
||||
|
||||
public static void startupProgressBars(SimpleFont font, final SimpleBufferBuilder buffer, final DisplayContext context, final int frameNumber) {
|
||||
@@ -177,10 +187,10 @@ public class RenderElement {
|
||||
}
|
||||
private static float[] indeterminateBar(int frame, boolean isActive) {
|
||||
if (RenderElement.globalAlpha != 0xFF || !isActive) {
|
||||
return new float[] {0f,1f};
|
||||
return new float[] { 0f, 1f };
|
||||
} else {
|
||||
var progress = frame % 100;
|
||||
return new float[]{clamp((progress - 2) / 100f, 0f, 1f), clamp((progress + 2) / 100f, 0f, 1f)};
|
||||
int progress = frame % 100;
|
||||
return new float[] { Math.clamp((progress - 2) / 100f, 0f, 1f), Math.clamp((progress + 2) / 100f, 0f, 1f) };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,8 +249,8 @@ public class RenderElement {
|
||||
};
|
||||
}
|
||||
|
||||
private static Initializer initializeText(SimpleFont font, TextGenerator textGenerator) {
|
||||
return () -> (bb, context, frame) -> renderText(font, textGenerator, bb, context);
|
||||
private static Renderer initializeText(SimpleFont font, TextGenerator textGenerator) {
|
||||
return (bb, context, frame) -> renderText(font, textGenerator, bb, context);
|
||||
}
|
||||
|
||||
private static void renderText(final SimpleFont font, final TextGenerator textGenerator, final SimpleBufferBuilder bb, final DisplayContext context) {
|
||||
@@ -254,14 +264,13 @@ public class RenderElement {
|
||||
private static TextGenerator text(int x, int y, String text, int colour) {
|
||||
return (bb, font, context) -> font.generateVerticesForTexts(x, y, bb, new SimpleFont.DisplayText(text, colour));
|
||||
}
|
||||
private static Initializer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
|
||||
return ()->{
|
||||
int[] imgSize = STBHelper.loadTextureFromClasspath(textureFileName, size, GL_TEXTURE0 + textureNumber + INDEX_TEXTURE_OFFSET);
|
||||
return (bb, ctx, frame) -> {
|
||||
ctx.elementShader().updateTextureUniform(textureNumber + INDEX_TEXTURE_OFFSET);
|
||||
ctx.elementShader().updateRenderTypeUniform(ElementShader.RenderType.TEXTURE);
|
||||
renderTexture(bb, ctx, frame, imgSize, positionAndColour);
|
||||
};
|
||||
|
||||
private static Renderer initializeTexture(final String textureFileName, int size, int textureNumber, TextureRenderer positionAndColour) {
|
||||
int[] imgSize = STBHelper.loadTextureFromClasspath(textureFileName, size, GL_TEXTURE0 + textureNumber + INDEX_TEXTURE_OFFSET);
|
||||
return (bb, ctx, frame) -> {
|
||||
ctx.elementShader().updateTextureUniform(textureNumber + INDEX_TEXTURE_OFFSET);
|
||||
ctx.elementShader().updateRenderTypeUniform(ElementShader.RenderType.TEXTURE);
|
||||
renderTexture(bb, ctx, frame, imgSize, positionAndColour);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -271,21 +280,13 @@ public class RenderElement {
|
||||
bb.draw();
|
||||
}
|
||||
|
||||
|
||||
@Deprecated(since = "1.21.5", forRemoval = true)
|
||||
public static float clamp(float num, float min, float max) {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return Math.min(num, max);
|
||||
}
|
||||
return Math.clamp(num, min, max);
|
||||
}
|
||||
|
||||
public static int clamp(int num, int min, int max) {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return Math.min(num, max);
|
||||
}
|
||||
return Math.min(max, Math.max(num, min));
|
||||
}
|
||||
|
||||
public static int hsvToRGB(float hue, float saturation, float value) {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SimpleFont {
|
||||
private final int textureNumber;
|
||||
private final int lineSpacing;
|
||||
private final int descent;
|
||||
private final int GLYPH_COUNT = 127-32;
|
||||
private static final int GLYPH_COUNT = 127 - 32;
|
||||
private final Glyph[] glyphs;
|
||||
|
||||
private record Glyph(char c, int charwidth, int[] pos, float[] uv) {
|
||||
@@ -120,7 +120,7 @@ public class SimpleFont {
|
||||
case '\n', '\t' -> 0;
|
||||
case ' ' -> glyphs[0].charwidth();
|
||||
default -> {
|
||||
if (c - 32 < this.GLYPH_COUNT && c > 32) {
|
||||
if (c - 32 < GLYPH_COUNT && c > 32) {
|
||||
yield this.glyphs[c - 32].charwidth();
|
||||
} else {
|
||||
yield 0;
|
||||
@@ -151,7 +151,7 @@ public class SimpleFont {
|
||||
case '\t' -> new Pos(pos.x()+font.glyphs[0].charwidth() * 4, pos.y(), pos.minx());
|
||||
case ' ' -> new Pos(pos.x()+font.glyphs[0].charwidth(), pos.y(), pos.minx());
|
||||
default -> {
|
||||
if (c-32 < font.GLYPH_COUNT && c > 32) {
|
||||
if (c-32 < GLYPH_COUNT && c > 32) {
|
||||
pos = font.glyphs[c - 32].loadQuad(pos, colour(), bb);
|
||||
}
|
||||
yield pos;
|
||||
|
||||
@@ -7,7 +7,6 @@ package net.minecraftforge.fml.loading;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.modlauncher.api.*;
|
||||
import joptsimple.OptionSpecBuilder;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.forgespi.Environment;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -19,7 +18,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
public class FMLServiceProvider implements ITransformationService {
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ import cpw.mods.modlauncher.api.LamdbaExceptionUtils.Supplier_WithExceptions;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
-1
@@ -17,7 +17,6 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
+7
-7
@@ -1,17 +1,17 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.jvmargs=-Xmx6G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
JAVA_VERSION=21
|
||||
MC_VERSION=1.21.4
|
||||
MC_VERSION=1.21.5
|
||||
MC_NEXT_VERSION=1.22
|
||||
MCP_VERSION=20241203.143248
|
||||
MCP_VERSION=20250325.155543
|
||||
MAPPING_CHANNEL=official
|
||||
MAPPING_VERSION=1.21.4
|
||||
MAPPING_VERSION=1.21.5
|
||||
|
||||
// Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||
# Set to true before the first build of a new MC version, so we don't do compatibility checks
|
||||
CHECK_COMPATIBILITY=false
|
||||
// Set to true to allow for fuzzy patching. Useful during updateing
|
||||
UPDATING=false
|
||||
# Set to true to allow for fuzzy patching. Useful during updateing
|
||||
UPDATING=false
|
||||
+33
-22
@@ -2,7 +2,7 @@ plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
|
||||
id 'net.minecraftforge.gradle' version '[6.0.36,6.2)'
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
@@ -22,17 +22,13 @@ minecraft {
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
|
||||
//
|
||||
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
|
||||
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
|
||||
// Tell FG to not automtically create the reobf tasks, as we now use Official mappings at runtime, If you don't use them at dev time then you'll have to fix your reobf yourself.
|
||||
|
||||
// Forge 1.20.6 and newer use official mappings at runtime, so we shouldn't reobf from official to SRG
|
||||
reobf = false
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
@@ -50,8 +46,7 @@ minecraft {
|
||||
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
|
||||
// generateRunFolders = true
|
||||
|
||||
// This property enables access transformers for use in development.
|
||||
// They will be applied to the Minecraft artifact.
|
||||
// This property enables access transformers for use in development, applied to the Minecraft artifact.
|
||||
// The access transformer file can be anywhere in the project.
|
||||
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
||||
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
||||
@@ -65,17 +60,15 @@ minecraft {
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// Optional additional logging. The markers can be added/remove as needed, separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
// property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// arg "-mixin.config=${mod_id}.mixins.json"
|
||||
}
|
||||
|
||||
client {
|
||||
@@ -110,7 +103,26 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
repositories {
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = 'Forge'
|
||||
url = 'https://maven.minecraftforge.net'
|
||||
}
|
||||
maven {
|
||||
name = 'Minecraft libraries'
|
||||
url = 'https://libraries.minecraft.net'
|
||||
}
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'Sponge'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroupAndSubgroups('org.spongepowered')
|
||||
}
|
||||
}
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
||||
@@ -147,7 +159,7 @@ dependencies {
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
tasks.named('processResources', ProcessResources) {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
@@ -163,7 +175,7 @@ tasks.named('processResources', ProcessResources).configure {
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
tasks.named('jar', Jar).configure {
|
||||
tasks.named('jar', Jar) {
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
@@ -173,6 +185,7 @@ tasks.named('jar', Jar).configure {
|
||||
'Implementation-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors
|
||||
])
|
||||
// attributes['MixinConfigs'] = "${mod_id}.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +207,7 @@ tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
||||
// IntelliJ no longer downloads javadocs and sources by default.
|
||||
// This tells Gradle to force IDEA to do it.
|
||||
// IntelliJ no longer downloads javadocs and sources by default, this tells Gradle to force IntelliJ to do it.
|
||||
idea.module { downloadJavadoc = downloadSources = true }
|
||||
|
||||
eclipse {
|
||||
@@ -205,8 +217,7 @@ eclipse {
|
||||
synchronizationTasks 'genEclipseRuns'
|
||||
}
|
||||
|
||||
// Merge the resources and classes into the same directory.
|
||||
// This is done because java expects modules to be in a single directory.
|
||||
// Merge the resources and classes into the same directory, because Java expects modules to be in a single directory.
|
||||
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
|
||||
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
|
||||
sourceSets.each {
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# Sets default memory used for Gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.jvmargs=-Xmx5G
|
||||
org.gradle.daemon=false
|
||||
|
||||
# In the case that Gradle needs to fork to recompile, this will set the memory for that process.
|
||||
systemProp.net.minecraftforge.gradle.repo.recompile.fork=true
|
||||
systemProp.net.minecraftforge.gradle.repo.recompile.fork.args=-Xmx5G
|
||||
|
||||
# Opts-out of ForgeGradle automatically adding mavenCentral(), Forge's maven and MC libs maven to the repositories block
|
||||
systemProp.net.minecraftforge.gradle.repo.attach=false
|
||||
|
||||
|
||||
## Environment Properties
|
||||
|
||||
|
||||
+2
-2
@@ -9,5 +9,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.10.0'
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
|
||||
@@ -109,6 +_,9 @@
|
||||
GlStateManager._colorMask(true, true, true, true);
|
||||
GlStateManager._clear(16384);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0);
|
||||
+ // Forge: if using stencil, clear it as well (3553 = GlConst.GL_TEXTURE_2D)
|
||||
+ if (p_394273_.isStencilEnabled())
|
||||
+ GlStateManager._glFramebufferTexture2D(GlConst.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, GlConst.GL_TEXTURE_2D, 0, 0);
|
||||
GlStateManager._glBindFramebuffer(36160, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlDebug.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlDebug.java
|
||||
@@ -23,6 +_,14 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GlDebug {
|
||||
+ /**
|
||||
+ * TODO: [Forge][Rendering][VEN] Expose this in the configs
|
||||
+ * <p>
|
||||
+ * Will enable synchronous OpenGL debug logging, which means the message will be sent from the call that
|
||||
+ * would have caused the error. Additionally, enables printing a stacktrace when and where this occurs.
|
||||
+ */
|
||||
+ private static final boolean PRINT_STACKTRACE_ON_ERROR = Boolean.getBoolean("forge.printGLStackOnError");
|
||||
+
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int CIRCULAR_LOG_SIZE = 10;
|
||||
private final Queue<GlDebug.LogEntry> MESSAGE_BUFFER = EvictingQueue.create(10);
|
||||
@@ -105,6 +_,8 @@
|
||||
}
|
||||
|
||||
LOGGER.info("OpenGL debug message: {}", gldebug$logentry);
|
||||
+ // TODO: [VEN] Trim the stack trace
|
||||
+ if (PRINT_STACKTRACE_ON_ERROR) LOGGER.info("Trace: ", new Throwable("GlDebug"));
|
||||
}
|
||||
|
||||
public List<String> getLastOpenGlDebugMessages() {
|
||||
@@ -121,6 +_,7 @@
|
||||
|
||||
@Nullable
|
||||
public static GlDebug enableDebugCallback(int p_394351_, boolean p_393026_, Set<String> p_393339_) {
|
||||
+ p_393026_ |= PRINT_STACKTRACE_ON_ERROR;
|
||||
if (p_394351_ <= 0) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -0,0 +1,53 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlDevice.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
|
||||
@@ -80,11 +_,25 @@
|
||||
|
||||
@Override
|
||||
public GpuTexture createTexture(@Nullable Supplier<String> p_397830_, TextureFormat p_394839_, int p_394481_, int p_391831_, int p_395609_) {
|
||||
- return this.createTexture(this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394839_, p_394481_, p_391831_, p_395609_);
|
||||
+ return this.createTexture(p_397830_, p_394839_, p_394481_, p_391831_, p_395609_, false);
|
||||
+ }
|
||||
+
|
||||
+ /** @see GpuDevice#createTexture(Supplier, TextureFormat, int, int, int, boolean) */
|
||||
+ @Override
|
||||
+ public GpuTexture createTexture(@Nullable Supplier<String> p_397830_, TextureFormat p_394839_, int p_394481_, int p_391831_, int p_395609_, boolean stencil) {
|
||||
+ return this.createTexture(this.debugLabels.exists() && p_397830_ != null ? p_397830_.get() : null, p_394839_, p_394481_, p_391831_, p_395609_, stencil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GpuTexture createTexture(@Nullable String p_394142_, TextureFormat p_394951_, int p_395535_, int p_393944_, int p_392329_) {
|
||||
+ return this.createTexture(p_394142_, p_394951_, p_395535_, p_393944_, p_392329_, false);
|
||||
+ }
|
||||
+
|
||||
+ /** @see GpuDevice#createTexture(String, TextureFormat, int, int, int, boolean) */
|
||||
+ @Override
|
||||
+ public GpuTexture createTexture(@Nullable String p_394142_, TextureFormat p_394951_, int p_395535_, int p_393944_, int p_392329_, boolean stencil) {
|
||||
+ // Forge: stencil rendering is only for depth
|
||||
+ stencil &= p_394951_.hasDepthAspect();
|
||||
if (p_392329_ < 1) {
|
||||
throw new IllegalArgumentException("mipLevels must be at least 1");
|
||||
} else {
|
||||
@@ -106,11 +_,14 @@
|
||||
GlStateManager._texImage2D(
|
||||
3553,
|
||||
j,
|
||||
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8 :
|
||||
GlConst.toGlInternalId(p_394951_),
|
||||
p_395535_ >> j,
|
||||
p_393944_ >> j,
|
||||
0,
|
||||
+ stencil ? org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL :
|
||||
GlConst.toGlExternalId(p_394951_),
|
||||
+ stencil ? org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV :
|
||||
GlConst.toGlType(p_394951_),
|
||||
null
|
||||
);
|
||||
@@ -122,7 +_,7 @@
|
||||
} else if (k != 0) {
|
||||
throw new IllegalStateException("OpenGL error " + k);
|
||||
} else {
|
||||
- GlTexture gltexture = new GlTexture(p_394142_, p_394951_, p_395535_, p_393944_, p_392329_, i);
|
||||
+ GlTexture gltexture = new GlTexture(p_394142_, p_394951_, p_395535_, p_393944_, p_392329_, i, stencil);
|
||||
this.debugLabels.applyLabel(gltexture);
|
||||
return gltexture;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
|
||||
@@ -90,6 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean _isBlendEnabled() {
|
||||
+ RenderSystem.assertOnRenderThread();
|
||||
+ return BLEND.mode.enabled;
|
||||
+ }
|
||||
+
|
||||
public static void _disableBlend() {
|
||||
RenderSystem.assertOnRenderThread();
|
||||
BLEND.mode.disable();
|
||||
@@ -411,9 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Stores the last values sent into glMultiTexCoord2f */
|
||||
+ public static float lastBrightnessX = 0.0f;
|
||||
+ public static float lastBrightnessY = 0.0f;
|
||||
+
|
||||
public static void _texParameter(int p_393876_, int p_397998_, int p_396741_) {
|
||||
RenderSystem.assertOnRenderThread();
|
||||
GL11.glTexParameteri(p_393876_, p_397998_, p_396741_);
|
||||
+ if (p_393876_ == GL13.GL_TEXTURE1) {
|
||||
+ lastBrightnessX = p_397998_;
|
||||
+ lastBrightnessY = p_396741_;
|
||||
+ }
|
||||
}
|
||||
|
||||
public static int _getTexLevelParameter(int p_393352_, int p_397204_, int p_396319_) {
|
||||
@@ -0,0 +1,32 @@
|
||||
--- a/com/mojang/blaze3d/opengl/GlTexture.java
|
||||
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
|
||||
@@ -18,8 +_,13 @@
|
||||
protected boolean modesDirty = true;
|
||||
|
||||
protected GlTexture(String p_393950_, TextureFormat p_392837_, int p_394590_, int p_391379_, int p_391947_, int p_396659_) {
|
||||
+ this(p_393950_, p_392837_, p_394590_, p_391379_, p_391947_, p_396659_, false);
|
||||
+ }
|
||||
+
|
||||
+ protected GlTexture(String p_393950_, TextureFormat p_392837_, int p_394590_, int p_391379_, int p_391947_, int p_396659_, boolean stencil) {
|
||||
super(p_393950_, p_392837_, p_394590_, p_391379_, p_391947_);
|
||||
this.id = p_396659_;
|
||||
+ this.stencilEnabled = stencil;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,5 +_,15 @@
|
||||
public void setTextureFilter(FilterMode p_394977_, FilterMode p_397175_, boolean p_393558_) {
|
||||
super.setTextureFilter(p_394977_, p_397175_, p_393558_);
|
||||
this.modesDirty = true;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /* FORGE START */
|
||||
+
|
||||
+ private final boolean stencilEnabled;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isStencilEnabled() {
|
||||
+ return this.stencilEnabled;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,18 @@
|
||||
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
||||
@@ -96,7 +_,10 @@
|
||||
GlStateManager._texParameter(3553, 34892, 0);
|
||||
GlStateManager._texParameter(3553, 10242, 33071);
|
||||
GlStateManager._texParameter(3553, 10243, 33071);
|
||||
+ if (!stencilEnabled)
|
||||
GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null);
|
||||
+ else
|
||||
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
||||
}
|
||||
|
||||
this.setFilterMode(9728, true);
|
||||
@@ -108,6 +_,7 @@
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
|
||||
@@ -75,7 +_,7 @@
|
||||
this.width = p_83951_;
|
||||
this.height = p_83952_;
|
||||
if (this.useDepth) {
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
|
||||
+ if (stencilEnabled) GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||
- this.depthTexture = RenderSystem.getDevice().createTexture(() -> this.label + " / Depth", TextureFormat.DEPTH32, p_83951_, p_83952_, 1);
|
||||
+ this.depthTexture = RenderSystem.getDevice().createTexture(() -> this.label + " / Depth", TextureFormat.DEPTH32, p_83951_, p_83952_, 1, this.stencilEnabled);
|
||||
this.depthTexture.setTextureFilter(FilterMode.NEAREST, false);
|
||||
this.depthTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
this.checkStatus();
|
||||
@@ -229,5 +_,26 @@
|
||||
|
||||
public int getDepthTextureId() {
|
||||
return this.depthBufferId;
|
||||
@@ -134,5 +_,26 @@
|
||||
@Nullable
|
||||
public GpuTexture getDepthTexture() {
|
||||
return this.depthTexture;
|
||||
+ }
|
||||
+
|
||||
+ private boolean stencilEnabled = false;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
--- a/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
@@ -94,6 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean _isBlendEnabled() {
|
||||
+ RenderSystem.assertOnRenderThread();
|
||||
+ return BLEND.mode.enabled;
|
||||
+ }
|
||||
+
|
||||
public static void _disableBlend() {
|
||||
RenderSystem.assertOnRenderThread();
|
||||
BLEND.mode.disable();
|
||||
@@ -519,9 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Stores the last values sent into glMultiTexCoord2f */
|
||||
+ public static float lastBrightnessX = 0.0f;
|
||||
+ public static float lastBrightnessY = 0.0f;
|
||||
+
|
||||
public static void _texParameter(int p_84161_, int p_84162_, float p_84163_) {
|
||||
RenderSystem.assertOnRenderThreadOrInit();
|
||||
GL11.glTexParameterf(p_84161_, p_84162_, p_84163_);
|
||||
+ if (p_84161_ == GL13.GL_TEXTURE1) {
|
||||
+ lastBrightnessX = p_84162_;
|
||||
+ lastBrightnessY = p_84163_;
|
||||
+ }
|
||||
}
|
||||
|
||||
public static void _texParameter(int p_84332_, int p_84333_, int p_84334_) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/Window.java
|
||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||
@@ -89,7 +_,8 @@
|
||||
@@ -88,7 +_,8 @@
|
||||
GLFW.glfwWindowHint(139267, 2);
|
||||
GLFW.glfwWindowHint(139272, 204801);
|
||||
GLFW.glfwWindowHint(139270, 1);
|
||||
@@ -10,15 +10,15 @@
|
||||
if (monitor != null) {
|
||||
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||
@@ -101,6 +_,7 @@
|
||||
@@ -100,6 +_,7 @@
|
||||
this.windowedX = this.x = aint1[0];
|
||||
this.windowedY = this.y = aint[0];
|
||||
}
|
||||
+ }
|
||||
|
||||
GLFW.glfwMakeContextCurrent(this.window);
|
||||
GL.createCapabilities();
|
||||
@@ -271,6 +_,9 @@
|
||||
this.setMode();
|
||||
this.refreshFramebufferSize();
|
||||
@@ -266,6 +_,9 @@
|
||||
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
|
||||
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
|
||||
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/com/mojang/blaze3d/systems/GpuDevice.java
|
||||
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
|
||||
@@ -25,7 +_,17 @@
|
||||
|
||||
GpuTexture createTexture(@Nullable Supplier<String> p_394357_, TextureFormat p_395807_, int p_395623_, int p_395802_, int p_396157_);
|
||||
|
||||
+ /** Forge: same as {@link #createTexture(Supplier, TextureFormat, int, int, int)} but with stencil support */
|
||||
+ default GpuTexture createTexture(@Nullable Supplier<String> p_394357_, TextureFormat p_395807_, int p_395623_, int p_395802_, int p_396157_, boolean stencil) {
|
||||
+ return this.createTexture(p_394357_, p_395807_, p_395623_, p_395802_, p_396157_);
|
||||
+ }
|
||||
+
|
||||
GpuTexture createTexture(@Nullable String p_391798_, TextureFormat p_393333_, int p_391800_, int p_395600_, int p_394065_);
|
||||
+
|
||||
+ /** Forge: same as {@link #createTexture(String, TextureFormat, int, int, int)} but with stencil support */
|
||||
+ default GpuTexture createTexture(@Nullable String p_391798_, TextureFormat p_393333_, int p_391800_, int p_395600_, int p_394065_, boolean stencil) {
|
||||
+ return this.createTexture(p_391798_, p_393333_, p_391800_, p_395600_, p_394065_);
|
||||
+ }
|
||||
|
||||
GpuBuffer createBuffer(@Nullable Supplier<String> p_395215_, BufferType p_392847_, BufferUsage p_391478_, int p_397054_);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/com/mojang/blaze3d/systems/RenderSystem.java
|
||||
+++ b/com/mojang/blaze3d/systems/RenderSystem.java
|
||||
@@ -196,6 +_,11 @@
|
||||
GlStateManager._depthMask(p_69459_);
|
||||
}
|
||||
|
||||
+ public static boolean isBlendEnabled() {
|
||||
+ assertOnRenderThread();
|
||||
+ return GlStateManager._isBlendEnabled();
|
||||
+ }
|
||||
+
|
||||
public static void enableBlend() {
|
||||
assertOnRenderThread();
|
||||
GlStateManager._enableBlend();
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/com/mojang/blaze3d/textures/GpuTexture.java
|
||||
+++ b/com/mojang/blaze3d/textures/GpuTexture.java
|
||||
@@ -6,7 +_,7 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@DontObfuscate
|
||||
-public abstract class GpuTexture implements AutoCloseable {
|
||||
+public abstract class GpuTexture implements AutoCloseable, net.minecraftforge.client.extensions.IForgeGpuTexture {
|
||||
private final TextureFormat format;
|
||||
private final int width;
|
||||
private final int height;
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/com/mojang/blaze3d/vertex/PoseStack.java
|
||||
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Vector3f;
|
||||
@@ -15,7 +_,7 @@
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class PoseStack {
|
||||
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
|
||||
private final Deque<PoseStack.Pose> poseStack = Util.make(Queues.newArrayDeque(), p_85848_ -> {
|
||||
Matrix4f matrix4f = new Matrix4f();
|
||||
Matrix3f matrix3f = new Matrix3f();
|
||||
private final List<PoseStack.Pose> poses = new ArrayList<>(16);
|
||||
private int lastIndex;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
|
||||
@@ -14,7 +_,7 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -20,7 +_,7 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@DontObfuscate
|
||||
-public class VertexFormat {
|
||||
+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat {
|
||||
public static final int UNKNOWN_ELEMENT = -1;
|
||||
private final List<VertexFormatElement> elements;
|
||||
private final List<String> names;
|
||||
@@ -23,6 +_,7 @@
|
||||
private final int[] offsetsByElement = new int[32];
|
||||
@@ -31,6 +_,7 @@
|
||||
private GpuBuffer immediateDrawVertexBuffer;
|
||||
@Nullable
|
||||
private VertexBuffer immediateDrawVertexBuffer;
|
||||
private GpuBuffer immediateDrawIndexBuffer;
|
||||
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
|
||||
|
||||
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
|
||||
this.elements = p_343616_;
|
||||
@@ -35,6 +_,11 @@
|
||||
@@ -43,6 +_,11 @@
|
||||
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
|
||||
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
|
||||
}
|
||||
@@ -29,13 +29,13 @@
|
||||
}
|
||||
|
||||
public static VertexFormat.Builder builder() {
|
||||
@@ -141,6 +_,9 @@
|
||||
@@ -146,6 +_,9 @@
|
||||
|
||||
return vertexbuffer;
|
||||
return this.immediateDrawIndexBuffer;
|
||||
}
|
||||
+
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
+ public int getOffset(int index) { return offsetsByElement[index]; }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Builder {
|
||||
@DontObfuscate
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/com/mojang/math/Transformation.java
|
||||
+++ b/com/mojang/math/Transformation.java
|
||||
@@ -13,7 +_,7 @@
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
-public final class Transformation {
|
||||
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
|
||||
private final Matrix4f matrix;
|
||||
private final Matrix4fc matrix;
|
||||
public static final Codec<Transformation> CODEC = RecordCodecBuilder.create(
|
||||
p_269604_ -> p_269604_.group(
|
||||
@@ -169,5 +_,19 @@
|
||||
@@ -174,5 +_,19 @@
|
||||
vector3f1.lerp(p_175938_.getScale(), p_175939_);
|
||||
quaternionf1.slerp(p_175938_.getRightRotation(), p_175939_);
|
||||
return new Transformation(vector3f, quaternionf, vector3f1, quaternionf1);
|
||||
|
||||
@@ -34,4 +34,4 @@
|
||||
+ this.stackTrace = t.getStackTrace();
|
||||
}
|
||||
|
||||
public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
|
||||
public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, BlockState p_178954_) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -170,6 +_,7 @@
|
||||
@@ -171,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -214,7 +_,11 @@
|
||||
@@ -226,7 +_,11 @@
|
||||
}
|
||||
|
||||
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/advancements/AdvancementRewards.java
|
||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||
@@ -41,6 +_,7 @@
|
||||
@@ -40,6 +_,7 @@
|
||||
LootParams lootparams = new LootParams.Builder(p_9990_.serverLevel())
|
||||
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
|
||||
.withParameter(LootContextParams.ORIGIN, p_9990_.position())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -120,9 +_,13 @@
|
||||
@@ -118,9 +_,13 @@
|
||||
}
|
||||
|
||||
protected void setRotation(float p_90573_, float p_90574_) {
|
||||
@@ -15,7 +15,7 @@
|
||||
FORWARDS.rotate(this.rotation, this.forwards);
|
||||
UP.rotate(this.rotation, this.up);
|
||||
LEFT.rotate(this.rotation, this.left);
|
||||
@@ -238,6 +_,13 @@
|
||||
@@ -236,6 +_,13 @@
|
||||
|
||||
public float getPartialTickTime() {
|
||||
return this.partialTickTime;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -424,12 +_,12 @@
|
||||
@@ -431,12 +_,12 @@
|
||||
if (screen != null) {
|
||||
try {
|
||||
if (p_90897_ != 1 && p_90897_ != 2) {
|
||||
@@ -15,7 +15,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -505,6 +_,7 @@
|
||||
@@ -495,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,10 +_,10 @@
|
||||
@@ -504,10 +_,10 @@
|
||||
if (screen != null && this.minecraft.getOverlay() == null) {
|
||||
try {
|
||||
if (Character.isBmpCodePoint(p_90891_)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -250,7 +_,7 @@
|
||||
@@ -248,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,7 +9,7 @@
|
||||
static Minecraft instance;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||
@@ -428,7 +_,6 @@
|
||||
@@ -426,7 +_,6 @@
|
||||
}
|
||||
}, Util.nonCriticalIoPool());
|
||||
LOGGER.info("Setting user: {}", this.user.getName());
|
||||
@@ -17,7 +17,7 @@
|
||||
this.demo = p_91084_.game.demo;
|
||||
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||
this.allowsChat = !p_91084_.game.disableChat;
|
||||
@@ -475,15 +_,15 @@
|
||||
@@ -478,10 +_,9 @@
|
||||
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
|
||||
}
|
||||
|
||||
@@ -26,16 +26,18 @@
|
||||
- this.mouseHandler.setup(this.window.getWindow());
|
||||
this.keyboardHandler = new KeyboardHandler(this);
|
||||
- this.keyboardHandler.setup(this.window.getWindow());
|
||||
RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
|
||||
RenderSystem.initRenderer(
|
||||
this.window.getWindow(),
|
||||
this.options.glDebugVerbosity,
|
||||
@@ -492,6 +_,7 @@
|
||||
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
|
||||
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
||||
this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.mainRenderTarget.clear();
|
||||
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
|
||||
@@ -561,6 +_,7 @@
|
||||
@@ -570,6 +_,7 @@
|
||||
this.blockEntityRenderDispatcher = new BlockEntityRenderDispatcher(this.font, this.modelManager.entityModels(), this.blockRenderer, this.itemModelResolver, this.itemRenderer, this.entityRenderDispatcher);
|
||||
this.resourceManager.registerReloadListener(this.blockEntityRenderDispatcher);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
||||
@@ -43,7 +45,7 @@
|
||||
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
||||
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||
@@ -576,6 +_,9 @@
|
||||
@@ -585,6 +_,9 @@
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
this.gui = new Gui(this);
|
||||
@@ -51,17 +53,17 @@
|
||||
+ this.mouseHandler.setup(this.window.getWindow());
|
||||
+ this.keyboardHandler.setup(this.window.getWindow());
|
||||
this.debugRenderer = new DebugRenderer(this);
|
||||
RealmsClient realmsclient = RealmsClient.create(this);
|
||||
RealmsClient realmsclient = RealmsClient.getOrCreate(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||
@@ -599,6 +_,7 @@
|
||||
this.options.fullscreen().set(this.window.isFullscreen());
|
||||
@@ -618,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
|
||||
this.window.updateVsync(this.options.enableVsync().get());
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setDefaultErrorCallback();
|
||||
@@ -620,16 +_,17 @@
|
||||
@@ -639,16 +_,17 @@
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||
this.setOverlay(
|
||||
@@ -69,20 +71,20 @@
|
||||
- this, reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
|
||||
+ net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(
|
||||
+ () -> this, () -> reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
this.selfTest();
|
||||
}
|
||||
|
||||
this.reloadStateTracker.finishReload();
|
||||
this.onResourceLoadFinished(minecraft$gameloadcookie);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading();
|
||||
}), false
|
||||
this.reloadStateTracker.finishReload();
|
||||
this.onResourceLoadFinished(minecraft$gameloadcookie);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.completeModLoading();
|
||||
}), false
|
||||
- )
|
||||
+ ).get()
|
||||
);
|
||||
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
|
||||
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
|
||||
@@ -724,6 +_,7 @@
|
||||
@@ -746,6 +_,7 @@
|
||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
stringbuilder.append("*");
|
||||
@@ -90,7 +92,7 @@
|
||||
}
|
||||
|
||||
stringbuilder.append(" ");
|
||||
@@ -747,6 +_,8 @@
|
||||
@@ -769,6 +_,8 @@
|
||||
}
|
||||
|
||||
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
@@ -99,7 +101,7 @@
|
||||
return p_193587_.user.user.getType() != User.Type.MSA
|
||||
? UserApiService.OFFLINE
|
||||
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||
@@ -757,7 +_,7 @@
|
||||
@@ -779,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||
@@ -108,7 +110,7 @@
|
||||
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
|
||||
} else {
|
||||
Util.throwAsRuntime(p_91240_);
|
||||
@@ -1043,12 +_,6 @@
|
||||
@@ -1065,12 +_,6 @@
|
||||
LOGGER.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -121,7 +123,7 @@
|
||||
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
|
||||
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
|
||||
} else {
|
||||
@@ -1062,6 +_,23 @@
|
||||
@@ -1084,6 +_,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,15 +147,15 @@
|
||||
this.screen = p_91153_;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -1146,6 +_,7 @@
|
||||
|
||||
@@ -1168,6 +_,7 @@
|
||||
FreeTypeUtil.destroy();
|
||||
Util.shutdownExecutors();
|
||||
RenderSystem.getDevice().close();
|
||||
+ net.minecraftforge.fml.config.ConfigTracker.INSTANCE.forceUnload();
|
||||
} catch (Throwable throwable) {
|
||||
LOGGER.error("Shutdown failure!", throwable);
|
||||
throw throwable;
|
||||
@@ -1215,9 +_,11 @@
|
||||
@@ -1237,9 +_,11 @@
|
||||
this.mouseHandler.handleAccumulatedMovement();
|
||||
profilerfiller.pop();
|
||||
if (!this.noRender) {
|
||||
@@ -165,8 +167,8 @@
|
||||
}
|
||||
|
||||
profilerfiller.push("blit");
|
||||
@@ -1342,10 +_,12 @@
|
||||
this.window.setGuiScale((double)i);
|
||||
@@ -1363,10 +_,12 @@
|
||||
this.window.setGuiScale(i);
|
||||
if (this.screen != null) {
|
||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
@@ -178,7 +180,7 @@
|
||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
}
|
||||
@@ -1486,6 +_,7 @@
|
||||
@@ -1504,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@@ -186,7 +188,7 @@
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
@@ -1514,10 +_,18 @@
|
||||
@@ -1532,10 +_,18 @@
|
||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -208,7 +210,7 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1545,6 +_,8 @@
|
||||
@@ -1563,6 +_,8 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
@@ -217,7 +219,7 @@
|
||||
switch (this.hitResult.getType()) {
|
||||
case ENTITY:
|
||||
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||
@@ -1552,7 +_,7 @@
|
||||
@@ -1570,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -226,7 +228,7 @@
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
flag = true;
|
||||
@@ -1565,8 +_,10 @@
|
||||
@@ -1583,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
@@ -237,7 +239,7 @@
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1582,6 +_,12 @@
|
||||
@@ -1600,6 +_,12 @@
|
||||
}
|
||||
|
||||
for (InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -250,7 +252,7 @@
|
||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||
return;
|
||||
@@ -1602,7 +_,7 @@
|
||||
@@ -1620,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success2) {
|
||||
@@ -259,16 +261,16 @@
|
||||
this.player.swing(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1614,7 +_,7 @@
|
||||
@@ -1632,7 +_,7 @@
|
||||
int i = itemstack.getCount();
|
||||
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||
if (interactionresult1 instanceof InteractionResult.Success interactionresult$success) {
|
||||
- if (interactionresult$success.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
+ if (interactionresult$success.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||
@@ -1630,6 +_,9 @@
|
||||
@@ -1648,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +280,7 @@
|
||||
if (!itemstack.isEmpty()
|
||||
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
|
||||
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
|
||||
@@ -1659,6 +_,8 @@
|
||||
@@ -1677,6 +_,8 @@
|
||||
}
|
||||
|
||||
ProfilerFiller profilerfiller = Profiler.get();
|
||||
@@ -287,7 +289,7 @@
|
||||
profilerfiller.push("gui");
|
||||
this.chatListener.tick();
|
||||
this.gui.tick(this.pause);
|
||||
@@ -1748,6 +_,7 @@
|
||||
@@ -1766,6 +_,7 @@
|
||||
|
||||
this.tutorial.tick();
|
||||
|
||||
@@ -295,7 +297,7 @@
|
||||
try {
|
||||
this.level.tick(() -> true);
|
||||
} catch (Throwable throwable1) {
|
||||
@@ -1761,6 +_,7 @@
|
||||
@@ -1779,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport1);
|
||||
}
|
||||
@@ -303,7 +305,7 @@
|
||||
}
|
||||
|
||||
profilerfiller.popPush("animateTick");
|
||||
@@ -1785,6 +_,7 @@
|
||||
@@ -1803,6 +_,7 @@
|
||||
profilerfiller.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
profilerfiller.pop();
|
||||
@@ -311,7 +313,7 @@
|
||||
}
|
||||
|
||||
private boolean isLevelRunningNormally() {
|
||||
@@ -1986,6 +_,7 @@
|
||||
@@ -2003,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
|
||||
@@ -319,7 +321,7 @@
|
||||
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
|
||||
this.level = p_91157_;
|
||||
this.updateLevelInEngines(p_91157_);
|
||||
@@ -2023,6 +_,7 @@
|
||||
@@ -2040,6 +_,7 @@
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
this.singleplayerServer = null;
|
||||
this.gameRenderer.resetData();
|
||||
@@ -327,7 +329,7 @@
|
||||
this.gameMode = null;
|
||||
this.narrator.clear();
|
||||
this.clientLevelTeardownInProgress = true;
|
||||
@@ -2030,6 +_,7 @@
|
||||
@@ -2047,6 +_,7 @@
|
||||
try {
|
||||
this.updateScreenAndTick(p_335030_);
|
||||
if (this.level != null) {
|
||||
@@ -335,7 +337,7 @@
|
||||
if (integratedserver != null) {
|
||||
ProfilerFiller profilerfiller = Profiler.get();
|
||||
profilerfiller.push("waitForServer");
|
||||
@@ -2043,6 +_,7 @@
|
||||
@@ -2060,6 +_,7 @@
|
||||
|
||||
this.gui.onDisconnected();
|
||||
this.isLocalServer = false;
|
||||
@@ -343,11 +345,11 @@
|
||||
}
|
||||
|
||||
this.level = null;
|
||||
@@ -2190,6 +_,7 @@
|
||||
@@ -2207,6 +_,7 @@
|
||||
|
||||
private void pickBlock() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onClickInput(2, this.options.keyPickItem, InteractionHand.MAIN_HAND).isCanceled()) return;
|
||||
boolean flag = Screen.hasControlDown();
|
||||
HitResult hitresult = this.hitResult;
|
||||
Objects.requireNonNull(this.hitResult);
|
||||
switch (this.hitResult) {
|
||||
case BlockHitResult blockhitresult:
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/MouseHandler.java
|
||||
+++ b/net/minecraft/client/MouseHandler.java
|
||||
@@ -85,6 +_,7 @@
|
||||
@@ -90,6 +_,7 @@
|
||||
this.activeButton = -1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
if (!this.mouseGrabbed && flag) {
|
||||
@@ -98,7 +_,7 @@
|
||||
@@ -103,7 +_,7 @@
|
||||
screen.afterMouseAction();
|
||||
|
||||
try {
|
||||
@@ -17,7 +17,7 @@
|
||||
return;
|
||||
}
|
||||
} catch (Throwable throwable1) {
|
||||
@@ -112,7 +_,7 @@
|
||||
@@ -116,7 +_,7 @@
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -26,18 +26,18 @@
|
||||
return;
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
@@ -147,6 +_,7 @@
|
||||
@@ -150,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
|
||||
}
|
||||
|
||||
private void onScroll(long p_91527_, double p_91528_, double p_91529_) {
|
||||
@@ -160,7 +_,9 @@
|
||||
public void fillMousePositionDetails(CrashReportCategory p_398230_, Window p_398216_) {
|
||||
@@ -189,7 +_,9 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
double d3 = this.getScaledXPos(this.minecraft.getWindow());
|
||||
double d4 = this.getScaledYPos(this.minecraft.getWindow());
|
||||
- this.minecraft.screen.mouseScrolled(d3, d4, d1, d2);
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return;
|
||||
+ if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return;
|
||||
@@ -45,7 +45,7 @@
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
} else if (this.minecraft.player != null) {
|
||||
Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2);
|
||||
@@ -169,6 +_,7 @@
|
||||
@@ -198,6 +_,7 @@
|
||||
}
|
||||
|
||||
int i = vector2i.y == 0 ? -vector2i.x : vector2i.y;
|
||||
@@ -53,8 +53,8 @@
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i);
|
||||
@@ -274,7 +_,7 @@
|
||||
double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
@@ -303,7 +_,7 @@
|
||||
double d5 = getScaledYPos(window, this.accumulatedDY);
|
||||
|
||||
try {
|
||||
- screen.mouseDragged(d2, d3, this.activeButton, d4, d5);
|
||||
@@ -62,7 +62,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler");
|
||||
screen.fillCrashDetails(crashreport1);
|
||||
@@ -349,6 +_,14 @@
|
||||
@@ -393,6 +_,14 @@
|
||||
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -698,7 +_,8 @@
|
||||
@@ -668,7 +_,8 @@
|
||||
},
|
||||
new OptionInstance.LazyEnum<>(
|
||||
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
|
||||
- p_232011_ -> Minecraft.getInstance().isRunning() && p_232011_ != "" && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_)
|
||||
+ // FORGE: fix incorrect string comparison - PR #8767
|
||||
+ p_232011_ -> Minecraft.getInstance().isRunning() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_)
|
||||
? Optional.empty()
|
||||
: Optional.of(p_232011_),
|
||||
? Optional.empty()
|
||||
: Optional.of(p_232011_),
|
||||
Codec.STRING
|
||||
@@ -1079,6 +_,7 @@
|
||||
@@ -683,6 +_,7 @@
|
||||
public boolean onboardAccessibility = true;
|
||||
public boolean syncWrites;
|
||||
public boolean startedCleanly = true;
|
||||
+ private final Map<String, String> unknownKeys = new java.util.HashMap<>();
|
||||
|
||||
public OptionInstance<Boolean> darkMojangStudiosBackground() {
|
||||
return this.darkMojangStudiosBackground;
|
||||
@@ -1050,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -18,15 +26,16 @@
|
||||
this.minecraft = p_92138_;
|
||||
this.optionsFile = new File(p_92139_, "options.txt");
|
||||
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
|
||||
@@ -1210,12 +_,22 @@
|
||||
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
|
||||
@@ -1181,15 +_,28 @@
|
||||
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
|
||||
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
|
||||
+ processOptionsForge(p_168428_);
|
||||
this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly);
|
||||
+ processOptionsKeysOnly(p_168428_);
|
||||
+ processOptionsEnd(p_168428_);
|
||||
+ }
|
||||
|
||||
+ // FORGE: split off to allow reloading options after mod loading is done
|
||||
+ private void processOptionsForge(Options.FieldAccess p_168428_) {
|
||||
+ // FORGE: split off to allow reloading keys after mod loading is done
|
||||
+ private void processOptionsKeysOnly(Options.FieldAccess p_168428_) {
|
||||
for (KeyMapping keymapping : this.keyMappings) {
|
||||
- String s = keymapping.saveString();
|
||||
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||
@@ -41,8 +50,13 @@
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
@@ -1233,6 +_,10 @@
|
||||
+ private void processOptionsEnd(Options.FieldAccess p_168428_) {
|
||||
for (SoundSource soundsource : SoundSource.values()) {
|
||||
p_168428_.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource));
|
||||
}
|
||||
@@ -1204,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@@ -53,17 +67,60 @@
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
return;
|
||||
@@ -1260,7 +_,8 @@
|
||||
}
|
||||
@@ -1228,7 +_,8 @@
|
||||
this.graphicsMode.set(isTrue(optional.get()) ? GraphicsStatus.FANCY : GraphicsStatus.FAST);
|
||||
}
|
||||
|
||||
- this.processOptions(
|
||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::processOptions;
|
||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
|
||||
+ processor.accept(
|
||||
new Options.FieldAccess() {
|
||||
@Nullable
|
||||
private String getValueOrNull(String p_168459_) {
|
||||
@@ -1451,6 +_,7 @@
|
||||
private String getValue(String p_394210_) {
|
||||
@@ -1310,6 +_,17 @@
|
||||
);
|
||||
compoundtag1.getString("fullscreenResolution").ifPresent(p_389133_ -> this.fullscreenVideoModeString = p_389133_);
|
||||
KeyMapping.resetMapping();
|
||||
+
|
||||
+ if (limited) {
|
||||
+ this.unknownKeys.clear();
|
||||
+ } else {
|
||||
+ var knownKeys = Arrays.stream(this.keyMappings).map(k -> "key_" + k.getName()).collect(Collectors.toSet());
|
||||
+ for (var entry : compoundtag1.entrySet()) {
|
||||
+ if (entry.getKey().startsWith("key_") && entry.getValue().asString().isPresent() && !knownKeys.contains(entry.getKey()))
|
||||
+ this.unknownKeys.put(entry.getKey(), entry.getValue().asString().get());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
} catch (Exception exception) {
|
||||
LOGGER.error("Failed to load options", (Throwable)exception);
|
||||
}
|
||||
@@ -1337,9 +_,11 @@
|
||||
public void save() {
|
||||
try (final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
|
||||
printwriter.println("version:" + SharedConstants.getCurrentVersion().getDataVersion().getVersion());
|
||||
+ var seen = new java.util.HashSet<String>();
|
||||
this.processOptions(
|
||||
new Options.FieldAccess() {
|
||||
public void writePrefix(String p_168491_) {
|
||||
+ seen.add(p_168491_);
|
||||
printwriter.print(p_168491_);
|
||||
printwriter.print(':');
|
||||
}
|
||||
@@ -1395,6 +_,12 @@
|
||||
if (s != null) {
|
||||
printwriter.println("fullscreenResolution:" + s);
|
||||
}
|
||||
+ // Forge add any unknown keys so that Mods can add keybindings between vanilla loading/saving its config.
|
||||
+ for (var entry : this.unknownKeys.entrySet()) {
|
||||
+ if (!seen.contains(entry.getKey()))
|
||||
+ printwriter.println(entry.getKey() + ":" + entry.getValue());
|
||||
+ }
|
||||
+
|
||||
} catch (Exception exception) {
|
||||
LOGGER.error("Failed to save options", (Throwable)exception);
|
||||
}
|
||||
@@ -1433,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
@@ -71,7 +128,7 @@
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
|
||||
}
|
||||
@@ -1564,6 +_,23 @@
|
||||
@@ -1546,6 +_,23 @@
|
||||
|
||||
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
|
||||
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
--- a/net/minecraft/client/Screenshot.java
|
||||
+++ b/net/minecraft/client/Screenshot.java
|
||||
@@ -54,14 +_,24 @@
|
||||
file2 = new File(file1, p_92307_);
|
||||
}
|
||||
@@ -43,6 +_,13 @@
|
||||
file2 = new File(file1, p_92297_);
|
||||
}
|
||||
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenshot(nativeimage, file2);
|
||||
+ if (event.isCanceled()) {
|
||||
+ p_92311_.accept(event.getCancelMessage());
|
||||
+ return;
|
||||
+ }
|
||||
+ final File target = event.getScreenshotFile();
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenshot(p_389141_, file2);
|
||||
+ if (event.isCanceled()) {
|
||||
+ p_92301_.accept(event.getCancelMessage());
|
||||
+ return;
|
||||
+ }
|
||||
+ final File target = event.getScreenshotFile();
|
||||
+
|
||||
Util.ioPool()
|
||||
.execute(
|
||||
() -> {
|
||||
try {
|
||||
- nativeimage.writeToFile(file2);
|
||||
- Component component = Component.literal(file2.getName())
|
||||
+ nativeimage.writeToFile(target);
|
||||
+ Component component = Component.literal(target.getName())
|
||||
.withStyle(ChatFormatting.UNDERLINE)
|
||||
- .withStyle(p_168608_ -> p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())));
|
||||
+ .withStyle(p_168608_ -> p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath())));
|
||||
+ if (event.getResultMessage() != null)
|
||||
+ p_92311_.accept(event.getResultMessage());
|
||||
+ else
|
||||
p_92311_.accept(Component.translatable("screenshot.success", component));
|
||||
} catch (Exception exception) {
|
||||
LOGGER.warn("Couldn't save screenshot", (Throwable)exception);
|
||||
Util.ioPool()
|
||||
.execute(
|
||||
() -> {
|
||||
@@ -50,10 +_,13 @@
|
||||
NativeImage $$4x = p_389141_;
|
||||
|
||||
try {
|
||||
- p_389141_.writeToFile(file2);
|
||||
- Component component = Component.literal(file2.getName())
|
||||
+ p_389141_.writeToFile(target);
|
||||
+ Component component = Component.literal(target.getName())
|
||||
.withStyle(ChatFormatting.UNDERLINE)
|
||||
.withStyle(p_389149_ -> p_389149_.withClickEvent(new ClickEvent.OpenFile(file2.getAbsoluteFile())));
|
||||
+ if (event.getResultMessage() != null)
|
||||
+ p_92301_.accept(event.getResultMessage());
|
||||
+ else
|
||||
p_92301_.accept(Component.translatable("screenshot.success", component));
|
||||
} catch (Throwable throwable1) {
|
||||
if (p_389141_ != null) {
|
||||
@@ -10,7 +10,7 @@
|
||||
private final Map<Block, Set<Property<?>>> coloringStates = Maps.newHashMap();
|
||||
|
||||
public static BlockColors createDefault() {
|
||||
@@ -90,11 +_,12 @@
|
||||
@@ -95,11 +_,12 @@
|
||||
}, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM);
|
||||
blockcolors.addColoringState(StemBlock.AGE, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM);
|
||||
blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> p_92597_ != null && p_92598_ != null ? -14647248 : -9321636, Blocks.LILY_PAD);
|
||||
@@ -24,7 +24,7 @@
|
||||
if (blockcolor != null) {
|
||||
return blockcolor.getColor(p_92583_, null, null, 0);
|
||||
} else {
|
||||
@@ -104,13 +_,15 @@
|
||||
@@ -109,13 +_,15 @@
|
||||
}
|
||||
|
||||
public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
boolean flag1 = flag || optionset.has(optionspec1);
|
||||
Bootstrap.bootStrap();
|
||||
ClientBootstrap.bootstrap();
|
||||
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, false))
|
||||
+ if (!loader.run(optionset, path, input, flag, flag1, flag, flag, true))
|
||||
+ return;
|
||||
DataGenerator datagenerator = new DataGenerator(path, SharedConstants.getCurrentVersion(), true);
|
||||
addClientProviders(datagenerator, flag1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/data/models/ModelProvider.java
|
||||
+++ b/net/minecraft/client/data/models/ModelProvider.java
|
||||
@@ -43,11 +_,11 @@
|
||||
@@ -45,11 +_,11 @@
|
||||
|
||||
@Override
|
||||
public CompletableFuture<?> run(CachedOutput p_376268_) {
|
||||
@@ -16,7 +16,7 @@
|
||||
modelprovider$blockstategeneratorcollector.validate();
|
||||
modelprovider$iteminfocollector.finalizeAndValidate();
|
||||
return CompletableFuture.allOf(
|
||||
@@ -57,6 +_,22 @@
|
||||
@@ -59,6 +_,22 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
+ return new ItemModelGenerators(items, models);
|
||||
+ }
|
||||
+
|
||||
static <T> CompletableFuture<?> saveAll(CachedOutput p_378816_, Function<T, Path> p_377914_, Map<T, ? extends Supplier<JsonElement>> p_377836_) {
|
||||
return DataProvider.saveAll(p_378816_, Supplier::get, p_377914_, p_377836_);
|
||||
}
|
||||
@@ -69,6 +_,15 @@
|
||||
@Override
|
||||
public final String getName() {
|
||||
return "Model Definitions";
|
||||
@@ -67,6 +_,15 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class BlockStateGeneratorCollector implements Consumer<BlockStateGenerator> {
|
||||
private final Map<Block, BlockStateGenerator> generators = new HashMap<>();
|
||||
public static class BlockStateGeneratorCollector implements Consumer<BlockModelDefinitionGenerator> {
|
||||
private final Map<Block, BlockModelDefinitionGenerator> generators = new HashMap<>();
|
||||
+ private final Supplier<Stream<Block>> known;
|
||||
+
|
||||
+ public BlockStateGeneratorCollector() {
|
||||
@@ -53,9 +53,9 @@
|
||||
+ this.known = known;
|
||||
+ }
|
||||
|
||||
public void accept(BlockStateGenerator p_378147_) {
|
||||
Block block = p_378147_.getBlock();
|
||||
@@ -79,7 +_,7 @@
|
||||
public void accept(BlockModelDefinitionGenerator p_393399_) {
|
||||
Block block = p_393399_.block();
|
||||
@@ -77,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/Gui.java
|
||||
+++ b/net/minecraft/client/gui/Gui.java
|
||||
@@ -147,7 +_,7 @@
|
||||
@@ -148,7 +_,7 @@
|
||||
public float vignetteBrightness = 1.0F;
|
||||
private int toolHighlightTimer;
|
||||
private ItemStack lastToolHighlight = ItemStack.EMPTY;
|
||||
@@ -9,16 +9,50 @@
|
||||
private final SubtitleOverlay subtitleOverlay;
|
||||
private final SpectatorGui spectatorGui;
|
||||
private final PlayerTabOverlay tabList;
|
||||
@@ -345,7 +_,7 @@
|
||||
@@ -168,7 +_,7 @@
|
||||
private int lastBubblePopSoundPlayed;
|
||||
private float autosaveIndicatorValue;
|
||||
private float lastAutosaveIndicatorValue;
|
||||
- private final LayeredDraw layers = new LayeredDraw();
|
||||
+ private final LayeredDraw layers = new net.minecraftforge.client.gui.overlay.ForgeLayeredDraw(net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.VANILLA_ROOT, net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.COMBINE_LIST);
|
||||
private float scopeScale;
|
||||
|
||||
public Gui(Minecraft p_330021_) {
|
||||
@@ -180,14 +_,14 @@
|
||||
this.bossOverlay = new BossHealthOverlay(p_330021_);
|
||||
this.subtitleOverlay = new SubtitleOverlay(p_330021_);
|
||||
this.resetTitleTimes();
|
||||
- LayeredDraw layereddraw = new LayeredDraw()
|
||||
+ LayeredDraw layereddraw = new net.minecraftforge.client.gui.overlay.ForgeLayeredDraw(net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.PRE_SLEEP_STACK, net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.PRE_LIST)
|
||||
.add(this::renderCameraOverlays)
|
||||
.add(this::renderCrosshair)
|
||||
.add(this::renderHotbarAndDecorations)
|
||||
.add(this::renderExperienceLevel)
|
||||
.add(this::renderEffects)
|
||||
.add((p_325313_, p_342678_) -> this.bossOverlay.render(p_325313_));
|
||||
- LayeredDraw layereddraw1 = new LayeredDraw()
|
||||
+ LayeredDraw layereddraw1 = new net.minecraftforge.client.gui.overlay.ForgeLayeredDraw(net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.POST_SLEEP_STACK,net.minecraftforge.client.gui.overlay.ForgeLayeredDraw.POST_LIST)
|
||||
.add(this::renderDemoOverlay)
|
||||
.add((p_325315_, p_344521_) -> {
|
||||
if (this.debugOverlay.showDebugScreen()) {
|
||||
@@ -204,6 +_,7 @@
|
||||
.add(layereddraw, () -> !p_330021_.options.hideGui)
|
||||
.add(this::renderSleepOverlay)
|
||||
.add(layereddraw1, () -> !p_330021_.options.hideGui);
|
||||
+ ((net.minecraftforge.client.gui.overlay.ForgeLayeredDraw) layers).resolveLayers();
|
||||
}
|
||||
|
||||
public void resetTitleTimes() {
|
||||
@@ -347,7 +_,7 @@
|
||||
Window window = this.minecraft.getWindow();
|
||||
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());
|
||||
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
|
||||
int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
|
||||
- this.chat.render(p_329202_, this.tickCount, i, j, false);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,6 +_,8 @@
|
||||
@@ -445,6 +_,8 @@
|
||||
|
||||
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
Holder<MobEffect> holder = mobeffectinstance.getEffect();
|
||||
@@ -27,7 +61,7 @@
|
||||
if (mobeffectinstance.showIcon()) {
|
||||
int k = p_282812_.guiWidth();
|
||||
int l = 1;
|
||||
@@ -473,6 +_,7 @@
|
||||
@@ -475,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +69,7 @@
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
|
||||
int l1 = k;
|
||||
int k1 = l;
|
||||
@@ -623,6 +_,10 @@
|
||||
@@ -625,6 +_,10 @@
|
||||
}
|
||||
|
||||
private void renderSelectedItemName(GuiGraphics p_283501_) {
|
||||
@@ -46,7 +80,7 @@
|
||||
Profiler.get().push("selectedItemName");
|
||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
|
||||
@@ -630,9 +_,13 @@
|
||||
@@ -632,9 +_,13 @@
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
@@ -62,7 +96,7 @@
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
k += 14;
|
||||
}
|
||||
@@ -643,7 +_,7 @@
|
||||
@@ -645,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (l > 0) {
|
||||
@@ -71,8 +105,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1152,7 +_,7 @@
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
|
||||
@@ -1154,7 +_,7 @@
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelectedItem();
|
||||
if (itemstack.isEmpty()) {
|
||||
this.toolHighlightTimer = 0;
|
||||
- } else if (this.lastToolHighlight.isEmpty() || !itemstack.is(this.lastToolHighlight.getItem()) || !itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
+ // Forge: Add float variant for x,y coordinates
|
||||
+ public int drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_) {
|
||||
return p_282636_.drawInBatch(
|
||||
p_281596_,
|
||||
(float)p_281586_,
|
||||
@@ -859,6 +_,7 @@
|
||||
p_281596_, p_281586_, p_282816_, p_281743_, p_282394_, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880
|
||||
);
|
||||
@@ -850,6 +_,7 @@
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
|
||||
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
|
||||
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem()));
|
||||
@@ -41,7 +41,7 @@
|
||||
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_281675_.getComponents()));
|
||||
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil()));
|
||||
throw new ReportedException(crashreport);
|
||||
@@ -879,13 +_,24 @@
|
||||
@@ -870,13 +_,24 @@
|
||||
this.renderItemCount(p_282005_, p_283349_, p_282641_, p_282146_, p_282803_);
|
||||
this.renderItemCooldown(p_283349_, p_282641_, p_282146_);
|
||||
this.pose.popPose();
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
public void renderTooltip(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
|
||||
@@ -895,8 +_,7 @@
|
||||
@@ -886,8 +_,7 @@
|
||||
public void renderTooltip(
|
||||
Font p_362491_, List<Component> p_368544_, Optional<TooltipComponent> p_362815_, int p_366300_, int p_368952_, @Nullable ResourceLocation p_368469_
|
||||
) {
|
||||
@@ -76,7 +76,7 @@
|
||||
this.renderTooltipInternal(p_362491_, list, p_366300_, p_368952_, DefaultTooltipPositioner.INSTANCE, p_368469_);
|
||||
}
|
||||
|
||||
@@ -909,7 +_,22 @@
|
||||
@@ -900,7 +_,22 @@
|
||||
}
|
||||
|
||||
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
|
||||
@@ -100,7 +100,7 @@
|
||||
}
|
||||
|
||||
public void renderComponentTooltip(Font p_369090_, List<Component> p_365405_, int p_368143_, int p_366244_, @Nullable ResourceLocation p_364763_) {
|
||||
@@ -951,11 +_,13 @@
|
||||
@@ -942,11 +_,13 @@
|
||||
@Nullable ResourceLocation p_368234_
|
||||
) {
|
||||
if (!p_282615_.isEmpty()) {
|
||||
@@ -115,7 +115,7 @@
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -965,18 +_,19 @@
|
||||
@@ -956,18 +_,19 @@
|
||||
|
||||
int i2 = i;
|
||||
int j2 = j;
|
||||
@@ -138,7 +138,7 @@
|
||||
k1 += clienttooltipcomponent1.getHeight(p_282675_) + (l1 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -984,7 +_,7 @@
|
||||
@@ -975,7 +_,7 @@
|
||||
|
||||
for (int k2 = 0; k2 < p_282615_.size(); k2++) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
|
||||
@@ -147,8 +147,8 @@
|
||||
k1 += clienttooltipcomponent2.getHeight(p_282675_) + (k2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -1041,6 +_,10 @@
|
||||
}
|
||||
@@ -1030,6 +_,10 @@
|
||||
default:
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||
@@ -105,9 +_,9 @@
|
||||
@@ -134,9 +_,9 @@
|
||||
@Nullable
|
||||
private CompletableFuture<LevelChunk> serverChunk;
|
||||
private boolean renderDebug;
|
||||
@@ -13,7 +13,7 @@
|
||||
private final LocalSampleLogger frameTimeLogger = new LocalSampleLogger(1);
|
||||
private final LocalSampleLogger tickTimeLogger = new LocalSampleLogger(TpsDebugDimensions.values().length);
|
||||
private final LocalSampleLogger pingLogger = new LocalSampleLogger(1);
|
||||
@@ -135,14 +_,18 @@
|
||||
@@ -179,14 +_,18 @@
|
||||
this.clientChunk = null;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
this.profilerPieChart.setBottomOffset(10);
|
||||
if (this.renderFpsCharts) {
|
||||
int i = p_281427_.guiWidth();
|
||||
@@ -155,7 +_,9 @@
|
||||
@@ -199,7 +_,9 @@
|
||||
|
||||
this.profilerPieChart.setBottomOffset(this.tpsChart.getFullHeight());
|
||||
}
|
||||
@@ -45,7 +45,7 @@
|
||||
if (this.renderNetworkCharts) {
|
||||
int l = p_281427_.guiWidth();
|
||||
int i1 = l / 2;
|
||||
@@ -171,12 +_,22 @@
|
||||
@@ -215,12 +_,22 @@
|
||||
try (Zone zone = profilerfiller.zone("profilerPie")) {
|
||||
this.profilerPieChart.render(p_281427_);
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
list.add("");
|
||||
boolean flag = this.minecraft.getSingleplayerServer() != null;
|
||||
list.add(
|
||||
@@ -190,11 +_,18 @@
|
||||
@@ -234,11 +_,18 @@
|
||||
+ (this.renderNetworkCharts ? " visible" : " hidden")
|
||||
);
|
||||
list.add("For help: press F3 + Q");
|
||||
@@ -90,7 +90,7 @@
|
||||
this.renderLines(p_281261_, list, false);
|
||||
}
|
||||
|
||||
@@ -543,6 +_,7 @@
|
||||
@@ -592,6 +_,7 @@
|
||||
list.add("");
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
|
||||
@@ -107,6 +_,7 @@
|
||||
@@ -127,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void addToast(Toast p_360768_) {
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
@Override
|
||||
public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) {
|
||||
int i = p_281839_.guiWidth();
|
||||
@@ -99,6 +_,7 @@
|
||||
@@ -95,6 +_,7 @@
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
+ if (renderContents(p_281839_, f2)) {
|
||||
int k2 = (int)((double)p_281839_.guiWidth() * 0.5);
|
||||
int l2 = (int)((double)p_281839_.guiHeight() * 0.5);
|
||||
double d1 = Math.min((double)p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25;
|
||||
@@ -114,12 +_,14 @@
|
||||
int l2 = (int)(p_281839_.guiWidth() * 0.5);
|
||||
int i1 = (int)(p_281839_.guiHeight() * 0.5);
|
||||
double d0 = Math.min(p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25;
|
||||
@@ -110,12 +_,14 @@
|
||||
if (f < 1.0F) {
|
||||
this.drawProgressBar(p_281839_, i / 2 - j1, l1 - 5, i / 2 + j1, l1 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
|
||||
this.drawProgressBar(p_281839_, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
|
||||
}
|
||||
+ }
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
try {
|
||||
this.reload.checkExceptions();
|
||||
this.onFinish.accept(Optional.empty());
|
||||
@@ -127,7 +_,6 @@
|
||||
@@ -123,7 +_,6 @@
|
||||
this.onFinish.accept(Optional.of(throwable));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -200,7 +_,7 @@
|
||||
@@ -197,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
protected void renderBlurredBackground() {
|
||||
@@ -454,6 +_,19 @@
|
||||
@@ -453,6 +_,19 @@
|
||||
}
|
||||
|
||||
public void onFilesDrop(List<Path> p_96591_) {
|
||||
|
||||
@@ -33,25 +33,17 @@
|
||||
.tooltip(tooltip)
|
||||
.build()
|
||||
)
|
||||
@@ -289,6 +_,7 @@
|
||||
if ((i & -67108864) != 0) {
|
||||
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
|
||||
this.logoRenderer.renderLogo(p_282860_, this.width, f);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
|
||||
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
|
||||
this.splash.render(p_282860_, this.width, this.font, i);
|
||||
}
|
||||
@@ -304,10 +_,18 @@
|
||||
s = s + I18n.get("menu.modded");
|
||||
}
|
||||
|
||||
- p_282860_.drawString(this.font, s, 2, this.height - 10, 16777215 | i);
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
|
||||
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i)
|
||||
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i)
|
||||
+ );
|
||||
+
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brd, brdline) ->
|
||||
+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i)
|
||||
+ p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i)
|
||||
+ );
|
||||
+
|
||||
if (this.realmsNotificationsEnabled() && f >= 1.0F) {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
|
||||
@@ -38,6 +_,7 @@
|
||||
@@ -39,6 +_,7 @@
|
||||
private int maxY = Integer.MIN_VALUE;
|
||||
private float fade;
|
||||
private boolean centered;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public AdvancementTab(
|
||||
Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, AdvancementNode p_297568_, DisplayInfo p_97150_
|
||||
@@ -54,6 +_,15 @@
|
||||
@@ -55,6 +_,15 @@
|
||||
this.addWidget(this.root, p_297568_.holder());
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
public AdvancementTabType getType() {
|
||||
return this.type;
|
||||
}
|
||||
@@ -147,8 +_,8 @@
|
||||
@@ -148,8 +_,8 @@
|
||||
return null;
|
||||
} else {
|
||||
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
|
||||
|
||||
+1
-1
@@ -55,6 +55,6 @@
|
||||
if (this.tabs.size() > 1) {
|
||||
for (AdvancementTab advancementtab : this.tabs.values()) {
|
||||
+ if (advancementtab.getPage() == tabPage)
|
||||
if (advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) {
|
||||
if (advancementtab.isMouseOver(p_281519_, p_283371_, p_283556_, p_282458_)) {
|
||||
p_282784_.renderTooltip(this.font, advancementtab.getTitle(), p_283556_, p_282458_);
|
||||
}
|
||||
+7
-7
@@ -6,7 +6,7 @@
|
||||
super.render(p_283479_, p_283661_, p_281248_, p_281886_);
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, p_283479_, p_283661_, p_281248_);
|
||||
p_283479_.pose().pushPose();
|
||||
p_283479_.pose().translate((float)i, (float)j, 0.0F);
|
||||
p_283479_.pose().translate(i, j, 0.0F);
|
||||
Slot slot = this.hoveredSlot;
|
||||
@@ -117,6 +_,8 @@
|
||||
this.onStopHovering(slot);
|
||||
@@ -40,7 +40,7 @@
|
||||
if (super.mouseClicked(p_97748_, p_97749_, p_97750_)) {
|
||||
return true;
|
||||
} else {
|
||||
- boolean flag = this.minecraft.options.keyPickItem.matchesMouse(p_97750_) && this.minecraft.gameMode.hasInfiniteItems();
|
||||
- boolean flag = this.minecraft.options.keyPickItem.matchesMouse(p_97750_) && this.minecraft.player.hasInfiniteMaterials();
|
||||
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(p_97750_);
|
||||
+ boolean flag = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey);
|
||||
Slot slot = this.getHoveredSlot(p_97748_, p_97749_);
|
||||
@@ -72,7 +72,7 @@
|
||||
this.quickCraftingType = 2;
|
||||
}
|
||||
}
|
||||
@@ -464,10 +_,13 @@
|
||||
@@ -461,10 +_,13 @@
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double p_97812_, double p_97813_, int p_97814_) {
|
||||
@@ -86,7 +86,7 @@
|
||||
int k = -1;
|
||||
if (slot != null) {
|
||||
k = slot.index;
|
||||
@@ -484,7 +_,7 @@
|
||||
@@ -481,7 +_,7 @@
|
||||
if (slot2 != null
|
||||
&& slot2.mayPickup(this.minecraft.player)
|
||||
&& slot2.hasItem()
|
||||
@@ -95,7 +95,7 @@
|
||||
&& AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
|
||||
this.slotClicked(slot2, slot2.index, p_97814_, ClickType.QUICK_MOVE);
|
||||
}
|
||||
@@ -548,7 +_,7 @@
|
||||
@@ -545,7 +_,7 @@
|
||||
|
||||
this.slotClicked(null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT);
|
||||
} else if (!this.menu.getCarried().isEmpty()) {
|
||||
@@ -104,7 +104,7 @@
|
||||
this.slotClicked(slot, k, p_97814_, ClickType.CLONE);
|
||||
} else {
|
||||
boolean flag1 = k != -999
|
||||
@@ -628,9 +_,10 @@
|
||||
@@ -622,9 +_,10 @@
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int p_97765_, int p_97766_, int p_97767_) {
|
||||
@@ -116,7 +116,7 @@
|
||||
this.onClose();
|
||||
return true;
|
||||
} else {
|
||||
@@ -704,4 +_,11 @@
|
||||
@@ -698,4 +_,11 @@
|
||||
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
+19
-19
@@ -20,7 +20,7 @@
|
||||
this.menu.items.addAll(p_261591_);
|
||||
@@ -330,6 +_,35 @@
|
||||
protected void init() {
|
||||
if (this.minecraft.gameMode.hasInfiniteItems()) {
|
||||
if (this.minecraft.player.hasInfiniteMaterials()) {
|
||||
super.init();
|
||||
+ this.pages.clear();
|
||||
+ int tabIndex = 0;
|
||||
@@ -98,14 +98,14 @@
|
||||
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
|
||||
if (selectedTab.showTitle()) {
|
||||
- p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, 4210752, false);
|
||||
+ com.mojang.blaze3d.systems.RenderSystem.disableBlend();
|
||||
+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend();
|
||||
+ p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, selectedTab.getLabelColor(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +_,7 @@
|
||||
double d0 = p_98531_ - (double)this.leftPos;
|
||||
double d1 = p_98532_ - (double)this.topPos;
|
||||
double d0 = p_98531_ - this.leftPos;
|
||||
double d1 = p_98532_ - this.topPos;
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
|
||||
@@ -113,7 +113,7 @@
|
||||
return true;
|
||||
}
|
||||
@@ -510,7 +_,7 @@
|
||||
double d1 = p_98623_ - (double)this.topPos;
|
||||
double d1 = p_98623_ - this.topPos;
|
||||
this.scrolling = false;
|
||||
|
||||
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
this.refreshSearchResults();
|
||||
} else {
|
||||
@@ -676,7 +_,15 @@
|
||||
@@ -673,7 +_,15 @@
|
||||
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
||||
this.effects.render(p_283000_, p_281317_, p_282770_, p_281295_);
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
|
||||
break;
|
||||
}
|
||||
@@ -688,6 +_,7 @@
|
||||
@@ -685,6 +_,7 @@
|
||||
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
this.renderTooltip(p_283000_, p_281317_, p_282770_);
|
||||
}
|
||||
|
||||
@@ -700,7 +_,7 @@
|
||||
@@ -697,7 +_,7 @@
|
||||
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
|
||||
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
|
||||
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
|
||||
@@ -172,7 +172,7 @@
|
||||
TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
|
||||
TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default;
|
||||
List<Component> list = p_281769_.getTooltipLines(Item.TooltipContext.of(this.minecraft.level), this.minecraft.player, tooltipflag);
|
||||
@@ -719,7 +_,7 @@
|
||||
@@ -718,7 +_,7 @@
|
||||
int i = 1;
|
||||
|
||||
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
|
||||
@@ -181,7 +181,7 @@
|
||||
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
|
||||
}
|
||||
}
|
||||
@@ -730,7 +_,7 @@
|
||||
@@ -729,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
|
||||
@@ -190,15 +190,15 @@
|
||||
if (creativemodetab != selectedTab) {
|
||||
this.renderTabButton(p_282663_, creativemodetab);
|
||||
}
|
||||
@@ -746,6 +_,7 @@
|
||||
p_282663_.blitSprite(RenderType::guiTextured, resourcelocation, j, k + (int)((float)(i - k - 17) * this.scrollOffs), 12, 15);
|
||||
@@ -745,6 +_,7 @@
|
||||
p_282663_.blitSprite(RenderType::guiTextured, resourcelocation, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
|
||||
}
|
||||
|
||||
+ if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
|
||||
this.renderTabButton(p_282663_, selectedTab);
|
||||
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
|
||||
InventoryScreen.renderEntityInInventoryFollowsMouse(
|
||||
@@ -764,7 +_,7 @@
|
||||
@@ -763,7 +_,7 @@
|
||||
}
|
||||
|
||||
private int getTabX(CreativeModeTab p_260136_) {
|
||||
@@ -207,7 +207,7 @@
|
||||
int j = 27;
|
||||
int k = 27 * i;
|
||||
if (p_260136_.isAlignedRight()) {
|
||||
@@ -776,7 +_,7 @@
|
||||
@@ -775,7 +_,7 @@
|
||||
|
||||
private int getTabY(CreativeModeTab p_260181_) {
|
||||
int i = 0;
|
||||
@@ -216,7 +216,7 @@
|
||||
i -= 32;
|
||||
} else {
|
||||
i += this.imageHeight;
|
||||
@@ -804,8 +_,8 @@
|
||||
@@ -803,8 +_,8 @@
|
||||
|
||||
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
|
||||
boolean flag = p_283489_ == selectedTab;
|
||||
@@ -227,15 +227,15 @@
|
||||
int j = this.leftPos + this.getTabX(p_283489_);
|
||||
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
|
||||
ResourceLocation[] aresourcelocation;
|
||||
@@ -815,6 +_,7 @@
|
||||
@@ -814,6 +_,7 @@
|
||||
aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
|
||||
}
|
||||
|
||||
+ com.mojang.blaze3d.systems.RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||
p_283590_.blitSprite(RenderType::guiTextured, aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
|
||||
p_283590_.pose().pushPose();
|
||||
p_283590_.pose().translate(0.0F, 0.0F, 100.0F);
|
||||
@@ -856,6 +_,14 @@
|
||||
@@ -855,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
static class CustomCreativeSlot extends Slot {
|
||||
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
|
||||
@@ -1037,6 +_,22 @@
|
||||
@@ -1036,6 +_,22 @@
|
||||
@Override
|
||||
public boolean mayPickup(Player p_98665_) {
|
||||
return this.target.mayPickup(p_98665_);
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@
|
||||
int l1 = 86 - this.font.width(s);
|
||||
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
|
||||
int i2 = 6839882;
|
||||
- if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.getAbilities().instabuild) {
|
||||
+ if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.getAbilities().instabuild) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{
|
||||
- if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) {
|
||||
+ if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.hasInfiniteMaterials()) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels{
|
||||
p_282430_.blitSprite(RenderType::guiTextured, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
|
||||
p_282430_.blitSprite(RenderType::guiTextured, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
|
||||
p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1, false);
|
||||
@@ -17,7 +17,7 @@
|
||||
+ {
|
||||
int l = this.menu.levelClue[j];
|
||||
int i1 = j + 1;
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && optional != null) {
|
||||
- if (this.isHovering(60, 14 + 19 * j, 108, 17, p_282491_, p_281953_) && k > 0 && l >= 0 && optional != null) {
|
||||
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
|
||||
List<Component> list = Lists.newArrayList();
|
||||
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -25,7 +_,7 @@
|
||||
@@ -22,7 +_,7 @@
|
||||
case ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip -> new ClientActivePlayersTooltip(
|
||||
clientactiveplayerstooltip$activeplayerstooltip
|
||||
);
|
||||
clientactiveplayerstooltip$activeplayerstooltip
|
||||
);
|
||||
- default -> throw new IllegalArgumentException("Unknown TooltipComponent");
|
||||
+ default -> net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
|
||||
});
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
+ .bounds(0, 0, 75 + 20 /* Forge: Add space */, 20)
|
||||
.createNarration(
|
||||
p_342179_ -> p_343088_.isUnbound()
|
||||
? Component.translatable("narrator.controls.unbound", p_343976_)
|
||||
? Component.translatable("narrator.controls.unbound", p_343976_)
|
||||
@@ -158,7 +_,7 @@
|
||||
)
|
||||
.build();
|
||||
|
||||
+2
-2
@@ -6,6 +6,6 @@
|
||||
p_100014_.setSelected(null);
|
||||
- p_100015_.forEach(
|
||||
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
|
||||
p_374582_ -> {
|
||||
p_389318_ -> {
|
||||
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
|
||||
this.minecraft, p_100014_, p_374582_
|
||||
this.minecraft, p_100014_, p_389318_
|
||||
+7
-7
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -168,6 +_,7 @@
|
||||
) {
|
||||
queueLoadScreen(p_369292_, PREPARING_WORLD_DATA);
|
||||
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_369292_.directoryValidator()));
|
||||
@@ -171,6 +_,7 @@
|
||||
WorldDataConfiguration worlddataconfiguration = SharedConstants.IS_RUNNING_IN_IDE
|
||||
? new WorldDataConfiguration(new DataPackConfig(List.of("vanilla", "tests"), List.of()), FeatureFlags.DEFAULT_FLAGS)
|
||||
: WorldDataConfiguration.DEFAULT;
|
||||
+ net.minecraftforge.event.ForgeEventFactory.addPackFindersServer(packrepository::addPackFinder);
|
||||
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT);
|
||||
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, worlddataconfiguration);
|
||||
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
|
||||
worldloader$initconfig,
|
||||
@@ -468,7 +_,7 @@
|
||||
@@ -471,7 +_,7 @@
|
||||
if (p_269627_) {
|
||||
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
|
||||
} else {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
},
|
||||
Component.translatable("dataPack.validation.failed"),
|
||||
@@ -582,6 +_,7 @@
|
||||
@@ -585,6 +_,7 @@
|
||||
if (path != null) {
|
||||
if (this.tempDataPackRepository == null) {
|
||||
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
|
||||
@@ -464,6 +_,7 @@
|
||||
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition55);
|
||||
@@ -497,6 +_,7 @@
|
||||
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition60);
|
||||
}
|
||||
});
|
||||
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/model/geom/ModelLayers.java
|
||||
+++ b/net/minecraft/client/model/geom/ModelLayers.java
|
||||
@@ -308,15 +_,18 @@
|
||||
@@ -330,15 +_,18 @@
|
||||
}
|
||||
|
||||
public static ModelLayerLocation createStandingSignModelName(WoodType p_171292_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientChunkCache.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientChunkCache.java
|
||||
@@ -63,6 +_,7 @@
|
||||
@@ -64,6 +_,7 @@
|
||||
int i = this.storage.getIndex(p_298665_.x, p_298665_.z);
|
||||
LevelChunk levelchunk = this.storage.getChunk(i);
|
||||
if (isValidChunk(levelchunk, p_298665_.x, p_298665_.z)) {
|
||||
@@ -8,7 +8,7 @@
|
||||
this.storage.drop(i, levelchunk);
|
||||
}
|
||||
}
|
||||
@@ -124,6 +_,7 @@
|
||||
@@ -125,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.level.onChunkLoaded(chunkpos);
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
|
||||
@@ -142,6 +_,7 @@
|
||||
);
|
||||
this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE);
|
||||
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
|
||||
@@ -147,6 +_,7 @@
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
+ net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
||||
@@ -123,6 +_,7 @@
|
||||
p_194170_.put(BiomeColors.GRASS_COLOR_RESOLVER, new BlockTintCache(p_194181_ -> this.calculateBlockTint(p_194181_, BiomeColors.GRASS_COLOR_RESOLVER)));
|
||||
p_194170_.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_194177_ -> this.calculateBlockTint(p_194177_, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
|
||||
p_194170_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)));
|
||||
+ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_194170_);
|
||||
@@ -126,6 +_,7 @@
|
||||
p_389331_.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_194177_ -> this.calculateBlockTint(p_194177_, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
|
||||
p_389331_.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_389335_ -> this.calculateBlockTint(p_389335_, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER)));
|
||||
p_389331_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)));
|
||||
+ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_389331_);
|
||||
});
|
||||
private final ClientChunkCache chunkSource;
|
||||
private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
|
||||
@@ -131,6 +_,8 @@
|
||||
@@ -134,6 +_,8 @@
|
||||
private final int seaLevel;
|
||||
private boolean tickDayTime;
|
||||
private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
public void handleBlockChangedAck(int p_233652_) {
|
||||
this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this);
|
||||
@@ -197,6 +_,8 @@
|
||||
@@ -200,6 +_,8 @@
|
||||
this.serverSimulationDistance = p_364305_;
|
||||
this.updateSkyBrightness();
|
||||
this.prepareWeather();
|
||||
@@ -26,7 +26,7 @@
|
||||
}
|
||||
|
||||
public void queueLightUpdate(Runnable p_194172_) {
|
||||
@@ -279,6 +_,7 @@
|
||||
@@ -282,6 +_,7 @@
|
||||
p_104640_.setOldPosAndRot();
|
||||
p_104640_.tickCount++;
|
||||
Profiler.get().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString());
|
||||
@@ -34,7 +34,7 @@
|
||||
p_104640_.tick();
|
||||
Profiler.get().pop();
|
||||
|
||||
@@ -330,8 +_,10 @@
|
||||
@@ -333,8 +_,10 @@
|
||||
}
|
||||
|
||||
public void addEntity(Entity p_104741_) {
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) {
|
||||
@@ -502,6 +_,12 @@
|
||||
@@ -516,6 +_,12 @@
|
||||
float p_263349_,
|
||||
long p_263408_
|
||||
) {
|
||||
@@ -55,24 +55,24 @@
|
||||
+ p_263417_ = event.getSource();
|
||||
+ p_263416_ = event.getNewVolume();
|
||||
+ p_263349_ = event.getNewPitch();
|
||||
if (p_263381_ == this.minecraft.player) {
|
||||
if (p_394722_ == this.minecraft.player) {
|
||||
this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_);
|
||||
}
|
||||
@@ -511,6 +_,12 @@
|
||||
@@ -525,6 +_,12 @@
|
||||
public void playSeededSound(
|
||||
@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_
|
||||
@Nullable Entity p_263536_, Entity p_396496_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_
|
||||
) {
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.minecraft.level, p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
|
||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
||||
+ p_263518_ = event.getSound();
|
||||
+ p_263487_ = event.getSource();
|
||||
+ p_263538_ = event.getNewVolume();
|
||||
+ p_263524_ = event.getNewPitch();
|
||||
if (p_263514_ == this.minecraft.player) {
|
||||
this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_));
|
||||
if (p_263536_ == this.minecraft.player) {
|
||||
this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_396496_, p_263509_));
|
||||
}
|
||||
@@ -953,6 +_,24 @@
|
||||
return this.seaLevel;
|
||||
@@ -975,6 +_,16 @@
|
||||
this.connection.registerForCleaning(p_396040_);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@@ -84,19 +84,11 @@
|
||||
+ public net.minecraftforge.client.model.data.ModelDataManager getModelDataManager() {
|
||||
+ return modelDataManager;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
|
||||
+ boolean constantAmbientLight = this.effects().constantAmbientLight();
|
||||
+ if (!shade)
|
||||
+ return constantAmbientLight ? 0.9F : 1.0F;
|
||||
+ return net.minecraftforge.client.model.lighting.QuadLighter.calculateShade(normalX, normalY, normalZ, constantAmbientLight);
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class ClientLevelData implements WritableLevelData {
|
||||
private final boolean hardcore;
|
||||
@@ -1041,6 +_,7 @@
|
||||
@@ -1063,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setDifficulty(Difficulty p_104852_) {
|
||||
@@ -104,7 +96,7 @@
|
||||
this.difficulty = p_104852_;
|
||||
}
|
||||
|
||||
@@ -1084,6 +_,12 @@
|
||||
@@ -1105,6 +_,12 @@
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -117,7 +109,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity p_171716_) {
|
||||
@@ -1097,6 +_,15 @@
|
||||
@@ -1117,6 +_,15 @@
|
||||
ClientLevel.this.dragonParts.removeAll(Arrays.asList(enderdragon.getSubEntities()));
|
||||
break;
|
||||
default:
|
||||
|
||||
+13
-16
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||
@@ -452,6 +_,7 @@
|
||||
@@ -477,6 +_,7 @@
|
||||
|
||||
this.minecraft.debugRenderer.clear();
|
||||
this.minecraft.player.resetPos();
|
||||
@@ -8,7 +8,7 @@
|
||||
this.minecraft.player.setId(p_105030_.playerId());
|
||||
this.level.addEntity(this.minecraft.player);
|
||||
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
|
||||
@@ -1249,6 +_,8 @@
|
||||
@@ -1263,6 +_,8 @@
|
||||
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
|
||||
}
|
||||
|
||||
@@ -17,19 +17,16 @@
|
||||
this.level.addEntity(localplayer1);
|
||||
localplayer1.input = new KeyboardInput(this.minecraft.options);
|
||||
this.minecraft.gameMode.adjustPlayer(localplayer1);
|
||||
@@ -1393,10 +_,7 @@
|
||||
@@ -1407,7 +_,7 @@
|
||||
PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
|
||||
BlockPos blockpos = p_104976_.getPos();
|
||||
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_325478_ -> {
|
||||
- CompoundTag compoundtag = p_104976_.getTag();
|
||||
- if (!compoundtag.isEmpty()) {
|
||||
- p_325478_.loadWithComponents(compoundtag, this.registryAccess);
|
||||
- }
|
||||
+ p_325478_.onDataPacket(connection, p_104976_, this.registryAccess);
|
||||
|
||||
if (p_325478_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
|
||||
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_389343_ -> {
|
||||
- p_389343_.loadWithComponents(p_104976_.getTag(), this.registryAccess);
|
||||
+ p_389343_.onDataPacket(connection, p_104976_, this.registryAccess);
|
||||
if (p_389343_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
|
||||
((CommandBlockEditScreen)this.minecraft.screen).updateGui();
|
||||
@@ -1557,7 +_,9 @@
|
||||
}
|
||||
@@ -1567,7 +_,9 @@
|
||||
@Override
|
||||
public void handleCommands(ClientboundCommandsPacket p_104990_) {
|
||||
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
|
||||
@@ -40,7 +37,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1658,6 +_,7 @@
|
||||
@@ -1668,6 +_,7 @@
|
||||
if (this.minecraft.screen instanceof RecipeUpdateListener recipeupdatelistener) {
|
||||
recipeupdatelistener.recipesUpdated();
|
||||
}
|
||||
@@ -48,7 +45,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1696,6 +_,8 @@
|
||||
@@ -1706,6 +_,8 @@
|
||||
this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures);
|
||||
List<ItemStack> list1 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
|
||||
this.searchTrees.updateCreativeTags(list1);
|
||||
@@ -57,7 +54,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2530,6 +_,8 @@
|
||||
@@ -2548,6 +_,8 @@
|
||||
}
|
||||
|
||||
public void sendChat(String p_249888_) {
|
||||
@@ -66,7 +63,7 @@
|
||||
Instant instant = Instant.now();
|
||||
long i = Crypt.SaltSupplier.getLong();
|
||||
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
|
||||
@@ -2538,6 +_,7 @@
|
||||
@@ -2556,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void sendCommand(String p_250092_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
|
||||
@@ -107,6 +_,7 @@
|
||||
@@ -110,6 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean destroyBlock(BlockPos p_105268_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -121,9 +_,8 @@
|
||||
@@ -124,9 +_,8 @@
|
||||
} else if (blockstate.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -19,7 +19,7 @@
|
||||
if (flag) {
|
||||
block.destroy(level, p_105268_, blockstate);
|
||||
}
|
||||
@@ -144,6 +_,7 @@
|
||||
@@ -147,6 +_,7 @@
|
||||
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
|
||||
this.startPrediction(this.minecraft.level, p_233757_ -> {
|
||||
@@ -27,7 +27,7 @@
|
||||
this.destroyBlock(p_105270_);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
|
||||
});
|
||||
@@ -153,15 +_,18 @@
|
||||
@@ -156,15 +_,18 @@
|
||||
this.connection
|
||||
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
|
||||
this.destroyBlock(p_105270_);
|
||||
} else {
|
||||
@@ -172,6 +_,7 @@
|
||||
@@ -175,6 +_,7 @@
|
||||
this.destroyTicks = 0.0F;
|
||||
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
|
||||
}
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
|
||||
});
|
||||
@@ -204,6 +_,7 @@
|
||||
@@ -207,6 +_,7 @@
|
||||
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
|
||||
this.startPrediction(this.minecraft.level, p_233753_ -> {
|
||||
@@ -62,7 +62,7 @@
|
||||
this.destroyBlock(p_105284_);
|
||||
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
|
||||
});
|
||||
@@ -216,7 +_,7 @@
|
||||
@@ -219,7 +_,7 @@
|
||||
} else {
|
||||
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
|
||||
if (this.destroyTicks % 4.0F == 0.0F) {
|
||||
@@ -71,7 +71,7 @@
|
||||
this.minecraft
|
||||
.getSoundManager()
|
||||
.play(
|
||||
@@ -233,6 +_,7 @@
|
||||
@@ -236,6 +_,7 @@
|
||||
|
||||
this.destroyTicks++;
|
||||
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
|
||||
@@ -79,7 +79,7 @@
|
||||
if (this.destroyProgress >= 1.0F) {
|
||||
this.isDestroying = false;
|
||||
this.startPrediction(this.minecraft.level, p_233739_ -> {
|
||||
@@ -271,7 +_,7 @@
|
||||
@@ -274,7 +_,7 @@
|
||||
|
||||
private boolean sameDestroyTarget(BlockPos p_105282_) {
|
||||
ItemStack itemstack = this.minecraft.player.getMainHandItem();
|
||||
@@ -88,7 +88,7 @@
|
||||
}
|
||||
|
||||
private void ensureHasSentCarriedItem() {
|
||||
@@ -299,12 +_,23 @@
|
||||
@@ -302,12 +_,23 @@
|
||||
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
|
||||
BlockPos blockpos = p_233749_.getBlockPos();
|
||||
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
|
||||
@@ -114,7 +114,7 @@
|
||||
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
|
||||
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
|
||||
return InteractionResult.FAIL;
|
||||
@@ -325,8 +_,10 @@
|
||||
@@ -328,8 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,9 +125,9 @@
|
||||
+ }
|
||||
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack))) {
|
||||
InteractionResult interactionresult2;
|
||||
if (this.localPlayerMode.isCreative()) {
|
||||
if (p_233747_.hasInfiniteMaterials()) {
|
||||
int i = itemstack.getCount();
|
||||
@@ -360,6 +_,11 @@
|
||||
@@ -363,6 +_,11 @@
|
||||
mutableobject.setValue(InteractionResult.PASS);
|
||||
return serverbounduseitempacket;
|
||||
} else {
|
||||
@@ -139,7 +139,7 @@
|
||||
InteractionResult interactionresult = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
|
||||
ItemStack itemstack1;
|
||||
if (interactionresult instanceof InteractionResult.Success interactionresult$success) {
|
||||
@@ -370,6 +_,9 @@
|
||||
@@ -373,6 +_,9 @@
|
||||
|
||||
if (itemstack1 != itemstack) {
|
||||
p_233722_.setItemInHand(p_233723_, itemstack1);
|
||||
@@ -149,7 +149,7 @@
|
||||
}
|
||||
|
||||
mutableobject.setValue(interactionresult);
|
||||
@@ -401,6 +_,10 @@
|
||||
@@ -404,6 +_,10 @@
|
||||
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
|
||||
this.ensureHasSentCarriedItem();
|
||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
|
||||
@@ -160,7 +160,7 @@
|
||||
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_));
|
||||
}
|
||||
|
||||
@@ -408,6 +_,10 @@
|
||||
@@ -411,6 +_,10 @@
|
||||
this.ensureHasSentCarriedItem();
|
||||
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
|
||||
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/ServerData.java
|
||||
+++ b/net/minecraft/client/multiplayer/ServerData.java
|
||||
@@ -34,6 +_,7 @@
|
||||
@@ -37,6 +_,7 @@
|
||||
private byte[] iconBytes;
|
||||
private ServerData.Type type;
|
||||
private ServerData.State state = ServerData.State.INITIAL;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
private CompletableFuture<SearchTree<RecipeCollection>> recipeSearch = CompletableFuture.completedFuture(SearchTree.empty());
|
||||
private final Map<SessionSearchTrees.Key, Runnable> reloaders = new IdentityHashMap<>();
|
||||
|
||||
@@ -92,44 +_,52 @@
|
||||
@@ -90,44 +_,52 @@
|
||||
}
|
||||
|
||||
public void updateCreativeTags(List<ItemStack> p_344581_) {
|
||||
@@ -53,11 +53,11 @@
|
||||
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(entry.getValue(), EMPTY);
|
||||
+ this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync(
|
||||
() -> new FullTextSearchTree<>(
|
||||
p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag),
|
||||
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::location).stream(),
|
||||
- p_342500_
|
||||
+ items
|
||||
),
|
||||
p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag),
|
||||
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::location).stream(),
|
||||
- p_342500_
|
||||
+ items
|
||||
),
|
||||
Util.backgroundExecutor()
|
||||
- );
|
||||
+ ));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/multiplayer/chat/ChatListener.java
|
||||
+++ b/net/minecraft/client/multiplayer/chat/ChatListener.java
|
||||
@@ -118,7 +_,9 @@
|
||||
@@ -123,7 +_,9 @@
|
||||
Instant instant = Instant.now();
|
||||
this.handleMessage(null, () -> {
|
||||
Component component = p_251256_.decorate(p_250375_);
|
||||
@@ -11,7 +11,7 @@
|
||||
this.narrateChatMessage(p_251256_, p_250375_);
|
||||
this.logSystemMessage(component, instant);
|
||||
this.previousMessageTime = Util.getMillis();
|
||||
@@ -137,12 +_,16 @@
|
||||
@@ -142,12 +_,16 @@
|
||||
MessageSignature messagesignature = p_249430_.signature();
|
||||
FilterMask filtermask = p_249430_.filterMask();
|
||||
if (filtermask.isEmpty()) {
|
||||
@@ -30,7 +30,7 @@
|
||||
this.narrateChatMessage(p_251766_, component);
|
||||
}
|
||||
}
|
||||
@@ -175,6 +_,8 @@
|
||||
@@ -180,6 +_,8 @@
|
||||
|
||||
public void handleSystemMessage(Component p_240522_, boolean p_240642_) {
|
||||
if (!this.minecraft.options.hideMatchedNames().get() || !this.minecraft.isBlocked(this.guessChatUUID(p_240522_))) {
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/particle/FlyTowardsPositionParticle.java
|
||||
+++ b/net/minecraft/client/particle/FlyTowardsPositionParticle.java
|
||||
@@ -104,6 +_,7 @@
|
||||
this.x = this.xStart + this.xd * (double)f;
|
||||
this.y = this.yStart + this.yd * (double)f - (double)(f1 * 1.2F);
|
||||
this.z = this.zStart + this.zd * (double)f;
|
||||
this.x = this.xStart + this.xd * f;
|
||||
this.y = this.yStart + this.yd * f - f1 * 1.2F;
|
||||
this.z = this.zStart + this.zd * f;
|
||||
+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static record LifetimeAlpha(float startAlpha, float endAlpha, float startAtNormalizedAge, float endAtNormalizedAge) {
|
||||
public record LifetimeAlpha(float startAlpha, float endAlpha, float startAtNormalizedAge, float endAtNormalizedAge) {
|
||||
public static final Particle.LifetimeAlpha ALWAYS_OPAQUE = new Particle.LifetimeAlpha(1.0F, 1.0F, 0.0F, 1.0F);
|
||||
@@ -1,13 +1,12 @@
|
||||
--- a/net/minecraft/client/particle/ParticleEngine.java
|
||||
+++ b/net/minecraft/client/particle/ParticleEngine.java
|
||||
@@ -72,11 +_,11 @@
|
||||
@@ -72,10 +_,10 @@
|
||||
private static final int MAX_PARTICLES_PER_LAYER = 16384;
|
||||
private static final List<ParticleRenderType> RENDER_ORDER = List.of(ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT);
|
||||
protected ClientLevel level;
|
||||
- private final Map<ParticleRenderType, Queue<Particle>> particles = Maps.newIdentityHashMap();
|
||||
+ private final Map<ParticleRenderType, Queue<Particle>> particles = Maps.newTreeMap(net.minecraftforge.client.ForgeHooksClient.makeParticleRenderTypeComparator(RENDER_ORDER));
|
||||
private final Queue<TrackingEmitter> trackingEmitters = Queues.newArrayDeque();
|
||||
private final TextureManager textureManager;
|
||||
private final RandomSource random = RandomSource.create();
|
||||
- private final Int2ObjectMap<ParticleProvider<?>> providers = new Int2ObjectOpenHashMap<>();
|
||||
+ private final Map<ResourceLocation, ParticleProvider<?>> providers = new java.util.HashMap<>();
|
||||
@@ -15,7 +14,7 @@
|
||||
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> spriteSets = Maps.newHashMap();
|
||||
private final TextureAtlas textureAtlas;
|
||||
@@ -205,10 +_,14 @@
|
||||
this.register(ParticleTypes.BLOCK_CRUMBLE, new TerrainParticle.CrumblingProvider());
|
||||
this.register(ParticleTypes.FIREFLY, FireflyParticle.FireflyProvider::new);
|
||||
}
|
||||
|
||||
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
|
||||
@@ -139,7 +138,7 @@
|
||||
BlockState blockstate = this.level.getBlockState(p_107368_);
|
||||
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) {
|
||||
@@ -558,7 +_,7 @@
|
||||
d0 = (double)i + aabb.maxX + 0.1F;
|
||||
d0 = i + aabb.maxX + 0.1F;
|
||||
}
|
||||
|
||||
- this.add(new TerrainParticle(this.level, d0, d1, d2, 0.0, 0.0, 0.0, blockstate, p_107368_).setPower(0.2F).scale(0.6F));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/particle/PortalParticle.java
|
||||
+++ b/net/minecraft/client/particle/PortalParticle.java
|
||||
@@ -80,6 +_,7 @@
|
||||
this.x = this.xStart + this.xd * (double)f2;
|
||||
this.y = this.yStart + this.yd * (double)f2 + (double)(1.0F - f);
|
||||
this.z = this.zStart + this.zd * (double)f2;
|
||||
this.x = this.xStart + this.xd * f2;
|
||||
this.y = this.yStart + this.yd * f2 + (1.0F - f);
|
||||
this.z = this.zStart + this.zd * f2;
|
||||
+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/client/particle/ReversePortalParticle.java
|
||||
+++ b/net/minecraft/client/particle/ReversePortalParticle.java
|
||||
@@ -31,6 +_,7 @@
|
||||
this.x = this.x + this.xd * (double)f;
|
||||
this.y = this.y + this.yd * (double)f;
|
||||
this.z = this.z + this.zd * (double)f;
|
||||
this.x = this.x + this.xd * f;
|
||||
this.y = this.y + this.yd * f;
|
||||
this.z = this.z + this.zd * f;
|
||||
+ this.setPos(this.x, this.y, this.z); // FORGE: update the particle's bounding box
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,22 +7,21 @@
|
||||
- if (!p_172458_.is(Blocks.GRASS_BLOCK)) {
|
||||
+ if (net.minecraftforge.client.extensions.common.IClientBlockExtensions.of(p_172458_).areBreakingParticlesTinted(p_172458_, p_172451_, p_172459_)) {
|
||||
int i = Minecraft.getInstance().getBlockColors().getColor(p_172458_, p_172451_, p_172459_, 0);
|
||||
this.rCol *= (float)(i >> 16 & 0xFF) / 255.0F;
|
||||
this.gCol *= (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
@@ -97,9 +_,15 @@
|
||||
this.rCol *= (i >> 16 & 0xFF) / 255.0F;
|
||||
this.gCol *= (i >> 8 & 0xFF) / 255.0F;
|
||||
@@ -97,8 +_,14 @@
|
||||
) {
|
||||
BlockState blockstate = p_331600_.getState();
|
||||
return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles()
|
||||
- ? new TerrainParticle(p_334810_, p_328897_, p_329583_, p_331123_, p_333546_, p_335782_, p_335068_, blockstate)
|
||||
+ ? (TerrainParticle)new TerrainParticle(p_334810_, p_328897_, p_329583_, p_331123_, p_333546_, p_335782_, p_335068_, blockstate).updateSprite(blockstate, p_331600_.getPos())
|
||||
: null;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ public Particle updateSprite(BlockState state, BlockPos pos) { //FORGE: we cannot assume that the x y z of the particles match the block pos of the block.
|
||||
+ if (pos != null) // There are cases where we are not able to obtain the correct source pos, and need to fallback to the non-model data version
|
||||
+ this.setSprite(Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getTexture(state, level, pos));
|
||||
+ this.setSprite(Minecraft.getInstance().getBlockRenderer().getBlockModelShaper().getParticleIcon(state, level, pos));
|
||||
+ return this;
|
||||
+ }
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class CrumblingProvider implements ParticleProvider<BlockParticleOption> {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/player/AbstractClientPlayer.java
|
||||
+++ b/net/minecraft/client/player/AbstractClientPlayer.java
|
||||
@@ -91,6 +_,6 @@
|
||||
@@ -86,6 +_,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/player/LocalPlayer.java
|
||||
+++ b/net/minecraft/client/player/LocalPlayer.java
|
||||
@@ -308,6 +_,7 @@
|
||||
@@ -303,6 +_,7 @@
|
||||
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
|
||||
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
|
||||
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
|
||||
@@ -8,56 +8,28 @@
|
||||
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
|
||||
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
|
||||
return !itemstack.isEmpty();
|
||||
@@ -493,7 +_,11 @@
|
||||
@@ -483,7 +_,11 @@
|
||||
|
||||
@Override
|
||||
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
|
||||
- this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), p_108651_, this.getSoundSource(), p_108652_, p_108653_, false);
|
||||
+ var holder = net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(p_108651_);
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, holder, this.getSoundSource(), p_108652_, p_108653_);
|
||||
+ var event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this.level(), this, holder, this.getSoundSource(), p_108652_, p_108653_);
|
||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
||||
+ this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), event.getSound().get(), event.getSource(), event.getNewVolume(), event.getNewPitch(), false);
|
||||
+
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -686,6 +_,7 @@
|
||||
@@ -716,6 +_,7 @@
|
||||
&& this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING)
|
||||
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
|
||||
this.input.tick();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onMovementInputUpdate(this, this.input);
|
||||
this.minecraft.getTutorial().onInput(this.input);
|
||||
if (this.shouldStopSprinting()) {
|
||||
this.setSprinting(false);
|
||||
@@ -724,7 +_,7 @@
|
||||
boolean flag3 = this.canStartSprinting();
|
||||
boolean flag4 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround();
|
||||
boolean flag5 = !flag1 && !flag2;
|
||||
- if ((flag4 || this.isUnderWater()) && flag5 && flag3) {
|
||||
+ if ((flag4 || this.isUnderWater() || this.canStartSwimming()) && flag5 && flag3) {
|
||||
if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) {
|
||||
this.sprintTriggerTime = 7;
|
||||
} else {
|
||||
@@ -732,15 +_,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if ((!this.isInWater() || this.isUnderWater()) && flag3 && this.minecraft.options.keySprint.isDown()) {
|
||||
+ if ((!this.isInWaterOrSwimmable() || this.isUnderWater() || this.canStartSwimming()) && flag3 && this.minecraft.options.keySprint.isDown()) {
|
||||
this.setSprinting(true);
|
||||
}
|
||||
|
||||
if (this.isSprinting()) {
|
||||
boolean flag6 = !this.input.hasForwardImpulse() || !this.hasEnoughFoodToStartSprinting();
|
||||
boolean flag7 = flag6 || this.horizontalCollision && !this.minorHorizontalCollision || this.isInWater() && !this.isUnderWater();
|
||||
+ flag7 = flag7 || (this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)) && !this.canStartSwimming());
|
||||
if (this.isSwimming()) {
|
||||
- if (!this.onGround() && !this.input.keyPresses.shift() && flag6 || !this.isInWater()) {
|
||||
+ if (!this.onGround() && !this.input.keyPresses.shift() && flag7 || !this.isInWaterOrSwimmable()) {
|
||||
this.setSprinting(false);
|
||||
}
|
||||
} else if (flag7) {
|
||||
@@ -777,8 +_,9 @@
|
||||
boolean flag3 = false;
|
||||
if (this.autoJumpTime > 0) {
|
||||
@@ -788,8 +_,9 @@
|
||||
}
|
||||
|
||||
this.wasFallFlying = this.isFallFlying();
|
||||
@@ -69,7 +41,24 @@
|
||||
}
|
||||
|
||||
if (this.isEyeInFluid(FluidTags.WATER)) {
|
||||
@@ -900,6 +_,8 @@
|
||||
@@ -856,13 +_,14 @@
|
||||
|| !this.input.hasForwardImpulse()
|
||||
|| !this.hasEnoughFoodToSprint()
|
||||
|| this.horizontalCollision && !this.minorHorizontalCollision
|
||||
- || this.isInWater() && !this.isUnderWater();
|
||||
+ || this.isInWater() && !this.isUnderWater()
|
||||
+ || this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)) && !this.canStartSwimming();
|
||||
}
|
||||
|
||||
private boolean shouldStopSwimSprinting() {
|
||||
return this.hasBlindness()
|
||||
|| this.isPassenger() && !this.vehicleCanSprint(this.getVehicle())
|
||||
- || !this.isInWater()
|
||||
+ || !this.isInWaterOrSwimmable()
|
||||
|| !this.input.hasForwardImpulse() && !this.onGround() && !this.input.keyPresses.shift()
|
||||
|| !this.hasEnoughFoodToSprint();
|
||||
}
|
||||
@@ -914,6 +_,8 @@
|
||||
@Override
|
||||
public void rideTick() {
|
||||
super.rideTick();
|
||||
@@ -78,7 +67,16 @@
|
||||
this.handsBusy = false;
|
||||
if (this.getControlledVehicle() instanceof AbstractBoat abstractboat) {
|
||||
abstractboat.setInput(
|
||||
@@ -1177,6 +_,18 @@
|
||||
@@ -1090,7 +_,7 @@
|
||||
&& (!this.isPassenger() || this.vehicleCanSprint(this.getVehicle()))
|
||||
&& (!this.isFallFlying() || this.isUnderWater())
|
||||
&& (!this.isMovingSlowly() || this.isUnderWater())
|
||||
- && (!this.isInWater() || this.isUnderWater());
|
||||
+ && (!this.isInWater() || this.isUnderWater() || this.canStartSwimming());
|
||||
}
|
||||
|
||||
private boolean vehicleCanSprint(Entity p_265184_) {
|
||||
@@ -1169,6 +_,18 @@
|
||||
@Override
|
||||
public float getVisualRotationYInDegrees() {
|
||||
return this.getYRot();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/FogRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/FogRenderer.java
|
||||
@@ -192,6 +_,12 @@
|
||||
@@ -187,6 +_,12 @@
|
||||
f2 = f2 * (1.0F - f10) + f2 * f12 * f10;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
return new Vector4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
@@ -270,9 +_,10 @@
|
||||
@@ -265,9 +_,10 @@
|
||||
fogrenderer$fogdata.shape = FogShape.CYLINDER;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/GameRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/GameRenderer.java
|
||||
@@ -158,6 +_,10 @@
|
||||
@@ -168,6 +_,10 @@
|
||||
this.setPostEffect(ResourceLocation.withDefaultNamespace("spider"));
|
||||
} else if (p_109107_ instanceof EnderMan) {
|
||||
this.setPostEffect(ResourceLocation.withDefaultNamespace("invert"));
|
||||
@@ -11,21 +11,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +_,13 @@
|
||||
@@ -181,7 +_,13 @@
|
||||
if (!(f < 1.0F)) {
|
||||
PostChain postchain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS);
|
||||
if (postchain != null) {
|
||||
+ boolean wasBlendEnabled = RenderSystem.isBlendEnabled();
|
||||
+ // TODO: [Forge][Rendering] Check if this blend management is needed anymnore with the new render pipeline changes
|
||||
+ boolean wasBlendEnabled = com.mojang.blaze3d.opengl.GlStateManager._isBlendEnabled();
|
||||
+ if (wasBlendEnabled)
|
||||
+ RenderSystem.disableBlend();
|
||||
postchain.setUniform("Radius", f);
|
||||
postchain.process(this.minecraft.getMainRenderTarget(), this.resourcePool);
|
||||
+ com.mojang.blaze3d.opengl.GlStateManager._disableBlend();
|
||||
postchain.process(this.minecraft.getMainRenderTarget(), this.resourcePool, p_389358_ -> p_389358_.setUniform("Radius", f));
|
||||
+ if (wasBlendEnabled)
|
||||
+ RenderSystem.enableBlend();
|
||||
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,7 +_,7 @@
|
||||
@@ -347,7 +_,7 @@
|
||||
f *= Mth.lerp(f2, 1.0F, 0.85714287F);
|
||||
}
|
||||
|
||||
@@ -34,13 +34,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,12 +_,12 @@
|
||||
(float)((double)window.getHeight() / window.getGuiScale()),
|
||||
0.0F,
|
||||
1000.0F,
|
||||
- 21000.0F
|
||||
+ net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()
|
||||
);
|
||||
@@ -490,11 +_,11 @@
|
||||
RenderTarget rendertarget = this.minecraft.getMainRenderTarget();
|
||||
RenderSystem.getDevice().createCommandEncoder().clearDepthTexture(rendertarget.getDepthTexture(), 1.0);
|
||||
Matrix4f matrix4f = new Matrix4f()
|
||||
- .setOrtho(0.0F, (float)(window.getWidth() / window.getGuiScale()), (float)(window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, 21000.0F);
|
||||
+ .setOrtho(0.0F, (float)(window.getWidth() / window.getGuiScale()), (float)(window.getHeight() / window.getGuiScale()), 0.0F, 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
|
||||
RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.ORTHOGRAPHIC);
|
||||
Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack();
|
||||
matrix4fstack.pushMatrix();
|
||||
@@ -49,7 +48,7 @@
|
||||
Lighting.setupFor3DItems();
|
||||
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
|
||||
if (flag && p_109096_ && this.minecraft.level != null) {
|
||||
@@ -501,7 +_,7 @@
|
||||
@@ -520,7 +_,7 @@
|
||||
}
|
||||
} else if (flag && this.minecraft.screen != null) {
|
||||
try {
|
||||
@@ -58,7 +57,7 @@
|
||||
} catch (Throwable throwable1) {
|
||||
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
|
||||
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
|
||||
@@ -657,6 +_,9 @@
|
||||
@@ -654,6 +_,9 @@
|
||||
if (this.minecraft.options.bobView().get()) {
|
||||
this.bobView(posestack, camera.getPartialTickTime());
|
||||
}
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ItemBlockRenderTypes {
|
||||
+ @Deprecated
|
||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_374604_ -> {
|
||||
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_389364_ -> {
|
||||
RenderType rendertype = RenderType.tripwire();
|
||||
p_374604_.put(Blocks.TRIPWIRE, rendertype);
|
||||
@@ -345,6 +_,7 @@
|
||||
p_374604_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
||||
p_374604_.put(Blocks.TINTED_GLASS, rendertype3);
|
||||
p_389364_.put(Blocks.TRIPWIRE, rendertype);
|
||||
@@ -352,6 +_,7 @@
|
||||
p_389364_.put(Blocks.BUBBLE_COLUMN, rendertype3);
|
||||
p_389364_.put(Blocks.TINTED_GLASS, rendertype3);
|
||||
});
|
||||
+ @Deprecated
|
||||
private static final Map<Fluid, RenderType> TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> {
|
||||
RenderType rendertype = RenderType.translucent();
|
||||
p_109290_.put(Fluids.FLOWING_WATER, rendertype);
|
||||
@@ -352,6 +_,8 @@
|
||||
@@ -359,6 +_,8 @@
|
||||
});
|
||||
private static boolean renderCutout;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
public static RenderType getChunkRenderType(BlockState p_109283_) {
|
||||
Block block = p_109283_.getBlock();
|
||||
if (block instanceof LeavesBlock) {
|
||||
@@ -362,6 +_,8 @@
|
||||
@@ -369,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
|
||||
Block block = p_109294_.getBlock();
|
||||
if (block instanceof LeavesBlock) {
|
||||
@@ -376,11 +_,14 @@
|
||||
@@ -383,11 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
public static RenderType getRenderType(ItemStack p_363859_) {
|
||||
if (p_363859_.getItem() instanceof BlockItem blockitem) {
|
||||
Block block = blockitem.getBlock();
|
||||
@@ -390,12 +_,81 @@
|
||||
@@ -397,12 +_,81 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
|
||||
@@ -343,12 +_,14 @@
|
||||
@@ -336,12 +_,14 @@
|
||||
if (iteminhandrenderer$handrenderselection.renderMainHand) {
|
||||
float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F;
|
||||
float f5 = 1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight);
|
||||
@@ -15,7 +15,7 @@
|
||||
this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_109317_, p_109319_);
|
||||
}
|
||||
|
||||
@@ -414,7 +_,7 @@
|
||||
@@ -407,7 +_,7 @@
|
||||
} else {
|
||||
this.renderOneHandedMap(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_);
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
boolean flag1 = CrossbowItem.isCharged(p_109377_);
|
||||
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
|
||||
int i = flag2 ? 1 : -1;
|
||||
@@ -460,6 +_,7 @@
|
||||
@@ -452,6 +_,7 @@
|
||||
} else {
|
||||
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
|
||||
int j = flag3 ? 1 : -1;
|
||||
@@ -32,14 +32,14 @@
|
||||
if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) {
|
||||
switch (p_109377_.getUseAnimation()) {
|
||||
case NONE:
|
||||
@@ -588,8 +_,18 @@
|
||||
@@ -579,8 +_,18 @@
|
||||
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
|
||||
} else {
|
||||
float f = localplayer.getAttackStrengthScale(1.0F);
|
||||
- float f1 = this.mainHandItem != itemstack ? 0.0F : f * f * f;
|
||||
- float f2 = this.offHandItem != itemstack1 ? 0.0F : 1.0F;
|
||||
+
|
||||
+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.mainHandItem, itemstack, localplayer.getInventory().selected);
|
||||
+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.mainHandItem, itemstack, localplayer.getInventory().getSelectedSlot());
|
||||
+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.offHandItem, itemstack1, -1);
|
||||
+
|
||||
+ if (!requipM && this.mainHandItem != itemstack)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/LevelRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/LevelRenderer.java
|
||||
@@ -109,7 +_,7 @@
|
||||
@@ -113,7 +_,7 @@
|
||||
private final SkyRenderer skyRenderer = new SkyRenderer();
|
||||
private final CloudRenderer cloudRenderer = new CloudRenderer();
|
||||
private final WorldBorderRenderer worldBorderRenderer = new WorldBorderRenderer();
|
||||
@@ -9,8 +9,8 @@
|
||||
@Nullable
|
||||
private ClientLevel level;
|
||||
private final SectionOcclusionGraph sectionOcclusionGraph = new SectionOcclusionGraph();
|
||||
@@ -482,7 +_,7 @@
|
||||
postchain1.addToFrame(framegraphbuilder, i, j, this.targets);
|
||||
@@ -483,7 +_,7 @@
|
||||
postchain1.addToFrame(framegraphbuilder, i, j, this.targets, null);
|
||||
}
|
||||
|
||||
- this.addParticlesPass(framegraphbuilder, p_109604_, f, fogparameters);
|
||||
@@ -18,7 +18,7 @@
|
||||
CloudStatus cloudstatus = this.minecraft.options.getCloudsType();
|
||||
if (cloudstatus != CloudStatus.OFF) {
|
||||
float f2 = this.level.effects().getCloudHeight();
|
||||
@@ -564,7 +_,11 @@
|
||||
@@ -561,7 +_,11 @@
|
||||
double d2 = vec3.z();
|
||||
p_369478_.push("terrain");
|
||||
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_361439_, p_369924_);
|
||||
@@ -30,7 +30,7 @@
|
||||
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_361439_, p_369924_);
|
||||
if (this.level.effects().constantAmbientLight()) {
|
||||
Lighting.setupNetherLevel();
|
||||
@@ -598,7 +_,7 @@
|
||||
@@ -586,7 +_,7 @@
|
||||
multibuffersource$buffersource.endLastBatch();
|
||||
this.checkPoseStack(posestack);
|
||||
p_369478_.popPush("blockentities");
|
||||
@@ -39,7 +39,7 @@
|
||||
multibuffersource$buffersource.endLastBatch();
|
||||
this.checkPoseStack(posestack);
|
||||
multibuffersource$buffersource.endBatch(RenderType.solid());
|
||||
@@ -612,8 +_,8 @@
|
||||
@@ -600,8 +_,8 @@
|
||||
multibuffersource$buffersource.endBatch(Sheets.hangingSignSheet());
|
||||
multibuffersource$buffersource.endBatch(Sheets.chestSheet());
|
||||
this.renderBuffers.outlineBufferSource().endOutlineBatch();
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
p_369478_.popPush("debug");
|
||||
@@ -643,8 +_,8 @@
|
||||
@@ -629,8 +_,8 @@
|
||||
this.renderSectionLayer(RenderType.translucent(), d0, d1, d2, p_361439_, p_369924_);
|
||||
p_369478_.popPush("string");
|
||||
this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_361439_, p_369924_);
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
|
||||
multibuffersource$buffersource.endBatch();
|
||||
@@ -652,7 +_,7 @@
|
||||
@@ -638,7 +_,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
FramePass framepass = p_366471_.addPass("particles");
|
||||
if (this.targets.particles != null) {
|
||||
this.targets.particles = framepass.readsAndWrites(this.targets.particles);
|
||||
@@ -671,7 +_,7 @@
|
||||
@@ -655,7 +_,7 @@
|
||||
resourcehandle1.get().copyDepthFrom(resourcehandle.get());
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -759,9 +_,9 @@
|
||||
@@ -725,9 +_,9 @@
|
||||
|| p_365712_.isDetached()
|
||||
|| p_365712_.getEntity() instanceof LivingEntity && ((LivingEntity)p_365712_.getEntity()).isSleeping()
|
||||
)
|
||||
@@ -91,7 +91,7 @@
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
@@ -801,9 +_,10 @@
|
||||
@@ -767,9 +_,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
Vec3 vec3 = p_369847_.getPosition();
|
||||
double d0 = vec3.x();
|
||||
double d1 = vec3.y();
|
||||
@@ -813,6 +_,7 @@
|
||||
@@ -779,6 +_,7 @@
|
||||
List<BlockEntity> list = sectionrenderdispatcher$rendersection.getCompiled().getRenderableBlockEntities();
|
||||
if (!list.isEmpty()) {
|
||||
for (BlockEntity blockentity : list) {
|
||||
@@ -112,7 +112,7 @@
|
||||
BlockPos blockpos = blockentity.getBlockPos();
|
||||
MultiBufferSource multibuffersource = p_362022_;
|
||||
p_366168_.pushPose();
|
||||
@@ -832,6 +_,9 @@
|
||||
@@ -798,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,14 +122,14 @@
|
||||
this.blockEntityRenderDispatcher.render(blockentity, p_367074_, p_366168_, multibuffersource);
|
||||
p_366168_.popPose();
|
||||
}
|
||||
@@ -840,13 +_,18 @@
|
||||
@@ -806,13 +_,18 @@
|
||||
|
||||
synchronized (this.globalBlockEntities) {
|
||||
for (BlockEntity blockentity1 : this.globalBlockEntities) {
|
||||
+ if (!frustum.isVisible(blockentity1.getRenderBoundingBox())) continue;
|
||||
BlockPos blockpos1 = blockentity1.getBlockPos();
|
||||
p_366168_.pushPose();
|
||||
p_366168_.translate((double)blockpos1.getX() - d0, (double)blockpos1.getY() - d1, (double)blockpos1.getZ() - d2);
|
||||
p_366168_.translate(blockpos1.getX() - d0, blockpos1.getY() - d1, blockpos1.getZ() - d2);
|
||||
+ if (!customOutline && this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player))
|
||||
+ customOutline = true;
|
||||
this.blockEntityRenderDispatcher.render(blockentity1, p_367074_, p_366168_, p_362022_);
|
||||
@@ -141,8 +141,8 @@
|
||||
}
|
||||
|
||||
private void renderBlockDestroyAnimation(PoseStack p_366956_, Camera p_369324_, MultiBufferSource.BufferSource p_365998_) {
|
||||
@@ -865,14 +_,14 @@
|
||||
p_366956_.translate((double)blockpos.getX() - d0, (double)blockpos.getY() - d1, (double)blockpos.getZ() - d2);
|
||||
@@ -831,14 +_,14 @@
|
||||
p_366956_.translate(blockpos.getX() - d0, blockpos.getY() - d1, blockpos.getZ() - d2);
|
||||
PoseStack.Pose posestack$pose = p_366956_.last();
|
||||
VertexConsumer vertexconsumer = new SheetedDecalTextureGenerator(p_365998_.getBuffer(ModelBakery.DESTROY_TYPES.get(i)), posestack$pose, 1.0F);
|
||||
- this.minecraft.getBlockRenderer().renderBreakingTexture(this.level.getBlockState(blockpos), blockpos, this.level, p_366956_, vertexconsumer);
|
||||
@@ -158,7 +158,7 @@
|
||||
if (this.minecraft.hitResult instanceof BlockHitResult blockhitresult) {
|
||||
if (blockhitresult.getType() != HitResult.Type.MISS) {
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
@@ -883,6 +_,9 @@
|
||||
@@ -849,6 +_,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
Vec3 vec3 = p_367935_.getPosition();
|
||||
Boolean obool = this.minecraft.options.highContrastBlockOutline().get();
|
||||
if (obool) {
|
||||
@@ -898,6 +_,8 @@
|
||||
@@ -864,6 +_,8 @@
|
||||
p_367206_.endLastBatch();
|
||||
}
|
||||
}
|
||||
@@ -177,16 +177,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1367,7 +_,7 @@
|
||||
@@ -1359,7 +_,7 @@
|
||||
} else {
|
||||
int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_);
|
||||
int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_);
|
||||
int i = p_398213_.packedBrightness(p_109538_, p_109540_);
|
||||
int j = LightTexture.block(i);
|
||||
- int k = p_109539_.getLightEmission();
|
||||
+ int k = p_109539_.getLightEmission(p_109538_, p_109540_);
|
||||
if (j < k) {
|
||||
j = k;
|
||||
}
|
||||
@@ -1429,5 +_,21 @@
|
||||
int l = LightTexture.sky(i);
|
||||
return LightTexture.pack(k, l);
|
||||
@@ -1422,6 +_,22 @@
|
||||
|
||||
public CloudRenderer getCloudRenderer() {
|
||||
return this.cloudRenderer;
|
||||
@@ -207,4 +207,5 @@
|
||||
+ public void setWeatherEffects(WeatherEffectRenderer value) {
|
||||
+ this.weatherEffectRenderer = value;
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/LightTexture.java
|
||||
+++ b/net/minecraft/client/renderer/LightTexture.java
|
||||
@@ -143,7 +_,7 @@
|
||||
@@ -142,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static int block(int p_109884_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/RenderType.java
|
||||
+++ b/net/minecraft/client/renderer/RenderType.java
|
||||
@@ -929,11 +_,22 @@
|
||||
@@ -633,9 +_,20 @@
|
||||
.createCompositeState(false)
|
||||
);
|
||||
private static final ImmutableList<RenderType> CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire());
|
||||
@@ -10,8 +10,6 @@
|
||||
+ layer.chunkLayerId = i++;
|
||||
+ }
|
||||
+
|
||||
private final VertexFormat format;
|
||||
private final VertexFormat.Mode mode;
|
||||
private final int bufferSize;
|
||||
private final boolean affectsCrumbling;
|
||||
private final boolean sortOnUpload;
|
||||
@@ -23,7 +21,7 @@
|
||||
|
||||
public static RenderType solid() {
|
||||
return SOLID;
|
||||
@@ -1154,7 +_,7 @@
|
||||
@@ -820,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static RenderType text(ResourceLocation p_110498_) {
|
||||
@@ -32,7 +30,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textBackground() {
|
||||
@@ -1162,19 +_,19 @@
|
||||
@@ -828,19 +_,19 @@
|
||||
}
|
||||
|
||||
public static RenderType textIntensity(ResourceLocation p_173238_) {
|
||||
@@ -56,7 +54,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textBackgroundSeeThrough() {
|
||||
@@ -1182,7 +_,7 @@
|
||||
@@ -848,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
+ var overlay = getOverlayBlock(player);
|
||||
+ if (overlay != null) {
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.renderBlockOverlay(player, p_110720_, net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType.BLOCK, overlay.getLeft(), overlay.getRight())) {
|
||||
+ renderTex(p_110719_.getBlockRenderer().getBlockModelShaper().getTexture(overlay.getLeft(), p_110719_.level, overlay.getRight()), p_110720_, p_378238_);
|
||||
+ renderTex(p_110719_.getBlockRenderer().getBlockModelShaper().getParticleIcon(overlay.getLeft(), p_110719_.level, overlay.getRight()), p_110720_, p_378238_);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
--- a/net/minecraft/client/renderer/Sheets.java
|
||||
+++ b/net/minecraft/client/renderer/Sheets.java
|
||||
@@ -155,7 +_,7 @@
|
||||
@@ -157,11 +_,11 @@
|
||||
}
|
||||
|
||||
private static Material createSignMaterial(WoodType p_173386_) {
|
||||
- return createSignMaterial(ResourceLocation.withDefaultNamespace(p_173386_.name()));
|
||||
+ return createSignMaterial(ResourceLocation.parse(p_173386_.name()));
|
||||
}
|
||||
|
||||
public static Material createSignMaterial(ResourceLocation p_378064_) {
|
||||
@@ -163,7 +_,7 @@
|
||||
- return SIGN_MAPPER.defaultNamespaceApply(p_173386_.name());
|
||||
+ return SIGN_MAPPER.apply(ResourceLocation.parse(p_173386_.name()));
|
||||
}
|
||||
|
||||
private static Material createHangingSignMaterial(WoodType p_251735_) {
|
||||
- return createHangingSignMaterial(ResourceLocation.withDefaultNamespace(p_251735_.name()));
|
||||
+ return createHangingSignMaterial(ResourceLocation.parse(p_251735_.name()));
|
||||
- return HANGING_SIGN_MAPPER.defaultNamespaceApply(p_251735_.name());
|
||||
+ return HANGING_SIGN_MAPPER.apply(ResourceLocation.parse(p_251735_.name()));
|
||||
}
|
||||
|
||||
public static Material createHangingSignMaterial(ResourceLocation p_377324_) {
|
||||
@@ -230,6 +_,23 @@
|
||||
public static Material getSignMaterial(WoodType p_173382_) {
|
||||
@@ -206,6 +_,23 @@
|
||||
case SINGLE:
|
||||
default:
|
||||
return p_110773_;
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
--- a/net/minecraft/client/renderer/block/BlockModelShaper.java
|
||||
+++ b/net/minecraft/client/renderer/block/BlockModelShaper.java
|
||||
@@ -22,8 +_,15 @@
|
||||
@@ -17,8 +_,13 @@
|
||||
this.modelManager = p_110880_;
|
||||
}
|
||||
|
||||
+ @Deprecated
|
||||
+ /** @deprecated Forge: Use {@link #getParticleIcon(BlockState, net.minecraft.world.level.Level, net.minecraft.core.BlockPos) getParticleIcon(BlockState, Level, Pos)} */
|
||||
public TextureAtlasSprite getParticleIcon(BlockState p_110883_) {
|
||||
- return this.getBlockModel(p_110883_).getParticleIcon();
|
||||
+ return this.getBlockModel(p_110883_).getParticleIcon(net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
- return this.getBlockModel(p_110883_).particleIcon();
|
||||
+ return this.getBlockModel(p_110883_).particleIcon(net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
+ }
|
||||
+
|
||||
+ public TextureAtlasSprite getTexture(BlockState p_110883_, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) {
|
||||
+ var data = level.getModelDataManager().getAt(pos);
|
||||
+ BakedModel model = this.getBlockModel(p_110883_);
|
||||
+ return model.getParticleIcon(model.getModelData(level, pos, p_110883_, data == null ? net.minecraftforge.client.model.data.ModelData.EMPTY : data));
|
||||
+ public TextureAtlasSprite getParticleIcon(BlockState p_110883_, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) {
|
||||
+ return this.getBlockModel(p_110883_).particleIcon(level.getModelDataManager().getAt(pos));
|
||||
}
|
||||
|
||||
public BakedModel getBlockModel(BlockState p_110894_) {
|
||||
public BlockStateModel getBlockModel(BlockState p_110894_) {
|
||||
+18
-55
@@ -1,15 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/block/BlockRenderDispatcher.java
|
||||
+++ b/net/minecraft/client/renderer/block/BlockRenderDispatcher.java
|
||||
@@ -37,7 +_,7 @@
|
||||
this.blockModelShaper = p_173399_;
|
||||
this.specialBlockModelRenderer = p_378785_;
|
||||
this.blockColors = p_173401_;
|
||||
- this.modelRenderer = new ModelBlockRenderer(this.blockColors);
|
||||
+ this.modelRenderer = new net.minecraftforge.client.model.lighting.ForgeModelBlockRenderer(this.blockColors);
|
||||
this.liquidBlockRenderer = new LiquidBlockRenderer();
|
||||
}
|
||||
|
||||
@@ -45,12 +_,22 @@
|
||||
@@ -49,12 +_,17 @@
|
||||
return this.blockModelShaper;
|
||||
}
|
||||
|
||||
@@ -20,42 +11,15 @@
|
||||
+
|
||||
+ public void renderBreakingTexture(BlockState p_110919_, BlockPos p_110920_, BlockAndTintGetter p_110921_, PoseStack p_110922_, VertexConsumer p_110923_, net.minecraftforge.client.model.data.ModelData modelData) {
|
||||
if (p_110919_.getRenderShape() == RenderShape.MODEL) {
|
||||
BakedModel bakedmodel = this.blockModelShaper.getBlockModel(p_110919_);
|
||||
long i = p_110919_.getSeed(p_110920_);
|
||||
- this.modelRenderer.tesselateBlock(p_110921_, bakedmodel, p_110919_, p_110920_, p_110922_, p_110923_, true, this.random, i, OverlayTexture.NO_OVERLAY);
|
||||
+ this.modelRenderer.tesselateBlock(p_110921_, bakedmodel, p_110919_, p_110920_, p_110922_, p_110923_, true, this.random, i, OverlayTexture.NO_OVERLAY, modelData, null);
|
||||
BlockStateModel blockstatemodel = this.blockModelShaper.getBlockModel(p_110919_);
|
||||
this.singleThreadRandom.setSeed(p_110919_.getSeed(p_110920_));
|
||||
this.singleThreadPartList.clear();
|
||||
- blockstatemodel.collectParts(this.singleThreadRandom, this.singleThreadPartList);
|
||||
+ blockstatemodel.collectParts(this.singleThreadRandom, this.singleThreadPartList, modelData, null);
|
||||
this.modelRenderer.tesselateBlock(p_110921_, this.singleThreadPartList, p_110919_, p_110920_, p_110922_, p_110923_, true, OverlayTexture.NO_OVERLAY);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated //Forge: Model data and render type parameter
|
||||
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_) {
|
||||
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
}
|
||||
|
||||
public void renderBatched(
|
||||
@@ -60,7 +_,9 @@
|
||||
PoseStack p_234359_,
|
||||
VertexConsumer p_234360_,
|
||||
boolean p_234361_,
|
||||
- RandomSource p_234362_
|
||||
+ RandomSource p_234362_,
|
||||
+ net.minecraftforge.client.model.data.ModelData modelData,
|
||||
+ net.minecraft.client.renderer.RenderType renderType
|
||||
) {
|
||||
try {
|
||||
this.modelRenderer
|
||||
@@ -74,7 +_,9 @@
|
||||
p_234361_,
|
||||
p_234362_,
|
||||
p_234356_.getSeed(p_234357_),
|
||||
- OverlayTexture.NO_OVERLAY
|
||||
+ OverlayTexture.NO_OVERLAY,
|
||||
+ modelData,
|
||||
+ renderType
|
||||
);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block in world");
|
||||
@@ -103,7 +_,12 @@
|
||||
@@ -97,7 +_,12 @@
|
||||
return this.blockModelShaper.getBlockModel(p_110911_);
|
||||
}
|
||||
|
||||
@@ -67,16 +31,15 @@
|
||||
+ public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
|
||||
RenderShape rendershape = p_110913_.getRenderShape();
|
||||
if (rendershape != RenderShape.INVISIBLE) {
|
||||
BakedModel bakedmodel = this.getBlockModel(p_110913_);
|
||||
@@ -111,9 +_,10 @@
|
||||
float f = (float)(i >> 16 & 0xFF) / 255.0F;
|
||||
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||
+ for (var rt : bakedmodel.getRenderTypes(p_110913_, RandomSource.create(42), modelData))
|
||||
this.modelRenderer
|
||||
.renderModel(
|
||||
- p_110914_.last(), p_110915_.getBuffer(ItemBlockRenderTypes.getRenderType(p_110913_)), p_110913_, bakedmodel, f, f1, f2, p_110916_, p_110917_
|
||||
+ p_110914_.last(), p_110915_.getBuffer(renderType != null ? renderType : net.minecraftforge.client.RenderTypeHelper.getEntityRenderType(rt)), p_110913_, bakedmodel, f, f1, f2, p_110916_, p_110917_, modelData, rt
|
||||
);
|
||||
BlockStateModel blockstatemodel = this.getBlockModel(p_110913_);
|
||||
@@ -105,8 +_,9 @@
|
||||
float f = (i >> 16 & 0xFF) / 255.0F;
|
||||
float f1 = (i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (i & 0xFF) / 255.0F;
|
||||
+ for (var rt : blockstatemodel.getRenderTypes(p_110913_, RandomSource.create(42), modelData))
|
||||
ModelBlockRenderer.renderModel(
|
||||
- p_110914_.last(), p_110915_.getBuffer(ItemBlockRenderTypes.getRenderType(p_110913_)), blockstatemodel, f, f1, f2, p_110916_, p_110917_
|
||||
+ p_110914_.last(), p_110915_.getBuffer(renderType != null ? renderType : net.minecraftforge.client.RenderTypeHelper.getEntityRenderType(rt)), blockstatemodel, f, f1, f2, p_110916_, p_110917_, modelData, rt
|
||||
);
|
||||
this.specialBlockModelRenderer.get().renderByBlock(p_110913_.getBlock(), ItemDisplayContext.NONE, p_110914_, p_110915_, p_110916_, p_110917_);
|
||||
}
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
+ int i = net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(p_234374_).getTintColor(p_234374_, p_234370_, p_234371_);
|
||||
+ float alpha = (float)(i >> 24 & 255) / 255.0F;
|
||||
+
|
||||
float f = (float)(i >> 16 & 0xFF) / 255.0F;
|
||||
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (float)(i & 0xFF) / 255.0F;
|
||||
float f = (i >> 16 & 0xFF) / 255.0F;
|
||||
float f1 = (i >> 8 & 0xFF) / 255.0F;
|
||||
float f2 = (i & 0xFF) / 255.0F;
|
||||
@@ -180,15 +_,15 @@
|
||||
float f57 = f4 * f;
|
||||
float f29 = f4 * f1;
|
||||
|
||||
+18
-141
@@ -1,160 +1,37 @@
|
||||
--- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java
|
||||
@@ -39,6 +_,11 @@
|
||||
this.blockColors = p_110999_;
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Model data and render type parameter
|
||||
+ public void tesselateBlock(BlockAndTintGetter p_234380_, BakedModel p_234381_, BlockState p_234382_, BlockPos p_234383_, PoseStack p_234384_, VertexConsumer p_234385_, boolean p_234386_, RandomSource p_234387_, long p_234388_, int p_234389_) {
|
||||
+ tesselateBlock(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
+ }
|
||||
+
|
||||
public void tesselateBlock(
|
||||
BlockAndTintGetter p_234380_,
|
||||
BakedModel p_234381_,
|
||||
@@ -49,16 +_,18 @@
|
||||
boolean p_234386_,
|
||||
RandomSource p_234387_,
|
||||
long p_234388_,
|
||||
- int p_234389_
|
||||
+ int p_234389_,
|
||||
+ net.minecraftforge.client.model.data.ModelData modelData,
|
||||
+ @Nullable net.minecraft.client.renderer.RenderType renderType
|
||||
@@ -48,7 +_,7 @@
|
||||
int p_234389_
|
||||
) {
|
||||
- boolean flag = Minecraft.useAmbientOcclusion() && p_234382_.getLightEmission() == 0 && p_234381_.useAmbientOcclusion();
|
||||
+ boolean flag = Minecraft.useAmbientOcclusion() && p_234382_.getLightEmission(p_234380_, p_234383_) == 0 && p_234381_.useAmbientOcclusion(p_234382_, renderType);
|
||||
p_234384_.translate(p_234382_.getOffset(p_234383_));
|
||||
if (!p_393688_.isEmpty()) {
|
||||
- boolean flag = Minecraft.useAmbientOcclusion() && p_234382_.getLightEmission() == 0 && p_393688_.getFirst().useAmbientOcclusion();
|
||||
+ boolean flag = Minecraft.useAmbientOcclusion() && p_234382_.getLightEmission(p_234380_, p_234383_) == 0 && p_393688_.getFirst().useAmbientOcclusion();
|
||||
p_234384_.translate(p_234382_.getOffset(p_234383_));
|
||||
|
||||
try {
|
||||
if (flag) {
|
||||
- this.tesselateWithAO(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_);
|
||||
+ this.tesselateWithAO(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, modelData, renderType);
|
||||
} else {
|
||||
- this.tesselateWithoutAO(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_);
|
||||
+ this.tesselateWithoutAO(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, modelData, renderType);
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block model");
|
||||
@@ -69,6 +_,11 @@
|
||||
try {
|
||||
@@ -322,6 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Model data and render type parameter
|
||||
+ public void tesselateWithAO(BlockAndTintGetter p_234391_, BakedModel p_234392_, BlockState p_234393_, BlockPos p_234394_, PoseStack p_234395_, VertexConsumer p_234396_, boolean p_234397_, RandomSource p_234398_, long p_234399_, int p_234400_) {
|
||||
+ tesselateWithAO(p_234391_, p_234392_, p_234393_, p_234394_, p_234395_, p_234396_, p_234397_, p_234398_, p_234399_, p_234400_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
+ public static void renderModel(PoseStack.Pose p_111068_, VertexConsumer p_111069_, BlockStateModel p_111070_, float p_111072_, float p_111073_, float p_111074_, int p_111075_, int p_111076_) {
|
||||
+ renderModel(p_111068_, p_111069_, p_111070_, p_111072_, p_111073_, p_111074_, p_111075_, p_111076_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
+ }
|
||||
+
|
||||
public void tesselateWithAO(
|
||||
BlockAndTintGetter p_234391_,
|
||||
BakedModel p_234392_,
|
||||
@@ -79,7 +_,9 @@
|
||||
boolean p_234397_,
|
||||
RandomSource p_234398_,
|
||||
long p_234399_,
|
||||
- int p_234400_
|
||||
+ int p_234400_,
|
||||
+ net.minecraftforge.client.model.data.ModelData modelData,
|
||||
+ @Nullable net.minecraft.client.renderer.RenderType renderType
|
||||
) {
|
||||
float[] afloat = new float[DIRECTIONS.length * 2];
|
||||
BitSet bitset = new BitSet(3);
|
||||
@@ -88,7 +_,7 @@
|
||||
|
||||
for (Direction direction : DIRECTIONS) {
|
||||
p_234398_.setSeed(p_234399_);
|
||||
- List<BakedQuad> list = p_234392_.getQuads(p_234393_, direction, p_234398_);
|
||||
+ List<BakedQuad> list = p_234392_.getQuads(p_234393_, direction, p_234398_, modelData, renderType);
|
||||
if (!list.isEmpty()) {
|
||||
blockpos$mutableblockpos.setWithOffset(p_234394_, direction);
|
||||
if (!p_234397_ || Block.shouldRenderFace(p_234393_, p_234391_.getBlockState(blockpos$mutableblockpos), direction)) {
|
||||
@@ -100,12 +_,17 @@
|
||||
}
|
||||
|
||||
p_234398_.setSeed(p_234399_);
|
||||
- List<BakedQuad> list1 = p_234392_.getQuads(p_234393_, null, p_234398_);
|
||||
+ List<BakedQuad> list1 = p_234392_.getQuads(p_234393_, null, p_234398_, modelData, renderType);
|
||||
if (!list1.isEmpty()) {
|
||||
this.renderModelFaceAO(p_234391_, p_234393_, p_234394_, p_234395_, p_234396_, list1, afloat, bitset, modelblockrenderer$ambientocclusionface, p_234400_);
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Model data and render type parameter
|
||||
+ public void tesselateWithoutAO(BlockAndTintGetter p_234402_, BakedModel p_234403_, BlockState p_234404_, BlockPos p_234405_, PoseStack p_234406_, VertexConsumer p_234407_, boolean p_234408_, RandomSource p_234409_, long p_234410_, int p_234411_) {
|
||||
+ tesselateWithoutAO(p_234402_, p_234403_, p_234404_, p_234405_, p_234406_, p_234407_, p_234408_, p_234409_, p_234410_, p_234411_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
+ }
|
||||
+
|
||||
public void tesselateWithoutAO(
|
||||
BlockAndTintGetter p_234402_,
|
||||
BakedModel p_234403_,
|
||||
@@ -116,14 +_,16 @@
|
||||
boolean p_234408_,
|
||||
RandomSource p_234409_,
|
||||
long p_234410_,
|
||||
- int p_234411_
|
||||
+ int p_234411_,
|
||||
+ net.minecraftforge.client.model.data.ModelData modelData,
|
||||
+ @Nullable net.minecraft.client.renderer.RenderType renderType
|
||||
) {
|
||||
BitSet bitset = new BitSet(3);
|
||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = p_234405_.mutable();
|
||||
|
||||
for (Direction direction : DIRECTIONS) {
|
||||
p_234409_.setSeed(p_234410_);
|
||||
- List<BakedQuad> list = p_234403_.getQuads(p_234404_, direction, p_234409_);
|
||||
+ List<BakedQuad> list = p_234403_.getQuads(p_234404_, direction, p_234409_, modelData, renderType);
|
||||
if (!list.isEmpty()) {
|
||||
blockpos$mutableblockpos.setWithOffset(p_234405_, direction);
|
||||
if (!p_234408_ || Block.shouldRenderFace(p_234404_, p_234402_.getBlockState(blockpos$mutableblockpos), direction)) {
|
||||
@@ -134,7 +_,7 @@
|
||||
}
|
||||
|
||||
p_234409_.setSeed(p_234410_);
|
||||
- List<BakedQuad> list1 = p_234403_.getQuads(p_234404_, null, p_234409_);
|
||||
+ List<BakedQuad> list1 = p_234403_.getQuads(p_234404_, null, p_234409_, modelData, renderType);
|
||||
if (!list1.isEmpty()) {
|
||||
this.renderModelFaceFlat(p_234402_, p_234404_, p_234405_, -1, p_234411_, true, p_234406_, p_234407_, list1, bitset);
|
||||
}
|
||||
@@ -154,6 +_,7 @@
|
||||
) {
|
||||
for (BakedQuad bakedquad : p_111018_) {
|
||||
this.calculateShape(p_111013_, p_111014_, p_111015_, bakedquad.getVertices(), bakedquad.getDirection(), p_111019_, p_111020_);
|
||||
+ if (!net.minecraftforge.client.ForgeHooksClient.calculateFaceWithoutAO(p_111013_, p_111014_, p_111015_, bakedquad, p_111020_.get(0), p_111021_.brightness, p_111021_.lightmap))
|
||||
p_111021_.calculate(p_111013_, p_111014_, p_111015_, bakedquad.getDirection(), p_111019_, p_111020_, bakedquad.isShade());
|
||||
this.putQuadData(
|
||||
p_111013_,
|
||||
@@ -319,6 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Deprecated //Forge: Model data and render type parameter
|
||||
+ public void renderModel(PoseStack.Pose p_111068_, VertexConsumer p_111069_, @Nullable BlockState p_111070_, BakedModel p_111071_, float p_111072_, float p_111073_, float p_111074_, int p_111075_, int p_111076_) {
|
||||
+ renderModel(p_111068_, p_111069_, p_111070_, p_111071_, p_111072_, p_111073_, p_111074_, p_111075_, p_111076_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
+ }
|
||||
+
|
||||
public void renderModel(
|
||||
public static void renderModel(
|
||||
PoseStack.Pose p_111068_,
|
||||
VertexConsumer p_111069_,
|
||||
@@ -328,18 +_,20 @@
|
||||
@@ -330,9 +_,11 @@
|
||||
float p_111073_,
|
||||
float p_111074_,
|
||||
int p_111075_,
|
||||
- int p_111076_
|
||||
+ int p_111076_,
|
||||
+ net.minecraftforge.client.model.data.ModelData modelData,
|
||||
+ @Nullable net.minecraft.client.renderer.RenderType renderType
|
||||
+ @org.jetbrains.annotations.Nullable net.minecraft.client.renderer.RenderType renderType
|
||||
) {
|
||||
RandomSource randomsource = RandomSource.create();
|
||||
long i = 42L;
|
||||
|
||||
for (Direction direction : DIRECTIONS) {
|
||||
randomsource.setSeed(42L);
|
||||
- renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource), p_111075_, p_111076_);
|
||||
+ renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, direction, randomsource, modelData, renderType), p_111075_, p_111076_);
|
||||
}
|
||||
|
||||
randomsource.setSeed(42L);
|
||||
- renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, null, randomsource), p_111075_, p_111076_);
|
||||
+ renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, p_111071_.getQuads(p_111070_, null, randomsource, modelData, renderType), p_111075_, p_111076_);
|
||||
}
|
||||
|
||||
private static void renderQuadList(
|
||||
- for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L))) {
|
||||
+ for (BlockModelPart blockmodelpart : p_397754_.collectParts(RandomSource.create(42L), modelData, renderType)) {
|
||||
for (Direction direction : DIRECTIONS) {
|
||||
renderQuadList(p_111068_, p_111069_, p_111072_, p_111073_, p_111074_, blockmodelpart.getQuads(direction), p_111075_, p_111076_);
|
||||
}
|
||||
@@ -1,33 +1,15 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BakedQuad.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BakedQuad.java
|
||||
@@ -13,14 +_,20 @@
|
||||
protected final TextureAtlasSprite sprite;
|
||||
private final boolean shade;
|
||||
private final int lightEmission;
|
||||
+ private final boolean hasAmbientOcclusion;
|
||||
@@ -6,7 +_,11 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_, int p_366759_) {
|
||||
+ this(p_111298_, p_111299_, p_111300_, p_111301_, p_111302_, p_366759_, true);
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public record BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission) {
|
||||
+public record BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission, boolean ambientOcclusion) {
|
||||
+ public BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission) {
|
||||
+ this(vertices, tintIndex, direction, sprite, shade, lightEmission, true);
|
||||
+ }
|
||||
+
|
||||
+ public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_, int p_366759_, boolean hasAmbientOcclusion) {
|
||||
this.vertices = p_111298_;
|
||||
this.tintIndex = p_111299_;
|
||||
this.direction = p_111300_;
|
||||
this.sprite = p_111301_;
|
||||
this.shade = p_111302_;
|
||||
this.lightEmission = p_366759_;
|
||||
+ this.hasAmbientOcclusion = hasAmbientOcclusion;
|
||||
public boolean isTinted() {
|
||||
return this.tintIndex != -1;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getSprite() {
|
||||
@@ -49,5 +_,9 @@
|
||||
|
||||
public int getLightEmission() {
|
||||
return this.lightEmission;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasAmbientOcclusion() {
|
||||
+ return this.hasAmbientOcclusion;
|
||||
}
|
||||
}
|
||||
+15
-15
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
|
||||
@@ -13,9 +_,18 @@
|
||||
@@ -15,9 +_,18 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
|
||||
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv, @Nullable net.minecraftforge.client.model.ForgeFaceData data) {
|
||||
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, @Nullable BlockElementFace.UVs uvs, Quadrant rotation) {
|
||||
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, @Nullable BlockElementFace.UVs uvs, Quadrant rotation, @Nullable net.minecraftforge.client.model.ForgeFaceData data) {
|
||||
public static final int NO_TINT = -1;
|
||||
|
||||
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
|
||||
+ this(cullForDirection, tintIndex, texture, uv, null);
|
||||
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, @Nullable BlockElementFace.UVs uvs, Quadrant rotation) {
|
||||
+ this(cullForDirection, tintIndex, texture, uvs, rotation, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -17,15 +17,15 @@
|
||||
+ return this.data == null ? net.minecraftforge.client.model.ForgeFaceData.DEFAULT : this.data;
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Deserializer implements JsonDeserializer<BlockElementFace> {
|
||||
private static final int DEFAULT_TINT_INDEX = -1;
|
||||
@@ -26,7 +_,7 @@
|
||||
int i = this.getTintIndex(jsonobject);
|
||||
String s = this.getTexture(jsonobject);
|
||||
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
|
||||
- return new BlockElementFace(direction, i, s, blockfaceuv);
|
||||
+ return new BlockElementFace(direction, i, s, blockfaceuv, net.minecraftforge.client.model.ForgeFaceData.read(jsonobject.get("forge_data"), null));
|
||||
public static float getU(BlockElementFace.UVs p_396140_, Quadrant p_396737_, int p_395337_) {
|
||||
return p_396140_.getVertexU(p_396737_.rotateVertexIndex(p_395337_)) / 16.0F;
|
||||
}
|
||||
@@ -38,7 +_,7 @@
|
||||
String s = getTexture(jsonobject);
|
||||
BlockElementFace.UVs blockelementface$uvs = getUVs(jsonobject);
|
||||
Quadrant quadrant = getRotation(jsonobject);
|
||||
- return new BlockElementFace(direction, i, s, blockelementface$uvs, quadrant);
|
||||
+ return new BlockElementFace(direction, i, s, blockelementface$uvs, quadrant, net.minecraftforge.client.model.ForgeFaceData.read(jsonobject.get("forge_data"), null));
|
||||
}
|
||||
|
||||
protected int getTintIndex(JsonObject p_111369_) {
|
||||
private static int getTintIndex(JsonObject p_111369_) {
|
||||
@@ -1,52 +1,45 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockModel.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockModel.java
|
||||
@@ -49,6 +_,7 @@
|
||||
public UnbakedModel parent;
|
||||
@Nullable
|
||||
private final ResourceLocation parentLocation;
|
||||
+ public final net.minecraftforge.client.model.geometry.BlockGeometryBakingContext customData = new net.minecraftforge.client.model.geometry.BlockGeometryBakingContext(this);
|
||||
|
||||
public static BlockModel fromStream(Reader p_111462_) {
|
||||
return GsonHelper.fromJson(GSON, p_111462_, BlockModel.class);
|
||||
@@ -85,6 +_,8 @@
|
||||
@Override
|
||||
public void resolveDependencies(ResolvableModel.Resolver p_377823_) {
|
||||
if (this.parentLocation != null) {
|
||||
+ if (customData.hasCustomGeometry())
|
||||
+ customData.getCustomGeometry().resolveDependencies(p_377823_, customData);
|
||||
this.parent = p_377823_.resolve(this.parentLocation);
|
||||
}
|
||||
}
|
||||
@@ -110,14 +_,20 @@
|
||||
public BakedModel bake(
|
||||
TextureSlots p_378598_, ModelBaker p_378458_, ModelState p_111453_, boolean p_111455_, boolean p_377435_, ItemTransforms p_378085_
|
||||
) {
|
||||
+ if (this.customData.getCustomGeometry() != null)
|
||||
+ return this.customData.getCustomGeometry().bake(customData, p_378458_, p_378598_, p_111453_);
|
||||
@@ -28,8 +_,20 @@
|
||||
@Nullable Boolean ambientOcclusion,
|
||||
@Nullable ItemTransforms transforms,
|
||||
TextureSlots.Data textureSlots,
|
||||
- @Nullable ResourceLocation parent
|
||||
+ @Nullable ResourceLocation parent,
|
||||
+ @Nullable net.minecraftforge.client.model.ForgeBlockModelData forgeData
|
||||
) implements UnbakedModel {
|
||||
+ public BlockModel(
|
||||
+ @Nullable UnbakedGeometry geometry,
|
||||
+ @Nullable UnbakedModel.GuiLight guiLight,
|
||||
+ @Nullable Boolean ambientOcclusion,
|
||||
+ @Nullable ItemTransforms transforms,
|
||||
+ TextureSlots.Data textureSlots,
|
||||
+ @Nullable ResourceLocation parent
|
||||
+ ) {
|
||||
+ this(geometry, guiLight, ambientOcclusion, transforms, textureSlots, parent, null);
|
||||
+ }
|
||||
+
|
||||
+ var wrapped = net.minecraftforge.client.ForgeHooksClient.wrapRenderType(p_378458_, this.customData.getRenderType(), this.customData.getRenderTypeFast());
|
||||
+
|
||||
return this.elements.isEmpty() && this.parent != null
|
||||
- ? this.parent.bake(p_378598_, p_378458_, p_111453_, p_111455_, p_377435_, p_378085_)
|
||||
- : SimpleBakedModel.bakeElements(this.elements, p_378598_, p_378458_.sprites(), p_111453_, p_111455_, p_377435_, true, p_378085_);
|
||||
+ ? this.parent.bake(p_378598_, wrapped, p_111453_, p_111455_, p_377435_, p_378085_)
|
||||
+ : SimpleBakedModel.bakeElements(this.elements, p_378598_, p_378458_.sprites(), p_111453_, p_111455_, p_377435_, true, p_378085_, wrapped.renderType(), wrapped.renderTypeFast());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@VisibleForTesting
|
||||
List<BlockElement> getElements() {
|
||||
+ if (customData.hasCustomGeometry()) return java.util.Collections.emptyList();
|
||||
return this.elements;
|
||||
}
|
||||
|
||||
@@ -147,7 +_,8 @@
|
||||
static final Gson GSON = new GsonBuilder()
|
||||
.registerTypeAdapter(BlockModel.class, new BlockModel.Deserializer())
|
||||
@@ -97,8 +_,9 @@
|
||||
unbakedmodel$guilight = UnbakedModel.GuiLight.getByName(GsonHelper.getAsString(jsonobject, "gui_light"));
|
||||
}
|
||||
|
||||
+ var forgeData = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModel(jsonobject, p_111500_);
|
||||
ResourceLocation resourcelocation = s.isEmpty() ? null : ResourceLocation.parse(s);
|
||||
- return new BlockModel(resourcelocation, list, textureslots$data, obool, unbakedmodel$guilight, itemtransforms);
|
||||
+ var ret = new BlockModel(resourcelocation, list, textureslots$data, obool, unbakedmodel$guilight, itemtransforms);
|
||||
+ return net.minecraftforge.client.ForgeHooksClient.deserializeBlockModel(ret, ret.getElements(), jsonobject, p_111500_);
|
||||
- return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, resourcelocation);
|
||||
+ return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, resourcelocation, forgeData);
|
||||
}
|
||||
|
||||
private TextureSlots.Data getTextureMap(JsonObject p_111510_) {
|
||||
@@ -121,6 +_,9 @@
|
||||
|
||||
@Nullable
|
||||
protected UnbakedGeometry getElements(JsonDeserializationContext p_111507_, JsonObject p_111508_) {
|
||||
+ var geo = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModelGeometry(p_111508_, p_111507_);
|
||||
+ if (geo != null)
|
||||
+ return geo;
|
||||
if (!p_111508_.has("elements")) {
|
||||
return null;
|
||||
} else {
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/BlockStateModel.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/BlockStateModel.java
|
||||
@@ -22,15 +_,21 @@
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public interface BlockStateModel {
|
||||
+public interface BlockStateModel extends net.minecraftforge.client.extensions.IForgeBlockStateModel {
|
||||
+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#collectParts(RandomSource, List<BlockModelPart>, net.minecraftforge.client.model.data.ModelData, net.minecraft.client.renderer.RenderType)}*/
|
||||
+ @Deprecated
|
||||
void collectParts(RandomSource p_397689_, List<BlockModelPart> p_394710_);
|
||||
|
||||
+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#collectParts(RandomSource, net.minecraftforge.client.model.data.ModelData, net.minecraft.client.renderer.RenderType)}*/
|
||||
+ @Deprecated
|
||||
default List<BlockModelPart> collectParts(RandomSource p_392713_) {
|
||||
List<BlockModelPart> list = new ObjectArrayList<>();
|
||||
- this.collectParts(p_392713_, list);
|
||||
+ this.collectParts(p_392713_, list, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
|
||||
return list;
|
||||
}
|
||||
|
||||
+ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBlockStateModel#particleIcon(net.minecraftforge.client.model.data.ModelData)}*/
|
||||
+ @Deprecated
|
||||
TextureAtlasSprite particleIcon();
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/FaceBakery.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java
|
||||
@@ -58,7 +_,13 @@
|
||||
@@ -67,7 +_,14 @@
|
||||
recalculateWinding(aint, direction);
|
||||
}
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
+ var data = p_111603_.data();
|
||||
+ var quad = new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, p_364904_, data.ambientOcclusion());
|
||||
+ if (!net.minecraftforge.client.model.ForgeFaceData.DEFAULT.equals(data)) {
|
||||
+ net.minecraftforge.client.model.QuadTransformers.applyingLightmap(data.blockLight(), data.skyLight()).processInPlace(quad);
|
||||
+ net.minecraftforge.client.model.QuadTransformers.applyingColor(data.color()).processInPlace(quad);
|
||||
+ quad = net.minecraftforge.client.model.QuadTransformers.applyingLightmap(data.blockLight(), data.skyLight())
|
||||
+ .andThen(net.minecraftforge.client.model.QuadTransformers.applyingColor(data.color()))
|
||||
+ .process(quad);
|
||||
+ }
|
||||
+ return quad;
|
||||
}
|
||||
|
||||
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_) {
|
||||
private static BlockElementFace.UVs shrinkUVs(TextureAtlasSprite p_397002_, BlockElementFace.UVs p_394057_) {
|
||||
+10
-15
@@ -1,24 +1,19 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/ItemTransform.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/ItemTransform.java
|
||||
@@ -21,11 +_,17 @@
|
||||
public final Vector3f rotation;
|
||||
public final Vector3f translation;
|
||||
public final Vector3f scale;
|
||||
+ public final Vector3f rightRotation;
|
||||
@@ -17,7 +_,11 @@
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
public ItemTransform(Vector3f p_254427_, Vector3f p_254496_, Vector3f p_254022_) {
|
||||
+ this(p_254427_, p_254496_, p_254022_, new Vector3f());
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public record ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale) {
|
||||
+public record ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale, Vector3fc rightRotation) {
|
||||
+ public ItemTransform(Vector3fc rotation, Vector3fc translation, Vector3fc scale) {
|
||||
+ this(rotation, translation, scale, new Vector3f());
|
||||
+ }
|
||||
+
|
||||
+ public ItemTransform(Vector3f p_254427_, Vector3f p_254496_, Vector3f p_254022_, Vector3f rightRotation) {
|
||||
this.rotation = new Vector3f(p_254427_);
|
||||
this.translation = new Vector3f(p_254496_);
|
||||
this.scale = new Vector3f(p_254022_);
|
||||
+ this.rightRotation = new Vector3f(rightRotation);
|
||||
}
|
||||
public static final ItemTransform NO_TRANSFORM = new ItemTransform(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F));
|
||||
|
||||
public void apply(boolean p_111764_, PoseStack p_111765_) {
|
||||
@@ -82,7 +_,7 @@
|
||||
public void apply(boolean p_111764_, PoseStack.Pose p_397991_) {
|
||||
@@ -62,7 +_,7 @@
|
||||
vector3f1.set(Mth.clamp(vector3f1.x, -5.0F, 5.0F), Mth.clamp(vector3f1.y, -5.0F, 5.0F), Mth.clamp(vector3f1.z, -5.0F, 5.0F));
|
||||
Vector3f vector3f2 = this.getVector3f(jsonobject, "scale", DEFAULT_SCALE);
|
||||
vector3f2.set(Mth.clamp(vector3f2.x, -4.0F, 4.0F), Mth.clamp(vector3f2.y, -4.0F, 4.0F), Mth.clamp(vector3f2.z, -4.0F, 4.0F));
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
--- a/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java
|
||||
+++ b/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java
|
||||
@@ -38,6 +_,11 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
+ public TextureAtlasSprite particleIcon(net.minecraftforge.client.model.data.ModelData data) {
|
||||
+ return this.shared.firstModel.particleIcon(data);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
public void collectParts(RandomSource p_391247_, List<BlockModelPart> p_397207_) {
|
||||
if (this.models == null) {
|
||||
this.models = this.shared.selectModels(this.blockState);
|
||||
@@ -51,6 +_,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void collectParts(RandomSource rand, List<BlockModelPart> dest, net.minecraftforge.client.model.data.ModelData extraData, net.minecraft.client.renderer.RenderType renderType) {
|
||||
+ if (this.models == null) {
|
||||
+ this.models = this.shared.selectModels(this.blockState);
|
||||
+ }
|
||||
+
|
||||
+ long i = rand.nextLong();
|
||||
+
|
||||
+ for (BlockStateModel blockstatemodel : this.models) {
|
||||
+ rand.setSeed(i);
|
||||
+ blockstatemodel.collectParts(rand, dest, extraData, renderType);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public record Selector<T>(Predicate<BlockState> condition, T model) {
|
||||
public <S> MultiPartModel.Selector<S> with(S p_393772_) {
|
||||
@@ -62,6 +_,7 @@
|
||||
static final class SharedBakedState {
|
||||
private final List<MultiPartModel.Selector<BlockStateModel>> selectors;
|
||||
final TextureAtlasSprite particleIcon;
|
||||
+ final BlockStateModel firstModel;
|
||||
private final Map<BitSet, List<BlockStateModel>> subsets = new ConcurrentHashMap<>();
|
||||
|
||||
private static BlockStateModel getFirstModel(List<MultiPartModel.Selector<BlockStateModel>> p_392132_) {
|
||||
@@ -74,8 +_,8 @@
|
||||
|
||||
public SharedBakedState(List<MultiPartModel.Selector<BlockStateModel>> p_393647_) {
|
||||
this.selectors = p_393647_;
|
||||
- BlockStateModel blockstatemodel = getFirstModel(p_393647_);
|
||||
- this.particleIcon = blockstatemodel.particleIcon();
|
||||
+ this.firstModel = getFirstModel(p_393647_);
|
||||
+ this.particleIcon = firstModel.particleIcon();
|
||||
}
|
||||
|
||||
public List<BlockStateModel> selectModels(BlockState p_392405_) {
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/blockentity/ChestRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/blockentity/ChestRenderer.java
|
||||
@@ -66,7 +_,7 @@
|
||||
@@ -67,7 +_,7 @@
|
||||
f1 = 1.0F - f1;
|
||||
f1 = 1.0F - f1 * f1 * f1;
|
||||
int i = neighborcombineresult.apply(new BrightnessCombiner<>()).applyAsInt(p_112367_);
|
||||
@@ -9,7 +9,7 @@
|
||||
VertexConsumer vertexconsumer = material.buffer(p_112366_, RenderType::entityCutout);
|
||||
if (flag1) {
|
||||
if (chesttype == ChestType.LEFT) {
|
||||
@@ -85,5 +_,9 @@
|
||||
@@ -86,5 +_,9 @@
|
||||
private void render(PoseStack p_112370_, VertexConsumer p_112371_, ChestModel p_363333_, float p_112375_, int p_112376_, int p_112377_) {
|
||||
p_363333_.setupAnim(p_112375_);
|
||||
p_363333_.renderToBuffer(p_112370_, p_112371_, p_112376_, p_112377_);
|
||||
|
||||
+9
-23
@@ -1,33 +1,19 @@
|
||||
--- a/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/blockentity/PistonHeadRenderer.java
|
||||
@@ -65,13 +_,15 @@
|
||||
@@ -70,10 +_,15 @@
|
||||
private void renderBlock(
|
||||
BlockPos p_112459_, BlockState p_112460_, PoseStack p_112461_, MultiBufferSource p_112462_, Level p_112463_, boolean p_112464_, int p_112465_
|
||||
) {
|
||||
- RenderType rendertype = ItemBlockRenderTypes.getMovingBlockRenderType(p_112460_);
|
||||
- VertexConsumer vertexconsumer = p_112462_.getBuffer(rendertype);
|
||||
+ var model = blockRenderer.getBlockModel(p_112460_);
|
||||
+ var model = this.blockRenderer.getBlockModel(p_112460_);
|
||||
+ var rand = RandomSource.create(p_112460_.getSeed(p_112459_));
|
||||
+ var data = net.minecraftforge.client.model.data.ModelData.EMPTY;
|
||||
+ for (var rendertype : model.getRenderTypes(p_112460_, RandomSource.create(p_112460_.getSeed(p_112459_)), data)) {
|
||||
+ VertexConsumer vertexconsumer = p_112462_.getBuffer(net.minecraftforge.client.RenderTypeHelper.getMovingBlockRenderType(rendertype));
|
||||
this.blockRenderer
|
||||
.getModelRenderer()
|
||||
.tesselateBlock(
|
||||
p_112463_,
|
||||
- this.blockRenderer.getBlockModel(p_112460_),
|
||||
+ model,
|
||||
p_112460_,
|
||||
p_112459_,
|
||||
p_112461_,
|
||||
@@ -79,8 +_,11 @@
|
||||
p_112464_,
|
||||
RandomSource.create(),
|
||||
p_112460_.getSeed(p_112459_),
|
||||
- p_112465_
|
||||
+ p_112465_,
|
||||
+ data,
|
||||
+ rendertype
|
||||
);
|
||||
+ for (var rendertype : model.getRenderTypes(p_112460_, rand, data)) {
|
||||
+ rand = RandomSource.create(p_112460_.getSeed(p_112459_)); // Reset rand to keep
|
||||
VertexConsumer vertexconsumer = p_112462_.getBuffer(rendertype);
|
||||
- List<BlockModelPart> list = this.blockRenderer.getBlockModel(p_112460_).collectParts(RandomSource.create(p_112460_.getSeed(p_112459_)));
|
||||
+ List<BlockModelPart> list = model.collectParts(rand, data, net.minecraftforge.client.RenderTypeHelper.getMovingBlockRenderType(rendertype));
|
||||
this.blockRenderer.getModelRenderer().tesselateBlock(p_112463_, list, p_112460_, p_112459_, p_112461_, vertexconsumer, p_112464_, p_112465_);
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java
|
||||
@@ -33,6 +_,7 @@
|
||||
@@ -34,6 +_,7 @@
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class SkullBlockRenderer implements BlockEntityRenderer<SkullBlockEntity> {
|
||||
@@ -8,7 +8,7 @@
|
||||
private final Function<SkullBlock.Type, SkullModelBase> modelByType;
|
||||
public static final Map<SkullBlock.Type, ResourceLocation> SKIN_BY_TYPE = Util.make(Maps.newHashMap(), p_340906_ -> {
|
||||
p_340906_.put(SkullBlock.Types.SKELETON, ResourceLocation.withDefaultNamespace("textures/entity/skeleton/skeleton.png"));
|
||||
@@ -57,7 +_,9 @@
|
||||
@@ -58,7 +_,9 @@
|
||||
case PIGLIN -> new PiglinHeadModel(p_376421_.bakeLayer(ModelLayers.PIGLIN_HEAD));
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
|
||||
@@ -78,4 +_,14 @@
|
||||
@@ -78,4 +_,9 @@
|
||||
public static int index(int p_345383_, int p_342744_, int p_343921_, int p_343462_) {
|
||||
return p_343921_ - p_345383_ + (p_343462_ - p_342744_) * 3;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
|
||||
+ return this.level.getShade(normalX, normalY, normalZ, shade);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.model.data.ModelDataManager getModelDataManager() {
|
||||
+ return level.getModelDataManager();
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/renderer/chunk/SectionCompiler.java
|
||||
+++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java
|
||||
@@ -41,6 +_,7 @@
|
||||
@@ -43,6 +_,7 @@
|
||||
}
|
||||
|
||||
public SectionCompiler.Results compile(SectionPos p_344383_, RenderChunkRegion p_342669_, VertexSorting p_342522_, SectionBufferBuilderPack p_343546_) {
|
||||
@@ -8,7 +8,7 @@
|
||||
SectionCompiler.Results sectioncompiler$results = new SectionCompiler.Results();
|
||||
BlockPos blockpos = p_344383_.origin();
|
||||
BlockPos blockpos1 = blockpos.offset(15, 15, 15);
|
||||
@@ -71,7 +_,11 @@
|
||||
@@ -74,10 +_,14 @@
|
||||
}
|
||||
|
||||
if (blockstate.getRenderShape() == RenderShape.MODEL) {
|
||||
@@ -16,23 +16,24 @@
|
||||
+ var model = this.blockRenderer.getBlockModel(blockstate);
|
||||
+ var data = modelDataMap.getOrDefault(blockpos2, net.minecraftforge.client.model.data.ModelData.EMPTY);
|
||||
+ data = model.getModelData(p_342669_, blockpos2, blockstate, data);
|
||||
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
|
||||
+ randomsource.setSeed(blockstate.getSeed(blockpos2)); // Forge: We set this on purpose twice so that getRenderTypes can have the same RNG as collectParts
|
||||
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, data)) {
|
||||
BufferBuilder bufferbuilder1 = this.getOrBeginLayer(map, p_343546_, rendertype2);
|
||||
randomsource.setSeed(blockstate.getSeed(blockpos2));
|
||||
- this.blockRenderer.getBlockModel(blockstate).collectParts(randomsource, list);
|
||||
+ model.collectParts(randomsource, list, data, rendertype2);
|
||||
posestack.pushPose();
|
||||
posestack.translate(
|
||||
@@ -79,8 +_,9 @@
|
||||
(float)SectionPos.sectionRelative(blockpos2.getY()),
|
||||
(float)SectionPos.sectionRelative(blockpos2.getZ())
|
||||
);
|
||||
- this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource);
|
||||
+ this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource, data, rendertype2);
|
||||
SectionPos.sectionRelative(blockpos2.getX()), SectionPos.sectionRelative(blockpos2.getY()), SectionPos.sectionRelative(blockpos2.getZ())
|
||||
@@ -85,6 +_,7 @@
|
||||
this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, list);
|
||||
posestack.popPose();
|
||||
list.clear();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +_,10 @@
|
||||
@@ -119,9 +_,10 @@
|
||||
private <E extends BlockEntity> void handleBlockEntity(SectionCompiler.Results p_343713_, E p_343478_) {
|
||||
BlockEntityRenderer<E> blockentityrenderer = this.blockEntityRenderer.getRenderer(p_343478_);
|
||||
if (blockentityrenderer != null) {
|
||||
|
||||
Loaded 100 of 849 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user