1.21.3 update

This commit is contained in:
LexManos 2024-10-25 17:52:16 -07:00
parent c22589b5b3
commit 086bcb7148
No known key found for this signature in database
GPG key ID: 6E90061A7AE1F652
806 changed files with 6314 additions and 10501 deletions

13
.gitignore vendored
View file

@ -26,7 +26,6 @@
/projects/mcp/
/projects/clean/
/projects/forge/
#/patches/*
#occupational hazards
/projects/**/build/
@ -35,20 +34,10 @@
/projects/**/*.launch
/repo/
src/*/generated/**/.cache/
# Generated by gradle every import
**/src/main/resources/META-INF/MANIFEST.MF
/fmlloader/src/main/resources/forge_version.json
#Patch rejects
#/patches-/
#*.patch.rej
#/projects/*/rejects/
# FML changelog
changelog.txt
*.py
*.7z
/logs/
/ForgeRoot.ipr
/ForgeRoot.iws

View file

@ -47,6 +47,7 @@ jarSigner.autoDetect('forge')
applyPatches {
level 'WARNING'
failOnError = UPDATING != 'true'
rejects = rootProject.layout.projectDirectory.dir('rejects').asFile
}
sourceSets {
@ -387,7 +388,7 @@ tasks.register("findFinalizeSpawnTargets", BytecodePredicateFinder) {
return 'net/minecraft/world/level/BaseSpawner' != parent.name // Ignore this class as we special case it.
&& insn.getOpcode().equals(Opcodes.INVOKEVIRTUAL)
&& insn.name == 'm_6518_'
&& insn.desc == '(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/MobSpawnType;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;';
&& insn.desc == '(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;';
}
}
tasks.register('validateDeprecations', ValidateDeprecations) {

View file

@ -15,12 +15,8 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.locating.IModFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
@ -32,8 +28,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinWorkerThread;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
@ -45,9 +39,7 @@ import java.util.stream.Stream;
* Master list of all mods - game-side version. This is classloaded in the game scope and
* can dispatch game level events as a result.
*/
public class ModList
{
//private static final Logger LOGGER = LogManager.getLogger();
public class ModList {
private static ModList INSTANCE;
private final List<IModFileInfo> modFiles;
private final List<IModInfo> sortedList;
@ -57,8 +49,7 @@ public class ModList
private List<ModFileScanData> modFileScanData;
private List<ModContainer> sortedContainers;
private ModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
{
private ModList(final List<ModFile> modFiles, final List<ModInfo> sortedList) {
this.modFiles = modFiles.stream().map(ModFile::getModFileInfo).map(ModFileInfo.class::cast).collect(Collectors.toList());
this.sortedList = sortedList.stream().
map(ModInfo.class::cast).
@ -82,12 +73,12 @@ public class ModList
getModContainerState(mainMod.getModId()),
((ModFileInfo)mf.getModFileInfo()).getCodeSigningFingerprint().orElse("NOSIGNATURE"));
}
private String crashReport() {
return "\n"+applyForEachModFile(this::fileToLine).collect(Collectors.joining("\n\t\t", "\t\t", ""));
}
public static ModList of(List<ModFile> modFiles, List<ModInfo> sortedList)
{
public static ModList of(List<ModFile> modFiles, List<ModInfo> sortedList) {
INSTANCE = new ModList(modFiles, sortedList);
return INSTANCE;
}
@ -96,13 +87,11 @@ public class ModList
return INSTANCE;
}
public List<IModFileInfo> getModFiles()
{
public List<IModFileInfo> getModFiles() {
return modFiles;
}
public IModFileInfo getModFileById(String modid)
{
public IModFileInfo getModFileById(String modid) {
return this.fileById.get(modid);
}
@ -151,48 +140,39 @@ public class ModList
return CompletableFuture.allOf(results).handle((r, th)->null).thenApply(res -> list);
}
void setLoadedMods(final List<ModContainer> modContainers)
{
void setLoadedMods(final List<ModContainer> modContainers) {
this.mods = modContainers;
this.sortedContainers = modContainers.stream().sorted(Comparator.comparingInt(c->sortedList.indexOf(c.getModInfo()))).toList();
this.indexedMods = modContainers.stream().collect(Collectors.toMap(ModContainer::getModId, Function.identity()));
}
@SuppressWarnings("unchecked")
public <T> Optional<T> getModObjectById(String modId)
{
public <T> Optional<T> getModObjectById(String modId) {
return getModContainerById(modId).map(ModContainer::getMod).map(o -> (T) o);
}
public Optional<? extends ModContainer> getModContainerById(String modId)
{
public Optional<? extends ModContainer> getModContainerById(String modId) {
return Optional.ofNullable(this.indexedMods.get(modId));
}
public Optional<? extends ModContainer> getModContainerByObject(Object obj)
{
public Optional<? extends ModContainer> getModContainerByObject(Object obj) {
return mods.stream().filter(mc -> mc.getMod() == obj).findFirst();
}
public List<IModInfo> getMods()
{
public List<IModInfo> getMods() {
return this.sortedList;
}
public boolean isLoaded(String modTarget)
{
public boolean isLoaded(String modTarget) {
return this.indexedMods.containsKey(modTarget);
}
public int size()
{
public int size() {
return mods.size();
}
public List<ModFileScanData> getAllScanData()
{
if (modFileScanData == null)
{
public List<ModFileScanData> getAllScanData() {
if (modFileScanData == null) {
modFileScanData = this.sortedList.stream().
map(IModInfo::getOwningFile).
filter(Objects::nonNull).
@ -205,8 +185,7 @@ public class ModList
}
public void forEachModFile(Consumer<IModFile> fileConsumer)
{
public void forEachModFile(Consumer<IModFile> fileConsumer) {
modFiles.stream().map(IModFileInfo::getFile).forEach(fileConsumer);
}
@ -225,10 +204,4 @@ public class ModList
public <T> Stream<T> applyForEachModContainer(Function<ModContainer, T> function) {
return indexedMods.values().stream().map(function);
}
private static class UncaughtModLoadingException extends ModLoadingException {
public UncaughtModLoadingException(ModLoadingStage stage, Throwable originalException) {
super(null, stage, "fml.modloading.uncaughterror", originalException);
}
}
}

View file

@ -8,20 +8,15 @@ package net.minecraftforge.fml;
import com.mojang.logging.LogUtils;
import net.minecraftforge.fml.config.IConfigSpec;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.loading.FMLLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.function.BiPredicate;
import java.util.function.Supplier;
public class ModLoadingContext
{
public class ModLoadingContext {
private static final Logger LOGGER = LogUtils.getLogger();
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
private ModContainer activeContainer;
private Object languageExtension;
private ModLoadingStage stage;
/**
* @deprecated Use the context provided by your language loader in your mod's constructor

View file

@ -22,9 +22,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Desktop;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URI;
@ -87,6 +85,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
private ScheduledFuture<?> initializationFuture;
private PerformanceInfo performanceInfo;
@SuppressWarnings("unused")
private ScheduledFuture<?> performanceTick;
// The GL ID of the window. Used for all operations
private long window;
@ -259,7 +258,11 @@ public class DisplayWindow implements ImmediateWindowProvider {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
this.elements.removeIf(element -> !element.render(context, framecount));
for (var itr = this.elements.iterator(); itr.hasNext(); ) {
var element = itr.next();
if (!element.render(context, framecount))
itr.remove();
}
if (animationTimerTrigger.compareAndSet(true, false)) // we only increment the framecount on a periodic basis
framecount++;
}
@ -302,13 +305,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
}
private void crashElegantly(String errorDetails) {
String qrText;
try (var is = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/glfailure.txt")))) {
qrText = is.lines().collect(Collectors.joining("\n"));
} catch (IOException ioe) {
qrText = "";
}
StringBuilder msgBuilder = new StringBuilder(2000);
msgBuilder.append("Failed to initialize graphics window with current settings.\n");
msgBuilder.append("\n\n");
@ -407,13 +403,13 @@ public class DisplayWindow implements ImmediateWindowProvider {
if (showHelpLog && versidx == 0) {
LOGGER.info("""
If this message is the only thing at the bottom of your log before a crash, you probably have a driver issue.
Possible solutions:
A) Make sure Minecraft is set to prefer high performance graphics in the OS and/or driver control panel
B) Check for driver updates on the graphics brand's website
C) Try reinstalling your graphics drivers
D) If still not working after trying all of the above, ask for further help on the Forge forums or Discord
You can safely ignore this message if the game starts up successfully.""");
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, GL_VERSIONS[versidx][0]); // we try our versions one at a time
@ -497,10 +493,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
glfwPollEvents();
}
private void badWindowHandler(final int code, final long desc) {
LOGGER.error("Got error from GLFW window init: "+code+ " "+MemoryUtil.memUTF8(desc));
}
private void winResize(long window, int width, int height) {
if (window == this.window && width != 0 && height != 0) {
this.winWidth = width;
@ -634,7 +626,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
public void addMojangTexture(final int textureId) {
this.elements.add(0, RenderElement.mojang(textureId, framecount));
// this.elements.get(0).retire(framecount + 1);
}
public void close() {

View file

@ -11,8 +11,6 @@ import org.lwjgl.stb.STBTTFontinfo;
import org.lwjgl.stb.STBTTPackContext;
import org.lwjgl.stb.STBTTPackRange;
import org.lwjgl.stb.STBTTPackedchar;
import org.lwjgl.system.MemoryStack;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

View file

@ -5,11 +5,11 @@ org.gradle.daemon=false
org.gradle.parallel=true
JAVA_VERSION=21
MC_VERSION=1.21.1
MC_VERSION=1.21.3
MC_NEXT_VERSION=1.22
MCP_VERSION=20240808.132146
MCP_VERSION=20241025.112443
MAPPING_CHANNEL=official
MAPPING_VERSION=1.21.1
MAPPING_VERSION=1.21.3
// Set to true before the first build of a new MC version, so we don't do compatibility checks
CHECK_COMPATIBILITY=false

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
@@ -104,7 +_,10 @@
@@ -96,7 +_,10 @@
GlStateManager._texParameter(3553, 34892, 0);
GlStateManager._texParameter(3553, 10242, 33071);
GlStateManager._texParameter(3553, 10243, 33071);
@ -11,7 +11,7 @@
}
this.setFilterMode(9728, true);
@@ -114,8 +_,13 @@
@@ -106,8 +_,13 @@
GlStateManager._texImage2D(3553, 0, 32856, this.width, this.height, 0, 6408, 5121, null);
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
@ -26,7 +26,7 @@
}
this.checkStatus();
@@ -257,5 +_,26 @@
@@ -229,5 +_,26 @@
public int getDepthTextureId() {
return this.depthBufferId;
@ -42,7 +42,7 @@
+ public void enableStencil() {
+ if (stencilEnabled) return;
+ stencilEnabled = true;
+ this.resize(viewWidth, viewHeight, net.minecraft.client.Minecraft.ON_OSX);
+ this.resize(viewWidth, viewHeight);
+ }
+
+ /**

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -493,9 +_,17 @@
@@ -519,9 +_,17 @@
}
}

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/Window.java
+++ b/com/mojang/blaze3d/platform/Window.java
@@ -84,7 +_,8 @@
@@ -88,7 +_,8 @@
GLFW.glfwWindowHint(139267, 2);
GLFW.glfwWindowHint(139272, 204801);
GLFW.glfwWindowHint(139270, 1);
@ -10,7 +10,7 @@
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;
@@ -96,6 +_,7 @@
@@ -100,6 +_,7 @@
this.windowedX = this.x = aint1[0];
this.windowedY = this.y = aint[0];
}
@ -18,7 +18,7 @@
GLFW.glfwMakeContextCurrent(this.window);
GL.createCapabilities();
@@ -254,6 +_,9 @@
@@ -267,6 +_,9 @@
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/PoseStack.java
+++ b/com/mojang/blaze3d/vertex/PoseStack.java
@@ -13,7 +_,7 @@
@@ -14,7 +_,7 @@
import org.joml.Vector3f;
@OnlyIn(Dist.CLIENT)

View file

@ -1,11 +0,0 @@
--- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
@@ -62,7 +_,7 @@
public VertexConsumer setNormal(float p_344306_, float p_342091_, float p_344579_) {
this.delegate.setNormal(p_344306_, p_342091_, p_344579_);
Vector3f vector3f = this.normalInversePose.transform(p_344306_, p_342091_, p_344579_, this.normal);
- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
Vector3f vector3f1 = this.cameraInversePose.transformPosition(this.x, this.y, this.z, this.worldPos);
vector3f1.rotateY((float) Math.PI);
vector3f1.rotateX((float) (-Math.PI / 2));

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
@@ -12,7 +_,7 @@
@@ -13,7 +_,7 @@
import org.lwjgl.system.MemoryStack;
@OnlyIn(Dist.CLIENT)
@ -9,16 +9,15 @@
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
@@ -135,10 +_,11 @@
}
@@ -133,9 +_,11 @@
int i1 = FastColor.ARGB32.color(k, (int)f3, (int)f4, (int)f5);
- int j1 = p_331444_[l];
+ int j1 = applyBakedLighting(p_331444_[l], bytebuffer);
int j1 = ARGB.color(k, (int)f3, (int)f4, (int)f5);
int k1 = LightTexture.lightCoordsWithEmission(p_331444_[i1], l);
+ k1 = applyBakedLighting(k1, bytebuffer);
float f10 = bytebuffer.getFloat(16);
float f9 = bytebuffer.getFloat(20);
Vector3f vector3f1 = matrix4f.transformPosition(f, f1, f2, new Vector3f());
+ applyBakedNormals(vector3f, bytebuffer, p_85988_.normal());
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), i1, f10, f9, p_85993_, j1, vector3f.x(), vector3f.y(), vector3f.z());
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), j1, f10, f9, p_85993_, k1, vector3f.x(), vector3f.y(), vector3f.z());
}
}

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
@@ -13,7 +_,7 @@
@@ -14,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
@ -9,7 +9,7 @@
public static final int UNKNOWN_ELEMENT = -1;
private final List<VertexFormatElement> elements;
private final List<String> names;
@@ -22,6 +_,7 @@
@@ -23,6 +_,7 @@
private final int[] offsetsByElement = new int[32];
@Nullable
private VertexBuffer immediateDrawVertexBuffer;
@ -17,7 +17,7 @@
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
this.elements = p_343616_;
@@ -34,6 +_,11 @@
@@ -35,6 +_,11 @@
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
}
@ -29,7 +29,7 @@
}
public static VertexFormat.Builder builder() {
@@ -158,6 +_,9 @@
@@ -141,6 +_,9 @@
return vertexbuffer;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -171,6 +_,7 @@
@@ -170,6 +_,7 @@
}
static {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/Util.java
+++ b/net/minecraft/Util.java
@@ -267,7 +_,7 @@
@@ -264,7 +_,7 @@
.getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion()))
.getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -40,6 +_,7 @@
@@ -41,6 +_,7 @@
LootParams lootparams = new LootParams.Builder(p_9990_.serverLevel())
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
.withParameter(LootContextParams.ORIGIN, p_9990_.position())

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -105,9 +_,13 @@
@@ -120,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);
@@ -223,6 +_,13 @@
@@ -238,6 +_,13 @@
public float getPartialTickTime() {
return this.partialTickTime;

View file

@ -1,20 +0,0 @@
--- a/net/minecraft/client/ClientRecipeBook.java
+++ b/net/minecraft/client/ClientRecipeBook.java
@@ -65,7 +_,7 @@
Recipe<?> recipe = recipeholder.value();
if (!recipe.isSpecial() && !recipe.isIncomplete()) {
RecipeBookCategories recipebookcategories = getCategory(recipeholder);
- String s = recipe.getGroup();
+ String s = recipe.getGroup().isEmpty() ? recipeholder.id().toString() : recipe.getGroup(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
if (s.isEmpty()) {
map.computeIfAbsent(recipebookcategories, p_90645_ -> Lists.newArrayList()).add(ImmutableList.of(recipeholder));
} else {
@@ -125,6 +_,8 @@
} else if (recipetype == RecipeType.SMITHING) {
return RecipeBookCategories.SMITHING;
} else {
+ var categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType)recipetype, p_299041_);
+ if (categories != null) return categories;
LOGGER.warn(
"Unknown recipe category: {}/{}",
LogUtils.defer(() -> BuiltInRegistries.RECIPE_TYPE.getKey(recipe.getType())),

View file

@ -1,18 +1,21 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -405,9 +_,9 @@
Screen.wrapScreenError(() -> {
if (p_90897_ == 1 || p_90897_ == 2) {
@@ -424,12 +_,12 @@
if (screen != null) {
try {
if (p_90897_ != 1 && p_90897_ != 2) {
- if (p_90897_ == 0 && screen.keyReleased(p_90895_, p_90896_, p_90898_)) {
+ if (p_90897_ == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, p_90895_, p_90896_, p_90898_)) {
return;
}
} else {
screen.afterKeyboardAction();
- aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
+ net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(aboolean, screen, p_90895_, p_90896_, p_90898_);
} else if (p_90897_ == 0) {
- aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
+ net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(aboolean, screen, p_90895_, p_90896_, p_90898_);
- if (screen.keyPressed(p_90895_, p_90896_, p_90898_)) {
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressed(screen, p_90895_, p_90896_, p_90898_)) {
return;
}
}
}, "keyPressed event handler", screen.getClass().getCanonicalName());
if (aboolean[0]) {
@@ -476,20 +_,21 @@
@@ -505,6 +_,7 @@
}
}
}
@ -20,20 +23,17 @@
}
}
private void charTyped(long p_90890_, int p_90891_, int p_90892_) {
if (p_90890_ == this.minecraft.getWindow().getWindow()) {
- GuiEventListener guieventlistener = this.minecraft.screen;
+ Screen guieventlistener = this.minecraft.screen;
if (guieventlistener != null && this.minecraft.getOverlay() == null) {
if (Character.charCount(p_90891_) == 1) {
Screen.wrapScreenError(
- () -> guieventlistener.charTyped((char)p_90891_, p_90892_), "charTyped event handler", guieventlistener.getClass().getCanonicalName()
+ () -> net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(guieventlistener, (char)p_90891_, p_90892_), "charTyped event handler", guieventlistener.getClass().getCanonicalName()
);
} else {
for (char c0 : Character.toChars(p_90891_)) {
- Screen.wrapScreenError(() -> guieventlistener.charTyped(c0, p_90892_), "charTyped event handler", guieventlistener.getClass().getCanonicalName());
+ Screen.wrapScreenError(() -> net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(guieventlistener, c0, p_90892_), "charTyped event handler", guieventlistener.getClass().getCanonicalName());
@@ -514,10 +_,10 @@
if (screen != null && this.minecraft.getOverlay() == null) {
try {
if (Character.isBmpCodePoint(p_90891_)) {
- screen.charTyped((char)p_90891_, p_90892_);
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, (char)p_90891_, p_90892_);
} else if (Character.isValidCodePoint(p_90891_)) {
- screen.charTyped(Character.highSurrogate(p_90891_), p_90892_);
- screen.charTyped(Character.lowSurrogate(p_90891_), p_90892_);
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, Character.highSurrogate(p_90891_), p_90892_);
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTyped(screen, Character.lowSurrogate(p_90891_), p_90892_);
}
}
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "charTyped event handler");

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -254,7 +_,7 @@
@@ -253,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;
@@ -431,7 +_,6 @@
@@ -433,7 +_,6 @@
}
}, Util.nonCriticalIoPool());
LOGGER.info("Setting user: {}", this.user.getName());
@ -17,10 +17,10 @@
this.demo = p_91084_.game.demo;
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
this.allowsChat = !p_91084_.game.disableChat;
@@ -468,15 +_,15 @@
@@ -480,15 +_,15 @@
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
}
this.window.setFramerateLimit(this.options.framerateLimit().get());
+ // FORGE: Move mouse and keyboard handler setup further below
this.mouseHandler = new MouseHandler(this);
- this.mouseHandler.setup(this.window.getWindow());
@ -29,27 +29,21 @@
RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
this.mainRenderTarget.clear(ON_OSX);
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_ -> {
@@ -540,6 +_,7 @@
this.entityRenderDispatcher = new EntityRenderDispatcher(this, this.textureManager, this.itemRenderer, this.blockRenderer, this.font, this.options, this.entityModels);
@@ -562,6 +_,7 @@
);
this.resourceManager.registerReloadListener(this.entityRenderDispatcher);
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleEngine);
this.resourceManager.registerReloadListener(this.particleEngine);
this.paintingTextures = new PaintingTextureManager(this.textureManager);
this.resourceManager.registerReloadListener(this.paintingTextures);
@@ -552,11 +_,15 @@
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
this.resourceManager.registerReloadListener(this.levelRenderer);
this.gpuWarnlistManager = new GpuWarnlistManager();
@@ -577,6 +_,9 @@
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
this.resourceManager.registerReloadListener(this.regionalCompliancies);
this.gui = new Gui(this);
@ -59,7 +53,7 @@
this.debugRenderer = new DebugRenderer(this);
RealmsClient realmsclient = RealmsClient.create(this);
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
@@ -580,6 +_,7 @@
@@ -600,6 +_,7 @@
this.options.fullscreen().set(this.window.isFullscreen());
}
@ -67,7 +61,7 @@
this.window.updateVsync(this.options.enableVsync().get());
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.window.setDefaultErrorCallback();
@@ -600,16 +_,17 @@
@@ -620,16 +_,17 @@
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
this.setOverlay(
@ -87,8 +81,8 @@
+ ).get()
);
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
}
@@ -698,6 +_,7 @@
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
@@ -724,6 +_,7 @@
StringBuilder stringbuilder = new StringBuilder("Minecraft");
if (checkModStatus().shouldReportAsModified()) {
stringbuilder.append("*");
@ -96,7 +90,7 @@
}
stringbuilder.append(" ");
@@ -721,6 +_,8 @@
@@ -747,6 +_,8 @@
}
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
@ -105,7 +99,7 @@
return p_193587_.user.user.getType() != User.Type.MSA
? UserApiService.OFFLINE
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
@@ -731,7 +_,7 @@
@@ -757,7 +_,7 @@
}
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
@ -114,7 +108,7 @@
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
} else {
Util.throwAsRuntime(p_91240_);
@@ -991,12 +_,6 @@
@@ -1043,12 +_,6 @@
LOGGER.error("setScreen called from non-game thread");
}
@ -127,7 +121,7 @@
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
} else {
@@ -1010,6 +_,23 @@
@@ -1062,6 +_,23 @@
}
}
@ -151,19 +145,19 @@
this.screen = p_91153_;
if (this.screen != null) {
this.screen.added();
@@ -1155,9 +_,11 @@
@@ -1215,9 +_,11 @@
this.mouseHandler.handleAccumulatedMovement();
this.profiler.pop();
profilerfiller.pop();
if (!this.noRender) {
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.timer);
this.profiler.popPush("gameRenderer");
this.gameRenderer.render(this.timer, p_91384_);
this.profiler.pop();
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.timer);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
profilerfiller.popPush("gameRenderer");
this.gameRenderer.render(this.deltaTracker, p_91384_);
profilerfiller.pop();
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
}
if (this.fpsPieResults != null) {
@@ -1283,10 +_,12 @@
profilerfiller.push("blit");
@@ -1339,10 +_,12 @@
this.window.setGuiScale((double)i);
if (this.screen != null) {
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
@ -171,12 +165,12 @@
}
RenderTarget rendertarget = this.getMainRenderTarget();
rendertarget.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX);
rendertarget.resize(this.window.getWidth(), this.window.getHeight());
+ if (this.gameRenderer != null)
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
this.mouseHandler.setIgnoreFirstMove();
}
@@ -1554,6 +_,7 @@
@@ -1483,6 +_,7 @@
}
public void stop() {
@ -184,7 +178,7 @@
this.running = false;
}
@@ -1582,10 +_,18 @@
@@ -1511,10 +_,18 @@
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
@ -206,7 +200,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
}
}
@@ -1613,6 +_,8 @@
@@ -1542,6 +_,8 @@
return false;
} else {
boolean flag = false;
@ -215,7 +209,7 @@
switch (this.hitResult.getType()) {
case ENTITY:
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
@@ -1620,7 +_,7 @@
@@ -1549,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
@ -224,7 +218,7 @@
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
if (this.level.getBlockState(blockpos).isAir()) {
flag = true;
@@ -1633,8 +_,10 @@
@@ -1562,8 +_,10 @@
}
this.player.resetAttackStrengthTicker();
@ -235,7 +229,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1650,6 +_,12 @@
@@ -1579,6 +_,12 @@
}
for (InteractionHand interactionhand : InteractionHand.values()) {
@ -248,68 +242,68 @@
ItemStack itemstack = this.player.getItemInHand(interactionhand);
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
return;
@@ -1670,7 +_,7 @@
@@ -1599,7 +_,7 @@
}
if (interactionresult.consumesAction()) {
- if (interactionresult.shouldSwing()) {
+ if (interactionresult.shouldSwing() && inputEvent.shouldSwingHand()) {
if (interactionresult instanceof InteractionResult.Success interactionresult$success2) {
- if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT) {
+ if (interactionresult$success2.swingSource() == InteractionResult.SwingSource.CLIENT && inputEvent.shouldSwingHand()) {
this.player.swing(interactionhand);
}
@@ -1682,7 +_,7 @@
@@ -1611,7 +_,7 @@
int i = itemstack.getCount();
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
if (interactionresult1.consumesAction()) {
- if (interactionresult1.shouldSwing()) {
+ if (interactionresult1.shouldSwing() && inputEvent.shouldSwingHand()) {
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())) {
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
@@ -1698,6 +_,9 @@
@@ -1627,6 +_,9 @@
}
}
+ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS))
+ net.minecraftforge.event.ForgeEventFactory.onRightClickEmpty(this.player, interactionhand);
+
if (!itemstack.isEmpty()) {
InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
if (interactionresult2.consumesAction()) {
@@ -1728,6 +_,8 @@
this.rightClickDelay--;
if (!itemstack.isEmpty()
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
@@ -1656,6 +_,8 @@
}
ProfilerFiller profilerfiller = Profiler.get();
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
+
this.profiler.push("gui");
profilerfiller.push("gui");
this.chatListener.tick();
this.gui.tick(this.pause);
@@ -1811,6 +_,7 @@
@@ -1745,6 +_,7 @@
this.tutorial.tick();
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true);
try {
this.level.tick(() -> true);
} catch (Throwable throwable) {
@@ -1824,6 +_,7 @@
} catch (Throwable throwable1) {
@@ -1758,6 +_,7 @@
throw new ReportedException(crashreport);
throw new ReportedException(crashreport1);
}
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.level, () -> true);
}
this.profiler.popPush("animateTick");
@@ -1843,6 +_,7 @@
this.profiler.popPush("keyboard");
profilerfiller.popPush("animateTick");
@@ -1782,6 +_,7 @@
profilerfiller.popPush("keyboard");
this.keyboardHandler.tick();
this.profiler.pop();
profilerfiller.pop();
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
}
private boolean isLevelRunningNormally() {
@@ -2043,6 +_,7 @@
@@ -1983,6 +_,7 @@
}
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
@ -317,7 +311,7 @@
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
this.level = p_91157_;
this.updateLevelInEngines(p_91157_);
@@ -2080,6 +_,7 @@
@@ -2020,6 +_,7 @@
IntegratedServer integratedserver = this.singleplayerServer;
this.singleplayerServer = null;
this.gameRenderer.resetData();
@ -325,15 +319,15 @@
this.gameMode = null;
this.narrator.clear();
this.clientLevelTeardownInProgress = true;
@@ -2087,6 +_,7 @@
@@ -2027,6 +_,7 @@
try {
this.updateScreenAndTick(p_335030_);
if (this.level != null) {
+ net.minecraftforge.event.ForgeEventFactory.onLevelUnload(this.level);
if (integratedserver != null) {
this.profiler.push("waitForServer");
@@ -2099,6 +_,7 @@
ProfilerFiller profilerfiller = Profiler.get();
profilerfiller.push("waitForServer");
@@ -2040,6 +_,7 @@
this.gui.onDisconnected();
this.isLocalServer = false;
@ -341,7 +335,7 @@
}
this.level = null;
@@ -2245,6 +_,7 @@
@@ -2187,6 +_,7 @@
private void pickBlock() {
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
@ -349,7 +343,7 @@
boolean flag = this.player.getAbilities().instabuild;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.hitResult.getType();
@@ -2257,7 +_,7 @@
@@ -2199,7 +_,7 @@
}
Block block = blockstate.getBlock();
@ -358,7 +352,7 @@
if (itemstack.isEmpty()) {
return;
}
@@ -2271,7 +_,7 @@
@@ -2213,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.hitResult).getEntity();
@ -367,7 +361,7 @@
if (itemstack == null) {
return;
}
@@ -2855,6 +_,10 @@
@@ -2818,6 +_,10 @@
@Nullable
public static String getLauncherBrand() {
return System.getProperty("minecraft.launcher.brand");

View file

@ -1,34 +1,40 @@
--- a/net/minecraft/client/MouseHandler.java
+++ b/net/minecraft/client/MouseHandler.java
@@ -79,6 +_,7 @@
@@ -85,6 +_,7 @@
this.activeButton = -1;
}
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return;
boolean[] aboolean = new boolean[]{false};
if (this.minecraft.getOverlay() == null) {
if (this.minecraft.screen == null) {
@@ -91,9 +_,9 @@
Screen screen = this.minecraft.screen;
if (flag) {
if (!this.mouseGrabbed && flag) {
@@ -98,7 +_,7 @@
screen.afterMouseAction();
- Screen.wrapScreenError(() -> aboolean[0] = screen.mouseClicked(d0, d1, i), "mouseClicked event handler", screen.getClass().getCanonicalName());
+ Screen.wrapScreenError(() -> net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(aboolean, screen, d0, d1, i), "mouseClicked event handler", screen.getClass().getCanonicalName());
try {
- if (screen.mouseClicked(d0, d1, i)) {
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, d0, d1, i)) {
return;
}
} catch (Throwable throwable1) {
@@ -112,7 +_,7 @@
}
} else {
- Screen.wrapScreenError(() -> aboolean[0] = screen.mouseReleased(d0, d1, i), "mouseReleased event handler", screen.getClass().getCanonicalName());
+ Screen.wrapScreenError(() -> net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(aboolean, screen, d0, d1, i), "mouseReleased event handler", screen.getClass().getCanonicalName());
}
try {
- if (screen.mouseReleased(d0, d1, i)) {
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, d0, d1, i)) {
return;
}
} catch (Throwable throwable) {
@@ -147,6 +_,7 @@
}
}
@@ -116,6 +_,7 @@
}
}
}
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
}
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
}
@@ -129,7 +_,9 @@
private void onScroll(long p_91527_, double p_91528_, double p_91529_) {
@@ -160,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();
@ -38,25 +44,25 @@
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2);
this.minecraft.screen.afterMouseAction();
} else if (this.minecraft.player != null) {
if (this.accumulatedScrollX != 0.0 && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
@@ -151,6 +_,7 @@
this.accumulatedScrollX -= (double)j;
this.accumulatedScrollY -= (double)i;
int k = i == 0 ? -j : i;
Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2);
@@ -169,6 +_,7 @@
}
int i = vector2i.y == 0 ? -vector2i.x : vector2i.y;
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return;
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
@@ -236,7 +_,7 @@
if (this.activeButton != -1 && this.mousePressedTime > 0.0) {
double d4 = this.accumulatedDX * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i);
@@ -274,7 +_,7 @@
double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
- Screen.wrapScreenError(() -> screen.mouseDragged(d2, d3, this.activeButton, d4, d5), "mouseDragged event handler", screen.getClass().getCanonicalName());
+ Screen.wrapScreenError(() -> net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, d2, d3, this.activeButton, d4, d5), "mouseDragged event handler", screen.getClass().getCanonicalName());
}
screen.afterMouseMove();
@@ -303,6 +_,14 @@
try {
- screen.mouseDragged(d2, d3, this.activeButton, d4, d5);
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, d2, d3, this.activeButton, d4, d5);
} catch (Throwable throwable) {
CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler");
screen.fillCrashDetails(crashreport1);
@@ -349,6 +_,14 @@
public double ypos() {
return this.ypos;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -681,7 +_,8 @@
@@ -698,7 +_,8 @@
},
new OptionInstance.LazyEnum<>(
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
@ -10,7 +10,7 @@
? Optional.empty()
: Optional.of(p_232011_),
Codec.STRING
@@ -1050,6 +_,7 @@
@@ -1079,6 +_,7 @@
}
public Options(Minecraft p_92138_, File p_92139_) {
@ -18,7 +18,7 @@
this.minecraft = p_92138_;
this.optionsFile = new File(p_92139_, "options.txt");
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
@@ -1184,12 +_,22 @@
@@ -1210,12 +_,22 @@
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
@ -42,7 +42,7 @@
}
}
@@ -1207,6 +_,10 @@
@@ -1233,6 +_,10 @@
}
public void load() {
@ -53,7 +53,7 @@
try {
if (!this.optionsFile.exists()) {
return;
@@ -1234,7 +_,8 @@
@@ -1260,7 +_,8 @@
}
}
@ -63,15 +63,15 @@
new Options.FieldAccess() {
@Nullable
private String getValueOrNull(String p_168459_) {
@@ -1428,6 +_,7 @@
@@ -1451,6 +_,7 @@
}
public void broadcastOptions() {
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
if (this.minecraft.player != null) {
this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
}
@@ -1546,6 +_,23 @@
@@ -1564,6 +_,23 @@
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));

View file

@ -1,45 +0,0 @@
--- a/net/minecraft/client/RecipeBookCategories.java
+++ b/net/minecraft/client/RecipeBookCategories.java
@@ -12,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public enum RecipeBookCategories {
+public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum {
CRAFTING_SEARCH(new ItemStack(Items.COMPASS)),
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.BRICKS)),
CRAFTING_REDSTONE(new ItemStack(Items.REDSTONE)),
@@ -38,7 +_,7 @@
public static final List<RecipeBookCategories> CRAFTING_CATEGORIES = ImmutableList.of(
CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE
);
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = ImmutableMap.of(
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = net.minecraftforge.client.RecipeBookManager.getAggregateCategories(ImmutableMap.of(
CRAFTING_SEARCH,
ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE),
FURNACE_SEARCH,
@@ -47,7 +_,7 @@
ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC),
SMOKER_SEARCH,
ImmutableList.of(SMOKER_FOOD)
- );
+ ));
private final List<ItemStack> itemIcons;
private RecipeBookCategories(final ItemStack... p_92267_) {
@@ -60,10 +_,15 @@
case FURNACE -> FURNACE_CATEGORIES;
case BLAST_FURNACE -> BLAST_FURNACE_CATEGORIES;
case SMOKER -> SMOKER_CATEGORIES;
+ default -> net.minecraftforge.client.RecipeBookManager.getCustomCategoriesOrEmpty(p_92270_);
};
}
public List<ItemStack> getIconItems() {
return this.itemIcons;
+ }
+
+ public static RecipeBookCategories create(String name, ItemStack... icons) {
+ throw new IllegalStateException("Enum not extended");
}
}

View file

@ -10,8 +10,8 @@
public static ItemColors createDefault(BlockColors p_92684_) {
ItemColors itemcolors = new ItemColors();
@@ -105,17 +_,20 @@
: FastColor.ARGB32.opaque(p_325310_.getOrDefault(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).rgb()),
@@ -101,17 +_,20 @@
(p_357654_, p_357655_) -> p_357655_ == 0 ? -1 : ARGB.opaque(p_357654_.getOrDefault(DataComponents.MAP_COLOR, MapItemColor.DEFAULT).rgb()),
Items.FILLED_MAP
);
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -31,7 +_,7 @@
@@ -33,7 +_,7 @@
import org.joml.Vector3f;
@OnlyIn(Dist.CLIENT)
@ -9,12 +9,3 @@
private static final float EFFECT_DEPTH = 0.01F;
private static final Vector3f SHADOW_OFFSET = new Vector3f(0.0F, 0.0F, 0.03F);
public static final int ALPHA_CUTOFF = 8;
@@ -322,6 +_,8 @@
public StringSplitter getSplitter() {
return this.splitter;
}
+
+ @Override public Font self() { return this; }
@OnlyIn(Dist.CLIENT)
public static enum DisplayMode {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java
@@ -131,7 +_,7 @@
@@ -147,7 +_,7 @@
public float vignetteBrightness = 1.0F;
private int toolHighlightTimer;
private ItemStack lastToolHighlight = ItemStack.EMPTY;
@ -9,7 +9,7 @@
private final SubtitleOverlay subtitleOverlay;
private final SpectatorGui spectatorGui;
private final PlayerTabOverlay tabList;
@@ -318,7 +_,7 @@
@@ -345,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());
@ -18,24 +18,24 @@
}
}
@@ -434,6 +_,8 @@
@@ -443,6 +_,8 @@
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
Holder<MobEffect> holder = mobeffectinstance.getEffect();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
if (mobeffectinstance.showIcon()) {
int i = p_282812_.guiWidth();
int j = 1;
@@ -463,6 +_,7 @@
int k = p_282812_.guiWidth();
int l = 1;
@@ -473,6 +_,7 @@
}
}
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue;
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, k, l, 0, f)) continue;
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
int l1 = i;
int i1 = j;
@@ -625,6 +_,10 @@
int l1 = k;
int k1 = l;
@@ -623,6 +_,10 @@
}
private void renderSelectedItemName(GuiGraphics p_283501_) {
@ -43,10 +43,10 @@
+ }
+
+ public void renderSelectedItemName(GuiGraphics p_283501_, int yShift) {
this.minecraft.getProfiler().push("selectedItemName");
Profiler.get().push("selectedItemName");
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
@@ -632,9 +_,13 @@
@@ -630,9 +_,13 @@
mutablecomponent.withStyle(ChatFormatting.ITALIC);
}
@ -62,16 +62,16 @@
if (!this.minecraft.gameMode.canHurtPlayer()) {
k += 14;
}
@@ -645,7 +_,7 @@
@@ -643,7 +_,7 @@
}
if (l > 0) {
- p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, FastColor.ARGB32.color(l, -1));
+ p_283501_.drawStringWithBackdrop(font, highlightTip, j, k, i, FastColor.ARGB32.color(l, -1));
- p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, ARGB.color(l, -1));
+ p_283501_.drawStringWithBackdrop(font, highlightTip, j, k, i, ARGB.color(l, -1));
}
}
@@ -1146,7 +_,7 @@
@@ -1152,7 +_,7 @@
ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
if (itemstack.isEmpty()) {
this.toolHighlightTimer = 0;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/GuiGraphics.java
+++ b/net/minecraft/client/gui/GuiGraphics.java
@@ -56,7 +_,7 @@
@@ -53,7 +_,7 @@
import org.joml.Vector2ic;
@OnlyIn(Dist.CLIENT)
@ -9,7 +9,7 @@
public static final float MAX_GUI_Z = 10000.0F;
public static final float MIN_GUI_Z = -10000.0F;
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
@@ -268,6 +_,11 @@
@@ -227,6 +_,11 @@
}
public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
@ -18,10 +18,10 @@
+
+ // Forge: Add float variant for x,y coordinates
+ public int drawString(Font p_283343_, @Nullable String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_) {
if (p_281896_ == null) {
return 0;
} else {
@@ -294,6 +_,11 @@
return p_281896_ == null
? 0
: p_283343_.drawInBatch(
@@ -248,6 +_,11 @@
}
public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
@ -30,10 +30,10 @@
+
+ // 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_) {
int i = p_282636_.drawInBatch(
return p_282636_.drawInBatch(
p_281596_,
(float)p_281586_,
@@ -864,6 +_,7 @@
@@ -872,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,9 +41,9 @@
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_281675_.getComponents()));
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil()));
throw new ReportedException(crashreport);
@@ -904,16 +_,26 @@
}
@@ -892,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();
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
}
@ -53,50 +53,56 @@
public void renderTooltip(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
+ this.tooltipStack = p_282781_;
this.renderTooltip(p_282308_, Screen.getTooltipFromItem(this.minecraft, p_282781_), p_282781_.getTooltipImage(), p_282687_, p_282292_);
this.renderTooltip(
p_282308_, Screen.getTooltipFromItem(this.minecraft, p_282781_), p_282781_.getTooltipImage(), p_282687_, p_282292_, p_282781_.get(DataComponents.TOOLTIP_STYLE)
);
+ this.tooltipStack = ItemStack.EMPTY;
+ }
+
+ public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
+ this.tooltipStack = stack;
+ this.renderTooltip(font, textComponents, tooltipComponent, mouseX, mouseY);
+ this.renderTooltip(font, textComponents, tooltipComponent, mouseX, mouseY, stack.get(DataComponents.TOOLTIP_STYLE));
+ this.tooltipStack = ItemStack.EMPTY;
}
public void renderTooltip(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
- List<ClientTooltipComponent> list = p_282716_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
- p_281682_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, guiWidth(), guiHeight(), p_283128_);
this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
@@ -908,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_
) {
- List<ClientTooltipComponent> list = p_368544_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
- p_362815_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_368544_, p_362815_, p_366300_, guiWidth(), guiHeight(), p_362491_);
this.renderTooltipInternal(p_362491_, list, p_366300_, p_368952_, DefaultTooltipPositioner.INSTANCE, p_368469_);
}
@@ -922,7 +_,22 @@
}
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
- this.renderTooltip(p_282739_, Lists.transform(p_281832_, Component::getVisualOrderText), p_282191_, p_282446_);
- this.renderComponentTooltip(p_282739_, p_281832_, p_282191_, p_282446_, null);
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, guiWidth(), guiHeight(), p_282739_);
+ this.renderTooltipInternal(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.INSTANCE);
+ this.renderTooltipInternal(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.INSTANCE, null);
+ }
+
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null);
+ this.tooltipStack = ItemStack.EMPTY;
+ }
+
+ public void renderComponentTooltipFromElements(Font font, List<com.mojang.datafixers.util.Either<FormattedText, TooltipComponent>> elements, int mouseX, int mouseY, ItemStack stack) {
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponentsFromElements(stack, elements, mouseX, guiWidth(), guiHeight(), font);
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE, null);
+ this.tooltipStack = ItemStack.EMPTY;
}
public void renderTooltip(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
@@ -941,11 +_,13 @@
private void renderTooltipInternal(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
public void renderComponentTooltip(Font p_369090_, List<Component> p_365405_, int p_368143_, int p_366244_, @Nullable ResourceLocation p_364763_) {
@@ -964,11 +_,13 @@
@Nullable ResourceLocation p_368234_
) {
if (!p_282615_.isEmpty()) {
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283230_, p_283417_, guiWidth(), guiHeight(), p_282615_, p_282675_, p_282442_);
+ if (preEvent.isCanceled()) return;
@ -109,21 +115,19 @@
if (k > i) {
i = k;
}
@@ -955,18 +_,21 @@
@@ -978,18 +_,19 @@
int i2 = i;
int j2 = j;
- Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283230_, p_283417_, i2, j2);
- Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283230_, p_283417_, i, j);
+ Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i2, j2);
int l = vector2ic.x();
int i1 = vector2ic.y();
this.pose.pushPose();
int j1 = 400;
- this.drawManaged(() -> TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400));
+ this.drawManaged(() -> {
+ var colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282615_);
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
+ });
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, 400, p_368234_);
+ var background_event = net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTooltipBackground(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282615_, p_368234_);
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, 400, background_event.getBackground());
this.pose.translate(0.0F, 0.0F, 400.0F);
int k1 = i1;
@ -131,15 +135,26 @@
ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1);
- clienttooltipcomponent1.renderText(p_282675_, l, k1, this.pose.last().pose(), this.bufferSource);
+ clienttooltipcomponent1.renderText(preEvent.getFont(), l, k1, this.pose.last().pose(), this.bufferSource);
k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0);
k1 += clienttooltipcomponent1.getHeight(p_282675_) + (l1 == 0 ? 2 : 0);
}
@@ -974,7 +_,7 @@
@@ -997,7 +_,7 @@
for (int k2 = 0; k2 < p_282615_.size(); k2++) {
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
- clienttooltipcomponent2.renderImage(p_282675_, l, k1, this);
+ clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, this);
k1 += clienttooltipcomponent2.getHeight() + (k2 == 0 ? 2 : 0);
- clienttooltipcomponent2.renderImage(p_282675_, l, k1, i2, j2, this);
+ clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, i2, j2, this);
k1 += clienttooltipcomponent2.getHeight(p_282675_) + (k2 == 0 ? 2 : 0);
}
@@ -1054,6 +_,10 @@
}
}
}
+ }
+
+ public MultiBufferSource.BufferSource getBufferSource() {
+ return this.bufferSource;
}
public void drawSpecial(Consumer<MultiBufferSource> p_367429_) {

View file

@ -1,9 +1,9 @@
--- a/net/minecraft/client/gui/components/AbstractButton.java
+++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -34,7 +_,7 @@
RenderSystem.enableDepthTest();
p_281670_.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
p_281670_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
@@ -39,7 +_,7 @@
this.getHeight(),
ARGB.white(this.alpha)
);
- int i = this.active ? 16777215 : 10526880;
+ int i = getFGColor();
this.renderString(p_281670_, minecraft.font, i | Mth.ceil(this.alpha * 255.0F) << 24);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -255,6 +_,25 @@
@@ -259,6 +_,25 @@
this.focused = p_93693_;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
@@ -63,13 +_,16 @@
@@ -66,13 +_,16 @@
for (LerpingBossEvent lerpingbossevent : this.events.values()) {
int k = i / 2 - 91;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
@@ -101,9 +_,9 @@
@@ -105,9 +_,9 @@
@Nullable
private CompletableFuture<LevelChunk> serverChunk;
private boolean renderDebug;
@ -13,53 +13,54 @@
private final LocalSampleLogger frameTimeLogger = new LocalSampleLogger(1);
private final LocalSampleLogger tickTimeLogger = new LocalSampleLogger(TpsDebugDimensions.values().length);
private final LocalSampleLogger pingLogger = new LocalSampleLogger(1);
@@ -129,14 +_,18 @@
@@ -135,14 +_,18 @@
this.clientChunk = null;
}
- public void render(GuiGraphics p_281427_) {
- this.minecraft.getProfiler().push("debug");
- ProfilerFiller profilerfiller = Profiler.get();
- profilerfiller.push("debug");
+ protected void update() {
Entity entity = this.minecraft.getCameraEntity();
this.block = entity.pick(20.0, 0.0F, false);
this.liquid = entity.pick(20.0, 0.0F, true);
- p_281427_.drawManaged(() -> {
+ }
+
+ protected void drawText(GuiGraphics p_281427_) {
this.drawGameInformation(p_281427_);
this.drawSystemInformation(p_281427_);
+ protected void drawText(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
this.drawGameInformation(p_281427_);
this.drawSystemInformation(p_281427_);
+ }
+
+ protected void drawFPSCharts(GuiGraphics p_281427_) {
if (this.renderFpsCharts) {
int i = p_281427_.guiWidth();
int j = i / 2;
@@ -146,7 +_,9 @@
this.tpsChart.drawChart(p_281427_, i - k, k);
}
}
+ protected void drawFPSCharts(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
this.profilerPieChart.setBottomOffset(10);
if (this.renderFpsCharts) {
int i = p_281427_.guiWidth();
@@ -155,7 +_,9 @@
this.profilerPieChart.setBottomOffset(this.tpsChart.getFullHeight());
}
+ }
+ protected void drawNetworkCharts(GuiGraphics p_281427_) {
if (this.renderNetworkCharts) {
int l = p_281427_.guiWidth();
int i1 = l / 2;
@@ -157,12 +_,21 @@
int j1 = this.pingChart.getWidth(i1);
this.pingChart.drawChart(p_281427_, l - j1, j1);
}
+ protected void drawNetworkCharts(ProfilerFiller profilerfiller, GuiGraphics p_281427_) {
if (this.renderNetworkCharts) {
int l = p_281427_.guiWidth();
int i1 = l / 2;
@@ -171,12 +_,22 @@
try (Zone zone = profilerfiller.zone("profilerPie")) {
this.profilerPieChart.render(p_281427_);
}
+ }
+
+ public void render(GuiGraphics p_281427_) {
+ this.minecraft.getProfiler().push("debug");
+ ProfilerFiller profilerfiller = Profiler.get();
+ profilerfiller.push("debug");
+ this.update();
+ p_281427_.drawManaged(() -> {
+ this.drawText(p_281427_);
+ this.drawFPSCharts(p_281427_);
+ this.drawNetworkCharts(p_281427_);
});
this.minecraft.getProfiler().pop();
+
+ this.drawText(profilerfiller, p_281427_);
+ this.drawFPSCharts(profilerfiller, p_281427_);
+ this.drawNetworkCharts(profilerfiller, p_281427_);
profilerfiller.pop();
}
- protected void drawGameInformation(GuiGraphics p_281525_) {
@ -69,7 +70,7 @@
list.add("");
boolean flag = this.minecraft.getSingleplayerServer() != null;
list.add(
@@ -176,11 +_,18 @@
@@ -190,11 +_,18 @@
+ (this.renderNetworkCharts ? " visible" : " hidden")
);
list.add("For help: press F3 + Q");
@ -79,17 +80,17 @@
+ protected void drawGameInformation(GuiGraphics p_281525_) {
+ List<String> list = this.getGameInformation();
+ list.addAll(this.getOverlayHelp());
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, true);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getDeltaTracker().getRealtimeDeltaTicks(), list, true);
+ this.renderLines(p_281525_, list, true);
}
protected void drawSystemInformation(GuiGraphics p_281261_) {
List<String> list = this.getSystemInformation();
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, false);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getDeltaTracker().getRealtimeDeltaTicks(), list, false);
this.renderLines(p_281261_, list, false);
}
@@ -529,6 +_,7 @@
@@ -543,6 +_,7 @@
list.add("");
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
list.add(String.valueOf(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));

View file

@ -1,10 +0,0 @@
--- a/net/minecraft/client/gui/components/toasts/ToastComponent.java
+++ b/net/minecraft/client/gui/components/toasts/ToastComponent.java
@@ -97,6 +_,7 @@
}
public void addToast(Toast p_94923_) {
+ if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return;
this.queued.add(p_94923_);
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
@@ -107,6 +_,7 @@
}
public void addToast(Toast p_360768_) {
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onToastAdd(p_360768_)) return;
this.queued.add(p_360768_);
}

View file

@ -1,6 +1,30 @@
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
@@ -131,6 +_,7 @@
@@ -62,6 +_,8 @@
return p_169325_ & 16777215 | p_169326_ << 24;
}
+ protected boolean renderContents(GuiGraphics gui, float alpha) { return true; }
+
@Override
public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) {
int i = p_281839_.guiWidth();
@@ -100,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;
@@ -115,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));
}
+ }
if (f >= 2.0F) {
this.minecraft.setOverlay(null);
}
if (this.fadeOutStart == -1L && this.reload.isDone() && (!this.fadeIn || f1 >= 2.0F)) {
@ -8,7 +32,7 @@
try {
this.reload.checkExceptions();
this.onFinish.accept(Optional.empty());
@@ -138,7 +_,6 @@
@@ -128,7 +_,6 @@
this.onFinish.accept(Optional.of(throwable));
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -94,6 +_,7 @@
@@ -95,6 +_,7 @@
} else {
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -201,7 +_,7 @@
@@ -200,7 +_,7 @@
}
public void onClose() {
@ -9,7 +9,7 @@
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
@@ -312,8 +_,10 @@
@@ -311,8 +_,10 @@
this.width = p_96608_;
this.height = p_96609_;
if (!this.initialized) {
@ -20,7 +20,7 @@
} else {
this.repositionElements();
}
@@ -326,8 +_,10 @@
@@ -325,8 +_,10 @@
protected void rebuildWidgets() {
this.clearWidgets();
this.clearFocus();
@ -31,15 +31,15 @@
}
@Override
@@ -354,6 +_,7 @@
@@ -353,6 +_,7 @@
this.renderBlurredBackground(p_297268_);
this.renderBlurredBackground();
this.renderMenuBackground(p_283688_);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderScreenBackground(this, p_283688_);
}
protected void renderBlurredBackground(float p_336041_) {
@@ -463,6 +_,19 @@
protected void renderBlurredBackground() {
@@ -454,6 +_,19 @@
}
public void onFilesDrop(List<Path> p_96591_) {

View file

@ -14,26 +14,26 @@
int l = this.height / 4 + 48;
+ Button modButton = null;
if (this.minecraft.isDemo()) {
this.createDemoMenuOptions(l, 24);
l = this.createDemoMenuOptions(l, 24);
} else {
this.createNormalMenuOptions(l, 24);
l = this.createNormalMenuOptions(l, 24);
+ modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this)))
+ .pos(this.width / 2 - 100, l + 24 * 2).size(98, 20).build());
+ .pos(this.width / 2 - 100, l).size(98, 20).build());
}
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
l = this.createTestWorldButton(l, 24);
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
CommonButtons.language(
@@ -170,7 +_,7 @@
}).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build()).active = flag;
@@ -184,7 +_,7 @@
}).bounds(this.width / 2 - 100, i = p_96764_ + p_96765_, 200, 20).tooltip(tooltip).build()).active = flag;
this.addRenderableWidget(
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
- .bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20)
+ .bounds(this.width / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20)
- .bounds(this.width / 2 - 100, p_96764_ = i + p_96765_, 200, 20)
+ .bounds(this.width / 2 + 2, p_96764_ = i + p_96765_, 98, 20)
.tooltip(tooltip)
.build()
)
@@ -276,6 +_,7 @@
@@ -293,6 +_,7 @@
if ((i & -67108864) != 0) {
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
this.logoRenderer.renderLogo(p_282860_, this.width, f);
@ -41,7 +41,7 @@
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
this.splash.render(p_282860_, this.width, this.font, i);
}
@@ -291,11 +_,19 @@
@@ -308,10 +_,18 @@
s = s + I18n.get("menu.modded");
}
@ -55,7 +55,6 @@
+ );
+
if (this.realmsNotificationsEnabled() && f >= 1.0F) {
RenderSystem.enableDepthTest();
this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_);
}
+ if (f >= 1.0f) this.modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -37,6 +_,7 @@
@@ -38,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_
@@ -53,6 +_,15 @@
@@ -54,6 +_,15 @@
this.addWidget(this.root, p_297568_.holder());
}
@ -24,7 +24,7 @@
public AdvancementTabType getType() {
return this.type;
}
@@ -146,8 +_,8 @@
@@ -147,8 +_,8 @@
return null;
} else {
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java
@@ -69,6 +_,7 @@
@@ -70,6 +_,7 @@
5
);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -49,6 +_,7 @@
@@ -51,6 +_,7 @@
@Nullable
private AdvancementTab selectedTab;
private boolean isScrolling;
@ -8,7 +8,7 @@
public AdvancementsScreen(ClientAdvancements p_97340_) {
this(p_97340_, null);
@@ -62,6 +_,19 @@
@@ -64,6 +_,19 @@
@Override
protected void init() {
@ -28,7 +28,7 @@
this.layout.addTitleHeader(TITLE, this.font);
this.tabs.clear();
this.selectedTab = null;
@@ -106,7 +_,7 @@
@@ -108,7 +_,7 @@
int j = (this.height - 140) / 2;
for (AdvancementTab advancementtab : this.tabs.values()) {
@ -37,8 +37,8 @@
this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
break;
}
@@ -180,10 +_,12 @@
p_283395_.blit(WINDOW_LOCATION, p_281890_, p_282532_, 0, 0, 252, 140);
@@ -181,10 +_,12 @@
p_283395_.blit(RenderType::guiTextured, WINDOW_LOCATION, p_281890_, p_282532_, 0.0F, 0.0F, 252, 140, 256, 256);
if (this.tabs.size() > 1) {
for (AdvancementTab advancementtab : this.tabs.values()) {
+ if (advancementtab.getPage() == tabPage)
@ -50,7 +50,7 @@
advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_);
}
}
@@ -203,6 +_,7 @@
@@ -202,6 +_,7 @@
if (this.tabs.size() > 1) {
for (AdvancementTab advancementtab : this.tabs.values()) {

View file

@ -1,49 +1,32 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -92,6 +_,7 @@
@@ -108,6 +_,7 @@
int i = this.leftPos;
int j = this.topPos;
super.render(p_283479_, p_283661_, p_281248_, p_281886_);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderBackground(this, p_283479_, p_283661_, p_281248_);
RenderSystem.disableDepthTest();
p_283479_.pose().pushPose();
p_283479_.pose().translate((float)i, (float)j, 0.0F);
@@ -108,12 +_,13 @@
int l = slot.x;
int i1 = slot.y;
if (this.hoveredSlot.isHighlightable()) {
- renderSlotHighlight(p_283479_, l, i1, 0);
+ renderSlotHighlight(p_283479_, l, i1, 0, getSlotColor(k));
}
}
Slot slot = this.hoveredSlot;
@@ -119,6 +_,8 @@
this.onStopHovering(slot);
}
this.renderLabels(p_283479_, p_283661_, p_281248_);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onContainerRenderForeground(this, p_283479_, p_283661_, p_281248_);
+
this.renderLabels(p_283479_, p_283661_, p_281248_);
ItemStack itemstack = this.draggingItem.isEmpty() ? this.menu.getCarried() : this.draggingItem;
if (!itemstack.isEmpty()) {
int l1 = 8;
@@ -156,13 +_,17 @@
}
public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_) {
- p_283692_.fillGradient(RenderType.guiOverlay(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, -2130706433, -2130706433, p_283504_);
+ renderSlotHighlight(p_283692_, p_281453_, p_281915_, p_283504_, -2130706433);
+ }
+
+ public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_, int color) {
+ p_283692_.fillGradient(RenderType.guiOverlay(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, color, color, p_283504_);
}
protected void renderTooltip(GuiGraphics p_283594_, int p_282171_, int p_281909_) {
if (this.menu.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
@@ -199,7 +_,7 @@
ItemStack itemstack = this.hoveredSlot.getItem();
- p_283594_.renderTooltip(this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), p_282171_, p_281909_);
+ p_283594_.renderTooltip(this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), itemstack, p_282171_, p_281909_);
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemstack)) {
p_283594_.renderTooltip(
- this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), p_282171_, p_281909_, itemstack.get(DataComponents.TOOLTIP_STYLE)
+ this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), itemstack, p_282171_, p_281909_
);
}
}
}
@@ -174,7 +_,8 @@
@@ -217,7 +_,8 @@
p_282567_.pose().pushPose();
p_282567_.pose().translate(0.0F, 0.0F, 232.0F);
p_282567_.renderItem(p_281330_, p_281772_, p_281689_);
@ -53,17 +36,17 @@
p_282567_.pose().popPose();
}
@@ -282,7 +_,8 @@
@@ -324,7 +_,8 @@
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();
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(p_97750_);
+ boolean flag = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey);
Slot slot = this.findSlot(p_97748_, p_97749_);
Slot slot = this.getHoveredSlot(p_97748_, p_97749_);
long i = Util.getMillis();
this.doubleclick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == p_97750_;
@@ -293,6 +_,7 @@
@@ -335,6 +_,7 @@
int j = this.leftPos;
int k = this.topPos;
boolean flag1 = this.hasClickedOutside(p_97748_, p_97749_, j, k, p_97750_);
@ -71,7 +54,7 @@
int l = -1;
if (slot != null) {
l = slot.index;
@@ -318,7 +_,7 @@
@@ -360,7 +_,7 @@
}
} else if (!this.isQuickCrafting) {
if (this.menu.getCarried().isEmpty()) {
@ -80,7 +63,7 @@
this.slotClicked(slot, l, p_97750_, ClickType.CLONE);
} else {
boolean flag2 = l != -999
@@ -346,7 +_,7 @@
@@ -388,7 +_,7 @@
this.quickCraftingType = 0;
} else if (p_97750_ == 1) {
this.quickCraftingType = 1;
@ -89,12 +72,12 @@
this.quickCraftingType = 2;
}
}
@@ -425,10 +_,13 @@
@@ -467,10 +_,13 @@
@Override
public boolean mouseReleased(double p_97812_, double p_97813_, int p_97814_) {
+ super.mouseReleased(p_97812_, p_97813_, p_97814_); //Forge, Call parent to release buttons
Slot slot = this.findSlot(p_97812_, p_97813_);
Slot slot = this.getHoveredSlot(p_97812_, p_97813_);
int i = this.leftPos;
int j = this.topPos;
boolean flag = this.hasClickedOutside(p_97812_, p_97813_, i, j, p_97814_);
@ -103,7 +86,7 @@
int k = -1;
if (slot != null) {
k = slot.index;
@@ -445,7 +_,7 @@
@@ -487,7 +_,7 @@
if (slot2 != null
&& slot2.mayPickup(this.minecraft.player)
&& slot2.hasItem()
@ -112,7 +95,7 @@
&& AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
this.slotClicked(slot2, slot2.index, p_97814_, ClickType.QUICK_MOVE);
}
@@ -509,7 +_,7 @@
@@ -551,7 +_,7 @@
this.slotClicked(null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT);
} else if (!this.menu.getCarried().isEmpty()) {
@ -121,7 +104,7 @@
this.slotClicked(slot, k, p_97814_, ClickType.CLONE);
} else {
boolean flag1 = k != -999
@@ -568,9 +_,10 @@
@@ -631,9 +_,10 @@
@Override
public boolean keyPressed(int p_97765_, int p_97766_, int p_97767_) {
@ -133,11 +116,10 @@
this.onClose();
return true;
} else {
@@ -639,5 +_,17 @@
public void onClose() {
this.minecraft.player.closeContainer();
@@ -707,4 +_,11 @@
super.onClose();
+ }
}
+
+ @org.jetbrains.annotations.Nullable
+ public Slot getSlotUnderMouse() { return this.hoveredSlot; }
@ -145,9 +127,4 @@
+ public int getGuiTop() { return topPos; }
+ public int getXSize() { return imageWidth; }
+ public int getYSize() { return imageHeight; }
+
+ protected int slotColor = -2130706433;
+ public int getSlotColor(int index) {
+ return slotColor;
}
}

View file

@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -112,6 +_,8 @@
private boolean hasClickedOutside;
@@ -115,6 +_,8 @@
private final Set<TagKey<Item>> visibleTags = new HashSet<>();
private final boolean displayOperatorCreativeTab;
private final EffectsInInventory effects;
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
@@ -159,7 +_,7 @@
@@ -163,7 +_,7 @@
private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
int i = this.menu.getRowIndexForScroll(this.scrollOffs);
this.menu.items.clear();
@ -18,7 +18,7 @@
this.refreshSearchResults();
} else {
this.menu.items.addAll(p_261591_);
@@ -322,6 +_,35 @@
@@ -331,6 +_,35 @@
protected void init() {
if (this.minecraft.gameMode.hasInfiniteItems()) {
super.init();
@ -54,7 +54,7 @@
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
this.searchBox.setMaxLength(50);
this.searchBox.setBordered(false);
@@ -368,7 +_,7 @@
@@ -377,7 +_,7 @@
public boolean charTyped(char p_98521_, int p_98522_) {
if (this.ignoreTextInput) {
return false;
@ -63,7 +63,7 @@
return false;
} else {
String s = this.searchBox.getValue();
@@ -387,7 +_,7 @@
@@ -396,7 +_,7 @@
@Override
public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
this.ignoreTextInput = false;
@ -72,7 +72,7 @@
if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
this.ignoreTextInput = true;
this.selectTab(CreativeModeTabs.searchTab());
@@ -423,6 +_,7 @@
@@ -432,6 +_,7 @@
}
private void refreshSearchResults() {
@ -80,7 +80,7 @@
this.menu.items.clear();
this.visibleTags.clear();
String s = this.searchBox.getValue();
@@ -435,10 +_,10 @@
@@ -444,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
@ -93,7 +93,7 @@
}
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
@@ -466,7 +_,8 @@
@@ -479,7 +_,8 @@
@Override
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
if (selectedTab.showTitle()) {
@ -103,7 +103,7 @@
}
}
@@ -476,7 +_,7 @@
@@ -489,7 +_,7 @@
double d0 = p_98531_ - (double)this.leftPos;
double d1 = p_98532_ - (double)this.topPos;
@ -112,7 +112,7 @@
if (this.checkTabClicked(creativemodetab, d0, d1)) {
return true;
}
@@ -498,7 +_,7 @@
@@ -511,7 +_,7 @@
double d1 = p_98623_ - (double)this.topPos;
this.scrolling = false;
@ -121,15 +121,7 @@
if (this.checkTabClicked(creativemodetab, d0, d1)) {
this.selectTab(creativemodetab);
return true;
@@ -516,6 +_,7 @@
private void selectTab(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = selectedTab;
selectedTab = p_98561_;
+ slotColor = p_98561_.getSlotColor();
this.quickCraftSlots.clear();
this.menu.items.clear();
this.clearDraggingState();
@@ -592,13 +_,15 @@
@@ -605,13 +_,15 @@
this.originalSlots = null;
}
@ -146,9 +138,9 @@
this.refreshSearchResults();
} else {
@@ -661,7 +_,15 @@
public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) {
@@ -677,7 +_,15 @@
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
this.effects.render(p_283000_, p_281317_, p_282770_, p_281295_);
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ if (this.pages.size() != 1) {
@ -163,7 +155,7 @@
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
break;
}
@@ -673,6 +_,7 @@
@@ -689,6 +_,7 @@
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
}
@ -171,7 +163,7 @@
this.renderTooltip(p_283000_, p_281317_, p_282770_);
}
@@ -680,7 +_,7 @@
@@ -701,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;
@ -180,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);
@@ -699,7 +_,7 @@
@@ -720,7 +_,7 @@
int i = 1;
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
@ -189,7 +181,7 @@
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
}
}
@@ -710,7 +_,7 @@
@@ -731,7 +_,7 @@
@Override
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
@ -198,15 +190,15 @@
if (creativemodetab != selectedTab) {
this.renderTabButton(p_282663_, creativemodetab);
}
@@ -726,6 +_,7 @@
p_282663_.blitSprite(resourcelocation, j, k + (int)((float)(i - k - 17) * this.scrollOffs), 12, 15);
@@ -747,6 +_,7 @@
p_282663_.blitSprite(RenderType::guiTextured, resourcelocation, j, k + (int)((float)(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(
@@ -744,7 +_,7 @@
@@ -765,7 +_,7 @@
}
private int getTabX(CreativeModeTab p_260136_) {
@ -215,7 +207,7 @@
int j = 27;
int k = 27 * i;
if (p_260136_.isAlignedRight()) {
@@ -756,7 +_,7 @@
@@ -777,7 +_,7 @@
private int getTabY(CreativeModeTab p_260181_) {
int i = 0;
@ -224,7 +216,7 @@
i -= 32;
} else {
i += this.imageHeight;
@@ -784,8 +_,8 @@
@@ -805,8 +_,8 @@
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
boolean flag = p_283489_ == selectedTab;
@ -235,15 +227,15 @@
int j = this.leftPos + this.getTabX(p_283489_);
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
ResourceLocation[] aresourcelocation;
@@ -795,6 +_,7 @@
@@ -816,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.
p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
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);
@@ -836,6 +_,14 @@
@@ -857,6 +_,14 @@
}
}
@ -258,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_) {
@@ -1020,6 +_,22 @@
@@ -1038,6 +_,22 @@
@Override
public boolean mayPickup(Player p_98665_) {
return this.target.mayPickup(p_98665_);

View file

@ -1,10 +1,10 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
@@ -47,12 +_,16 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
@@ -48,12 +_,16 @@
Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
if (!collection.isEmpty() && j >= 32) {
boolean flag = j >= 120;
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i);
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, !flag, i);
+ if (event.isCanceled()) return;
+ flag = !event.isCompact();
+ i = event.getHorizontalOffset();
@ -15,30 +15,40 @@
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList();
this.renderBackgrounds(p_281945_, i, k, iterable, flag);
this.renderIcons(p_281945_, i, k, iterable, flag);
this.renderBackgrounds(p_362146_, i, k, iterable, flag);
this.renderIcons(p_362146_, i, k, iterable, flag);
if (flag) {
@@ -98,6 +_,11 @@
int i = this.topPos;
@@ -99,6 +_,11 @@
int i = this.screen.topPos;
for (MobEffectInstance mobeffectinstance : p_282642_) {
for (MobEffectInstance mobeffectinstance : p_361981_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_282745_, p_282521_ + (p_281536_ ? 6 : 7), i, 0)) {
+ i += p_282291_;
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_367085_, p_367644_ + (p_368681_ ? 6 : 7), i, 0)) {
+ i += p_367522_;
+ continue;
+ }
Holder<MobEffect> holder = mobeffectinstance.getEffect();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
p_282745_.blit(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite);
@@ -109,6 +_,11 @@
int i = this.topPos;
p_367085_.blitSprite(RenderType::guiTextured, textureatlassprite, p_367644_ + (p_368681_ ? 6 : 7), i + 7, 18, 18);
@@ -110,6 +_,11 @@
int i = this.screen.topPos;
for (MobEffectInstance mobeffectinstance : p_281986_) {
for (MobEffectInstance mobeffectinstance : p_365480_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_281462_, p_283484_, i, 0)) {
+ i += p_282057_;
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_361851_, p_367468_, i, 0)) {
+ i += p_365556_;
+ continue;
+ }
Component component = this.getEffectName(mobeffectinstance);
p_281462_.drawString(this.font, component, p_283484_ + 10 + 18, i + 6, 16777215);
p_361851_.drawString(this.screen.getFont(), component, p_367468_ + 10 + 18, i + 6, 16777215);
Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate());
@@ -125,5 +_,9 @@
}
return mutablecomponent;
+ }
+
+ public AbstractContainerScreen<?> getScreen() {
+ return this.screen;
}
}

View file

@ -1,18 +1,18 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -111,7 +_,7 @@
@@ -109,7 +_,7 @@
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{
RenderSystem.enableBlend();
p_282430_.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
p_282430_.blitSprite(DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
@@ -177,13 +_,16 @@
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);
@@ -175,13 +_,16 @@
.registryAccess()
.registryOrThrow(Registries.ENCHANTMENT)
.getHolder(this.menu.enchantClue[j]);
.lookupOrThrow(Registries.ENCHANTMENT)
.get(this.menu.enchantClue[j]);
- if (!optional.isEmpty()) {
+ {
int l = this.menu.levelClue[j];

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
@@ -15,7 +_,7 @@
@@ -16,7 +_,7 @@
private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
private static final int TEXTURE_WIDTH = 16;
private static final int TEXTURE_HEIGHT = 16;

View file

@ -1,16 +1,17 @@
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
@@ -234,7 +_,12 @@
p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_, p_283601_);
@@ -232,6 +_,14 @@
} else {
p_281357_.renderItemDecorations(this.font, p_282046_, p_282403_, p_283601_, p_282046_.getCount() == 1 ? "1" : null);
- p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null);
p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null);
+ /*
+ // Forge: fixes Forge-8806, code for count rendering taken from GuiGraphics#renderGuiItemDecorations
+ p_281357_.pose().pushPose();
+ p_281357_.pose().translate(0.0F, 0.0F, 200.0F);
+ String count = p_283466_.getCount() == 1 ? "1" : String.valueOf(p_283466_.getCount());
+ font.drawInBatch(count, (float) (p_282403_ + 14) + 19 - 2 - font.width(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.pose().last().pose(), p_281357_.bufferSource(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
+ p_281357_.pose().popPose();
+ */
p_281357_.pose().pushPose();
p_281357_.pose().translate(0.0F, 0.0F, 300.0F);
p_281357_.blitSprite(DISCOUNT_STRIKETHRUOGH_SPRITE, p_282403_ + 7, p_283601_ + 12, 0, 9, 2);
p_281357_.blitSprite(RenderType::guiTextured, DISCOUNT_STRIKETHRUOGH_SPRITE, p_282403_ + 7, p_283601_ + 12, 9, 2);

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
@@ -22,6 +_,8 @@
} else if (p_169951_ instanceof ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip) {
return new ClientActivePlayersTooltip(clientactiveplayerstooltip$activeplayerstooltip);
} else {
+ ClientTooltipComponent result = net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
+ if (result != null) return result;
throw new IllegalArgumentException("Unknown TooltipComponent");
}
@@ -25,7 +_,7 @@
case ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip -> new ClientActivePlayersTooltip(
clientactiveplayerstooltip$activeplayerstooltip
);
- default -> throw new IllegalArgumentException("Unknown TooltipComponent");
+ default -> net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
});
}

View file

@ -1,40 +0,0 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
@@ -17,16 +_,21 @@
private static final int BORDER_COLOR_BOTTOM = 1344798847;
public static void renderTooltipBackground(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_) {
+ renderTooltipBackground(p_282666_, p_281901_, p_281846_, p_281559_, p_283336_, p_283422_, BACKGROUND_COLOR, BACKGROUND_COLOR, BORDER_COLOR_TOP, BORDER_COLOR_BOTTOM);
+ }
+
+ // Forge: Allow specifying colors for the inner border gradient and a gradient instead of a single color for the background and outer border
+ public static void renderTooltipBackground(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_, int backgroundTop, int backgroundBottom, int borderTop, int borderBottom) {
int i = p_281901_ - 3;
int j = p_281846_ - 3;
int k = p_281559_ + 3 + 3;
int l = p_283336_ + 3 + 3;
- renderHorizontalLine(p_282666_, i, j - 1, k, p_283422_, -267386864);
- renderHorizontalLine(p_282666_, i, j + l, k, p_283422_, -267386864);
- renderRectangle(p_282666_, i, j, k, l, p_283422_, -267386864);
- renderVerticalLine(p_282666_, i - 1, j, l, p_283422_, -267386864);
- renderVerticalLine(p_282666_, i + k, j, l, p_283422_, -267386864);
- renderFrameGradient(p_282666_, i, j + 1, k, l, p_283422_, 1347420415, 1344798847);
+ renderHorizontalLine(p_282666_, i, j - 1, k, p_283422_, backgroundTop);
+ renderHorizontalLine(p_282666_, i, j + l, k, p_283422_, backgroundBottom);
+ renderRectangleGradient(p_282666_, i, j, k, l, p_283422_, backgroundTop, backgroundBottom);
+ renderVerticalLineGradient(p_282666_, i - 1, j, l, p_283422_, backgroundTop, backgroundBottom);
+ renderVerticalLineGradient(p_282666_, i + k, j, l, p_283422_, backgroundTop, backgroundBottom);
+ renderFrameGradient(p_282666_, i, j + 1, k, l, p_283422_, borderTop, borderBottom);
}
private static void renderFrameGradient(
@@ -52,5 +_,9 @@
private static void renderRectangle(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_) {
p_281392_.fill(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_);
+ }
+
+ private static void renderRectangleGradient(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_, int colorTo) {
+ p_281392_.fillGradient(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_, colorTo);
}
}

View file

@ -24,14 +24,15 @@
.createNarration(
p_342179_ -> p_343088_.isUnbound()
? Component.translatable("narrator.controls.unbound", p_343976_)
@@ -163,6 +_,7 @@
@@ -163,7 +_,7 @@
)
.build();
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_343650_ -> {
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_357685_ -> {
- p_343088_.setKey(p_343088_.getDefaultKey());
+ this.key.setToDefault();
KeyBindsList.this.minecraft.options.setKey(p_343088_, p_343088_.getDefaultKey());
KeyBindsList.this.resetMappingAndUpdateButtons();
}).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build();
this.refreshEntry();
@@ -215,7 +_,7 @@
MutableComponent mutablecomponent = Component.empty();
if (!this.key.isUnbound()) {

View file

@ -9,15 +9,15 @@
}
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -73,11 +_,14 @@
@@ -73,11 +_,12 @@
public boolean keyPressed(int p_342715_, int p_342862_, int p_345515_) {
if (this.selectedKey != null) {
if (p_342715_ == 256) {
- this.selectedKey.setKey(InputConstants.UNKNOWN);
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
} else {
- this.selectedKey.setKey(InputConstants.getKey(p_342715_, p_342862_));
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_342715_, p_342862_));
this.options.setKey(this.selectedKey, InputConstants.getKey(p_342715_, p_342862_));
}
+ if (p_342715_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))

View file

@ -6,6 +6,6 @@
p_100014_.setSelected(null);
- p_100015_.forEach(
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
p_340813_ -> {
p_357689_ -> {
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
this.minecraft, p_100014_, p_340813_
this.minecraft, p_100014_, p_357689_

View file

@ -1,20 +0,0 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -115,7 +_,7 @@
this.initFilterButtonTextures();
this.tabButtons.clear();
- for (RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) {
+ for (RecipeBookCategories recipebookcategories : this.menu.getRecipeBookCategories()) {
this.tabButtons.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -293,7 +_,7 @@
}
if (itemstack != null && this.minecraft.screen != null) {
- p_282776_.renderComponentTooltip(this.minecraft.font, Screen.getTooltipFromItem(this.minecraft, itemstack), p_282948_, p_283050_);
+ p_282776_.renderComponentTooltip(this.minecraft.font, Screen.getTooltipFromItem(this.minecraft, itemstack), p_282948_, p_283050_, itemstack);
}
}

View file

@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -118,6 +_,7 @@
public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) {
queueLoadScreen(p_232897_, PREPARING_WORLD_DATA);
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator()));
@@ -169,6 +_,7 @@
) {
queueLoadScreen(p_369292_, PREPARING_WORLD_DATA);
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_369292_.directoryValidator()));
+ net.minecraftforge.event.ForgeEventFactory.addPackFindersServer(packrepository::addPackFinder);
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT);
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
worldloader$initconfig,
@@ -415,7 +_,7 @@
@@ -479,7 +_,7 @@
if (p_269627_) {
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
} else {
@ -17,7 +17,7 @@
}
},
Component.translatable("dataPack.validation.failed"),
@@ -533,6 +_,7 @@
@@ -593,6 +_,7 @@
if (path != null) {
if (this.tempDataPackRepository == null) {
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);

View file

@ -1,11 +1,15 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
@@ -62,6 +_,10 @@
@@ -75,6 +_,14 @@
);
}
+ public WorldCreationContext withDataConfiguration(WorldDataConfiguration dataConfiguration) {
+ return new WorldCreationContext(this.options, this.datapackDimensions, this.selectedDimensions, this.worldgenRegistries, this.dataPackResources, dataConfiguration);
+ return new WorldCreationContext(this.options, this.datapackDimensions, this.selectedDimensions, this.worldgenRegistries, this.dataPackResources, dataConfiguration, this.initialWorldCreationOptions);
+ }
+
+ public WorldCreationContext withInitalOptions(InitialWorldCreationOptions initialWorldCreationOptions) {
+ return new WorldCreationContext(this.options, this.datapackDimensions, this.selectedDimensions, this.worldgenRegistries, this.dataPackResources, this.dataConfiguration, initialWorldCreationOptions);
+ }
+
public RegistryAccess.Frozen worldgenLoadContext() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -225,7 +_,7 @@
@@ -234,7 +_,7 @@
@Nullable
public PresetEditor getPresetEditor() {
Holder<WorldPreset> holder = this.getWorldType().preset();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -321,6 +_,8 @@
@@ -329,6 +_,8 @@
this.minecraft.forceSetScreen(new GenericMessageScreen(Component.translatable("selectWorld.resource_load")));
PackRepository packrepository = ServerPacksSource.createPackRepository(p_333651_);

View file

@ -8,16 +8,16 @@
static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
@@ -402,6 +_,7 @@
RenderSystem.enableBlend();
p_281612_.blit(this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
RenderSystem.disableBlend();
@@ -400,6 +_,7 @@
p_281612_.drawString(this.minecraft.font, s1, p_282820_ + 32 + 3, p_283181_ + 9 + 3, -8355712, false);
p_281612_.drawString(this.minecraft.font, component, p_282820_ + 32 + 3, p_283181_ + 9 + 9 + 3, -8355712, false);
p_281612_.blit(RenderType::guiTextured, this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
+ renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_);
if (this.minecraft.options.touchscreen().get() || p_283396_) {
p_281612_.fill(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544);
int j = p_283204_ - p_282820_;
@@ -448,6 +_,19 @@
p_281612_.blitSprite(resourcelocation, p_282820_, p_283181_, 32, 32);
@@ -446,6 +_,19 @@
p_281612_.blitSprite(RenderType::guiTextured, resourcelocation, p_282820_, p_283181_, 32, 32);
}
}
+ }
@ -26,7 +26,7 @@
+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) {
+ if (this.summary.isLifecycleExperimental()) {
+ int leftStart = left + WorldSelectionList.this.getRowWidth();
+ guiGraphics.blit(WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
+ guiGraphics.blit(RenderType::guiTextured, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
+ if (WorldSelectionList.this.getEntryAtPosition(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
+ var font = Minecraft.getInstance().font;
+ List<net.minecraft.util.FormattedCharSequence> tooltip = font.split(Component.translatable("forge.experimentalsettings.tooltip"), 200);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -111,8 +_,8 @@
@@ -120,8 +_,8 @@
CrashReport.preload();
logger = LogUtils.getLogger();
s1 = "Bootstrap";
@ -9,4 +9,4 @@
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(Bootstrap::bootStrap, net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.validate();
s1 = "Argument parsing";
List<String> list = optionset.valuesOf(optionspec27);
List<String> list = optionset.valuesOf(optionspec29);

View file

@ -1,24 +1,24 @@
--- a/net/minecraft/client/model/HumanoidModel.java
+++ b/net/minecraft/client/model/HumanoidModel.java
@@ -308,6 +_,8 @@
@@ -259,6 +_,8 @@
case BRUSH:
this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) (Math.PI / 5);
this.rightArm.yRot = 0.0F;
+ default:
+ this.rightArmPose.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT);
+ p_366231_.applyTransform(this, p_362371_, net.minecraft.world.entity.HumanoidArm.RIGHT);
}
}
@@ -352,6 +_,8 @@
@@ -303,6 +_,8 @@
case BRUSH:
this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) (Math.PI / 5);
this.leftArm.yRot = 0.0F;
+ default:
+ this.leftArmPose.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT);
+ p_370002_.applyTransform(this, p_363560_, net.minecraft.world.entity.HumanoidArm.LEFT);
}
}
@@ -451,7 +_,7 @@
@@ -381,7 +_,7 @@
}
@OnlyIn(Dist.CLIENT)
@ -27,7 +27,7 @@
EMPTY(false),
ITEM(false),
BLOCK(false),
@@ -467,10 +_,28 @@
@@ -397,10 +_,28 @@
private ArmPose(final boolean p_102896_) {
this.twoHanded = p_102896_;
@ -51,8 +51,8 @@
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ public <T extends LivingEntity> void applyTransform(HumanoidModel<T> model, T entity, net.minecraft.world.entity.HumanoidArm arm) {
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, entity, arm);
+ public <T extends HumanoidRenderState> void applyTransform(HumanoidModel<T> model, T state, net.minecraft.world.entity.HumanoidArm arm) {
+ if (this.forgeArmPose != null) this.forgeArmPose.applyTransform(model, state, arm);
}
}
}

View file

@ -1,9 +1,9 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -329,6 +_,7 @@
WoodType.values().forEach(p_171114_ -> builder.put(ModelLayers.createSignModelName(p_171114_), layerdefinition23));
LayerDefinition layerdefinition24 = HangingSignRenderer.createHangingSignLayer();
WoodType.values().forEach(p_247864_ -> builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24));
@@ -449,6 +_,7 @@
builder.put(ModelLayers.createWallSignModelName(p_357774_), layerdefinition54);
builder.put(ModelLayers.createHangingSignModelName(p_357774_), layerdefinition55);
});
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
ImmutableMap<ModelLayerLocation, LayerDefinition> immutablemap = builder.build();
List<ModelLayerLocation> list = ModelLayers.getKnownLocations().filter(p_171117_ -> !immutablemap.containsKey(p_171117_)).collect(Collectors.toList());

View file

@ -1,12 +1,18 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -229,11 +_,13 @@
@@ -301,15 +_,18 @@
}
public static ModelLayerLocation createSignModelName(WoodType p_171292_) {
- return createLocation("sign/" + p_171292_.name(), "main");
public static ModelLayerLocation createStandingSignModelName(WoodType p_171292_) {
- return createLocation("sign/standing/" + p_171292_.name(), "main");
+ ResourceLocation location = ResourceLocation.parse(p_171292_.name());
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/" + location.getPath()), "main");
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/standing/" + location.getPath()), "main");
}
public static ModelLayerLocation createWallSignModelName(WoodType p_363532_) {
- return createLocation("sign/wall/" + p_363532_.name(), "main");
+ ResourceLocation location = ResourceLocation.parse(p_363532_.name());
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/wall/" + location.getPath()), "main");
}
public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_) {

View file

@ -1,14 +1,14 @@
--- a/net/minecraft/client/multiplayer/ClientChunkCache.java
+++ b/net/minecraft/client/multiplayer/ClientChunkCache.java
@@ -61,6 +_,7 @@
@@ -63,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)) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk));
this.storage.replace(i, levelchunk, null);
this.storage.drop(i, levelchunk);
}
}
@@ -121,6 +_,7 @@
@@ -123,6 +_,7 @@
}
this.level.onChunkLoaded(chunkpos);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
@@ -149,6 +_,7 @@
@@ -142,6 +_,7 @@
@Override
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
@@ -143,6 +_,7 @@
@@ -142,6 +_,7 @@
);
this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE);
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -210,6 +_,7 @@
@@ -209,6 +_,7 @@
Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
if (this.serverData != null && this.serverData.isRealm()) {
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_342266_.reason()));
@ -8,7 +8,7 @@
} else {
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
}
@@ -234,6 +_,7 @@
@@ -233,6 +_,7 @@
@Override
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -113,12 +_,15 @@
@@ -118,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)));
@ -8,16 +8,17 @@
});
private final ClientChunkCache chunkSource;
private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
private int serverSimulationDistance;
private final BlockStatePredictionHandler blockStatePredictionHandler = new BlockStatePredictionHandler();
@@ -126,6 +_,8 @@
private final int seaLevel;
private boolean tickDayTime;
private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
+ private final net.minecraftforge.client.model.data.ModelDataManager modelDataManager = new net.minecraftforge.client.model.data.ModelDataManager(this);
public void handleBlockChangedAck(int p_233652_) {
this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this);
@@ -183,6 +_,8 @@
this.serverSimulationDistance = p_205510_;
@@ -192,6 +_,8 @@
this.serverSimulationDistance = p_364305_;
this.updateSkyBrightness();
this.prepareWeather();
+ this.gatherCapabilities();
@ -25,15 +26,15 @@
}
public void queueLightUpdate(Runnable p_194172_) {
@@ -273,6 +_,7 @@
@@ -274,6 +_,7 @@
p_104640_.setOldPosAndRot();
p_104640_.tickCount++;
this.getProfiler().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString());
Profiler.get().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString());
+ if (p_104640_.canUpdate())
p_104640_.tick();
this.getProfiler().pop();
Profiler.get().pop();
@@ -321,8 +_,10 @@
@@ -326,8 +_,10 @@
}
public void addEntity(Entity p_104741_) {
@ -44,7 +45,7 @@
}
public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -493,6 +_,12 @@
@@ -498,6 +_,12 @@
float p_263349_,
long p_263408_
) {
@ -57,7 +58,7 @@
if (p_263381_ == this.minecraft.player) {
this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_);
}
@@ -502,6 +_,12 @@
@@ -507,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_
) {
@ -70,8 +71,8 @@
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_));
}
@@ -927,6 +_,24 @@
return this.connection.potionBrewing();
@@ -943,6 +_,24 @@
return this.seaLevel;
}
+ @Override
@ -95,7 +96,7 @@
@OnlyIn(Dist.CLIENT)
public static class ClientLevelData implements WritableLevelData {
private final boolean hardcore;
@@ -1022,6 +_,7 @@
@@ -1031,6 +_,7 @@
}
public void setDifficulty(Difficulty p_104852_) {
@ -103,7 +104,7 @@
this.difficulty = p_104852_;
}
@@ -1058,11 +_,26 @@
@@ -1067,11 +_,26 @@
if (p_171712_ instanceof AbstractClientPlayer) {
ClientLevel.this.players.add((AbstractClientPlayer)p_171712_);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -427,6 +_,7 @@
@@ -451,6 +_,7 @@
this.minecraft.debugRenderer.clear();
this.minecraft.player.resetPos();
@ -8,17 +8,16 @@
this.minecraft.player.setId(p_105030_.playerId());
this.level.addEntity(this.minecraft.player);
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
@@ -1164,7 +_,9 @@
@@ -1249,6 +_,8 @@
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
}
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
localplayer1.resetPos();
+ net.minecraftforge.client.event.ForgeEventFactoryClient.firePlayerRespawn(this.minecraft.gameMode, localplayer, localplayer1, localplayer1.connection.connection);
this.level.addEntity(localplayer1);
localplayer1.setYRot(-180.0F);
localplayer1.input = new KeyboardInput(this.minecraft.options);
@@ -1300,10 +_,7 @@
this.minecraft.gameMode.adjustPlayer(localplayer1);
@@ -1393,10 +_,7 @@
PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
BlockPos blockpos = p_104976_.getPos();
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_325478_ -> {
@ -30,7 +29,7 @@
if (p_325478_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.minecraft.screen).updateGui();
@@ -1465,7 +_,9 @@
@@ -1557,7 +_,9 @@
@Override
public void handleCommands(ClientboundCommandsPacket p_104990_) {
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
@ -41,24 +40,24 @@
}
@Override
@@ -1487,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook();
clientrecipebook.setupCollections(this.recipeManager.getOrderedRecipes(), this.minecraft.level.registryAccess());
this.searchTrees.updateRecipes(clientrecipebook, this.registryAccess);
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.recipeManager);
@@ -1658,6 +_,7 @@
if (this.minecraft.screen instanceof RecipeUpdateListener recipeupdatelistener) {
recipeupdatelistener.recipesUpdated();
}
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRecipesUpdated(p_364029_);
}
@Override
@@ -1585,6 +_,8 @@
tagcollector.updateTags(this.registryAccess, this.connection.isMemoryConnection());
List<ItemStack> list = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
this.searchTrees.updateCreativeTags(list);
@@ -1696,6 +_,8 @@
this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures);
List<ItemStack> list1 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
this.searchTrees.updateCreativeTags(list1);
+
+ net.minecraftforge.event.ForgeEventFactory.onTagsUpdated(this.registryAccess, true, this.connection.isMemoryConnection());
}
@Override
@@ -2389,6 +_,8 @@
@@ -2516,6 +_,8 @@
}
public void sendChat(String p_249888_) {
@ -67,7 +66,7 @@
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.getLong();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
@@ -2397,6 +_,7 @@
@@ -2524,6 +_,7 @@
}
public void sendCommand(String p_250092_) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
@@ -105,6 +_,7 @@
@@ -106,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 {
@@ -119,9 +_,8 @@
@@ -120,9 +_,8 @@
} else if (blockstate.isAir()) {
return false;
} else {
@ -19,7 +19,7 @@
if (flag) {
block.destroy(level, p_105268_, blockstate);
}
@@ -142,6 +_,7 @@
@@ -143,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_);
});
@@ -151,15 +_,18 @@
@@ -152,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 {
@@ -170,6 +_,7 @@
@@ -171,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_);
});
@@ -202,6 +_,7 @@
@@ -203,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_);
});
@@ -214,7 +_,7 @@
@@ -215,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(
@@ -231,6 +_,7 @@
@@ -232,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_ -> {
@@ -269,7 +_,7 @@
@@ -270,7 +_,7 @@
private boolean sameDestroyTarget(BlockPos p_105282_) {
ItemStack itemstack = this.minecraft.player.getMainHandItem();
@ -88,7 +88,7 @@
}
private void ensureHasSentCarriedItem() {
@@ -297,12 +_,23 @@
@@ -298,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_);
@ -97,7 +97,7 @@
+ return event.getCancellationResult();
+ }
if (this.localPlayerMode == GameType.SPECTATOR) {
return InteractionResult.SUCCESS;
return InteractionResult.CONSUME;
} else {
- boolean flag = !p_233747_.getMainHandItem().isEmpty() || !p_233747_.getOffhandItem().isEmpty();
+ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
@ -114,20 +114,20 @@
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
return InteractionResult.FAIL;
@@ -323,8 +_,10 @@
@@ -324,8 +_,10 @@
}
}
- if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack.getItem())) {
- if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack)) {
- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ return InteractionResult.PASS;
+ }
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack.getItem()))) {
InteractionResult interactionresult1;
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack))) {
InteractionResult interactionresult2;
if (this.localPlayerMode.isCreative()) {
int i = itemstack.getCount();
@@ -358,10 +_,18 @@
@@ -359,6 +_,11 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
@ -136,8 +136,11 @@
+ mutableobject.setValue(event.getCancellationResult());
+ return serverbounduseitempacket;
+ }
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
ItemStack itemstack1 = interactionresultholder.getObject();
InteractionResult interactionresult = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
ItemStack itemstack1;
if (interactionresult instanceof InteractionResult.Success interactionresult$success) {
@@ -369,6 +_,9 @@
if (itemstack1 != itemstack) {
p_233722_.setItemInHand(p_233723_, itemstack1);
+ if (itemstack1.isEmpty()) {
@ -145,8 +148,8 @@
+ }
}
mutableobject.setValue(interactionresultholder.getResult());
@@ -393,6 +_,10 @@
mutableobject.setValue(interactionresult);
@@ -400,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_));
@ -154,10 +157,10 @@
+ var event = net.minecraftforge.event.ForgeEventFactory.onEntityInteract(p_105227_, p_105228_, p_105229_);
+ if (event.isCanceled()) return event.getCancellationResult();
+ }
return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_);
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_));
}
@@ -400,6 +_,10 @@
@@ -407,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));
@ -165,6 +168,6 @@
+ var event = net.minecraftforge.event.ForgeEventFactory.onEntityInteractSpecific(p_105231_, p_105232_, p_105234_, vec3);
+ if (event.isCanceled()) return event.getCancellationResult();
+ }
return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_);
return (InteractionResult)(this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_));
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
@@ -85,6 +_,7 @@
@@ -86,6 +_,7 @@
}
protected void setGameMode(GameType p_105318_) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/SessionSearchTrees.java
+++ b/net/minecraft/client/multiplayer/SessionSearchTrees.java
@@ -31,8 +_,8 @@
@@ -34,8 +_,8 @@
private static final SessionSearchTrees.Key RECIPE_COLLECTIONS = new SessionSearchTrees.Key();
public static final SessionSearchTrees.Key CREATIVE_NAMES = new SessionSearchTrees.Key();
public static final SessionSearchTrees.Key CREATIVE_TAGS = new SessionSearchTrees.Key();
@ -11,7 +11,7 @@
private CompletableFuture<SearchTree<RecipeCollection>> recipeSearch = CompletableFuture.completedFuture(SearchTree.empty());
private final Map<SessionSearchTrees.Key, Runnable> reloaders = new IdentityHashMap<>();
@@ -82,44 +_,52 @@
@@ -92,44 +_,52 @@
}
public void updateCreativeTags(List<ItemStack> p_344581_) {

View file

@ -1,12 +1,11 @@
--- a/net/minecraft/client/particle/BreakingItemParticle.java
+++ b/net/minecraft/client/particle/BreakingItemParticle.java
@@ -33,7 +_,8 @@
@@ -33,7 +_,7 @@
protected BreakingItemParticle(ClientLevel p_105665_, double p_105666_, double p_105667_, double p_105668_, ItemStack p_105669_) {
super(p_105665_, p_105666_, p_105667_, p_105668_, 0.0, 0.0, 0.0);
- this.setSprite(Minecraft.getInstance().getItemRenderer().getModel(p_105669_, p_105665_, null, 0).getParticleIcon());
+ var model = Minecraft.getInstance().getItemRenderer().getModel(p_105669_, p_105665_, null, 0);
+ this.setSprite(model.getOverrides().resolve(model, p_105669_, p_105665_, null, 0).getParticleIcon(net.minecraftforge.client.model.data.ModelData.EMPTY));
+ this.setSprite(Minecraft.getInstance().getItemRenderer().getModel(p_105669_, p_105665_, null, 0).getParticleIcon(net.minecraftforge.client.model.data.ModelData.EMPTY));
this.gravity = 1.0F;
this.quadSize /= 2.0F;
this.uo = this.random.nextFloat() * 3.0F;

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -77,11 +_,11 @@
ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_LIT, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, ParticleRenderType.CUSTOM
ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, ParticleRenderType.CUSTOM
);
protected ClientLevel level;
- private final Map<ParticleRenderType, Queue<Particle>> particles = Maps.newIdentityHashMap();
@ -14,8 +14,8 @@
private final Queue<Particle> particlesToAdd = Queues.newArrayDeque();
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> spriteSets = Maps.newHashMap();
private final TextureAtlas textureAtlas;
@@ -212,10 +_,14 @@
this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new);
@@ -214,10 +_,14 @@
this.register(ParticleTypes.BLOCK_CRUMBLE, new TerrainParticle.CrumblingProvider());
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
@ -30,7 +30,7 @@
public <T extends ParticleOptions> void register(ParticleType<T> p_273423_, ParticleProvider.Sprite<T> p_273134_) {
this.register(
p_273423_,
@@ -232,10 +_,12 @@
@@ -234,10 +_,12 @@
);
}
@ -44,7 +44,7 @@
}
@Override
@@ -361,7 +_,7 @@
@@ -357,7 +_,7 @@
private <T extends ParticleOptions> Particle makeParticle(
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
) {
@ -53,7 +53,7 @@
return particleprovider == null
? null
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
@@ -437,11 +_,19 @@
@@ -433,17 +_,26 @@
}
}
@ -61,7 +61,7 @@
+ /**@deprecated Forge: use {@link #render(LightTexture, Camera, float, net.minecraft.client.renderer.culling.Frustum)} with Frustum as additional parameter*/
+ @Deprecated
public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_) {
+ render(p_107339_, p_107340_, p_107341_);
+ render(p_107339_, p_107340_, p_107341_, null);
+ }
+
+ public void render(LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum frustum) {
@ -73,8 +73,7 @@
+ if (particlerendertype == ParticleRenderType.NO_RENDER) continue;
Queue<Particle> queue = this.particles.get(particlerendertype);
if (queue != null && !queue.isEmpty()) {
RenderSystem.setShader(GameRenderer::getParticleShader);
@@ -449,6 +_,7 @@
Tesselator tesselator = Tesselator.getInstance();
BufferBuilder bufferbuilder = particlerendertype.begin(tesselator, this.textureManager);
if (bufferbuilder != null) {
for (Particle particle : queue) {
@ -82,7 +81,7 @@
try {
particle.render(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -480,7 +_,7 @@
@@ -475,7 +_,7 @@
}
public void destroy(BlockPos p_107356_, BlockState p_107357_) {
@ -91,7 +90,7 @@
VoxelShape voxelshape = p_107357_.getShape(this.level, p_107356_);
double d0 = 0.25;
voxelshape.forAllBoxes(
@@ -513,6 +_,7 @@
@@ -508,6 +_,7 @@
p_107357_,
p_107356_
)
@ -99,7 +98,7 @@
);
}
}
@@ -522,6 +_,13 @@
@@ -517,6 +_,13 @@
}
}
@ -113,7 +112,7 @@
public void crack(BlockPos p_107368_, Direction p_107369_) {
BlockState blockstate = this.level.getBlockState(p_107368_);
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) {
@@ -557,7 +_,7 @@
@@ -552,7 +_,7 @@
d0 = (double)i + aabb.maxX + 0.1F;
}

View file

@ -25,4 +25,4 @@
+ }
@OnlyIn(Dist.CLIENT)
public static class DustPillarProvider implements ParticleProvider<BlockParticleOption> {
public static class CrumblingProvider implements ParticleProvider<BlockParticleOption> {

View file

@ -1,10 +1,10 @@
--- a/net/minecraft/client/player/AbstractClientPlayer.java
+++ b/net/minecraft/client/player/AbstractClientPlayer.java
@@ -96,6 +_,6 @@
@@ -91,6 +_,6 @@
}
}
- return Mth.lerp(Minecraft.getInstance().options.fovEffectScale().get().floatValue(), 1.0F, f);
+ return net.minecraftforge.client.ForgeHooksClient.getFieldOfViewModifier(this, f);
- return Mth.lerp(p_362521_, 1.0F, f);
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireFovModifierEvent(this, f, p_362521_).getNewFovModifier();
}
}

View file

@ -1,14 +1,6 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -161,6 +_,7 @@
@Override
public boolean hurt(DamageSource p_108662_, float p_108663_) {
+ net.minecraftforge.event.ForgeEventFactory.onLivingAttackEntity(this, p_108662_, p_108663_);
return false;
}
@@ -304,6 +_,7 @@
@@ -303,6 +_,7 @@
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
@ -16,7 +8,7 @@
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
return !itemstack.isEmpty();
@@ -501,7 +_,11 @@
@@ -488,7 +_,11 @@
@Override
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
@ -29,7 +21,7 @@
}
@Override
@@ -694,6 +_,7 @@
@@ -682,6 +_,7 @@
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
float f = (float)this.getAttributeValue(Attributes.SNEAKING_SPEED);
this.input.tick(this.isMovingSlowly(), f);
@ -37,7 +29,7 @@
this.minecraft.getTutorial().onInput(this.input);
if (this.isUsingItem() && !this.isPassenger()) {
this.input.leftImpulse *= 0.2F;
@@ -722,7 +_,7 @@
@@ -710,7 +_,7 @@
boolean flag4 = this.canStartSprinting();
boolean flag5 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround();
boolean flag6 = !flag1 && !flag2;
@ -46,7 +38,7 @@
if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) {
this.sprintTriggerTime = 7;
} else {
@@ -730,15 +_,15 @@
@@ -718,15 +_,15 @@
}
}
@ -60,39 +52,33 @@
- boolean flag8 = flag7 || this.horizontalCollision && !this.minorHorizontalCollision || this.isInWater() && !this.isUnderWater();
+ boolean flag8 = flag7 || this.horizontalCollision && !this.minorHorizontalCollision || this.isInWater() && !this.isUnderWater() || (this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)) && !this.canStartSwimming());
if (this.isSwimming()) {
- if (!this.onGround() && !this.input.shiftKeyDown && flag7 || !this.isInWater()) {
+ if (!this.onGround() && !this.input.shiftKeyDown && flag7 || !(this.isInWater() || this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)))) {
- if (!this.onGround() && !this.input.keyPresses.shift() && flag7 || !this.isInWater()) {
+ if (!this.onGround() && !this.input.keyPresses.shift() && flag7 || !(this.isInWater() || this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)))) {
this.setSprinting(false);
}
} else if (flag8) {
@@ -772,14 +_,15 @@
if (this.input.jumping && !flag9 && !flag && !abilities.flying && !this.isPassenger() && !this.onClimbable()) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
- if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack) && this.tryToStartFallFlying()) {
+ if (itemstack.canElytraFly(this) && this.tryToStartFallFlying()) {
this.connection.send(new ServerboundPlayerCommandPacket(this, ServerboundPlayerCommandPacket.Action.START_FALL_FLYING));
}
@@ -763,8 +_,9 @@
}
this.wasFallFlying = this.isFallFlying();
- if (this.isInWater() && this.input.shiftKeyDown && this.isAffectedByFluids()) {
- if (this.isInWater() && this.input.keyPresses.shift() && this.isAffectedByFluids()) {
- this.goDownInWater();
+ var fluidType = this.getMaxHeightFluidType();
+ if ((this.isInWater() || (!fluidType.isAir() && this.canSwimInFluidType(fluidType))) && this.input.shiftKeyDown && this.isAffectedByFluids()) {
+ if ((this.isInWater() || (!fluidType.isAir() && this.canSwimInFluidType(fluidType))) && this.input.keyPresses.shift() && this.isAffectedByFluids()) {
+ this.sinkInFluid(this.isInWater() ? net.minecraftforge.common.ForgeMod.WATER_TYPE.get() : fluidType);
}
if (this.isEyeInFluid(FluidTags.WATER)) {
@@ -885,6 +_,7 @@
@@ -870,6 +_,8 @@
@Override
public void rideTick() {
super.rideTick();
+ if (this.wantsToStopRiding() && this.isPassenger()) this.input.shiftKeyDown = false;
+ if (this.wantsToStopRiding() && this.isPassenger())
+ this.input.keyPresses = this.input.keyPresses.jump(false);
this.handsBusy = false;
if (this.getControlledVehicle() instanceof Boat boat) {
boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down);
@@ -1142,5 +_,17 @@
if (this.getControlledVehicle() instanceof AbstractBoat abstractboat) {
abstractboat.setInput(
@@ -1146,6 +_,18 @@
@Override
public float getVisualRotationYInDegrees() {
return this.getYRot();
@ -100,7 +86,7 @@
+
+ public void updateSyncFields(LocalPlayer old) {
+ this.xLast = old.xLast;
+ this.yLast1 = old.yLast1;
+ this.yLast = old.yLast;
+ this.zLast = old.zLast;
+ this.yRotLast = old.yRotLast;
+ this.xRotLast = old.xRotLast;
@ -109,4 +95,5 @@
+ this.wasSprinting = old.wasSprinting;
+ this.positionReminder = old.positionReminder;
}
}
@Override

View file

@ -1,10 +0,0 @@
--- a/net/minecraft/client/player/RemotePlayer.java
+++ b/net/minecraft/client/player/RemotePlayer.java
@@ -33,6 +_,7 @@
@Override
public boolean hurt(DamageSource p_108772_, float p_108773_) {
+ net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_108772_, p_108773_);
return true;
}

View file

@ -1,15 +1,6 @@
--- a/net/minecraft/client/renderer/DimensionSpecialEffects.java
+++ b/net/minecraft/client/renderer/DimensionSpecialEffects.java
@@ -13,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public abstract class DimensionSpecialEffects {
+public abstract class DimensionSpecialEffects implements net.minecraftforge.client.extensions.IForgeDimensionSpecialEffects {
private static final Object2ObjectMap<ResourceLocation, DimensionSpecialEffects> EFFECTS = Util.make(new Object2ObjectArrayMap<>(), p_108881_ -> {
DimensionSpecialEffects.OverworldEffects dimensionspecialeffects$overworldeffects = new DimensionSpecialEffects.OverworldEffects();
p_108881_.defaultReturnValue(dimensionspecialeffects$overworldeffects);
@@ -37,7 +_,7 @@
@@ -36,7 +_,7 @@
}
public static DimensionSpecialEffects forType(DimensionType p_108877_) {
@ -17,4 +8,4 @@
+ return net.minecraftforge.client.DimensionSpecialEffectsManager.getForType(p_108877_.effectsLocation());
}
@Nullable
public boolean isSunriseOrSunset(float p_361903_) {

View file

@ -1,20 +0,0 @@
--- a/net/minecraft/client/renderer/EffectInstance.java
+++ b/net/minecraft/client/renderer/EffectInstance.java
@@ -58,7 +_,7 @@
private final EffectProgram fragmentProgram;
public EffectInstance(ResourceProvider p_334130_, String p_108942_) throws IOException {
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_108942_ + ".json");
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_108942_).withPath(p -> "shaders/program/" + p + ".json");
this.name = p_108942_;
Resource resource = p_334130_.getResourceOrThrow(resourcelocation);
@@ -150,7 +_,7 @@
} else {
EffectProgram effectprogram;
if (program == null) {
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_172569_ + p_172568_.getExtension());
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_172569_).withPath(p -> "shaders/program/" + p + p_172568_.getExtension());
Resource resource = p_331503_.getResourceOrThrow(resourcelocation);
try (InputStream inputstream = resource.open()) {

View file

@ -1,23 +1,27 @@
--- a/net/minecraft/client/renderer/FogRenderer.java
+++ b/net/minecraft/client/renderer/FogRenderer.java
@@ -193,6 +_,12 @@
fogBlue = fogBlue * (1.0F - f7) + fogBlue * f9 * f7;
@@ -192,6 +_,12 @@
f2 = f2 * (1.0F - f10) + f2 * f12 * f10;
}
+ Vector3f fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(p_109019_, p_109020_, p_109021_, p_109022_, p_109023_, fogRed, fogGreen, fogBlue);
+ Vector3f fogColor = net.minecraftforge.client.ForgeHooksClient.getFogColor(p_362477_, p_364035_, p_361507_, p_361512_, p_367602_, f, f1, f2);
+
+ fogRed = fogColor.x();
+ fogGreen = fogColor.y();
+ fogBlue = fogColor.z();
+ f = fogColor.x();
+ f1 = fogColor.y();
+ f2 = fogColor.z();
+
RenderSystem.clearColor(fogRed, fogGreen, fogBlue, 0.0F);
return new Vector4f(f, f1, f2, 1.0F);
}
@@ -269,6 +_,7 @@
RenderSystem.setShaderFogStart(fogrenderer$fogdata.start);
RenderSystem.setShaderFogEnd(fogrenderer$fogdata.end);
RenderSystem.setShaderFogShape(fogrenderer$fogdata.shape);
+ net.minecraftforge.client.ForgeHooksClient.onFogRender(p_234174_, fogtype, p_234173_, p_234177_, p_234175_, fogrenderer$fogdata.start, fogrenderer$fogdata.end, fogrenderer$fogdata.shape);
@@ -270,9 +_,10 @@
fogrenderer$fogdata.shape = FogShape.CYLINDER;
}
- return new FogParameters(
+ var original = new FogParameters(
fogrenderer$fogdata.start, fogrenderer$fogdata.end, fogrenderer$fogdata.shape, p_365589_.x, p_365589_.y, p_365589_.z, p_365589_.w
);
+ return net.minecraftforge.client.ForgeHooksClient.getFogParameters(p_234174_, fogtype, p_234173_, p_234177_, p_234175_, original);
}
}
public static void levelFogColor() {

View file

@ -1,82 +1,68 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -311,6 +_,8 @@
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/spider.json"));
@@ -158,6 +_,10 @@
this.setPostEffect(ResourceLocation.withDefaultNamespace("spider"));
} else if (p_109107_ instanceof EnderMan) {
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/invert.json"));
+ } else {
+ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_109107_, this);
this.setPostEffect(ResourceLocation.withDefaultNamespace("invert"));
+ } else if (p_109107_ != null) {
+ var rl = net.minecraftforge.client.EntitySpectatorShaderManager.get(p_109107_.getType());
+ if (rl != null)
+ this.setPostEffect(rl);
}
}
@@ -350,8 +_,11 @@
public void processBlurEffect(float p_333718_) {
float f = (float)this.minecraft.options.getMenuBackgroundBlurriness();
if (this.blurEffect != null && f >= 1.0F) {
+ // FORGE: Blending the blur was removed in 1.21. This is necessary for screen layering to work properly. https://github.com/MinecraftForge/MinecraftForge/issues/10114
+ RenderSystem.enableBlend();
this.blurEffect.setUniform("Radius", f);
this.blurEffect.process(p_333718_);
+ RenderSystem.disableBlend();
@@ -171,8 +_,11 @@
if (!(f < 1.0F)) {
PostChain postchain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS);
if (postchain != null) {
+ // FORGE: Blending the blur was removed in 1.21. This is necessary for screen layering to work properly. https://github.com/MinecraftForge/MinecraftForge/issues/10114
+ RenderSystem.enableBlend();
postchain.setUniform("Radius", f);
postchain.process(this.minecraft.getMainRenderTarget(), this.resourcePool);
+ RenderSystem.disableBlend();
}
}
}
@@ -526,6 +_,7 @@
Pair.of(new ShaderInstance(p_250719_, "rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.POSITION_COLOR), p_286147_ -> rendertypeGuiGhostRecipeOverlayShader = p_286147_)
);
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_breeze_wind", DefaultVertexFormat.NEW_ENTITY), p_308287_ -> rendertypeBreezeWindShader = p_308287_));
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRegisterShaders(p_250719_, list1);
this.loadBlurEffect(p_250719_);
} catch (IOException ioexception) {
list1.forEach(p_172729_ -> p_172729_.getFirst().close());
@@ -685,7 +_,7 @@
d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F);
@@ -312,7 +_,7 @@
f *= Mth.lerp(f2, 1.0F, 0.85714287F);
}
- return d0;
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this, p_109142_, p_109143_, d0, p_109144_).getFOV();
- return f;
+ return net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeFov(this, p_109142_, p_109143_, f, p_109144_).getFOV();
}
}
@@ -843,12 +_,12 @@
@@ -468,12 +_,12 @@
(float)((double)window.getHeight() / window.getGuiScale()),
0.0F,
1000.0F,
- 21000.0F
+ net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane()
);
RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z);
RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.ORTHOGRAPHIC);
Matrix4fStack matrix4fstack = RenderSystem.getModelViewStack();
matrix4fstack.pushMatrix();
- matrix4fstack.translation(0.0F, 0.0F, -11000.0F);
+ matrix4fstack.translation(0.0F, 0.0F, 10000F - net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
@@ -882,7 +_,7 @@
if (flag && p_109096_ && this.minecraft.level != null) {
@@ -499,7 +_,7 @@
}
} else if (flag && this.minecraft.screen != null) {
try {
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, p_343467_.getGameTimeDeltaTicks());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
@@ -1053,12 +_,17 @@
@@ -655,6 +_,9 @@
if (this.minecraft.options.bobView().get()) {
this.bobView(posestack, camera.getPartialTickTime());
}
this.resetProjectionMatrix(matrix4f);
+
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, f);
+ camera.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
Quaternionf quaternionf = camera.rotation().conjugate(new Quaternionf());
Matrix4f matrix4f1 = new Matrix4f().rotation(quaternionf);
this.minecraft
.levelRenderer
.prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue())));
this.minecraft.levelRenderer.renderLevel(p_342230_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
+ this.minecraft.getProfiler().popPush("forge_render_last");
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL.dispatch(this.minecraft.levelRenderer, posestack.last().pose(), matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum());
this.minecraft.getProfiler().popPush("hand");
if (this.renderHand) {
RenderSystem.clear(256, Minecraft.ON_OSX);
matrix4f.mul(posestack.last().pose());
float f3 = this.minecraft.options.screenEffectScale().get().floatValue();

View file

@ -1,22 +1,22 @@
--- a/net/minecraft/client/renderer/ItemBlockRenderTypes.java
+++ b/net/minecraft/client/renderer/ItemBlockRenderTypes.java
@@ -20,6 +_,7 @@
@@ -18,6 +_,7 @@
@OnlyIn(Dist.CLIENT)
public class ItemBlockRenderTypes {
+ @Deprecated
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_340896_ -> {
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_357825_ -> {
RenderType rendertype = RenderType.tripwire();
p_340896_.put(Blocks.TRIPWIRE, rendertype);
@@ -335,6 +_,7 @@
p_340896_.put(Blocks.BUBBLE_COLUMN, rendertype3);
p_340896_.put(Blocks.TINTED_GLASS, rendertype3);
p_357825_.put(Blocks.TRIPWIRE, rendertype);
@@ -340,6 +_,7 @@
p_357825_.put(Blocks.BUBBLE_COLUMN, rendertype3);
p_357825_.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);
@@ -342,6 +_,8 @@
@@ -347,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) {
@@ -352,6 +_,8 @@
@@ -357,6 +_,8 @@
}
}
@ -34,27 +34,21 @@
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
Block block = p_109294_.getBlock();
if (block instanceof LeavesBlock) {
@@ -366,6 +_,8 @@
@@ -371,6 +_,8 @@
}
}
+ /** @deprecated Forge: Use {@link net.minecraftforge.client.RenderTypeHelper#getEntityRenderType(RenderType, boolean)} while iterating through {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
+ @Deprecated // Note: this method does NOT support model-based render types
public static RenderType getRenderType(BlockState p_109285_, boolean p_109286_) {
RenderType rendertype = getChunkRenderType(p_109285_);
if (rendertype == RenderType.translucent()) {
@@ -379,6 +_,8 @@
public static RenderType getRenderType(BlockState p_364446_) {
RenderType rendertype = getChunkRenderType(p_364446_);
return rendertype == RenderType.translucent() ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet();
@@ -385,12 +_,77 @@
}
}
+ /** @deprecated Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderPasses(ItemStack, boolean)} and {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(ItemStack, boolean)}. */
+ @Deprecated // Note: this method does NOT support model-based render types
public static RenderType getRenderType(ItemStack p_109280_, boolean p_109281_) {
Item item = p_109280_.getItem();
if (item instanceof BlockItem) {
@@ -390,11 +_,74 @@
}
public static RenderType getRenderLayer(FluidState p_109288_) {
- RenderType rendertype = TYPE_BY_FLUID.get(p_109288_.getType());
+ RenderType rendertype = FLUID_RENDER_TYPES.get(net.minecraftforge.registries.ForgeRegistries.FLUIDS.getDelegateOrThrow(p_109288_.getType()));
@ -81,7 +75,7 @@
+ });
+
+ /** @deprecated Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
+ @Deprecated(since = "1.19")
+ //@Deprecated(since = "1.19", forRemoval = true)
+ public static net.minecraftforge.client.ChunkRenderTypeSet getRenderLayers(BlockState state) {
+ Block block = state.getBlock();
+ if (block instanceof LeavesBlock) {
@ -92,20 +86,20 @@
+ }
+
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
+ @Deprecated(since = "1.19")
+ //@Deprecated(since = "1.19", forRemoval = true)
+ public static void setRenderLayer(Block block, RenderType type) {
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
+ setRenderLayer(block, net.minecraftforge.client.ChunkRenderTypeSet.of(type));
+ }
+
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
+ @Deprecated(since = "1.19")
+ //@Deprecated(since = "1.19", forRemoval = true)
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
+ setRenderLayer(block, createSetFromPredicate(predicate));
+ }
+
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
+ @Deprecated(since = "1.19")
+ //@Deprecated(since = "1.19", forRemoval = true)
+ public static synchronized void setRenderLayer(Block block, net.minecraftforge.client.ChunkRenderTypeSet layers) {
+ checkClientLoading();
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
@@ -332,12 +_,14 @@
@@ -339,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_);
}
@@ -403,7 +_,7 @@
@@ -410,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;
@@ -453,6 +_,7 @@
@@ -460,6 +_,7 @@
);
} else {
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
@ -32,7 +32,7 @@
if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) {
int k = flag3 ? 1 : -1;
switch (p_109377_.getUseAnimation()) {
@@ -567,8 +_,16 @@
@@ -574,8 +_,16 @@
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
} else {
float f = localplayer.getAttackStrengthScale(1.0F);

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/renderer/LevelEventHandler.java
+++ b/net/minecraft/client/renderer/LevelEventHandler.java
@@ -325,7 +_,7 @@
case 2001:
BlockState blockstate1 = Block.stateById(p_368262_);
if (!blockstate1.isAir()) {
- SoundType soundtype = blockstate1.getSoundType();
+ SoundType soundtype = blockstate1.getSoundType(this.level, p_362689_, null);
this.level
.playLocalSound(
p_362689_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false

View file

@ -1,203 +1,183 @@
--- a/net/minecraft/client/renderer/LevelRenderer.java
+++ b/net/minecraft/client/renderer/LevelRenderer.java
@@ -256,6 +_,9 @@
@@ -111,7 +_,7 @@
private final SkyRenderer skyRenderer = new SkyRenderer();
private final CloudRenderer cloudRenderer = new CloudRenderer();
private final WorldBorderRenderer worldBorderRenderer = new WorldBorderRenderer();
- private final WeatherEffectRenderer weatherEffectRenderer = new WeatherEffectRenderer();
+ private WeatherEffectRenderer weatherEffectRenderer = new WeatherEffectRenderer();
@Nullable
private ClientLevel level;
private final SectionOcclusionGraph sectionOcclusionGraph = new SectionOcclusionGraph();
@@ -487,7 +_,7 @@
postchain1.addToFrame(framegraphbuilder, i, j, this.targets);
}
- this.addParticlesPass(framegraphbuilder, p_109604_, p_109606_, f, fogparameters);
+ this.addParticlesPass(framegraphbuilder, p_109604_, p_109606_, f, fogparameters, frustum);
CloudStatus cloudstatus = this.minecraft.options.getCloudsType();
if (cloudstatus != CloudStatus.OFF) {
float f2 = this.level.effects().getCloudHeight();
@@ -569,7 +_,11 @@
double d2 = vec3.z();
p_369478_.push("terrain");
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_361439_, p_369924_);
+ // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
+ var atlas = this.minecraft.getModelManager().getAtlas(net.minecraft.client.renderer.texture.TextureAtlas.LOCATION_BLOCKS);
+ atlas.setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0);
this.renderSectionLayer(RenderType.cutoutMipped(), d0, d1, d2, p_361439_, p_369924_);
+ atlas.restoreLastBlurMipmap();
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_361439_, p_369924_);
if (this.level.effects().constantAmbientLight()) {
Lighting.setupNetherLevel();
@@ -603,7 +_,7 @@
multibuffersource$buffersource.endLastBatch();
this.checkPoseStack(posestack);
p_369478_.popPush("blockentities");
- this.renderBlockEntities(posestack, multibuffersource$buffersource, multibuffersource$buffersource1, p_364769_, f);
+ var renderOutline = this.renderBlockEntities(posestack, multibuffersource$buffersource, multibuffersource$buffersource1, p_364769_, f, p_363733_) || p_362593_;
multibuffersource$buffersource.endLastBatch();
this.checkPoseStack(posestack);
multibuffersource$buffersource.endBatch(RenderType.solid());
@@ -617,8 +_,8 @@
multibuffersource$buffersource.endBatch(Sheets.hangingSignSheet());
multibuffersource$buffersource.endBatch(Sheets.chestSheet());
this.renderBuffers.outlineBufferSource().endOutlineBatch();
- if (p_362593_) {
- this.renderBlockOutline(p_364769_, multibuffersource$buffersource, posestack, false);
+ if (renderOutline) {
+ this.renderBlockOutline(p_364769_, multibuffersource$buffersource, posestack, false, f);
}
p_369478_.popPush("debug");
@@ -648,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_);
- if (p_362593_) {
- this.renderBlockOutline(p_364769_, multibuffersource$buffersource, posestack, true);
+ if (renderOutline) {
+ this.renderBlockOutline(p_364769_, multibuffersource$buffersource, posestack, true, f);
}
multibuffersource$buffersource.endBatch();
@@ -657,7 +_,7 @@
});
}
private void renderSnowAndRain(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) {
+ if (level.effects().renderSnowAndRain(level, ticks, p_109705_, p_109704_, p_109706_, p_109707_, p_109708_)) {
+ return;
+ }
float f = this.minecraft.level.getRainLevel(p_109705_);
if (!(f <= 0.0F)) {
p_109704_.turnOnLightLayer();
@@ -418,6 +_,9 @@
}
- private void addParticlesPass(FrameGraphBuilder p_366471_, Camera p_363128_, LightTexture p_366434_, float p_365755_, FogParameters p_363695_) {
+ private void addParticlesPass(FrameGraphBuilder p_366471_, Camera p_363128_, LightTexture p_366434_, float p_365755_, FogParameters p_363695_, Frustum frustum) {
FramePass framepass = p_366471_.addPass("particles");
if (this.targets.particles != null) {
this.targets.particles = framepass.readsAndWrites(this.targets.particles);
@@ -677,7 +_,7 @@
}
public void tickRain(Camera p_109694_) {
+ if (level.effects().tickRain(level, ticks, p_109694_)) {
+ return;
+ }
float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F);
if (!(f <= 0.0F)) {
RandomSource randomsource = RandomSource.create((long)this.ticks * 312987231L);
@@ -929,9 +_,11 @@
RenderSystem.clear(16640, Minecraft.ON_OSX);
float f1 = p_109605_.getRenderDistance();
boolean flag1 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d0), Mth.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog();
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f);
profilerfiller.popPush("sky");
RenderSystem.setShader(GameRenderer::getPositionShader);
this.renderSky(p_254120_, p_330527_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f));
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
profilerfiller.popPush("fog");
FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f1, 32.0F), flag1, f);
profilerfiller.popPush("terrain_setup");
@@ -940,7 +_,9 @@
this.compileSections(p_109604_);
profilerfiller.popPush("terrain");
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_254120_, p_330527_);
+ this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).setBlurMipmap(false, this.minecraft.options.mipmapLevels().get() > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
this.renderSectionLayer(RenderType.cutoutMipped(), d0, d1, d2, p_254120_, p_330527_);
+ this.minecraft.getModelManager().getAtlas(TextureAtlas.LOCATION_BLOCKS).restoreLastBlurMipmap();
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_254120_, p_330527_);
if (this.level.effects().constantAmbientLight()) {
Lighting.setupNetherLevel();
@@ -983,7 +_,7 @@
|| p_109604_.isDetached()
|| p_109604_.getEntity() instanceof LivingEntity && ((LivingEntity)p_109604_.getEntity()).isSleeping()
RenderStateShard.PARTICLES_TARGET.setupRenderState();
- this.minecraft.particleEngine.render(p_366434_, p_363128_, p_365755_);
+ this.minecraft.particleEngine.render(p_366434_, p_363128_, p_365755_, frustum);
RenderStateShard.PARTICLES_TARGET.clearRenderState();
});
}
@@ -766,9 +_,9 @@
|| p_365712_.isDetached()
|| p_365712_.getEntity() instanceof LivingEntity && ((LivingEntity)p_365712_.getEntity()).isSleeping()
)
- && (!(entity instanceof LocalPlayer) || p_109604_.getEntity() == entity)) {
+ && (!(entity instanceof LocalPlayer) || p_109604_.getEntity() == entity || (entity == minecraft.player && !minecraft.player.isSpectator()))) { //FORGE: render local player entity when it is not the renderViewEntity
this.renderedEntities++;
if (entity.tickCount == 0) {
entity.xOld = entity.getX();
@@ -999,6 +_,9 @@
int i = entity.getTeamColor();
outlinebuffersource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255);
} else {
+ if (this.shouldShowEntityOutlines() && entity.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering
+ flag2 = true;
+ }
multibuffersource = multibuffersource$buffersource;
- && (!(entity instanceof LocalPlayer) || p_365712_.getEntity() == entity)) {
+ && (!(entity instanceof LocalPlayer) || p_365712_.getEntity() == entity || (entity == minecraft.player && !minecraft.player.isSpectator()))) { //FORGE: render local player entity when it is not the renderViewEntity
p_368622_.add(entity);
- if (flag1 && this.minecraft.shouldEntityAppearGlowing(entity)) {
+ if (flag1 && (this.minecraft.shouldEntityAppearGlowing(entity) || entity.hasCustomOutlineRendering(this.minecraft.player))) {
flag = true;
}
}
@@ -808,9 +_,10 @@
}
}
@@ -1014,12 +_,14 @@
multibuffersource$buffersource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS));
multibuffersource$buffersource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS));
multibuffersource$buffersource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS));
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_ENTITIES.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
profilerfiller.popPush("blockentities");
for (SectionRenderDispatcher.RenderSection sectionrenderdispatcher$rendersection : this.visibleSections) {
- private void renderBlockEntities(
- PoseStack p_366168_, MultiBufferSource.BufferSource p_362022_, MultiBufferSource.BufferSource p_369016_, Camera p_369847_, float p_367074_
+ private boolean renderBlockEntities(
+ PoseStack p_366168_, MultiBufferSource.BufferSource p_362022_, MultiBufferSource.BufferSource p_369016_, Camera p_369847_, float p_367074_, Frustum frustum
) {
+ boolean customOutline = false;
Vec3 vec3 = p_369847_.getPosition();
double d0 = vec3.x();
double d1 = vec3.y();
@@ -820,6 +_,7 @@
List<BlockEntity> list = sectionrenderdispatcher$rendersection.getCompiled().getRenderableBlockEntities();
if (!list.isEmpty()) {
for (BlockEntity blockentity1 : list) {
+ if (!frustum.isVisible(blockentity1.getRenderBoundingBox())) continue;
BlockPos blockpos4 = blockentity1.getBlockPos();
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
posestack.pushPose();
@@ -1039,6 +_,10 @@
for (BlockEntity blockentity : list) {
+ if (!frustum.isVisible(blockentity.getRenderBoundingBox())) continue;
BlockPos blockpos = blockentity.getBlockPos();
MultiBufferSource multibuffersource = p_362022_;
p_366168_.pushPose();
@@ -839,6 +_,9 @@
}
}
+ if (this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering
+ flag2 = true;
+ }
+ if (!customOutline && this.shouldShowEntityOutlines() && blockentity.hasCustomOutlineRendering(this.minecraft.player))
+ customOutline = true;
+
this.blockEntityRenderDispatcher.render(blockentity1, f, posestack, multibuffersource1);
posestack.popPose();
this.blockEntityRenderDispatcher.render(blockentity, p_367074_, p_366168_, multibuffersource);
p_366168_.popPose();
}
@@ -1047,9 +_,13 @@
@@ -847,13 +_,18 @@
synchronized (this.globalBlockEntities) {
for (BlockEntity blockentity : this.globalBlockEntities) {
+ if (!frustum.isVisible(blockentity.getRenderBoundingBox())) continue;
BlockPos blockpos3 = blockentity.getBlockPos();
posestack.pushPose();
posestack.translate((double)blockpos3.getX() - d0, (double)blockpos3.getY() - d1, (double)blockpos3.getZ() - d2);
+ if (this.shouldShowEntityOutlines() && blockentity.hasCustomOutlineRendering(this.minecraft.player)) { // FORGE: allow custom outline rendering
+ flag2 = true;
+ }
this.blockEntityRenderDispatcher.render(blockentity, f, posestack, multibuffersource$buffersource);
posestack.popPose();
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);
+ if (!customOutline && this.shouldShowEntityOutlines() && blockentity1.hasCustomOutlineRendering(this.minecraft.player))
+ customOutline = true;
this.blockEntityRenderDispatcher.render(blockentity1, p_367074_, p_366168_, p_362022_);
p_366168_.popPose();
}
@@ -1072,6 +_,7 @@
this.minecraft.getMainRenderTarget().bindWrite(false);
}
+
+ return customOutline;
}
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_BLOCK_ENTITIES.dispatch(this, p_254120_, p_254120_, this.ticks, p_109604_, frustum);
profilerfiller.popPush("destroyProgress");
for (Entry<SortedSet<BlockDestructionProgress>> entry : this.destructionProgress.long2ObjectEntrySet()) {
@@ -1089,7 +_,8 @@
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(
this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(k)), posestack$pose1, 1.0F
);
- this.minecraft.getBlockRenderer().renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, posestack, vertexconsumer1);
+ var modelData = level.getModelDataManager().getAt(blockpos2);
+ this.minecraft.getBlockRenderer().renderBreakingTexture(this.level.getBlockState(blockpos2), blockpos2, this.level, posestack, vertexconsumer1, modelData == null ? net.minecraftforge.client.model.data.ModelData.EMPTY : modelData);
posestack.popPose();
private void renderBlockDestroyAnimation(PoseStack p_366956_, Camera p_369324_, MultiBufferSource.BufferSource p_365998_) {
@@ -872,14 +_,14 @@
p_366956_.translate((double)blockpos.getX() - d0, (double)blockpos.getY() - d1, (double)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);
+ this.minecraft.getBlockRenderer().renderBreakingTexture(this.level.getBlockState(blockpos), blockpos, this.level, p_366956_, vertexconsumer, level.getModelDataManager().getAtOrEmpty(blockpos));
p_366956_.popPose();
}
}
@@ -1101,10 +_,13 @@
profilerfiller.popPush("outline");
BlockPos blockpos1 = ((BlockHitResult)hitresult).getBlockPos();
BlockState blockstate = this.level.getBlockState(blockpos1);
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, posestack, multibuffersource$buffersource))
if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos1)) {
VertexConsumer vertexconsumer2 = multibuffersource$buffersource.getBuffer(RenderType.lines());
this.renderHitOutline(posestack, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate);
}
}
- private void renderBlockOutline(Camera p_367935_, MultiBufferSource.BufferSource p_367206_, PoseStack p_365062_, boolean p_368189_) {
+ private void renderBlockOutline(Camera p_367935_, MultiBufferSource.BufferSource p_367206_, PoseStack p_365062_, boolean p_368189_, float partialTicks) {
if (this.minecraft.hitResult instanceof BlockHitResult blockhitresult) {
if (blockhitresult.getType() != HitResult.Type.MISS) {
BlockPos blockpos = blockhitresult.getBlockPos();
@@ -890,6 +_,9 @@
return;
}
+ if (net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_367935_, blockhitresult, partialTicks, p_365062_, p_367206_))
+ return;
+
Vec3 vec3 = p_367935_.getPosition();
Boolean obool = this.minecraft.options.highContrastBlockOutline().get();
if (obool) {
@@ -905,6 +_,8 @@
p_367206_.endLastBatch();
}
}
+ } else if (hitresult != null && hitresult.getType() == HitResult.Type.ENTITY) {
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, posestack, multibuffersource$buffersource);
+ } else if (this.minecraft.hitResult instanceof net.minecraft.world.phys.EntityHitResult entity) {
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_367935_, entity, partialTicks, p_365062_, p_367206_);
}
this.minecraft.debugRenderer.render(posestack, multibuffersource$buffersource, d0, d1, d2);
@@ -1132,7 +_,8 @@
this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget());
RenderStateShard.PARTICLES_TARGET.setupRenderState();
profilerfiller.popPush("particles");
- this.minecraft.particleEngine.render(p_109606_, p_109604_, f);
+ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum);
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
RenderStateShard.PARTICLES_TARGET.clearRenderState();
} else {
profilerfiller.popPush("translucent");
@@ -1146,7 +_,8 @@
profilerfiller.popPush("string");
this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_254120_, p_330527_);
profilerfiller.popPush("particles");
- this.minecraft.particleEngine.render(p_109606_, p_109604_, f);
+ this.minecraft.particleEngine.render(p_109606_, p_109604_, f, frustum);
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_PARTICLES.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
}
if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) {
@@ -1162,6 +_,7 @@
RenderStateShard.WEATHER_TARGET.setupRenderState();
profilerfiller.popPush("weather");
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
this.renderWorldBorder(p_109604_);
RenderStateShard.WEATHER_TARGET.clearRenderState();
this.transparencyChain.process(p_342180_.getGameTimeDeltaTicks());
@@ -1170,6 +_,7 @@
RenderSystem.depthMask(false);
profilerfiller.popPush("weather");
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
this.renderWorldBorder(p_109604_);
RenderSystem.depthMask(true);
}
@@ -1269,6 +_,7 @@
shaderinstance.clear();
VertexBuffer.unbind();
this.minecraft.getProfiler().pop();
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(p_298012_, this, p_297481_, p_333714_, this.ticks, this.minecraft.gameRenderer.getMainCamera(), this.getFrustum());
p_298012_.clearRenderState();
}
@@ -1519,6 +_,9 @@
}
public void renderSky(Matrix4f p_254034_, Matrix4f p_333200_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
+ if (level.effects().renderSky(level, ticks, p_202426_, p_202427_, p_254034_, p_202428_, p_202429_)) {
+ return;
+ }
p_202429_.run();
if (!p_202428_) {
FogType fogtype = p_202427_.getFluidInCamera();
@@ -1642,6 +_,9 @@
}
public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, Matrix4f p_330176_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) {
+ if (level.effects().renderClouds(level, ticks, p_254364_, p_254145_, p_253843_, p_253663_, p_253795_, p_254537_)) {
+ return;
+ }
float f = this.level.effects().getCloudHeight();
if (!Float.isNaN(f)) {
float f1 = 12.0F;
@@ -1901,7 +_,7 @@
@@ -1112,7 +_,7 @@
boolean flag = false;
if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.NEARBY) {
BlockPos blockpos1 = sectionrenderdispatcher$rendersection.getOrigin().offset(8, 8, 8);
@ -206,31 +186,7 @@
} else if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
flag = sectionrenderdispatcher$rendersection.isDirtyFromPlayer();
}
@@ -2477,6 +_,14 @@
this.viewArea.setDirty(p_109502_, p_109503_, p_109504_, p_109505_);
}
+ public Frustum getFrustum() {
+ return this.capturedFrustum != null ? this.capturedFrustum : this.cullingFrustum;
+ }
+
+ public int getTicks() {
+ return this.ticks;
+ }
+
public void playJukeboxSong(Holder<JukeboxSong> p_343944_, BlockPos p_342259_) {
if (this.level != null) {
this.stopJukeboxSong(p_342259_);
@@ -2886,7 +_,7 @@
case 2001:
BlockState blockstate1 = Block.stateById(p_234307_);
if (!blockstate1.isAir()) {
- SoundType soundtype = blockstate1.getSoundType();
+ SoundType soundtype = blockstate1.getSoundType(this.level, p_234306_, null);
this.level
.playLocalSound(
p_234306_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false
@@ -3338,7 +_,7 @@
@@ -1391,7 +_,7 @@
} else {
int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_);
int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_);
@ -239,3 +195,25 @@
if (j < k) {
j = k;
}
@@ -1453,5 +_,21 @@
public CloudRenderer getCloudRenderer() {
return this.cloudRenderer;
+ }
+
+ public Frustum getFrustum() {
+ return this.capturedFrustum != null ? this.capturedFrustum : this.cullingFrustum;
+ }
+
+ public int getTicks() {
+ return this.ticks;
+ }
+
+ public WeatherEffectRenderer getWeatherEffects() {
+ return this.weatherEffectRenderer;
+ }
+
+ public void setWeatherEffects(WeatherEffectRenderer value) {
+ this.weatherEffectRenderer = value;
}
}

View file

@ -1,19 +1,10 @@
--- a/net/minecraft/client/renderer/LightTexture.java
+++ b/net/minecraft/client/renderer/LightTexture.java
@@ -129,6 +_,8 @@
}
}
+ clientlevel.effects().adjustLightmapColors(clientlevel, p_109882_, f, f7, f8, j, i, vector3f1);
+
if (f5 > 0.0F) {
float f13 = Math.max(vector3f1.x(), Math.max(vector3f1.y(), vector3f1.z()));
if (f13 < 1.0F) {
@@ -186,7 +_,7 @@
@@ -143,7 +_,7 @@
}
public static int block(int p_109884_) {
- return p_109884_ >> 4 & 65535;
- return p_109884_ >>> 4 & 15;
+ return (p_109884_ & 0xFFFF) >> 4; // Forge: Fix fullbright quads showing dark artifacts. Reported as MC-169806
}

View file

@ -1,19 +0,0 @@
--- a/net/minecraft/client/renderer/PostChain.java
+++ b/net/minecraft/client/renderer/PostChain.java
@@ -156,7 +_,7 @@
throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer");
}
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("textures/effect/" + s4 + ".png");
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(s4).withPath(p -> "textures/effect/" + p + ".png");
this.resourceProvider
.getResource(resourcelocation)
.orElseThrow(() -> new ChainedJsonException("Render target or texture '" + s4 + "' does not exist"));
@@ -257,6 +_,7 @@
public void addTempTarget(String p_110039_, int p_110040_, int p_110041_) {
RenderTarget rendertarget = new TextureTarget(p_110040_, p_110041_, true, Minecraft.ON_OSX);
rendertarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
+ if (screenTarget.isStencilEnabled()) rendertarget.enableStencil();
this.customRenderTargets.put(p_110039_, rendertarget);
if (p_110040_ == this.screenWidth && p_110041_ == this.screenHeight) {
this.fullSizedTargets.add(rendertarget);

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/client/renderer/RenderType.java
+++ b/net/minecraft/client/renderer/RenderType.java
@@ -674,11 +_,22 @@
RenderType.CompositeState.builder().setShaderState(RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY_SHADER).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setDepthTestState(GREATER_DEPTH_TEST).setWriteMaskState(COLOR_WRITE).createCompositeState(false)
@@ -800,11 +_,22 @@
.createCompositeState(false)
);
private static final ImmutableList<RenderType> CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire());
+ static {
@ -23,7 +23,7 @@
public static RenderType solid() {
return SOLID;
@@ -899,7 +_,7 @@
@@ -1025,7 +_,7 @@
}
public static RenderType text(ResourceLocation p_110498_) {
@ -32,7 +32,7 @@
}
public static RenderType textBackground() {
@@ -907,19 +_,19 @@
@@ -1033,19 +_,19 @@
}
public static RenderType textIntensity(ResourceLocation p_173238_) {
@ -56,7 +56,7 @@
}
public static RenderType textBackgroundSeeThrough() {
@@ -927,7 +_,7 @@
@@ -1053,7 +_,7 @@
}
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {

View file

@ -57,7 +57,7 @@
+ }
+
+ public static void renderFluid(Minecraft p_110726_, PoseStack p_110727_, ResourceLocation texture) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShader(CoreShaders.POSITION_TEX);
- RenderSystem.setShaderTexture(0, UNDERWATER_LOCATION);
+ RenderSystem.setShaderTexture(0, texture);
BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ());

View file

@ -1,58 +0,0 @@
--- a/net/minecraft/client/renderer/ShaderInstance.java
+++ b/net/minecraft/client/renderer/ShaderInstance.java
@@ -94,10 +_,15 @@
@Nullable
public final Uniform CHUNK_OFFSET;
+ @Deprecated // Forge: Use the ResourceLocation variant below
public ShaderInstance(ResourceProvider p_173336_, String p_173337_, VertexFormat p_173338_) throws IOException {
- this.name = p_173337_;
+ this(p_173336_, ResourceLocation.parse(p_173337_), p_173338_);
+ }
+
+ public ShaderInstance(ResourceProvider p_173336_, ResourceLocation shaderLocation, VertexFormat p_173338_) throws IOException {
+ this.name = shaderLocation.getNamespace().equals("minecraft") ? shaderLocation.getPath() : shaderLocation.toString();
this.vertexFormat = p_173338_;
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/core/" + p_173337_ + ".json");
+ ResourceLocation resourcelocation = shaderLocation.withPath(p -> "shaders/core/" + p + ".json");
try (Reader reader = p_173336_.openAsReader(resourcelocation)) {
JsonObject jsonobject = GsonHelper.parse(reader);
@@ -177,8 +_,9 @@
Program program1 = p_173342_.getPrograms().get(p_173343_);
Program program;
if (program1 == null) {
- String s = "shaders/core/" + p_173343_ + p_173342_.getExtension();
- Resource resource = p_173341_.getResourceOrThrow(ResourceLocation.withDefaultNamespace(s));
+ ResourceLocation resourcelocation = ResourceLocation.parse(p_173343_).withPath(p -> "shaders/core/" + p + p_173342_.getExtension());
+ String s = resourcelocation.getPath();
+ Resource resource = p_173341_.getResourceOrThrow(resourcelocation);
try (InputStream inputstream = resource.open()) {
final String s1 = FileUtil.getFullResourcePath(s);
@@ -187,12 +_,11 @@
@Override
public String applyImport(boolean p_173374_, String p_173375_) {
- p_173375_ = FileUtil.normalizeResourcePath((p_173374_ ? s1 : "shaders/include/") + p_173375_);
- if (!this.importedPaths.add(p_173375_)) {
+ // Forge: use the mod's namespace to look up resources if specified
+ ResourceLocation resourcelocation = net.minecraftforge.client.ForgeHooksClient.getShaderImportLocation(s1, p_173374_, p_173375_);
+ if (!this.importedPaths.add(resourcelocation.toString())) {
return null;
} else {
- ResourceLocation resourcelocation = ResourceLocation.parse(p_173375_);
-
try {
String s2;
try (Reader reader = p_173341_.openAsReader(resourcelocation)) {
@@ -201,7 +_,8 @@
return s2;
} catch (IOException ioexception) {
- ShaderInstance.LOGGER.error("Could not open GLSL import {}: {}", p_173375_, ioexception.getMessage());
+ // Forge: specify the namespace of the failed import in case of duplicates from multiple mods
+ ShaderInstance.LOGGER.error("Could not open GLSL import {}: {}", resourcelocation, ioexception.getMessage());
return "#error " + ioexception.getMessage();
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/Sheets.java
+++ b/net/minecraft/client/renderer/Sheets.java
@@ -145,11 +_,11 @@
@@ -140,11 +_,11 @@
}
private static Material createSignMaterial(WoodType p_173386_) {
@ -14,7 +14,7 @@
}
public static Material getSignMaterial(WoodType p_173382_) {
@@ -208,6 +_,23 @@
@@ -203,6 +_,23 @@
case SINGLE:
default:
return p_110773_;

View file

@ -76,8 +76,8 @@
this.modelRenderer
.renderModel(
p_110914_.last(),
- p_110915_.getBuffer(ItemBlockRenderTypes.getRenderType(p_110913_, false)),
+ p_110915_.getBuffer(renderType != null ? renderType : net.minecraftforge.client.RenderTypeHelper.getEntityRenderType(rt, false)),
- p_110915_.getBuffer(ItemBlockRenderTypes.getRenderType(p_110913_)),
+ p_110915_.getBuffer(renderType != null ? renderType : net.minecraftforge.client.RenderTypeHelper.getEntityRenderType(rt)),
p_110913_,
bakedmodel,
f,

View file

@ -13,7 +13,7 @@
float f = (float)(i >> 16 & 0xFF) / 255.0F;
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
float f2 = (float)(i & 0xFF) / 255.0F;
@@ -181,15 +_,15 @@
@@ -180,15 +_,15 @@
float f57 = f4 * f;
float f29 = f4 * f1;
float f30 = f4 * f2;
@ -37,7 +37,7 @@
}
}
@@ -202,10 +_,10 @@
@@ -201,10 +_,10 @@
float f46 = f3 * f;
float f48 = f3 * f1;
float f50 = f3 * f2;
@ -52,8 +52,8 @@
}
int j = this.getLightColor(p_234370_, p_234371_);
@@ -259,10 +_,9 @@
if (flag7 && !isFaceOccludedByNeighbor(p_234370_, p_234371_, direction, Math.max(f44, f45), p_234370_.getBlockState(p_234371_.relative(direction)))) {
@@ -258,10 +_,9 @@
if (flag7 && !isFaceOccludedByNeighbor(direction, Math.max(f44, f45), p_234370_.getBlockState(p_234371_.relative(direction)))) {
BlockPos blockpos = p_234371_.relative(direction);
TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1];
- if (!flag) {
@ -66,7 +66,7 @@
}
}
@@ -275,15 +_,15 @@
@@ -274,15 +_,15 @@
float f33 = f4 * f32 * f;
float f34 = f4 * f32 * f1;
float f35 = f4 * f32 * f2;
@ -90,7 +90,7 @@
}
}
}
@@ -345,10 +_,11 @@
@@ -344,10 +_,11 @@
float p_343128_,
float p_344448_,
float p_344284_,

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java
+++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java
@@ -40,6 +_,11 @@
@@ -39,6 +_,11 @@
this.blockColors = p_110999_;
}
@ -12,7 +12,7 @@
public void tesselateBlock(
BlockAndTintGetter p_234380_,
BakedModel p_234381_,
@@ -50,17 +_,19 @@
@@ -49,16 +_,18 @@
boolean p_234386_,
RandomSource p_234387_,
long p_234388_,
@ -23,8 +23,7 @@
) {
- 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);
Vec3 vec3 = p_234382_.getOffset(p_234380_, p_234383_);
p_234384_.translate(vec3.x, vec3.y, vec3.z);
p_234384_.translate(p_234382_.getOffset(p_234383_));
try {
if (flag) {
@ -36,7 +35,7 @@
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block model");
@@ -71,6 +_,11 @@
@@ -69,6 +_,11 @@
}
}
@ -48,7 +47,7 @@
public void tesselateWithAO(
BlockAndTintGetter p_234391_,
BakedModel p_234392_,
@@ -81,7 +_,9 @@
@@ -79,7 +_,9 @@
boolean p_234397_,
RandomSource p_234398_,
long p_234399_,
@ -59,7 +58,7 @@
) {
float[] afloat = new float[DIRECTIONS.length * 2];
BitSet bitset = new BitSet(3);
@@ -90,7 +_,7 @@
@@ -88,7 +_,7 @@
for (Direction direction : DIRECTIONS) {
p_234398_.setSeed(p_234399_);
@ -67,8 +66,8 @@
+ 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_, p_234394_, direction, blockpos$mutableblockpos)) {
@@ -102,12 +_,17 @@
if (!p_234397_ || Block.shouldRenderFace(p_234393_, p_234391_.getBlockState(blockpos$mutableblockpos), direction)) {
@@ -100,12 +_,17 @@
}
p_234398_.setSeed(p_234399_);
@ -87,7 +86,7 @@
public void tesselateWithoutAO(
BlockAndTintGetter p_234402_,
BakedModel p_234403_,
@@ -118,14 +_,16 @@
@@ -116,14 +_,16 @@
boolean p_234408_,
RandomSource p_234409_,
long p_234410_,
@ -105,8 +104,8 @@
+ 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_, p_234405_, direction, blockpos$mutableblockpos)) {
@@ -136,7 +_,7 @@
if (!p_234408_ || Block.shouldRenderFace(p_234404_, p_234402_.getBlockState(blockpos$mutableblockpos), direction)) {
@@ -134,7 +_,7 @@
}
p_234409_.setSeed(p_234410_);
@ -115,7 +114,7 @@
if (!list1.isEmpty()) {
this.renderModelFaceFlat(p_234402_, p_234404_, p_234405_, -1, p_234411_, true, p_234406_, p_234407_, list1, bitset);
}
@@ -156,6 +_,7 @@
@@ -154,6 +_,7 @@
) {
for (BakedQuad bakedquad : p_111018_) {
this.calculateShape(p_111013_, p_111014_, p_111015_, bakedquad.getVertices(), bakedquad.getDirection(), p_111019_, p_111020_);
@ -123,7 +122,7 @@
p_111021_.calculate(p_111013_, p_111014_, p_111015_, bakedquad.getDirection(), p_111019_, p_111020_, bakedquad.isShade());
this.putQuadData(
p_111013_,
@@ -321,6 +_,11 @@
@@ -319,6 +_,11 @@
}
}
@ -135,7 +134,7 @@
public void renderModel(
PoseStack.Pose p_111068_,
VertexConsumer p_111069_,
@@ -330,18 +_,20 @@
@@ -328,18 +_,20 @@
float p_111073_,
float p_111074_,
int p_111075_,

View file

@ -1,29 +1,30 @@
--- a/net/minecraft/client/renderer/block/model/BakedQuad.java
+++ b/net/minecraft/client/renderer/block/model/BakedQuad.java
@@ -12,13 +_,19 @@
protected final Direction direction;
@@ -13,14 +_,20 @@
protected final TextureAtlasSprite sprite;
private final boolean shade;
private final int lightEmission;
+ private final boolean hasAmbientOcclusion;
public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_) {
+ this(p_111298_, p_111299_, p_111300_, p_111301_, p_111302_, true);
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);
+ }
+
+ public BakedQuad(int[] p_111298_, int p_111299_, Direction p_111300_, TextureAtlasSprite p_111301_, boolean p_111302_, boolean hasAmbientOcclusion) {
+ 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 TextureAtlasSprite getSprite() {
@@ -43,5 +_,9 @@
@@ -49,5 +_,9 @@
public boolean isShade() {
return this.shade;
public int getLightEmission() {
return this.lightEmission;
+ }
+
+ public boolean hasAmbientOcclusion() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/block/model/BlockModel.java
+++ b/net/minecraft/client/renderer/block/model/BlockModel.java
@@ -77,9 +_,10 @@
@@ -72,9 +_,10 @@
public BlockModel parent;
@Nullable
protected ResourceLocation parentLocation;
@ -11,8 +11,8 @@
+ return GsonHelper.fromJson(net.minecraftforge.client.model.ExtendedBlockModelDeserializer.INSTANCE, p_111462_, BlockModel.class);
}
public static BlockModel fromString(String p_111464_) {
@@ -104,10 +_,17 @@
public BlockModel(
@@ -95,10 +_,17 @@
this.overrides = p_273099_;
}
@ -30,52 +30,18 @@
public boolean hasAmbientOcclusion() {
if (this.hasAmbientOcclusion != null) {
return this.hasAmbientOcclusion;
@@ -136,6 +_,10 @@
return this.overrides.isEmpty() ? ItemOverrides.EMPTY : new ItemOverrides(p_250138_, p_251800_, this.overrides);
}
@@ -130,6 +_,10 @@
throw new IllegalStateException("BlockModel parent has to be a block model.");
}
+ public ItemOverrides getOverrides(ModelBaker p_250138_, BlockModel p_251800_, Function<Material, TextureAtlasSprite> spriteGetter) {
+ return this.overrides.isEmpty() ? ItemOverrides.EMPTY : new ItemOverrides(p_250138_, p_251800_, this.overrides, spriteGetter);
+ }
+ if (customData.hasCustomGeometry()) {
+ customData.getCustomGeometry().resolveDependencies(p_365651_, customData);
+ }
+
@Override
public Collection<ResourceLocation> getDependencies() {
Set<ResourceLocation> set = Sets.newHashSet();
@@ -184,6 +_,10 @@
blockmodel.parent = (BlockModel)unbakedmodel;
this.parent = blockmodel;
}
+ if (customData.hasCustomGeometry()) {
+ customData.getCustomGeometry().resolveParents(p_249059_, customData);
+ }
+
this.overrides.forEach(p_247932_ -> {
UnbakedModel unbakedmodel1 = p_249059_.apply(p_247932_.getModel());
if (!Objects.equals(unbakedmodel1, this)) {
@@ -192,13 +_,21 @@
});
}
+ /**
+ * @deprecated Forge: Use {@link #bake(ModelBaker, BlockModel, Function, ModelState, ResourceLocation, boolean)}.
+ */
+ @Deprecated
@Override
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_) {
return this.bake(p_252120_, this, p_250023_, p_251130_, true);
}
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_) {
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111455_);
+ }
+
public BakedModel bake(
- ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_
+ ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes
) {
TextureAtlasSprite textureatlassprite = p_111452_.apply(this.getMaterial("particle"));
if (this.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) {
@@ -290,7 +_,18 @@
@@ -229,7 +_,18 @@
ItemTransform itemtransform5 = this.getTransform(ItemDisplayContext.GUI);
ItemTransform itemtransform6 = this.getTransform(ItemDisplayContext.GROUND);
ItemTransform itemtransform7 = this.getTransform(ItemDisplayContext.FIXED);
@ -95,7 +61,7 @@
}
private ItemTransform getTransform(ItemDisplayContext p_270662_) {
@@ -408,6 +_,10 @@
@@ -347,6 +_,10 @@
public boolean lightLikeBlock() {
return this == SIDE;
@ -105,4 +71,4 @@
+ return name;
}
}
}

View file

@ -1,13 +1,13 @@
--- a/net/minecraft/client/renderer/block/model/FaceBakery.java
+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java
@@ -57,7 +_,14 @@
@@ -58,7 +_,14 @@
this.recalculateWinding(aint, direction);
}
- return new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_);
- return new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, p_364904_);
+ var data = p_111603_.data();
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, data.calculateNormals());
+ var quad = new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, data.ambientOcclusion());
+ //net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, data.calculateNormals());
+ 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);

View file

@ -1,50 +0,0 @@
--- a/net/minecraft/client/renderer/block/model/ItemOverrides.java
+++ b/net/minecraft/client/renderer/block/model/ItemOverrides.java
@@ -31,7 +_,15 @@
this.properties = new ResourceLocation[0];
}
+ /**
+ * @deprecated Forge: Use {@link #ItemOverrides(ModelBaker, UnbakedModel, List, java.util.function.Function)}
+ */
+ @Deprecated
public ItemOverrides(ModelBaker p_251211_, BlockModel p_111741_, List<ItemOverride> p_111743_) {
+ this(p_251211_, p_111741_, p_111743_, p_251211_.getModelTextureGetter());
+ }
+
+ public ItemOverrides(ModelBaker p_251211_, UnbakedModel p_111741_, List<ItemOverride> p_111743_, java.util.function.Function<net.minecraft.client.resources.model.Material, net.minecraft.client.renderer.texture.TextureAtlasSprite> spriteGetter) {
this.properties = p_111743_.stream().flatMap(ItemOverride::getPredicates).map(ItemOverride.Predicate::getProperty).distinct().toArray(ResourceLocation[]::new);
Object2IntMap<ResourceLocation> object2intmap = new Object2IntOpenHashMap<>();
@@ -43,7 +_,7 @@
for (int j = p_111743_.size() - 1; j >= 0; j--) {
ItemOverride itemoverride = p_111743_.get(j);
- BakedModel bakedmodel = this.bakeModel(p_251211_, p_111741_, itemoverride);
+ BakedModel bakedmodel = this.bakeModel(p_251211_, p_111741_, itemoverride, spriteGetter);
ItemOverrides.PropertyMatcher[] aitemoverrides$propertymatcher = itemoverride.getPredicates().map(p_173477_ -> {
int k = object2intmap.getInt(p_173477_.getProperty());
return new ItemOverrides.PropertyMatcher(k, p_173477_.getValue());
@@ -55,9 +_,9 @@
}
@Nullable
- private BakedModel bakeModel(ModelBaker p_249483_, BlockModel p_251965_, ItemOverride p_250816_) {
+ private BakedModel bakeModel(ModelBaker p_249483_, UnbakedModel p_251965_, ItemOverride p_250816_, java.util.function.Function<net.minecraft.client.resources.model.Material, net.minecraft.client.renderer.texture.TextureAtlasSprite> spriteGetter) {
UnbakedModel unbakedmodel = p_249483_.getModel(p_250816_.getModel());
- return Objects.equals(unbakedmodel, p_251965_) ? null : p_249483_.bake(p_250816_.getModel(), BlockModelRotation.X0_Y0);
+ return Objects.equals(unbakedmodel, p_251965_) ? null : p_249483_.bake(p_250816_.getModel(), BlockModelRotation.X0_Y0, spriteGetter);
}
@Nullable
@@ -89,6 +_,10 @@
}
return p_173465_;
+ }
+
+ public com.google.common.collect.ImmutableList<BakedOverride> getOverrides() {
+ return com.google.common.collect.ImmutableList.copyOf(overrides);
}
@OnlyIn(Dist.CLIENT)

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/client/renderer/block/model/MultiVariant.java
+++ b/net/minecraft/client/renderer/block/model/MultiVariant.java
@@ -68,7 +_,7 @@
WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder();
@@ -50,7 +_,7 @@
SimpleWeightedRandomList.Builder<BakedModel> builder = SimpleWeightedRandomList.builder();
for (Variant variant : this.getVariants()) {
for (Variant variant : this.variants) {
- BakedModel bakedmodel = p_249016_.bake(variant.getModelLocation(), variant);
+ BakedModel bakedmodel = p_249016_.bake(variant.getModelLocation(), variant, p_111851_);
weightedbakedmodel$builder.add(bakedmodel, variant.getWeight());
builder.add(bakedmodel, variant.getWeight());
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/blockentity/ChestRenderer.java
+++ b/net/minecraft/client/renderer/blockentity/ChestRenderer.java
@@ -128,7 +_,7 @@
@@ -66,7 +_,7 @@
f1 = 1.0F - f1;
f1 = 1.0F - f1 * f1 * f1;
int i = neighborcombineresult.apply(new BrightnessCombiner<>()).applyAsInt(p_112367_);
@ -9,10 +9,10 @@
VertexConsumer vertexconsumer = material.buffer(p_112366_, RenderType::entityCutout);
if (flag1) {
if (chesttype == ChestType.LEFT) {
@@ -159,5 +_,9 @@
p_112372_.render(p_112370_, p_112371_, p_112376_, p_112377_);
p_112373_.render(p_112370_, p_112371_, p_112376_, p_112377_);
p_112374_.render(p_112370_, p_112371_, p_112376_, p_112377_);
@@ -85,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_);
+ }
+
+ protected Material getMaterial(T blockEntity, ChestType chestType) {

Some files were not shown because too many files have changed in this diff Show more