1.21.11 Mounts of Mayhem Release

Lots of rendering related changes, specifically for BackedQuad and IQuadTransformers.
Removed our deprecated model generators, modders should have been using vanilla's for a while.
This commit is contained in:
LexManos committed 2025-12-09 18:28:42 -08:00
1 parent 17e1002e86
commit 01bfc33b28
698 files changed
+4892 -10126

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ name: Publish
on:
push:
branches: [ '1.21.x' ]
branches: [ '1.21.11' ]
permissions:
contents: read
@@ -7,8 +7,11 @@ package net.minecraftforge.fml.util.thread;
import net.minecraftforge.fml.LogicalSide;
public class EffectiveSide
{
/**
* Attempts to determine the effect side of the current thread, based on know threads in networking.
* This is not guaranteed to be correct, and modders should use other methods to determine the logical side when possible.
*/
public class EffectiveSide {
public static LogicalSide get() {
final ThreadGroup group = Thread.currentThread().getThreadGroup();
return group instanceof SidedThreadGroup ? ((SidedThreadGroup) group).getSide() : LogicalSide.CLIENT;
@@ -7,11 +7,13 @@ package net.minecraftforge.fml.util.thread;
import net.minecraftforge.fml.LogicalSide;
public final class SidedThreadGroups
{
public final class SidedThreadGroups {
public static final SidedThreadGroup CLIENT = new SidedThreadGroup(LogicalSide.CLIENT);
public static final SidedThreadGroup SERVER = new SidedThreadGroup(LogicalSide.SERVER);
private SidedThreadGroups() {
public static SidedThreadGroup get(boolean client) {
return client ? CLIENT : SERVER;
}
private SidedThreadGroups() { }
}
@@ -1,4 +1,10 @@
[
{
"class": "net/minecraft/gametest/framework/GameTestHelper",
"methods": [
"spawn(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/EntitySpawnReason;)Lnet/minecraft/world/entity/Entity;"
]
},
{
"class": "net/minecraft/server/commands/RaidCommand",
"methods": [
@@ -23,31 +29,25 @@
"trySpawn(Lnet/minecraft/server/level/ServerLevel;)V"
]
},
{
"class": "net/minecraft/world/entity/animal/equine/SkeletonTrapGoal",
"methods": [
"createHorse(Lnet/minecraft/world/DifficultyInstance;)Lnet/minecraft/world/entity/animal/equine/AbstractHorse;",
"createSkeleton(Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/animal/equine/AbstractHorse;)Lnet/minecraft/world/entity/monster/skeleton/Skeleton;"
]
},
{
"class": "net/minecraft/world/entity/animal/equine/ZombieHorse",
"methods": [
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
]
},
{
"class": "net/minecraft/world/entity/animal/frog/Tadpole",
"methods": [
]
},
{
"class": "net/minecraft/world/entity/animal/horse/SkeletonTrapGoal",
"methods": [
"createHorse(Lnet/minecraft/world/DifficultyInstance;)Lnet/minecraft/world/entity/animal/horse/AbstractHorse;",
"createSkeleton(Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/animal/horse/AbstractHorse;)Lnet/minecraft/world/entity/monster/Skeleton;"
]
},
{
"class": "net/minecraft/world/entity/monster/Evoker$EvokerSummonSpellGoal",
"methods": [
"performSpellCasting()V"
]
},
{
"class": "net/minecraft/world/entity/monster/Spider",
"methods": [
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
]
},
{
"class": "net/minecraft/world/entity/monster/Strider",
"methods": [
@@ -55,14 +55,38 @@
]
},
{
"class": "net/minecraft/world/entity/monster/Zombie",
"class": "net/minecraft/world/entity/monster/illager/Evoker$EvokerSummonSpellGoal",
"methods": [
"performSpellCasting()V"
]
},
{
"class": "net/minecraft/world/entity/monster/spider/Spider",
"methods": [
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
]
},
{
"class": "net/minecraft/world/entity/monster/zombie/Drowned",
"methods": [
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
]
},
{
"class": "net/minecraft/world/entity/monster/zombie/Husk",
"methods": [
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
]
},
{
"class": "net/minecraft/world/entity/monster/zombie/Zombie",
"methods": [
"hurtServer(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/damagesource/DamageSource;F)Z",
"finalizeSpawn(Lnet/minecraft/world/level/ServerLevelAccessor;Lnet/minecraft/world/DifficultyInstance;Lnet/minecraft/world/entity/EntitySpawnReason;Lnet/minecraft/world/entity/SpawnGroupData;)Lnet/minecraft/world/entity/SpawnGroupData;"
]
},
{
"class": "net/minecraft/world/entity/monster/ZombieVillager",
"class": "net/minecraft/world/entity/monster/zombie/ZombieVillager",
"methods": [
]
@@ -74,9 +98,9 @@
]
},
{
"class": "net/minecraft/world/entity/npc/Villager",
"class": "net/minecraft/world/entity/npc/villager/Villager",
"methods": [
"getBreedOffspring(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/AgeableMob;)Lnet/minecraft/world/entity/npc/Villager;"
"getBreedOffspring(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/AgeableMob;)Lnet/minecraft/world/entity/npc/villager/Villager;"
]
},
{
+3 -3
View File
@@ -5,11 +5,11 @@ org.gradle.daemon=false
org.gradle.parallel=true
JAVA_VERSION=21
MC_VERSION=1.21.10
MC_VERSION=1.21.11
MC_NEXT_VERSION=1.22
MCP_VERSION=20251007.101210
MCP_VERSION=20251209.095502
MAPPING_CHANNEL=official
MAPPING_VERSION=1.21.10
MAPPING_VERSION=1.21.11
# Set to true before the first build of a new MC version, so we don't do compatibility checks
CHECK_COMPATIBILITY=false
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlCommandEncoder.java
+++ b/com/mojang/blaze3d/opengl/GlCommandEncoder.java
@@ -131,6 +_,9 @@
@@ -133,6 +_,9 @@
GlStateManager._colorMask(true, true, true, true);
GlStateManager._clear(16384);
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, 0, 0);
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlDebug.java
+++ b/com/mojang/blaze3d/opengl/GlDebug.java
@@ -23,6 +_,14 @@
@@ -24,6 +_,14 @@
@OnlyIn(Dist.CLIENT)
public class GlDebug {
@@ -24,10 +24,10 @@
}
public List<String> getLastOpenGlDebugMessages() {
@@ -121,6 +_,7 @@
@@ -120,6 +_,7 @@
}
@Nullable
public static GlDebug enableDebugCallback(int p_394351_, boolean p_393026_, Set<String> p_393339_) {
public static @Nullable GlDebug enableDebugCallback(int p_394351_, boolean p_393026_, Set<String> p_393339_) {
+ p_393026_ |= PRINT_STACKTRACE_ON_ERROR;
if (p_394351_ <= 0) {
return null;
@@ -1,8 +1,8 @@
--- a/com/mojang/blaze3d/opengl/GlDevice.java
+++ b/com/mojang/blaze3d/opengl/GlDevice.java
@@ -90,8 +_,15 @@
public GpuTexture createTexture(
@Nullable Supplier<String> p_397830_, int p_394481_, TextureFormat p_394839_, int p_391831_, int p_395609_, int p_407582_, int p_408928_
@@ -124,8 +_,15 @@
int p_407582_,
int p_408928_
) {
+ return createTexture(p_397830_, p_394481_, p_394839_, p_391831_, p_395609_, p_407582_, p_408928_, false);
+ }
@@ -17,23 +17,23 @@
);
}
@@ -99,6 +_,15 @@
@@ -133,6 +_,15 @@
public GpuTexture createTexture(
@Nullable String p_394142_, int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_
@Nullable String p_394142_, @GpuTexture.Usage int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_
) {
+ return createTexture(p_394142_, p_395535_, p_394951_, p_393944_, p_392329_, p_408015_, p_406483_, false);
+ }
+
+ @Override
+ public GpuTexture createTexture(
+ @Nullable String p_394142_, int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_, boolean stencil
+ @Nullable String p_394142_, @GpuTexture.Usage int p_395535_, TextureFormat p_394951_, int p_393944_, int p_392329_, int p_408015_, int p_406483_, boolean stencil
+ ) {
+ // Forge: stencil rendering is only for depth
+ stencil &= p_394951_.hasDepthAspect();
if (p_406483_ < 1) {
throw new IllegalArgumentException("mipLevels must be at least 1");
} else if (p_408015_ < 1) {
@@ -149,11 +_,14 @@
@@ -183,11 +_,14 @@
GlStateManager._texImage2D(
k,
l,
@@ -48,7 +48,7 @@
GlConst.toGlType(p_394951_),
null
);
@@ -164,11 +_,14 @@
@@ -198,11 +_,14 @@
GlStateManager._texImage2D(
j,
i1,
@@ -63,7 +63,7 @@
GlConst.toGlType(p_394951_),
null
);
@@ -181,7 +_,7 @@
@@ -215,7 +_,7 @@
} else if (j1 != 0) {
throw new IllegalStateException("OpenGL error " + j1);
} else {
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/opengl/GlStateManager.java
+++ b/com/mojang/blaze3d/opengl/GlStateManager.java
@@ -85,6 +_,11 @@
@@ -86,6 +_,11 @@
}
}
@@ -1,9 +1,9 @@
--- a/com/mojang/blaze3d/opengl/GlTexture.java
+++ b/com/mojang/blaze3d/opengl/GlTexture.java
@@ -19,8 +_,13 @@
private int views;
protected GlTexture(int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_) {
@@ -21,8 +_,13 @@
protected GlTexture(
@GpuTexture.Usage int p_394590_, String p_393950_, TextureFormat p_392837_, int p_391379_, int p_391947_, int p_396659_, int p_408255_, int p_408889_
) {
+ this(p_394590_, p_393950_, p_392837_, p_391379_, p_391947_, p_396659_, p_408255_, p_408889_, false);
+ }
+
@@ -14,20 +14,16 @@
}
@Override
@@ -93,6 +_,16 @@
public void setTextureFilter(FilterMode p_394977_, FilterMode p_397175_, boolean p_393558_) {
super.setTextureFilter(p_394977_, p_397175_, p_393558_);
this.modesDirty = true;
@@ -89,5 +_,12 @@
if (this.closed && this.views == 0) {
this.destroyImmediately();
}
+ }
+
+
+ /* FORGE START */
+
+ private final boolean stencilEnabled;
+
+ @Override
+ public boolean isStencilEnabled() {
+ return this.stencilEnabled;
}
@Override
}
@@ -1,17 +1,17 @@
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
@@ -86,7 +_,7 @@
@@ -80,7 +_,7 @@
this.width = p_83951_;
this.height = p_83952_;
if (this.useDepth) {
- this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1);
+ this.depthTexture = gpudevice.createTexture(() -> this.label + " / Depth", 15, TextureFormat.DEPTH32, p_83951_, p_83952_, 1, 1, this.stencilEnabled);
this.depthTextureView = gpudevice.createTextureView(this.depthTexture);
this.depthTexture.setTextureFilter(FilterMode.NEAREST, false);
this.depthTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
@@ -155,5 +_,26 @@
@Nullable
public GpuTextureView getDepthTextureView() {
}
@@ -126,5 +_,26 @@
public @Nullable GpuTextureView getDepthTextureView() {
return this.depthTextureView;
+ }
+
@@ -1,7 +1,7 @@
--- a/com/mojang/blaze3d/systems/GpuDevice.java
+++ b/com/mojang/blaze3d/systems/GpuDevice.java
@@ -26,7 +_,17 @@
@Nullable Supplier<String> p_394357_, int p_395623_, TextureFormat p_395807_, int p_395802_, int p_396157_, int p_408810_, int p_407070_
@@ -36,9 +_,19 @@
int p_407070_
);
+ /** Forge: same as {@link #createTexture(Supplier, int, TextureFormat, int, int, int)} but with stencil support */
@@ -9,7 +9,9 @@
+ return this.createTexture(p_394357_, p_395623_, p_395807_, p_395802_, p_396157_, p_408810_, p_407070_);
+ }
+
GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_);
GpuTexture createTexture(
@Nullable String p_391798_, @GpuTexture.Usage int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_
);
+
+ /** Forge: same as {@link #createTexture(String, int, TextureFormat, int, int, int)} but with stencil support */
+ default GpuTexture createTexture(@Nullable String p_391798_, int p_391800_, TextureFormat p_393333_, int p_395600_, int p_394065_, int p_408732_, int p_407125_, boolean stencil) {
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/textures/GpuTexture.java
+++ b/com/mojang/blaze3d/textures/GpuTexture.java
@@ -6,7 +_,7 @@
@@ -10,7 +_,7 @@
@OnlyIn(Dist.CLIENT)
@DontObfuscate
@@ -1,7 +1,7 @@
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
@@ -15,7 +_,7 @@
import org.lwjgl.system.MemoryStack;
@@ -14,7 +_,7 @@
import org.joml.Vector3fc;
@OnlyIn(Dist.CLIENT)
-public interface VertexConsumer {
@@ -9,15 +9,3 @@
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_);
@@ -131,9 +_,11 @@
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(), j1, f10, f9, p_85993_, k1, vector3f.x(), vector3f.y(), vector3f.z());
}
}
@@ -9,15 +9,15 @@
public static final int UNKNOWN_ELEMENT = -1;
private final List<VertexFormatElement> elements;
private final List<String> names;
@@ -31,6 +_,7 @@
private GpuBuffer immediateDrawVertexBuffer;
@Nullable
private GpuBuffer immediateDrawIndexBuffer;
@@ -29,6 +_,7 @@
private final int[] offsetsByElement = new int[32];
private @Nullable GpuBuffer immediateDrawVertexBuffer;
private @Nullable GpuBuffer immediateDrawIndexBuffer;
+ private final com.google.common.collect.ImmutableMap<String, VertexFormatElement> elementMapping;
VertexFormat(List<VertexFormatElement> p_343616_, List<String> p_345241_, IntList p_345522_, int p_344162_) {
this.elements = p_343616_;
@@ -43,6 +_,11 @@
@@ -41,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() {
@@ -141,6 +_,9 @@
@@ -139,6 +_,9 @@
this.immediateDrawIndexBuffer = uploadToBuffer(this.immediateDrawIndexBuffer, p_391835_, 72, () -> "Immediate index buffer for " + this);
return this.immediateDrawIndexBuffer;
}
@@ -1,18 +1,18 @@
--- a/com/mojang/math/Transformation.java
+++ b/com/mojang/math/Transformation.java
@@ -14,7 +_,7 @@
import org.joml.Quaternionf;
import org.joml.Vector3f;
@@ -16,7 +_,7 @@
import org.joml.Vector3fc;
import org.jspecify.annotations.Nullable;
-public final class Transformation {
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
private final Matrix4fc matrix;
public static final Codec<Transformation> CODEC = RecordCodecBuilder.create(
p_269604_ -> p_269604_.group(
@@ -174,5 +_,19 @@
vector3f1.lerp(p_175938_.getScale(), p_175939_);
quaternionf1.slerp(p_175938_.getRightRotation(), p_175939_);
return new Transformation(vector3f, quaternionf, vector3f1, quaternionf1);
@@ -168,5 +_,19 @@
this.getScale().lerp(p_175938_.getScale(), p_175939_, new Vector3f()),
this.getRightRotation().slerp(p_175938_.getRightRotation(), p_175939_, new Quaternionf())
);
+ }
+
+ private Matrix3f normalTransform = null;
@@ -1,6 +1,6 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
@@ -71,6 +_,15 @@
@@ -62,6 +_,15 @@
}
@Override
@@ -15,4 +15,4 @@
+ @Override
public void render(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
super.render(p_283497_, p_88680_, p_88681_, p_88682_);
p_283497_.drawCenteredString(this.font, this.lines.title, this.width / 2, 80, -1);
p_283497_.drawCenteredString(this.font, this.title, this.width / 2, 80, -1);
@@ -0,0 +1,11 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsResetWorldScreen.java
@@ -263,7 +_,7 @@
int k = this.getY();
p_282595_.blit(RenderPipelines.GUI_TEXTURED, this.image, j + 2, k + 2, 0.0F, 0.0F, 56, 56, 56, 56, 56, 56, i);
p_282595_.blitSprite(RenderPipelines.GUI_TEXTURED, SLOT_FRAME_SPRITE, j, k, 60, 60, i);
- int l = flag ? -6250336 : -1;
+ int l = getFGColor();
p_282595_.drawCenteredString(RealmsResetWorldScreen.this.font, this.getMessage(), j + 28, k - 14, l);
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -224,6 +_,7 @@
@@ -216,6 +_,7 @@
}
static {
@@ -1,14 +1,14 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -233,7 +_,11 @@
@@ -231,7 +_,11 @@
}
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
- AdvancementHolder advancementholder = this.build(ResourceLocation.parse(p_138391_));
+ return save(p_138390_, ResourceLocation.parse(p_138391_));
- AdvancementHolder advancementholder = this.build(Identifier.parse(p_138391_));
+ return save(p_138390_, Identifier.parse(p_138391_));
+ }
+
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, Identifier id) {
+ AdvancementHolder advancementholder = this.build(id);
p_138390_.accept(advancementholder);
return advancementholder;
@@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/AdvancementRewards.java
+++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -43,6 +_,7 @@
@@ -44,6 +_,7 @@
LootParams lootparams = new LootParams.Builder(serverlevel)
.withParameter(LootContextParams.THIS_ENTITY, p_9990_)
.withParameter(LootContextParams.ORIGIN, p_9990_.position())
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -132,9 +_,13 @@
@@ -136,9 +_,13 @@
}
protected void setRotation(float p_90573_, float p_90574_) {
@@ -15,10 +15,10 @@
FORWARDS.rotate(this.rotation, this.forwards);
UP.rotate(this.rotation, this.up);
LEFT.rotate(this.rotation, this.left);
@@ -250,6 +_,13 @@
@@ -168,6 +_,13 @@
public float getPartialTickTime() {
return this.partialTickTime;
public float yRot() {
return this.yRot;
+ }
+
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/KeyMapping.java
+++ b/net/minecraft/client/KeyMapping.java
@@ -19,9 +_,9 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
-public class KeyMapping implements Comparable<KeyMapping> {
@@ -12,7 +12,7 @@
private final String name;
private final InputConstants.Key defaultKey;
private final KeyMapping.Category category;
@@ -38,7 +_,7 @@
@@ -39,7 +_,7 @@
}
private static void forAllKeyMappings(InputConstants.Key p_424096_, Consumer<KeyMapping> p_427756_) {
@@ -21,7 +21,7 @@
if (list != null && !list.isEmpty()) {
for (KeyMapping keymapping : list) {
p_427756_.accept(keymapping);
@@ -100,7 +_,7 @@
@@ -106,7 +_,7 @@
}
public boolean isDown() {
@@ -30,12 +30,13 @@
}
public KeyMapping.Category getCategory() {
@@ -140,7 +_,16 @@
public int compareTo(KeyMapping p_90841_) {
return this.category == p_90841_.category
? I18n.get(this.name).compareTo(I18n.get(p_90841_.name))
- : Integer.compare(KeyMapping.Category.SORT_ORDER.indexOf(this.category), KeyMapping.Category.SORT_ORDER.indexOf(p_90841_.category));
+ : compareSort(this.category, p_90841_.category);
@@ -149,8 +_,17 @@
? I18n.get(this.name).compareTo(I18n.get(p_90841_.name))
: Integer.compare(this.order, p_90841_.order);
} else {
- return Integer.compare(KeyMapping.Category.SORT_ORDER.indexOf(this.category), KeyMapping.Category.SORT_ORDER.indexOf(p_90841_.category));
+ return compareSort(this.category, p_90841_.category);
}
+ }
+
+ private static int compareSort(Category c1, Category c2) {
@@ -48,7 +49,7 @@
}
public static Supplier<Component> createNameSupplier(String p_90843_) {
@@ -149,6 +_,20 @@
@@ -159,6 +_,20 @@
}
public boolean same(KeyMapping p_90851_) {
@@ -69,7 +70,7 @@
return this.key.equals(p_90851_.key);
}
@@ -167,11 +_,13 @@
@@ -177,11 +_,13 @@
}
public Component getTranslatedKeyMessage() {
@@ -84,7 +85,7 @@
}
public String saveString() {
@@ -183,12 +_,94 @@
@@ -193,11 +_,94 @@
}
private void registerMapping(InputConstants.Key p_423386_) {
@@ -92,8 +93,7 @@
+ MAP.put(p_423386_, this);
}
@Nullable
public static KeyMapping get(String p_378660_) {
public static @Nullable KeyMapping get(String p_378660_) {
return ALL.get(p_378660_);
+ }
+
@@ -104,28 +104,28 @@
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, Category category) {
+ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category);
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, Category category, int order) {
+ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category, order);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputConstants.Key keyCode, Category category) {
+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category);
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, InputConstants.Key keyCode, Category category, int order) {
+ this(description, keyConflictContext, net.minecraftforge.client.settings.KeyModifier.NONE, keyCode, category, order);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, Category category) {
+ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category);
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, Category category, int order) {
+ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category, order);
+ }
+
+ /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, Category category) {
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, Category category, int order) {
+ this.name = description;
+ this.key = keyCode;
+ this.defaultKey = keyCode;
@@ -133,6 +133,7 @@
+ this.keyConflictContext = keyConflictContext;
+ this.keyModifier = keyModifier;
+ this.keyModifierDefault = keyModifier;
+ this.order = order;
+ if (this.keyModifier.matches(keyCode))
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ ALL.put(description, this);
@@ -1,12 +1,15 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -499,12 +_,12 @@
@@ -497,7 +_,7 @@
if (screen != null) {
try {
if (p_90895_ != 1 && p_90895_ != 2) {
- if (p_90895_ == 0 && screen.keyReleased(p_423534_)) {
+ if (p_90895_ == 0 && net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleased(screen, p_423534_)) {
return;
if (options.keyDebugModifier.matches(p_423534_)) {
this.usedDebugKeyAsModifier = false;
}
@@ -506,7 +_,7 @@
}
} else {
screen.afterKeyboardAction();
@@ -15,7 +18,7 @@
if (this.minecraft.screen == null) {
InputConstants.Key inputconstants$key = InputConstants.getKey(p_423534_);
KeyMapping.set(inputconstants$key, false);
@@ -568,6 +_,7 @@
@@ -582,6 +_,7 @@
}
}
}
@@ -23,7 +26,7 @@
}
}
@@ -576,7 +_,7 @@
@@ -590,7 +_,7 @@
Screen screen = this.minecraft.screen;
if (screen != null && this.minecraft.getOverlay() == null) {
try {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -260,7 +_,7 @@
@@ -265,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,7 +9,7 @@
static Minecraft instance;
private static final Logger LOGGER = LogUtils.getLogger();
private static final int MAX_TICKS_PER_UPDATE = 10;
@@ -439,7 +_,6 @@
@@ -431,7 +_,6 @@
}
}, Util.nonCriticalIoPool());
LOGGER.info("Setting user: {}", this.user.getName());
@@ -17,7 +17,7 @@
this.demo = p_91084_.game.demo;
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
this.allowsChat = !p_91084_.game.disableChat;
@@ -491,10 +_,9 @@
@@ -483,10 +_,9 @@
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
}
@@ -29,7 +29,7 @@
RenderSystem.initRenderer(
this.window.handle(),
this.options.glDebugVerbosity,
@@ -505,6 +_,7 @@
@@ -498,6 +_,7 @@
LOGGER.info("Using optional rendering extensions: {}", String.join(", ", RenderSystem.getDevice().getEnabledExtensions()));
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
@@ -37,7 +37,7 @@
this.resourcePackRepository.reload();
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
@@ -593,6 +_,7 @@
@@ -585,6 +_,7 @@
this.particleResources = new ParticleResources();
this.resourceManager.registerReloadListener(this.particleResources);
this.particleEngine = new ParticleEngine(this.level, this.particleResources);
@@ -45,7 +45,7 @@
this.particleResources.onReload(this.particleEngine::clearParticles);
this.waypointStyles = new WaypointStyleManager();
this.resourceManager.registerReloadListener(this.waypointStyles);
@@ -604,6 +_,9 @@
@@ -596,6 +_,9 @@
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
this.resourceManager.registerReloadListener(this.regionalCompliancies);
this.gui = new Gui(this);
@@ -55,7 +55,7 @@
RealmsClient realmsclient = RealmsClient.getOrCreate(this);
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
RenderSystem.setErrorCallback(this::onFullscreenError);
@@ -636,6 +_,7 @@
@@ -628,6 +_,7 @@
}
}
@@ -63,14 +63,14 @@
this.window.updateVsync(this.options.enableVsync().get());
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.window.setAllowCursorChanges(this.options.allowCursorChanges().get());
@@ -659,16 +_,17 @@
@@ -651,16 +_,17 @@
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
this.setOverlay(
- new LoadingOverlay(
- this, reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
- this, reloadinstance, p_447796_ -> Util.ifElse(p_447796_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
+ net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(
+ () -> this, () -> reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_296162_ -> this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie), () -> {
+ () -> this, () -> reloadinstance, p_296164_ -> Util.ifElse(p_296164_, p_447796_ -> this.rollbackResourcePacks(p_447796_, minecraft$gameloadcookie), () -> {
if (SharedConstants.IS_RUNNING_IN_IDE) {
this.selfTest();
}
@@ -84,7 +84,7 @@
);
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.logPath());
this.framerateLimitTracker = new FramerateLimitTracker(this.options, this);
@@ -787,6 +_,7 @@
@@ -779,6 +_,7 @@
StringBuilder stringbuilder = new StringBuilder("Minecraft");
if (checkModStatus().shouldReportAsModified()) {
stringbuilder.append("*");
@@ -92,7 +92,7 @@
}
stringbuilder.append(" ");
@@ -810,6 +_,8 @@
@@ -802,6 +_,8 @@
}
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
@@ -101,16 +101,16 @@
return p_193587_.game.offlineDeveloperMode ? UserApiService.OFFLINE : p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
}
@@ -822,7 +_,7 @@
@@ -814,7 +_,7 @@
}
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
private void rollbackResourcePacks(Throwable p_91240_, Minecraft.@Nullable GameLoadCookie p_299515_) {
- if (this.resourcePackRepository.getSelectedIds().size() > 1) {
+ if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
} else {
Util.throwAsRuntime(p_91240_);
@@ -1108,12 +_,6 @@
@@ -1100,12 +_,6 @@
LOGGER.error("setScreen called from non-game thread");
}
@@ -123,7 +123,7 @@
if (p_91153_ == null) {
if (this.clientLevelTeardownInProgress) {
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
@@ -1132,6 +_,23 @@
@@ -1124,6 +_,23 @@
}
}
@@ -147,28 +147,28 @@
this.screen = p_91153_;
if (this.screen != null) {
this.screen.added();
@@ -1214,6 +_,7 @@
FreeTypeUtil.destroy();
@@ -1207,6 +_,7 @@
Util.shutdownExecutors();
RenderSystem.getSamplerCache().close();
RenderSystem.getDevice().close();
+ net.minecraftforge.fml.config.ConfigTracker.INSTANCE.forceUnload();
} catch (Throwable throwable) {
LOGGER.error("Shutdown failure!", throwable);
throw throwable;
@@ -1278,7 +_,9 @@
RenderSystem.getDevice().createCommandEncoder().clearColorAndDepthTextures(rendertarget.getColorTexture(), 0, rendertarget.getDepthTexture(), 1.0);
profilerfiller.push("gameRenderer");
if (!this.noRender) {
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
this.gameRenderer.render(this.deltaTracker, p_91384_);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
}
@@ -1289,7 +_,9 @@
RenderSystem.getDevice().createCommandEncoder().clearColorAndDepthTextures(rendertarget.getColorTexture(), 0, rendertarget.getDepthTexture(), 1.0);
profilerfiller.push("gameRenderer");
if (!this.noRender) {
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.deltaTracker);
this.gameRenderer.render(this.deltaTracker, p_91384_);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.deltaTracker);
}
profilerfiller.popPush("blit");
@@ -1388,10 +_,12 @@
profilerfiller.popPush("blit");
@@ -1401,10 +_,12 @@
this.window.setGuiScale(i);
if (this.screen != null) {
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
this.screen.resize(this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
}
@@ -178,7 +178,7 @@
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
this.mouseHandler.setIgnoreFirstMove();
}
@@ -1529,6 +_,7 @@
@@ -1542,6 +_,7 @@
}
public void stop() {
@@ -186,58 +186,59 @@
this.running = false;
}
@@ -1556,10 +_,18 @@
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
- if (!this.level.getBlockState(blockpos).isAir()) {
+ if (!this.level.isEmptyBlock(blockpos)) {
@@ -1571,10 +_,18 @@
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
- if (!this.level.getBlockState(blockpos).isAir()) {
+ if (!this.level.isEmptyBlock(blockpos)) {
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
+ if (inputEvent.shouldSwingHand()) {
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
+ this.player.swing(InteractionHand.MAIN_HAND);
+ }
+ return;
+ }
Direction direction = blockhitresult.getDirection();
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
- this.level.addBreakingBlockEffect(blockpos, direction);
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
this.player.swing(InteractionHand.MAIN_HAND);
}
}
@@ -1611,6 +_,8 @@
this.player.swing(InteractionHand.MAIN_HAND);
return true;
} else {
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent)) {
+ if (inputEvent.shouldSwingHand()) {
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
+ this.player.swing(InteractionHand.MAIN_HAND);
+ }
+ return;
+ }
Direction direction = blockhitresult.getDirection();
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
- this.level.addBreakingBlockEffect(blockpos, direction);
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
+ this.level.addBreakingBlockEffect(blockpos, blockhitresult);
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
switch (this.hitResult.getType()) {
case ENTITY:
AttackRange attackrange = itemstack.get(DataComponents.ATTACK_RANGE);
@@ -1621,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
- if (!this.level.getBlockState(blockpos).isAir()) {
+ if (!this.level.isEmptyBlock(blockpos)) {
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
if (this.level.getBlockState(blockpos).isAir()) {
flag = true;
@@ -1634,9 +_,10 @@
}
this.player.resetAttackStrengthTicker();
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
}
- if (!this.player.isSpectator()) {
+ if (!this.player.isSpectator() && inputEvent.shouldSwingHand()) {
this.player.swing(InteractionHand.MAIN_HAND);
}
}
@@ -1587,6 +_,8 @@
return false;
} else {
boolean flag = false;
+ var inputEvent = new net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (!net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered.BUS.post(inputEvent))
switch (this.hitResult.getType()) {
case ENTITY:
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
@@ -1594,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
- if (!this.level.getBlockState(blockpos).isAir()) {
+ if (!this.level.isEmptyBlock(blockpos)) {
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
if (this.level.getBlockState(blockpos).isAir()) {
flag = true;
@@ -1607,8 +_,10 @@
}
this.player.resetAttackStrengthTicker();
+ net.minecraftforge.event.ForgeEventFactory.onLeftClickEmpty(this.player);
}
+ if (inputEvent.shouldSwingHand())
this.player.swing(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1624,6 +_,12 @@
@@ -1655,6 +_,12 @@
}
for (InteractionHand interactionhand : InteractionHand.values()) {
@@ -250,16 +251,16 @@
ItemStack itemstack = this.player.getItemInHand(interactionhand);
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
return;
@@ -1644,7 +_,7 @@
}
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);
@@ -1676,7 +_,7 @@
}
@@ -1656,7 +_,7 @@
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);
}
@@ -1689,7 +_,7 @@
int i = itemstack.getCount();
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
if (interactionresult1 instanceof InteractionResult.Success interactionresult$success) {
@@ -268,7 +269,7 @@
this.player.swing(interactionhand);
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.player.hasInfiniteMaterials())) {
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
@@ -1672,6 +_,9 @@
@@ -1705,6 +_,9 @@
}
}
@@ -278,7 +279,7 @@
if (!itemstack.isEmpty()
&& this.gameMode.useItem(this.player, interactionhand) instanceof InteractionResult.Success interactionresult$success1) {
if (interactionresult$success1.swingSource() == InteractionResult.SwingSource.CLIENT) {
@@ -1701,6 +_,8 @@
@@ -1734,6 +_,8 @@
}
ProfilerFiller profilerfiller = Profiler.get();
@@ -287,7 +288,7 @@
profilerfiller.push("gui");
this.chatListener.tick();
this.gui.tick(this.pause);
@@ -1786,6 +_,7 @@
@@ -1815,6 +_,7 @@
this.tutorial.tick();
@@ -295,7 +296,7 @@
try {
this.level.tick(() -> true);
} catch (Throwable throwable1) {
@@ -1799,6 +_,7 @@
@@ -1828,6 +_,7 @@
throw new ReportedException(crashreport1);
}
@@ -303,7 +304,7 @@
}
profilerfiller.popPush("animateTick");
@@ -1823,6 +_,7 @@
@@ -1852,6 +_,7 @@
profilerfiller.popPush("keyboard");
this.keyboardHandler.tick();
profilerfiller.pop();
@@ -311,7 +312,7 @@
}
private boolean isLevelRunningNormally() {
@@ -2041,6 +_,7 @@
@@ -2070,6 +_,7 @@
}
public void setLevel(ClientLevel p_91157_) {
@@ -319,7 +320,7 @@
this.level = p_91157_;
this.updateLevelInEngines(p_91157_);
}
@@ -2094,6 +_,7 @@
@@ -2131,6 +_,7 @@
IntegratedServer integratedserver = this.singleplayerServer;
this.singleplayerServer = null;
this.gameRenderer.resetData();
@@ -327,7 +328,7 @@
this.gameMode = null;
this.narrator.clear();
this.clientLevelTeardownInProgress = true;
@@ -2101,6 +_,7 @@
@@ -2138,6 +_,7 @@
try {
if (this.level != null) {
this.gui.onDisconnected();
@@ -335,15 +336,15 @@
}
if (integratedserver != null) {
@@ -2113,6 +_,7 @@
@@ -2150,6 +_,7 @@
}
profilerfiller.pop();
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level);
}
this.setScreenAndShow(p_335030_);
@@ -2254,6 +_,7 @@
this.setScreenAndShow(p_457642_);
@@ -2292,6 +_,7 @@
private void pickBlock() {
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
@@ -8,16 +8,16 @@
if (this.minecraft.getOverlay() == null) {
if (this.minecraft.screen == null) {
if (!this.mouseGrabbed && flag) {
@@ -103,7 +_,7 @@
try {
long i = Util.getMillis();
boolean flag1 = i - this.lastClickTime < 250L && this.lastClickButton == mousebuttonevent.button();
@@ -106,7 +_,7 @@
&& i - this.lastClick.time() < 250L
&& this.lastClick.screen() == screen
&& this.lastClickButton == mousebuttonevent.button();
- if (screen.mouseClicked(mousebuttonevent, flag1)) {
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, d0, d1, mousebuttonevent, flag1)) {
this.lastClickTime = i;
this.lastClick = new MouseHandler.LastClick(i, screen);
this.lastClickButton = mousebuttoninfo.button();
return;
@@ -118,7 +_,7 @@
@@ -121,7 +_,7 @@
}
} else {
try {
@@ -26,7 +26,7 @@
return;
}
} catch (Throwable throwable) {
@@ -148,6 +_,7 @@
@@ -151,6 +_,7 @@
KeyMapping.click(inputconstants$key);
}
}
@@ -34,7 +34,7 @@
}
}
@@ -204,7 +_,9 @@
@@ -207,7 +_,9 @@
if (this.minecraft.screen != null) {
double d3 = this.getScaledXPos(this.minecraft.getWindow());
double d4 = this.getScaledYPos(this.minecraft.getWindow());
@@ -45,7 +45,7 @@
this.minecraft.screen.afterMouseAction();
} else if (this.minecraft.player != null) {
Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2);
@@ -213,6 +_,7 @@
@@ -216,6 +_,7 @@
}
int i = vector2i.y == 0 ? -vector2i.x : vector2i.y;
@@ -53,7 +53,7 @@
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i);
@@ -321,7 +_,7 @@
@@ -324,7 +_,7 @@
double d5 = getScaledYPos(window, this.accumulatedDY);
try {
@@ -62,7 +62,7 @@
} catch (Throwable throwable) {
CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler");
screen.fillCrashDetails(crashreport1);
@@ -408,6 +_,14 @@
@@ -411,6 +_,14 @@
public double ypos() {
return this.ypos;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -709,7 +_,8 @@
@@ -816,7 +_,8 @@
},
new OptionInstance.LazyEnum<>(
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
@@ -10,15 +10,15 @@
? Optional.empty()
: Optional.of(p_232011_),
Codec.STRING
@@ -743,6 +_,7 @@
@@ -848,6 +_,7 @@
);
public boolean syncWrites;
public boolean startedCleanly = true;
+ private final Map<String, String> unknownKeys = new java.util.HashMap<>();
public OptionInstance<Boolean> darkMojangStudiosBackground() {
return this.darkMojangStudiosBackground;
@@ -1150,6 +_,7 @@
private static void operateOnLevelRenderer(Consumer<LevelRenderer> p_457625_) {
LevelRenderer levelrenderer = Minecraft.getInstance().levelRenderer;
@@ -1313,6 +_,7 @@
}
public Options(Minecraft p_92138_, File p_92139_) {
@@ -26,9 +26,9 @@
this.minecraft = p_92138_;
this.optionsFile = new File(p_92139_, "options.txt");
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
@@ -1290,15 +_,28 @@
@@ -1463,15 +_,28 @@
this.startedCleanly = p_168428_.process("startedCleanly", this.startedCleanly);
p_168428_.process("showNowPlayingToast", this.showNowPlayingToast);
p_168428_.process("musicToast", this.musicToast);
p_168428_.process("musicFrequency", this.musicFrequency);
+ processOptionsKeysOnly(p_168428_);
+ processOptionsEnd(p_168428_);
@@ -56,7 +56,7 @@
for (SoundSource soundsource : SoundSource.values()) {
p_168428_.process("soundCategory_" + soundsource.getName(), this.soundSourceVolumes.get(soundsource));
}
@@ -1313,6 +_,10 @@
@@ -1486,6 +_,10 @@
}
public void load() {
@@ -67,17 +67,17 @@
try {
if (!this.optionsFile.exists()) {
return;
@@ -1337,7 +_,8 @@
this.graphicsMode.set(isTrue(optional.get()) ? GraphicsStatus.FANCY : GraphicsStatus.FAST);
@@ -1505,7 +_,8 @@
}
final CompoundTag compoundtag1 = this.dataFix(compoundtag);
- this.processOptions(
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsKeysOnly : this::processOptions;
+ processor.accept(
new Options.FieldAccess() {
@Nullable
private String getValue(String p_394210_) {
@@ -1418,6 +_,17 @@
private @Nullable String getValue(String p_394210_) {
Tag tag = compoundtag1.get(p_394210_);
@@ -1585,6 +_,17 @@
);
compoundtag1.getString("fullscreenResolution").ifPresent(p_389133_ -> this.fullscreenVideoModeString = p_389133_);
KeyMapping.resetMapping();
@@ -95,7 +95,7 @@
} catch (Exception exception) {
LOGGER.error("Failed to load options", (Throwable)exception);
}
@@ -1445,9 +_,11 @@
@@ -1612,9 +_,11 @@
public void save() {
try (final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.optionsFile), StandardCharsets.UTF_8))) {
printwriter.println("version:" + SharedConstants.getCurrentVersion().dataVersion().version());
@@ -107,7 +107,7 @@
printwriter.print(p_168491_);
printwriter.print(':');
}
@@ -1503,6 +_,12 @@
@@ -1670,6 +_,12 @@
if (s != null) {
printwriter.println("fullscreenResolution:" + s);
}
@@ -120,7 +120,7 @@
} catch (Exception exception) {
LOGGER.error("Failed to save options", (Throwable)exception);
}
@@ -1541,6 +_,7 @@
@@ -1707,6 +_,7 @@
}
public void broadcastOptions() {
@@ -128,7 +128,7 @@
if (this.minecraft.player != null) {
this.minecraft.player.connection.broadcastClientInformation(this.buildPlayerInformation());
}
@@ -1654,6 +_,23 @@
@@ -1820,6 +_,23 @@
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
@@ -4,7 +4,7 @@
file2 = new File(file1, p_92297_);
}
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(p_389141_, file2);
+ var event = new net.minecraftforge.client.event.ScreenshotEvent(p_447863_, file2);
+ if (net.minecraftforge.client.event.ScreenshotEvent.BUS.post(event)) {
+ p_92301_.accept(event.getCancelMessage());
+ return;
@@ -15,12 +15,12 @@
.execute(
() -> {
@@ -50,10 +_,13 @@
NativeImage $$4x = p_389141_;
NativeImage $$4x = p_447863_;
try {
- p_389141_.writeToFile(file2);
- p_447863_.writeToFile(file2);
- Component component = Component.literal(file2.getName())
+ p_389141_.writeToFile(target);
+ p_447863_.writeToFile(target);
+ Component component = Component.literal(target.getName())
.withStyle(ChatFormatting.UNDERLINE)
.withStyle(p_389149_ -> p_389149_.withClickEvent(new ClickEvent.OpenFile(file2.getAbsoluteFile())));
@@ -29,4 +29,4 @@
+ else
p_92301_.accept(Component.translatable("screenshot.success", component));
} catch (Throwable throwable1) {
if (p_389141_ != null) {
if (p_447863_ != null) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/data/Main.java
+++ b/net/minecraft/client/data/Main.java
@@ -31,13 +_,18 @@
@@ -30,13 +_,18 @@
OptionSpec<Void> optionspec1 = optionparser.accepts("client", "Include client generators");
OptionSpec<Void> optionspec2 = optionparser.accepts("all", "Include all generators");
OptionSpec<String> optionspec3 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/data/models/ItemModelGenerators.java
+++ b/net/minecraft/client/data/models/ItemModelGenerators.java
@@ -882,6 +_,9 @@
@@ -912,6 +_,9 @@
this.declareCustomModelItem(Items.COD);
this.declareCustomModelItem(Items.FEATHER);
this.declareCustomModelItem(Items.LEAD);
@@ -21,11 +21,11 @@
}
+ protected Stream<Block> getKnownBlocks() {
+ return BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().location().getNamespace()));
+ return BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().identifier().getNamespace()));
+ }
+
+ protected Stream<Item> getKnownItems() {
+ return BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().location().getNamespace()));
+ return BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().identifier().getNamespace()));
+ }
+
+ protected BlockModelGenerators getBlockModelGenerators(BlockStateGeneratorCollector blocks, ItemInfoCollector items, SimpleModelCollector models) {
@@ -46,7 +46,7 @@
+ private final Supplier<Stream<Block>> known;
+
+ public BlockStateGeneratorCollector() {
+ this(() -> BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().location().getNamespace())));
+ this(() -> BuiltInRegistries.BLOCK.stream().filter(block -> "minecraft".equals(block.builtInRegistryHolder().key().identifier().getNamespace())));
+ }
+
+ public BlockStateGeneratorCollector(Supplier<Stream<Block>> known) {
@@ -61,8 +61,8 @@
public void validate() {
- Stream<Holder.Reference<Block>> stream = BuiltInRegistries.BLOCK.listElements().filter(p_376480_ -> true);
+ Stream<Holder.Reference<Block>> stream = known.get().map(Block::builtInRegistryHolder);
List<ResourceLocation> list = stream.filter(p_378423_ -> !this.generators.containsKey(p_378423_.value()))
.map(p_378200_ -> p_378200_.key().location())
List<Identifier> list = stream.filter(p_378423_ -> !this.generators.containsKey(p_378423_.value()))
.map(p_447940_ -> p_447940_.key().identifier())
.toList();
@@ -97,6 +_,15 @@
public static class ItemInfoCollector implements ItemModelOutput {
@@ -71,7 +71,7 @@
+ private final Supplier<Stream<Item>> known;
+
+ public ItemInfoCollector() {
+ this(() -> BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().location().getNamespace())));
+ this(() -> BuiltInRegistries.ITEM.stream().filter(item -> "minecraft".equals(item.builtInRegistryHolder().key().identifier().getNamespace())));
+ }
+
+ public ItemInfoCollector(Supplier<Stream<Item>> known) {
@@ -79,16 +79,16 @@
+ }
@Override
public void accept(Item p_376450_, ItemModel.Unbaked p_378513_) {
public void accept(Item p_376450_, ItemModel.Unbaked p_378513_, ClientItem.Properties p_455809_) {
@@ -115,7 +_,7 @@
this.copies.put(p_376965_, p_377438_);
}
- public void finalizeAndValidate() {
+ public void generateDefaultBlockModels() {
BuiltInRegistries.ITEM.forEach(p_378629_ -> {
if (!this.copies.containsKey(p_378629_)) {
if (p_378629_ instanceof BlockItem blockitem && !this.itemInfos.containsKey(blockitem)) {
BuiltInRegistries.ITEM.forEach(p_447944_ -> {
if (!this.copies.containsKey(p_447944_)) {
if (p_447944_ instanceof BlockItem blockitem && !this.itemInfos.containsKey(blockitem)) {
@@ -124,6 +_,8 @@
}
}
@@ -102,10 +102,10 @@
this.register(p_376289_, clientitem);
}
});
- List<ResourceLocation> list = BuiltInRegistries.ITEM
- List<Identifier> list = BuiltInRegistries.ITEM
- .listElements()
+ List<ResourceLocation> list = known.get()
+ List<Identifier> list = known.get()
+ .map(item -> item.builtInRegistryHolder())
.filter(p_377225_ -> !this.itemInfos.containsKey(p_377225_.value()))
.map(p_378591_ -> p_378591_.key().location())
.map(p_447943_ -> p_447943_.key().identifier())
.toList();
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -31,7 +_,7 @@
import org.joml.Matrix4f;
@@ -32,7 +_,7 @@
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
-public class Font {
@@ -9,7 +9,7 @@
private final SubtitleOverlay subtitleOverlay;
private final SpectatorGui spectatorGui;
private final PlayerTabOverlay tabList;
@@ -196,6 +_,7 @@
@@ -193,6 +_,7 @@
() -> new JumpableVehicleBarRenderer(p_330021_)
);
this.resetTitleTimes();
@@ -17,7 +17,7 @@
}
public void resetTitleTimes() {
@@ -206,6 +_,10 @@
@@ -203,6 +_,10 @@
public void render(GuiGraphics p_282884_, DeltaTracker p_342095_) {
if (!(this.minecraft.screen instanceof LevelLoadingScreen)) {
@@ -28,16 +28,16 @@
if (!this.minecraft.options.hideGui) {
this.renderCameraOverlays(p_282884_, p_342095_);
this.renderCrosshair(p_282884_, p_342095_);
@@ -389,7 +_,7 @@
@@ -386,7 +_,7 @@
int i = Mth.floor(this.minecraft.mouseHandler.getScaledXPos(window));
int j = Mth.floor(this.minecraft.mouseHandler.getScaledYPos(window));
p_329202_.nextStratum();
- this.chat.render(p_329202_, this.tickCount, i, j, false);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount);
- this.chat.render(p_329202_, this.getFont(), this.tickCount, i, j, false, false);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeChatEvent(p_329202_, this.chat, window, i, j, this.tickCount, this.getFont());
}
}
@@ -477,6 +_,8 @@
@@ -476,6 +_,8 @@
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
Holder<MobEffect> holder = mobeffectinstance.getEffect();
@@ -46,7 +46,7 @@
if (mobeffectinstance.showIcon()) {
int k = p_282812_.guiWidth();
int l = 1;
@@ -507,6 +_,7 @@
@@ -506,6 +_,7 @@
}
}
@@ -54,7 +54,7 @@
p_282812_.blitSprite(RenderPipelines.GUI_TEXTURED, getMobEffectSprite(holder), k + 3, l + 3, 18, 18, ARGB.white(f));
}
}
@@ -603,6 +_,10 @@
@@ -602,6 +_,10 @@
}
public void renderSelectedItemName(GuiGraphics p_283501_) {
@@ -65,7 +65,7 @@
Profiler.get().push("selectedItemName");
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
@@ -610,9 +_,13 @@
@@ -609,9 +_,13 @@
mutablecomponent.withStyle(ChatFormatting.ITALIC);
}
@@ -81,16 +81,16 @@
if (!this.minecraft.gameMode.canHurtPlayer()) {
k += 14;
}
@@ -623,7 +_,7 @@
@@ -622,7 +_,7 @@
}
if (l > 0) {
- 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));
- p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, ARGB.white(l));
+ p_283501_.drawStringWithBackdrop(font, highlightTip, j, k, i, ARGB.white(l));
}
}
@@ -1151,7 +_,7 @@
@@ -1148,7 +_,7 @@
ItemStack itemstack = this.minecraft.player.getInventory().getSelectedItem();
if (itemstack.isEmpty()) {
this.toolHighlightTimer = 0;
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/GuiGraphics.java
+++ b/net/minecraft/client/gui/GuiGraphics.java
@@ -83,7 +_,7 @@
import org.joml.Vector3f;
@@ -86,7 +_,7 @@
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
-public class GuiGraphics {
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
private final Minecraft minecraft;
final Minecraft minecraft;
private final Matrix3x2fStack pose;
@@ -950,6 +_,7 @@
@@ -972,6 +_,7 @@
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_283653_.getItem()));
@@ -17,7 +17,7 @@
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_283653_.getComponents()));
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_283653_.hasFoil()));
throw new ReportedException(crashreport);
@@ -968,6 +_,7 @@
@@ -990,6 +_,7 @@
this.renderItemCooldown(p_283349_, p_282641_, p_282146_);
this.renderItemCount(p_282005_, p_283349_, p_282641_, p_282146_, p_282803_);
this.pose.popMatrix();
@@ -25,7 +25,7 @@
}
}
@@ -979,21 +_,30 @@
@@ -1001,21 +_,30 @@
this.setTooltipForNextFrame(this.minecraft.font, p_407686_, DefaultTooltipPositioner.INSTANCE, p_410475_, p_407139_, false);
}
@@ -50,15 +50,15 @@
+ }
+
public void setTooltipForNextFrame(
Font p_407847_, List<Component> p_408847_, Optional<TooltipComponent> p_410489_, int p_409369_, int p_407472_, @Nullable ResourceLocation p_410303_
Font p_408450_, List<Component> p_405939_, Optional<TooltipComponent> p_456997_, int p_409519_, int p_410392_, @Nullable Identifier p_460731_
) {
- List<ClientTooltipComponent> list = p_408847_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
- p_410489_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_408847_, p_410489_, p_409369_, guiWidth(), guiHeight(), p_407847_);
this.setTooltipForNextFrameInternal(p_407847_, list, p_409369_, p_407472_, DefaultTooltipPositioner.INSTANCE, p_410303_, false);
- List<ClientTooltipComponent> list = p_405939_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Util.toMutableList());
- p_456997_.ifPresent(p_325321_ -> list.add(list.isEmpty() ? 0 : 1, ClientTooltipComponent.create(p_325321_)));
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_405939_, p_456997_, p_409519_, guiWidth(), guiHeight(), p_408450_);
this.setTooltipForNextFrameInternal(p_408450_, list, p_409519_, p_410392_, DefaultTooltipPositioner.INSTANCE, p_460731_, false);
}
@@ -1006,7 +_,22 @@
@@ -1028,7 +_,22 @@
}
public void setComponentTooltipForNextFrame(Font p_406239_, List<Component> p_410275_, int p_410594_, int p_409343_) {
@@ -81,32 +81,33 @@
+ this.tooltipStack = ItemStack.EMPTY;
}
public void setComponentTooltipForNextFrame(Font p_408650_, List<Component> p_407512_, int p_406019_, int p_408123_, @Nullable ResourceLocation p_409993_) {
@@ -1056,9 +_,14 @@
public void setComponentTooltipForNextFrame(Font p_408650_, List<Component> p_407512_, int p_406019_, int p_408123_, @Nullable Identifier p_456486_) {
@@ -1073,24 +_,31 @@
int p_407794_,
int p_408784_,
ClientTooltipPositioner p_408798_,
- @Nullable Identifier p_451079_,
+ @Nullable Identifier p_456486_,
boolean p_410618_
) {
if (!p_409928_.isEmpty()) {
if (this.deferredTooltip == null || p_410618_) {
- this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_407676_);
- this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_451079_);
+ final var stackContext = this.tooltipStack;
+ this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_407676_, stackContext);
+ this.deferredTooltip = () -> this.renderTooltip(p_406605_, p_409928_, p_407794_, p_408784_, p_408798_, p_456486_, stackContext);
}
}
+ }
+
+ public void renderTooltip(Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable ResourceLocation p_409298_) {
+ renderTooltip(p_283128_, p_282716_, p_283678_, p_281696_, p_409451_, p_409298_, ItemStack.EMPTY);
+ public void renderTooltip(Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_456486_) {
+ renderTooltip(p_283128_, p_282716_, p_283678_, p_281696_, p_409451_, p_456486_, ItemStack.EMPTY);
}
public void renderTooltip(
@@ -1067,13 +_,16 @@
int p_283678_,
int p_281696_,
ClientTooltipPositioner p_409451_,
- @Nullable ResourceLocation p_409298_
+ @Nullable ResourceLocation p_409298_,
+ ItemStack itemstack
- Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_459396_
+ Font p_283128_, List<ClientTooltipComponent> p_282716_, int p_283678_, int p_281696_, ClientTooltipPositioner p_409451_, @Nullable Identifier p_459396_, ItemStack itemstack
) {
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, p_283678_, p_281696_, guiWidth(), guiHeight(), p_282716_, p_283128_, p_409451_, p_409298_);
+ var preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(itemstack, this, p_283678_, p_281696_, guiWidth(), guiHeight(), p_282716_, p_283128_, p_409451_, p_459396_);
+ if (preEvent == null) return;
int i = 0;
int j = p_282716_.size() == 1 ? -2 : 0;
@@ -117,7 +118,7 @@
if (k > i) {
i = k;
}
@@ -1083,16 +_,16 @@
@@ -1100,16 +_,16 @@
int l1 = i;
int i2 = j;
@@ -126,7 +127,7 @@
int l = vector2ic.x();
int i1 = vector2ic.y();
this.pose.pushMatrix();
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, p_409298_);
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, p_459396_);
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i, j, preEvent.getBackground());
int j1 = i1;
@@ -137,7 +138,7 @@
j1 += clienttooltipcomponent1.getHeight(p_283128_) + (k1 == 0 ? 2 : 0);
}
@@ -1100,7 +_,7 @@
@@ -1117,7 +_,7 @@
for (int j2 = 0; j2 < p_282716_.size(); j2++) {
ClientTooltipComponent clienttooltipcomponent2 = p_282716_.get(j2);
@@ -146,7 +147,7 @@
j1 += clienttooltipcomponent2.getHeight(p_283128_) + (j2 == 0 ? 2 : 0);
}
@@ -1315,6 +_,14 @@
@@ -1328,6 +_,14 @@
public void submitProfilerChartRenderState(List<ResultField> p_408565_, int p_410147_, int p_406156_, int p_407365_, int p_408180_) {
this.guiRenderState.submitPicturesInPictureState(new GuiProfilerChartRenderState(p_408565_, p_410147_, p_406156_, p_407365_, p_408180_, this.scissorStack.peek()));
@@ -1,11 +0,0 @@
--- a/net/minecraft/client/gui/components/AbstractButton.java
+++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -41,7 +_,7 @@
this.getHeight(),
ARGB.white(this.alpha)
);
- int i = ARGB.color(this.alpha, this.active ? -1 : -6250336);
+ int i = getFGColor();
this.renderString(p_281670_, minecraft.font, i);
if (this.isHovered()) {
p_281670_.requestCursor(this.isActive() ? CursorTypes.POINTING_HAND : CursorTypes.NOT_ALLOWED);
@@ -1,17 +1,16 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -238,6 +_,25 @@
@@ -221,6 +_,23 @@
this.focused = p_93693_;
}
+ // Forge start
+ public static final int UNSET_FG_COLOR = -1;
+
+ protected int packedFGColor = UNSET_FG_COLOR;
+
+ public int getFGColor() {
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
+ return net.minecraft.util.ARGB.color(this.alpha, this.active ? -1 : -6250336); // White : Light Grey
+ return this.active ? net.minecraft.util.CommonColors.WHITE : net.minecraft.util.CommonColors.LIGHT_GRAY;
+ }
+
+ public void setFGColor(int color) {
@@ -21,7 +20,6 @@
+ public void clearFGColor() {
+ this.packedFGColor = UNSET_FG_COLOR;
+ }
+ // Forge end
+
@Override
public NarratableEntry.NarrationPriority narrationPriority() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/Button.java
+++ b/net/minecraft/client/gui/components/Button.java
@@ -32,6 +_,12 @@
@@ -33,6 +_,12 @@
this.createNarration = p_259552_;
}
@@ -17,10 +17,10 @@
}
public Button build() {
- Button button = new Button(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
- Button button = new Button.Plain(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
- button.setTooltip(this.tooltip);
- return button;
+ return build(Button::new);
+ return build(Button.Plain::new);
+ }
+
+ // Forge (GH-9238)
@@ -29,3 +29,14 @@
}
}
@@ -118,6 +_,10 @@
int p_455297_, int p_455388_, int p_459653_, int p_452847_, Component p_459347_, Button.OnPress p_453378_, Button.CreateNarration p_456163_
) {
super(p_455297_, p_455388_, p_459653_, p_452847_, p_459347_, p_453378_, p_456163_);
+ }
+
+ protected Plain(Builder builder) {
+ super(builder);
}
@Override
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/toasts/ToastManager.java
+++ b/net/minecraft/client/gui/components/toasts/ToastManager.java
@@ -146,6 +_,7 @@
@@ -142,6 +_,7 @@
}
public void addToast(Toast p_360768_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/render/GuiRenderer.java
+++ b/net/minecraft/client/gui/render/GuiRenderer.java
@@ -146,6 +_,7 @@
@@ -138,6 +_,7 @@
builder.put((Class<? extends PictureInPictureRenderState>)pictureinpicturerenderer.getRenderStateClass(), pictureinpicturerenderer);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
@@ -103,6 +_,8 @@
@@ -102,6 +_,8 @@
}
if (optional.isEmpty()) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
@@ -62,6 +_,8 @@
@@ -63,6 +_,8 @@
return p_169325_ & 16777215 | p_169326_ << 24;
}
@@ -9,7 +9,7 @@
@Override
public void render(GuiGraphics p_281839_, int p_282704_, int p_283650_, float p_283394_) {
int i = p_281839_.guiWidth();
@@ -102,6 +_,7 @@
@@ -103,6 +_,7 @@
f2 = 1.0F;
}
@@ -17,7 +17,7 @@
int l2 = (int)(p_281839_.guiWidth() * 0.5);
int i1 = (int)(p_281839_.guiHeight() * 0.5);
double d0 = Math.min(p_281839_.guiWidth() * 0.75, (double)p_281839_.guiHeight()) * 0.25;
@@ -117,6 +_,7 @@
@@ -118,6 +_,7 @@
if (f < 1.0F) {
this.drawProgressBar(p_281839_, i / 2 - k1, i2 - 5, i / 2 + k1, i2 + 5, 1.0F - Mth.clamp(f, 0.0F, 1.0F));
}
@@ -25,7 +25,7 @@
if (f >= 2.0F) {
this.minecraft.setOverlay(null);
@@ -126,6 +_,7 @@
@@ -127,6 +_,7 @@
@Override
public void tick() {
if (this.fadeOutStart == -1L && this.reload.isDone() && this.isReadyToFadeOut()) {
@@ -33,11 +33,11 @@
try {
this.reload.checkExceptions();
this.onFinish.accept(Optional.empty());
@@ -133,7 +_,6 @@
@@ -134,7 +_,6 @@
this.onFinish.accept(Optional.of(throwable));
}
- this.fadeOutStart = Util.getMillis();
if (this.minecraft.screen != null) {
Window window = this.minecraft.getWindow();
this.minecraft.screen.init(this.minecraft, window.getGuiScaledWidth(), window.getGuiScaledHeight());
this.minecraft.screen.init(window.getGuiScaledWidth(), window.getGuiScaledHeight());
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -103,6 +_,7 @@
@@ -102,6 +_,7 @@
} else {
gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, () -> new SocialInteractionsScreen(this)));
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -191,7 +_,7 @@
@@ -194,7 +_,7 @@
}
public void onClose() {
@@ -9,7 +9,7 @@
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
@@ -343,8 +_,10 @@
@@ -326,8 +_,10 @@
this.width = p_96608_;
this.height = p_96609_;
if (!this.initialized) {
@@ -20,7 +20,7 @@
} else {
this.repositionElements();
}
@@ -361,8 +_,10 @@
@@ -344,8 +_,10 @@
protected void rebuildWidgets() {
this.clearWidgets();
this.clearFocus();
@@ -31,7 +31,7 @@
}
protected void fadeWidgets(float p_409453_) {
@@ -402,6 +_,8 @@
@@ -385,6 +_,8 @@
this.renderMenuBackground(p_283688_);
}
@@ -40,7 +40,7 @@
this.minecraft.gui.renderDeferredSubtitles();
}
@@ -484,6 +_,19 @@
@@ -467,6 +_,19 @@
}
public void onFilesDrop(List<Path> p_96591_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/TitleScreen.java
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
@@ -55,6 +_,7 @@
@@ -53,6 +_,7 @@
private boolean fading;
private long fadeInStart;
private final LogoRenderer logoRenderer;
@@ -8,7 +8,7 @@
public TitleScreen() {
this(false);
@@ -107,11 +_,15 @@
@@ -105,11 +_,15 @@
int j = this.width - i - 2;
int k = 24;
int l = this.height / 4 + 48;
@@ -24,7 +24,7 @@
l = this.createTestWorldButton(l, 24);
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
@@ -178,7 +_,7 @@
@@ -176,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)))
@@ -33,11 +33,11 @@
.tooltip(tooltip)
.build()
)
@@ -298,9 +_,18 @@
@@ -295,9 +_,18 @@
s = s + I18n.get("menu.modded");
}
- p_282860_.drawString(this.font, s, 2, this.height - 10, ARGB.color(f, -1));
- p_282860_.drawString(this.font, s, 2, this.height - 10, ARGB.white(f));
+ final float f_f = f;
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brd, brdline) ->
+ p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), ARGB.color(f_f, -1))
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -39,6 +_,7 @@
@@ -40,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_
@@ -55,6 +_,15 @@
@@ -56,6 +_,15 @@
this.addWidget(this.root, p_297568_.holder());
}
@@ -24,7 +24,7 @@
public AdvancementTabType getType() {
return this.type;
}
@@ -145,8 +_,8 @@
@@ -150,8 +_,8 @@
return null;
} else {
for (AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -53,6 +_,7 @@
@Nullable
private AdvancementTab selectedTab;
@@ -52,6 +_,7 @@
private final Map<AdvancementHolder, AdvancementTab> tabs = Maps.newLinkedHashMap();
private @Nullable AdvancementTab selectedTab;
private boolean isScrolling;
+ private static int tabPage, maxPages;
public AdvancementsScreen(ClientAdvancements p_97340_) {
this(p_97340_, null);
@@ -66,6 +_,19 @@
@@ -65,6 +_,19 @@
@Override
protected void init() {
@@ -28,7 +28,7 @@
this.layout.addTitleHeader(TITLE, this.font);
this.tabs.clear();
this.selectedTab = null;
@@ -110,7 +_,7 @@
@@ -109,7 +_,7 @@
int j = (this.height - 140) / 2;
for (AdvancementTab advancementtab : this.tabs.values()) {
@@ -37,12 +37,12 @@
this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
break;
}
@@ -185,10 +_,12 @@
@@ -200,10 +_,12 @@
p_283395_.blit(RenderPipelines.GUI_TEXTURED, 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)
advancementtab.drawTab(p_283395_, p_281890_, p_282532_, advancementtab == this.selectedTab);
advancementtab.drawTab(p_283395_, p_281890_, p_282532_, p_451461_, p_451545_, advancementtab == this.selectedTab);
}
for (AdvancementTab advancementtab1 : this.tabs.values()) {
@@ -50,7 +50,7 @@
advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_);
}
}
@@ -207,6 +_,7 @@
@@ -222,6 +_,7 @@
if (this.tabs.size() > 1) {
for (AdvancementTab advancementtab : this.tabs.values()) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -105,6 +_,7 @@
@@ -102,6 +_,7 @@
int i = this.leftPos;
int j = this.topPos;
super.render(p_409971_, p_409213_, p_408205_, p_408282_);
@@ -8,7 +8,7 @@
p_409971_.pose().pushMatrix();
p_409971_.pose().translate(i, j);
this.renderLabels(p_409971_, p_409213_, p_408205_);
@@ -117,6 +_,8 @@
@@ -114,6 +_,8 @@
this.onStopHovering(slot);
}
@@ -17,7 +17,7 @@
p_409971_.pose().popMatrix();
}
@@ -200,7 +_,7 @@
@@ -197,7 +_,7 @@
ItemStack itemstack = this.hoveredSlot.getItem();
if (this.menu.getCarried().isEmpty() || this.showTooltipWithItemInHand(itemstack)) {
p_283594_.setTooltipForNextFrame(
@@ -26,7 +26,7 @@
);
}
}
@@ -216,7 +_,8 @@
@@ -213,7 +_,8 @@
private void renderFloatingItem(GuiGraphics p_282567_, ItemStack p_281330_, int p_281772_, int p_281689_, @Nullable String p_282568_) {
p_282567_.renderItem(p_281330_, p_281772_, p_281689_);
@@ -36,7 +36,7 @@
}
protected void renderLabels(GuiGraphics p_281635_, int p_282681_, int p_283686_) {
@@ -317,7 +_,8 @@
@@ -313,7 +_,8 @@
if (super.mouseClicked(p_427253_, p_427622_)) {
return true;
} else {
@@ -46,7 +46,7 @@
Slot slot = this.getHoveredSlot(p_427253_.x(), p_427253_.y());
this.doubleclick = this.lastClickSlot == slot && p_427622_;
this.skipNextRelease = false;
@@ -327,6 +_,7 @@
@@ -323,6 +_,7 @@
int i = this.leftPos;
int j = this.topPos;
boolean flag1 = this.hasClickedOutside(p_427253_.x(), p_427253_.y(), i, j);
@@ -54,7 +54,7 @@
int k = -1;
if (slot != null) {
k = slot.index;
@@ -352,7 +_,7 @@
@@ -348,7 +_,7 @@
}
} else if (!this.isQuickCrafting) {
if (this.menu.getCarried().isEmpty()) {
@@ -63,7 +63,7 @@
this.slotClicked(slot, k, p_427253_.button(), ClickType.CLONE);
} else {
boolean flag2 = k != -999 && p_427253_.hasShiftDown();
@@ -376,7 +_,7 @@
@@ -372,7 +_,7 @@
this.quickCraftingType = 0;
} else if (p_427253_.button() == 1) {
this.quickCraftingType = 1;
@@ -72,7 +72,7 @@
this.quickCraftingType = 2;
}
}
@@ -453,10 +_,13 @@
@@ -449,10 +_,13 @@
@Override
public boolean mouseReleased(MouseButtonEvent p_430939_) {
@@ -86,7 +86,7 @@
int k = -1;
if (slot != null) {
k = slot.index;
@@ -473,7 +_,7 @@
@@ -469,7 +_,7 @@
if (slot2 != null
&& slot2.mayPickup(this.minecraft.player)
&& slot2.hasItem()
@@ -95,7 +95,7 @@
&& AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
this.slotClicked(slot2, slot2.index, p_430939_.button(), ClickType.QUICK_MOVE);
}
@@ -538,7 +_,7 @@
@@ -534,7 +_,7 @@
this.slotClicked(null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT);
} else if (!this.menu.getCarried().isEmpty()) {
@@ -104,7 +104,7 @@
this.slotClicked(slot, k, p_430939_.button(), ClickType.CLONE);
} else {
boolean flag1 = k != -999 && p_430939_.hasShiftDown();
@@ -609,7 +_,7 @@
@@ -605,7 +_,7 @@
public boolean keyPressed(KeyEvent p_424324_) {
if (super.keyPressed(p_424324_)) {
return true;
@@ -113,7 +113,7 @@
this.onClose();
return true;
} else {
@@ -688,6 +_,13 @@
@@ -684,6 +_,13 @@
super.onClose();
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -116,6 +_,8 @@
@@ -115,6 +_,8 @@
private final Set<TagKey<Item>> visibleTags = new HashSet<>();
private final boolean displayOperatorCreativeTab;
private final EffectsInInventory effects;
@@ -9,7 +9,7 @@
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
@@ -164,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_);
@@ -332,6 +_,36 @@
@@ -329,6 +_,36 @@
protected void init() {
if (this.minecraft.player.hasInfiniteMaterials()) {
super.init();
@@ -55,7 +55,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);
@@ -378,7 +_,7 @@
@@ -376,7 +_,7 @@
public boolean charTyped(CharacterEvent p_424087_) {
if (this.ignoreTextInput) {
return false;
@@ -64,7 +64,7 @@
return false;
} else {
String s = this.searchBox.getValue();
@@ -397,7 +_,7 @@
@@ -395,7 +_,7 @@
@Override
public boolean keyPressed(KeyEvent p_429237_) {
this.ignoreTextInput = false;
@@ -73,7 +73,7 @@
if (this.minecraft.options.keyChat.matches(p_429237_)) {
this.ignoreTextInput = true;
this.selectTab(CreativeModeTabs.searchTab());
@@ -433,6 +_,7 @@
@@ -431,6 +_,7 @@
}
private void refreshSearchResults() {
@@ -81,7 +81,7 @@
this.menu.items.clear();
this.visibleTags.clear();
String s = this.searchBox.getValue();
@@ -445,10 +_,10 @@
@@ -443,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
@@ -94,7 +94,7 @@
}
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
@@ -480,7 +_,8 @@
@@ -478,7 +_,8 @@
@Override
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
if (selectedTab.showTitle()) {
@@ -104,7 +104,7 @@
}
}
@@ -490,7 +_,7 @@
@@ -488,7 +_,7 @@
double d0 = p_430803_.x() - this.leftPos;
double d1 = p_430803_.y() - this.topPos;
@@ -113,7 +113,7 @@
if (this.checkTabClicked(creativemodetab, d0, d1)) {
return true;
}
@@ -512,7 +_,7 @@
@@ -510,7 +_,7 @@
double d1 = p_423848_.y() - this.topPos;
this.scrolling = false;
@@ -122,7 +122,7 @@
if (this.checkTabClicked(creativemodetab, d0, d1)) {
this.selectTab(creativemodetab);
return true;
@@ -606,13 +_,15 @@
@@ -604,13 +_,15 @@
this.originalSlots = null;
}
@@ -139,9 +139,9 @@
this.refreshSearchResults();
} else {
@@ -676,7 +_,14 @@
@@ -673,7 +_,14 @@
this.effects.render(p_283000_, p_281317_, p_282770_);
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
this.effects.renderTooltip(p_283000_, p_281317_, p_282770_);
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ if (this.pages.size() != 1) {
@@ -155,7 +155,7 @@
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
break;
}
@@ -700,7 +_,7 @@
@@ -697,7 +_,7 @@
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
@@ -164,7 +164,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);
@@ -721,7 +_,7 @@
@@ -718,7 +_,7 @@
int i = 1;
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
@@ -173,24 +173,24 @@
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
}
}
@@ -732,7 +_,7 @@
@@ -729,7 +_,7 @@
@Override
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
- for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ for (CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (creativemodetab != selectedTab) {
this.renderTabButton(p_282663_, creativemodetab);
this.renderTabButton(p_282663_, p_282089_, p_282249_, creativemodetab);
}
@@ -748,6 +_,7 @@
p_282663_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
@@ -749,6 +_,7 @@
p_282663_.blitSprite(RenderPipelines.GUI_TEXTURED, identifier, j, k + (int)((i - k - 17) * this.scrollOffs), 12, 15);
}
+ if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
this.renderTabButton(p_282663_, selectedTab);
this.renderTabButton(p_282663_, p_282089_, p_282249_, selectedTab);
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
InventoryScreen.renderEntityInInventoryFollowsMouse(
@@ -766,7 +_,7 @@
@@ -767,7 +_,7 @@
}
private int getTabX(CreativeModeTab p_260136_) {
@@ -199,7 +199,7 @@
int j = 27;
int k = 27 * i;
if (p_260136_.isAlignedRight()) {
@@ -778,7 +_,7 @@
@@ -779,7 +_,7 @@
private int getTabY(CreativeModeTab p_260181_) {
int i = 0;
@@ -208,9 +208,9 @@
i -= 32;
} else {
i += this.imageHeight;
@@ -806,8 +_,8 @@
@@ -807,8 +_,8 @@
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
protected void renderTabButton(GuiGraphics p_283590_, int p_454271_, int p_455485_, CreativeModeTab p_283489_) {
boolean flag = p_283489_ == selectedTab;
- boolean flag1 = p_283489_.row() == CreativeModeTab.Row.TOP;
- int i = p_283489_.column();
@@ -218,16 +218,16 @@
+ int i = currentPage.getColumn(p_283489_);
int j = this.leftPos + this.getTabX(p_283489_);
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
ResourceLocation[] aresourcelocation;
@@ -817,6 +_,7 @@
aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
Identifier[] aidentifier;
@@ -822,6 +_,7 @@
p_283590_.requestCursor(CursorTypes.POINTING_HAND);
}
+ com.mojang.blaze3d.opengl.GlStateManager._enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
p_283590_.blitSprite(RenderPipelines.GUI_TEXTURED, aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
p_283590_.blitSprite(RenderPipelines.GUI_TEXTURED, aidentifier[Mth.clamp(i, 0, aidentifier.length)], j, k, 26, 32);
int l = j + 13 - 8;
int i1 = k + 16 - 8 + (flag1 ? 1 : -1);
@@ -853,6 +_,14 @@
@@ -858,6 +_,14 @@
}
}
@@ -242,7 +242,7 @@
@OnlyIn(Dist.CLIENT)
static class CustomCreativeSlot extends Slot {
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
@@ -1034,6 +_,22 @@
@@ -1038,6 +_,22 @@
@Override
public boolean mayPickup(Player p_98665_) {
return this.target.mayPickup(p_98665_);
@@ -259,7 +259,7 @@
+ }
+
+ @Override
+ public Slot setBackground(ResourceLocation sprite) {
+ public Slot setBackground(Identifier sprite) {
+ this.target.setBackground(sprite);
+ return this;
}
@@ -1,48 +1,36 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectsInInventory.java
@@ -47,12 +_,16 @@
int j = this.screen.width - i;
Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
if (!collection.isEmpty() && j >= 32) {
boolean flag = j >= 120;
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, !flag, i);
- int k = j >= 120 ? j - 7 : 32;
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenEffectSize(this.screen, j, j < 120, i);
+ if (event == null) return;
+ flag = !event.isCompact();
+ int k = !event.isCompact() ? j - 7 : 32;
+ i = event.getHorizontalOffset();
int k = 33;
int l = 33;
if (collection.size() > 5) {
k = 132 / (collection.size() - 1);
l = 132 / (collection.size() - 1);
}
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().toList();
this.renderBackgrounds(p_362146_, i, k, iterable, flag);
this.renderIcons(p_362146_, i, k, iterable, flag);
if (flag) {
@@ -98,6 +_,11 @@
int i = this.screen.topPos;
this.renderEffects(p_456221_, collection, i, l, p_453611_, p_457243_, k);
}
}
@@ -66,6 +_,11 @@
for (MobEffectInstance mobeffectinstance : p_361981_) {
for (MobEffectInstance mobeffectinstance : iterable) {
boolean flag = mobeffectinstance.isAmbient();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_367085_, p_367644_ + (p_368681_ ? 6 : 7), i, 0)) {
+ i += p_367522_;
+ continue;
+ }
Holder<MobEffect> holder = mobeffectinstance.getEffect();
ResourceLocation resourcelocation = Gui.getMobEffectSprite(holder);
p_367085_.blitSprite(RenderPipelines.GUI_TEXTURED, resourcelocation, p_367644_ + (p_368681_ ? 6 : 7), i + 7, 18, 18);
@@ -109,6 +_,11 @@
int i = this.screen.topPos;
for (MobEffectInstance mobeffectinstance : p_365480_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_361851_, p_367468_, i, 0)) {
+ i += p_365556_;
+ if (renderer.renderInventory(mobeffectinstance, this, p_362146_, p_370153_, i, 0)) {
+ i += p_365612_;
+ continue;
+ }
Component component = this.getEffectName(mobeffectinstance);
p_361851_.drawString(this.screen.getFont(), component, p_367468_ + 10 + 18, i + 6, -1);
Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F, this.minecraft.level.tickRateManager().tickrate());
@@ -124,5 +_,9 @@
int j = this.renderBackground(p_362146_, font, component, component1, p_370153_, i, flag, p_457235_);
@@ -123,5 +_,9 @@
}
return mutablecomponent;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -107,7 +_,7 @@
@@ -108,7 +_,7 @@
int l1 = 86 - this.font.width(s);
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
int i2 = -9937334;
@@ -9,7 +9,7 @@
p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
p_282430_.blitSprite(RenderPipelines.GUI_TEXTURED, DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, ARGB.opaque((i2 & 16711422) >> 1), false);
@@ -158,13 +_,16 @@
@@ -160,13 +_,16 @@
.registryAccess()
.lookupOrThrow(Registries.ENCHANTMENT)
.get(this.menu.enchantClue[j]);
@@ -17,8 +17,8 @@
+ {
int l = this.menu.levelClue[j];
int i1 = j + 1;
- if (this.isHovering(60, 14 + 19 * j, 108, 17, p_282491_, p_281953_) && k > 0 && l >= 0 && optional != null) {
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
- if (this.isHovering(60, 14 + 19 * j, 108, 17, p_282491_, p_281953_) && k > 0 && l >= 0) {
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && l >= 0) {
List<Component> list = Lists.newArrayList();
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
- if (!flag) {
@@ -4,8 +4,8 @@
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;
- private final ResourceLocation texture = ResourceLocation.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
+ private final ResourceLocation texture = ResourceLocation.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
- private final Identifier texture = Identifier.withDefaultNamespace("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
+ private final Identifier texture = Identifier.parse(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit"));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
@@ -230,6 +_,14 @@
@@ -236,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);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
@@ -363,6 +_,8 @@
@@ -361,6 +_,8 @@
p_425273_.setTooltipForNextFrame(Lists.transform(this.onlinePlayersTooltip, Component::getVisualOrderText), p_424268_, p_430737_);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
@@ -115,9 +_,10 @@
@@ -116,9 +_,10 @@
this.name = p_343976_;
this.changeButton = Button.builder(p_343976_, p_342196_ -> {
KeyBindsList.this.keyBindsScreen.selectedKey = p_343088_;
@@ -12,7 +12,7 @@
.createNarration(
p_342179_ -> p_343088_.isUnbound()
? Component.translatable("narrator.controls.unbound", p_343976_)
@@ -125,7 +_,7 @@
@@ -126,7 +_,7 @@
)
.build();
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_357685_ -> {
@@ -21,7 +21,7 @@
KeyBindsList.this.resetMappingAndUpdateButtons();
}).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build();
this.refreshEntry();
@@ -166,7 +_,8 @@
@@ -167,7 +_,8 @@
MutableComponent mutablecomponent = Component.empty();
if (!this.key.isUnbound()) {
for (KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
@@ -43,7 +_,7 @@
@@ -42,7 +_,7 @@
protected void addFooter() {
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_343640_ -> {
for (KeyMapping keymapping : this.options.keyMappings) {
@@ -9,7 +9,7 @@
}
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -75,11 +_,12 @@
@@ -74,11 +_,12 @@
public boolean keyPressed(KeyEvent p_424487_) {
if (this.selectedKey != null) {
if (p_424487_.isEscape()) {
@@ -24,7 +24,7 @@
this.selectedKey = null;
this.lastKeySelection = Util.getMillis();
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -102,5 +_,18 @@
@@ -101,5 +_,18 @@
}
this.resetButton.active = flag;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
+++ b/net/minecraft/client/gui/screens/packs/TransferableSelectionList.java
@@ -64,7 +_,7 @@
@@ -65,7 +_,7 @@
Component component = Component.empty().append(this.title).withStyle(ChatFormatting.UNDERLINE, ChatFormatting.BOLD);
this.addEntry(new TransferableSelectionList.HeaderEntry(this.minecraft.font, component), (int)(9.0F * 1.5F));
this.setSelected(null);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -171,6 +_,7 @@
@@ -173,6 +_,7 @@
WorldDataConfiguration worlddataconfiguration = SharedConstants.IS_RUNNING_IN_IDE
? new WorldDataConfiguration(new DataPackConfig(List.of("vanilla", "tests"), List.of()), FeatureFlags.DEFAULT_FLAGS)
: WorldDataConfiguration.DEFAULT;
@@ -8,7 +8,7 @@
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, worlddataconfiguration);
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
worldloader$initconfig,
@@ -471,7 +_,7 @@
@@ -472,7 +_,7 @@
if (p_269627_) {
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
} else {
@@ -17,7 +17,7 @@
}
},
Component.translatable("dataPack.validation.failed"),
@@ -585,6 +_,7 @@
@@ -584,6 +_,7 @@
if (path != null) {
if (this.tempDataPackRepository == null) {
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -234,7 +_,7 @@
@Nullable
public PresetEditor getPresetEditor() {
@@ -232,7 +_,7 @@
public @Nullable PresetEditor getPresetEditor() {
Holder<WorldPreset> holder = this.getWorldType().preset();
- return holder != null ? PresetEditor.EDITORS.get(holder.unwrapKey()) : null;
+ return holder != null ? holder.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -329,6 +_,8 @@
@@ -331,6 +_,8 @@
this.minecraft.setScreenAndShow(new GenericMessageScreen(Component.translatable("selectWorld.resource_load")));
PackRepository packrepository = ServerPacksSource.createPackRepository(p_333651_);
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -79,6 +_,7 @@
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join_highlighted");
static final ResourceLocation JOIN_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join");
@@ -83,6 +_,7 @@
static final Identifier JOIN_HIGHLIGHTED_SPRITE = Identifier.withDefaultNamespace("world_list/join_highlighted");
static final Identifier JOIN_SPRITE = Identifier.withDefaultNamespace("world_list/join");
static final Logger LOGGER = LogUtils.getLogger();
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = ResourceLocation.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png");
+ private static final Identifier FORGE_EXPERIMENTAL_WARNING_ICON = Identifier.fromNamespaceAndPath("forge","textures/gui/experimental_warning.png");
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);
@@ -494,6 +_,19 @@
@@ -489,6 +_,19 @@
}
}
@@ -28,7 +28,7 @@
@Override
public Component getNarration() {
Component component = Component.translatable(
@@ -520,6 +_,7 @@
@@ -515,6 +_,7 @@
this.infoText.setPosition(i, this.getContentY() + 9 + 9 + 3);
this.infoText.render(p_424437_, p_425443_, p_425024_, p_424775_);
p_424437_.blit(RenderPipelines.GUI_TEXTURED, this.icon.textureLocation(), this.getContentX(), this.getContentY(), 0.0F, 0.0F, 32, 32, 32, 32);
@@ -1,36 +1,36 @@
--- a/net/minecraft/client/model/HumanoidModel.java
+++ b/net/minecraft/client/model/HumanoidModel.java
@@ -290,6 +_,8 @@
case BRUSH:
this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) (Math.PI / 5);
this.rightArm.yRot = 0.0F;
@@ -308,6 +_,8 @@
break;
case SPEAR:
SpearAnimations.thirdPersonHandUse(this.rightArm, this.head, true, p_362371_.getUseItemStackForArm(HumanoidArm.RIGHT), p_362371_);
+ default:
+ p_366231_.applyTransform(this, p_362371_, net.minecraft.world.entity.HumanoidArm.RIGHT);
+ p_362371_.rightArmPose.applyTransform(this, p_362371_, net.minecraft.world.entity.HumanoidArm.RIGHT);
}
}
@@ -334,6 +_,8 @@
case BRUSH:
this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) (Math.PI / 5);
this.leftArm.yRot = 0.0F;
@@ -355,6 +_,8 @@
break;
case SPEAR:
SpearAnimations.thirdPersonHandUse(this.leftArm, this.head, false, p_363560_.getUseItemStackForArm(HumanoidArm.LEFT), p_363560_);
+ default:
+ p_370002_.applyTransform(this, p_363560_, net.minecraft.world.entity.HumanoidArm.LEFT);
+ p_363560_.leftArmPose.applyTransform(this, p_363560_, net.minecraft.world.entity.HumanoidArm.LEFT);
}
}
@@ -402,7 +_,7 @@
@@ -427,7 +_,7 @@
}
@OnlyIn(Dist.CLIENT)
- public static enum ArmPose {
+ public static enum ArmPose implements net.minecraftforge.common.IExtensibleEnum {
EMPTY(false),
ITEM(false),
BLOCK(false),
@@ -418,10 +_,28 @@
private ArmPose(final boolean p_102896_) {
EMPTY(false, false),
ITEM(false, false),
BLOCK(false, false),
@@ -453,10 +_,29 @@
ArmPose(final boolean p_102896_, final boolean p_456170_) {
this.twoHanded = p_102896_;
this.affectsOffhandPose = p_456170_;
+ this.forgeArmPose = null;
}
@@ -41,18 +41,19 @@
+ @javax.annotation.Nullable
+ private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose;
+
+ private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ private ArmPose(boolean twoHanded, boolean affectsOffhandPose, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ this.twoHanded = twoHanded;
+ this.affectsOffhandPose = affectsOffhandPose;
+ com.google.common.base.Preconditions.checkNotNull(forgeArmPose, "Cannot create new ArmPose with null transformer!");
+ this.forgeArmPose = forgeArmPose;
+ }
+
+ public static ArmPose create(String name, boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ public static ArmPose create(String name, boolean twoHanded, boolean affectsOffhandPose, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ throw new IllegalStateException("Enum not extended");
+ }
+
+ 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);
}
}
}
public boolean affectsOffhandPose() {
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -506,6 +_,7 @@
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition57);
@@ -524,6 +_,7 @@
builder.put(ModelLayers.createHangingSignModelName(p_374591_, hangingsignrenderer$attachmenttype), layerdefinition58);
}
});
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
@@ -1,24 +1,24 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -328,15 +_,18 @@
@@ -341,15 +_,18 @@
}
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/standing/" + location.getPath()), "main");
+ Identifier location = Identifier.parse(p_171292_.name());
+ return new ModelLayerLocation(Identifier.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");
+ Identifier location = Identifier.parse(p_363532_.name());
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "sign/wall/" + location.getPath()), "main");
}
public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_, HangingSignRenderer.AttachmentType p_378070_) {
- return createLocation("hanging_sign/" + p_252225_.name() + "/" + p_378070_.getSerializedName(), "main");
+ ResourceLocation location = ResourceLocation.parse(p_252225_.name());
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath() + "/" + p_378070_.getSerializedName()), "main");
+ Identifier location = Identifier.parse(p_252225_.name());
+ return new ModelLayerLocation(Identifier.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath() + "/" + p_378070_.getSerializedName()), "main");
}
public static Stream<ModelLayerLocation> getKnownLocations() {
@@ -8,7 +8,7 @@
this.storage.drop(i, levelchunk);
}
}
@@ -125,6 +_,7 @@
@@ -123,6 +_,7 @@
}
this.level.onChunkLoaded(chunkpos);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
@@ -160,6 +_,7 @@
@@ -157,6 +_,7 @@
@Override
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
@@ -184,6 +_,7 @@
@@ -182,6 +_,7 @@
return true;
}
}));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -214,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 DisconnectedScreen(this.parent, component, p_342266_.reason(), CommonComponents.GUI_BACK));
@@ -8,7 +8,7 @@
} else {
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
}
@@ -238,6 +_,7 @@
@@ -233,6 +_,7 @@
@Override
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -145,6 +_,7 @@
@@ -143,6 +_,7 @@
p_389331_.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_194177_ -> this.calculateBlockTint(p_194177_, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
p_389331_.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(p_389335_ -> this.calculateBlockTint(p_389335_, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER)));
p_389331_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(p_194168_ -> this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER)));
@@ -8,7 +8,7 @@
});
private final ClientChunkCache chunkSource;
private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
@@ -156,6 +_,8 @@
@@ -155,6 +_,8 @@
private final int seaLevel;
private boolean tickDayTime;
private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
@@ -17,16 +17,16 @@
public void handleBlockChangedAck(int p_233652_) {
if (SharedConstants.DEBUG_BLOCK_BREAK) {
@@ -239,6 +_,8 @@
this.serverSimulationDistance = p_364305_;
this.updateSkyBrightness();
this.prepareWeather();
@@ -240,6 +_,8 @@
if (this.canHaveWeather()) {
this.prepareWeather();
}
+ this.gatherCapabilities();
+ net.minecraftforge.event.ForgeEventFactory.onLevelLoad(this);
}
public void queueLightUpdate(Runnable p_194172_) {
@@ -343,6 +_,7 @@
private EnvironmentAttributeSystem.Builder addEnvironmentAttributeLayers(EnvironmentAttributeSystem.Builder p_450625_) {
@@ -350,6 +_,7 @@
p_104640_.setOldPosAndRot();
p_104640_.tickCount++;
Profiler.get().push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString());
@@ -34,7 +34,7 @@
p_104640_.tick();
Profiler.get().pop();
@@ -394,8 +_,10 @@
@@ -401,8 +_,10 @@
}
public void addEntity(Entity p_104741_) {
@@ -71,7 +71,7 @@
if (p_263536_ == this.minecraft.player) {
this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_396496_, p_263509_));
}
@@ -1032,7 +_,7 @@
@@ -954,7 +_,7 @@
@Override
public void addDestroyBlockEffect(BlockPos p_171667_, BlockState p_171668_) {
@@ -80,7 +80,7 @@
VoxelShape voxelshape = p_171668_.getShape(this, p_171667_);
double d0 = 0.25;
voxelshape.forAllBoxes(
@@ -1067,6 +_,7 @@
@@ -989,6 +_,7 @@
p_171668_,
p_171667_
)
@@ -88,7 +88,7 @@
);
}
}
@@ -1076,6 +_,13 @@
@@ -998,6 +_,13 @@
}
}
@@ -102,7 +102,7 @@
public void addBreakingBlockEffect(BlockPos p_425440_, Direction p_431745_) {
BlockState blockstate = this.getBlockState(p_425440_);
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) {
@@ -1111,7 +_,7 @@
@@ -1033,7 +_,7 @@
d0 = i + aabb.maxX + 0.1F;
}
@@ -111,7 +111,7 @@
}
}
@@ -1175,6 +_,16 @@
@@ -1097,6 +_,16 @@
this.explosionTracker.track(p_429129_, p_428744_, p_431051_, p_431683_);
}
@@ -128,7 +128,7 @@
@OnlyIn(Dist.CLIENT)
public static class ClientLevelData implements WritableLevelData {
private final boolean hardcore;
@@ -1256,6 +_,7 @@
@@ -1178,6 +_,7 @@
}
public void setDifficulty(Difficulty p_104852_) {
@@ -136,7 +136,7 @@
this.difficulty = p_104852_;
}
@@ -1298,6 +_,12 @@
@@ -1220,6 +_,12 @@
break;
default:
}
@@ -149,7 +149,7 @@
}
public void onTrackingEnd(Entity p_171716_) {
@@ -1310,6 +_,15 @@
@@ -1232,6 +_,15 @@
ClientLevel.this.dragonParts.removeAll(Arrays.asList(enderdragon.getSubEntities()));
break;
default:
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -514,6 +_,7 @@
@@ -527,6 +_,7 @@
this.debugSubscriber.clear();
this.minecraft.levelRenderer.debugRenderer.refreshRendererList();
this.minecraft.player.resetPos();
@@ -8,7 +8,7 @@
this.minecraft.player.setId(p_105030_.playerId());
this.level.addEntity(this.minecraft.player);
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
@@ -1321,6 +_,8 @@
@@ -1334,6 +_,8 @@
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
}
@@ -17,7 +17,7 @@
this.level.addEntity(localplayer1);
localplayer1.input = new KeyboardInput(this.minecraft.options);
this.minecraft.gameMode.adjustPlayer(localplayer1);
@@ -1469,7 +_,7 @@
@@ -1489,7 +_,7 @@
ProblemReporter.ScopedCollector problemreporter$scopedcollector = new ProblemReporter.ScopedCollector(p_404890_.problemPath(), LOGGER);
try {
@@ -26,7 +26,7 @@
} catch (Throwable throwable1) {
try {
problemreporter$scopedcollector.close();
@@ -1646,7 +_,9 @@
@@ -1666,7 +_,9 @@
@Override
public void handleCommands(ClientboundCommandsPacket p_104990_) {
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft.packetProcessor());
@@ -37,7 +37,7 @@
}
@Override
@@ -1747,6 +_,7 @@
@@ -1767,6 +_,7 @@
if (this.minecraft.screen instanceof RecipeUpdateListener recipeupdatelistener) {
recipeupdatelistener.recipesUpdated();
}
@@ -45,7 +45,7 @@
}
@Override
@@ -1785,6 +_,8 @@
@@ -1805,6 +_,8 @@
this.fuelValues = FuelValues.vanillaBurnTimes(this.registryAccess, this.enabledFeatures);
List<ItemStack> list1 = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
this.searchTrees.updateCreativeTags(list1);
@@ -54,7 +54,7 @@
}
@Override
@@ -2614,6 +_,8 @@
@@ -2631,6 +_,8 @@
}
public void sendChat(String p_249888_) {
@@ -63,7 +63,7 @@
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.getLong();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
@@ -2622,6 +_,7 @@
@@ -2639,6 +_,7 @@
}
public void sendCommand(String p_250092_) {
@@ -71,7 +71,7 @@
SignableCommand<ClientSuggestionProvider> signablecommand = SignableCommand.of(this.commands.parse(p_250092_, this.suggestionsProvider));
if (signablecommand.arguments().isEmpty()) {
this.send(new ServerboundChatCommandPacket(p_250092_));
@@ -2638,6 +_,7 @@
@@ -2655,6 +_,7 @@
}
public void sendUnattendedCommand(String p_407213_, @Nullable Screen p_406262_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
@@ -76,6 +_,7 @@
@@ -72,6 +_,7 @@
}
protected void setGameMode(GameType p_105318_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ServerData.java
+++ b/net/minecraft/client/multiplayer/ServerData.java
@@ -38,6 +_,7 @@
@@ -36,6 +_,7 @@
private ServerData.Type type;
private int acceptedCodeOfConduct;
private ServerData.State state = ServerData.State.INITIAL;
@@ -8,3 +8,12 @@
this.pingStart = Util.getMillis();
connection.send(new ServerboundPingRequestPacket(this.pingStart));
this.success = true;
@@ -152,7 +_,7 @@
}
void pingLegacyServer(InetSocketAddress p_171812_, final ServerAddress p_300887_, final ServerData p_171813_, EventLoopGroupHolder p_457463_) {
- new Bootstrap().group(p_457463_.eventLoopGroup()).handler(new ChannelInitializer<Channel>() {
+ new Bootstrap().group(p_457463_.eventLoopGroup(true)).handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel p_105498_) {
try {
@@ -54,7 +54,7 @@
+ this.creativeSearch.put(entry.getValue(), CompletableFuture.supplyAsync(
() -> new FullTextSearchTree<>(
p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag),
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::location).stream(),
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::identifier).stream(),
- p_342500_
+ items
),
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -63,7 +_,7 @@
private <T extends ParticleOptions> Particle makeParticle(
@@ -61,7 +_,7 @@
private <T extends ParticleOptions> @Nullable Particle makeParticle(
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
) {
- ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.resourceManager.getProviders().get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType()));
@@ -9,7 +9,7 @@
return particleprovider == null
? null
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_, this.random);
@@ -113,6 +_,8 @@
@@ -111,6 +_,8 @@
return new ItemPickupParticleGroup(this);
} else if (p_428647_ == ParticleRenderType.ELDER_GUARDIANS) {
return new ElderGuardianParticleGroup(this);
@@ -18,7 +18,7 @@
} else {
return (ParticleGroup<?>)(p_428647_ == ParticleRenderType.NO_RENDER ? new NoRenderParticleGroup(this) : new QuadParticleGroup(this, p_428647_));
}
@@ -122,8 +_,20 @@
@@ -120,8 +_,20 @@
this.trackedParticleCounts.addTo(p_423291_, p_172283_);
}
@@ -2,13 +2,13 @@
+++ b/net/minecraft/client/particle/ParticleResources.java
@@ -45,6 +_,7 @@
private static final FileToIdConverter PARTICLE_LISTER = FileToIdConverter.json("particles");
private final Map<ResourceLocation, ParticleResources.MutableSpriteSet> spriteSets = Maps.newHashMap();
private final Map<Identifier, ParticleResources.MutableSpriteSet> spriteSets = Maps.newHashMap();
private final Int2ObjectMap<ParticleProvider<?>> providers = new Int2ObjectOpenHashMap<>();
+ private final Map<ResourceLocation, ParticleProvider<?>> providersByName = new java.util.HashMap<>();
@Nullable
private Runnable onReload;
+ private final Map<Identifier, ParticleProvider<?>> providersByName = new java.util.HashMap<>();
private @Nullable Runnable onReload;
@@ -174,14 +_,17 @@
public ParticleResources() {
@@ -173,14 +_,17 @@
this.register(ParticleTypes.FIREFLY, FireflyParticle.FireflyProvider::new);
}
@@ -27,7 +27,7 @@
}
@Override
@@ -274,8 +_,13 @@
@@ -265,8 +_,13 @@
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/TerrainParticle.java
+++ b/net/minecraft/client/particle/TerrainParticle.java
@@ -41,7 +_,7 @@
@@ -43,7 +_,7 @@
this.rCol = 0.6F;
this.gCol = 0.6F;
this.bCol = 0.6F;
@@ -9,7 +9,7 @@
int i = Minecraft.getInstance().getBlockColors().getColor(p_172458_, p_172451_, p_172459_, 0);
this.rCol *= (i >> 16 & 0xFF) / 255.0F;
this.gCol *= (i >> 8 & 0xFF) / 255.0F;
@@ -97,8 +_,14 @@
@@ -99,8 +_,14 @@
) {
BlockState blockstate = p_331600_.getState();
return !blockstate.isAir() && !blockstate.is(Blocks.MOVING_PISTON) && blockstate.shouldSpawnTerrainParticles()
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/AbstractClientPlayer.java
+++ b/net/minecraft/client/player/AbstractClientPlayer.java
@@ -138,7 +_,7 @@
@@ -133,7 +_,7 @@
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -295,6 +_,7 @@
@@ -310,6 +_,7 @@
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
@@ -8,7 +8,7 @@
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
return !itemstack.isEmpty();
@@ -482,7 +_,11 @@
@@ -521,7 +_,11 @@
@Override
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
@@ -21,7 +21,7 @@
}
@Override
@@ -720,6 +_,7 @@
@@ -761,6 +_,7 @@
&& this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING)
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
this.input.tick();
@@ -29,7 +29,7 @@
this.minecraft.getTutorial().onInput(this.input);
boolean flag3 = false;
if (this.autoJumpTime > 0) {
@@ -792,8 +_,9 @@
@@ -833,8 +_,9 @@
}
this.wasFallFlying = this.isFallFlying();
@@ -41,7 +41,7 @@
}
if (this.isEyeInFluid(FluidTags.WATER)) {
@@ -859,7 +_,7 @@
@@ -900,7 +_,7 @@
}
private boolean shouldStopSwimSprinting() {
@@ -50,7 +50,7 @@
}
public Portal.Transition getActivePortalLocalTransition() {
@@ -902,6 +_,8 @@
@@ -943,6 +_,8 @@
@Override
public void rideTick() {
super.rideTick();
@@ -59,16 +59,16 @@
this.handsBusy = false;
if (this.getControlledVehicle() instanceof AbstractBoat abstractboat) {
abstractboat.setInput(
@@ -1079,7 +_,7 @@
@@ -1120,7 +_,7 @@
&& this.isSprintingPossible(this.getAbilities().flying)
&& !this.isUsingItem()
&& !this.isSlowDueToUsingItem()
&& (!this.isFallFlying() || this.isUnderWater())
- && (!this.isMovingSlowly() || this.isUnderWater());
+ && (!this.isMovingSlowly() || this.isUnderWater() || this.canStartSwimming());
}
private boolean vehicleCanSprint(Entity p_265184_) {
@@ -1158,6 +_,17 @@
@@ -1195,6 +_,17 @@
@Override
public float getVisualRotationYInDegrees() {
return this.getYRot();
@@ -1,11 +0,0 @@
--- a/net/minecraft/client/renderer/DimensionSpecialEffects.java
+++ b/net/minecraft/client/renderer/DimensionSpecialEffects.java
@@ -32,7 +_,7 @@
}
public static DimensionSpecialEffects forType(DimensionType p_108877_) {
- return EFFECTS.get(p_108877_.effectsLocation());
+ return net.minecraftforge.client.DimensionSpecialEffectsManager.getForType(p_108877_.effectsLocation());
}
public boolean isSunriseOrSunset(float p_361903_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -233,6 +_,9 @@
@@ -242,6 +_,9 @@
case null:
default:
this.clearPostEffect();
@@ -10,7 +10,7 @@
}
}
@@ -244,7 +_,13 @@
@@ -253,7 +_,13 @@
public void processBlurEffect() {
PostChain postchain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS);
if (postchain != null) {
@@ -24,7 +24,7 @@
}
}
@@ -406,7 +_,7 @@
@@ -377,7 +_,7 @@
f *= Mth.lerp(f2, 1.0F, 0.85714287F);
}
@@ -33,7 +33,7 @@
}
}
@@ -557,7 +_,7 @@
@@ -530,7 +_,7 @@
}
} else if (flag && this.minecraft.screen != null) {
try {
@@ -42,7 +42,7 @@
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
@@ -672,6 +_,10 @@
@@ -696,6 +_,10 @@
BlockInWorld blockinworld = new BlockInWorld(this.minecraft.level, blockpos, false);
Registry<Block> registry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BLOCK);
flag = !itemstack.isEmpty() && (itemstack.canBreakBlockInAdventureMode(blockinworld) || itemstack.canPlaceOnBlockInAdventureMode(blockinworld));
@@ -53,7 +53,7 @@
}
}
}
@@ -706,6 +_,9 @@
@@ -736,6 +_,9 @@
if (this.minecraft.options.bobView().get()) {
this.bobView(posestack, this.mainCamera.getPartialTickTime());
}
@@ -62,4 +62,4 @@
+ this.mainCamera.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
matrix4f.mul(posestack.last().pose());
float f3 = this.minecraft.options.screenEffectScale().get().floatValue();
float f2 = this.minecraft.options.screenEffectScale().get().floatValue();
@@ -5,26 +5,26 @@
@OnlyIn(Dist.CLIENT)
public class ItemBlockRenderTypes {
+ @Deprecated
private static final Map<Block, ChunkSectionLayer> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_420870_ -> {
private static final Map<Block, ChunkSectionLayer> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_448152_ -> {
ChunkSectionLayer chunksectionlayer = ChunkSectionLayer.TRIPWIRE;
p_420870_.put(Blocks.TRIPWIRE, chunksectionlayer);
@@ -357,12 +_,15 @@
p_420870_.put(Blocks.BUBBLE_COLUMN, chunksectionlayer3);
p_420870_.put(Blocks.TINTED_GLASS, chunksectionlayer3);
p_448152_.put(Blocks.TRIPWIRE, chunksectionlayer);
@@ -356,12 +_,15 @@
p_448152_.put(Blocks.BUBBLE_COLUMN, chunksectionlayer2);
p_448152_.put(Blocks.TINTED_GLASS, chunksectionlayer2);
});
+ @Deprecated
private static final Map<Fluid, ChunkSectionLayer> LAYER_BY_FLUID = Util.make(Maps.newHashMap(), p_404902_ -> {
p_404902_.put(Fluids.FLOWING_WATER, ChunkSectionLayer.TRANSLUCENT);
p_404902_.put(Fluids.WATER, ChunkSectionLayer.TRANSLUCENT);
});
private static boolean renderCutout;
private static boolean cutoutLeaves;
+ /** @deprecated Forge: Use {@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 ChunkSectionLayer getChunkRenderType(BlockState p_109283_) {
Block block = p_109283_.getBlock();
if (block instanceof LeavesBlock) {
@@ -373,6 +_,8 @@
@@ -372,6 +_,8 @@
}
}
@@ -33,7 +33,7 @@
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
Block block = p_109294_.getBlock();
if (block instanceof LeavesBlock) {
@@ -393,11 +_,14 @@
@@ -391,17 +_,78 @@
}
}
@@ -41,15 +41,7 @@
+ @Deprecated // Note: this method does NOT support model-based render types
public static RenderType getRenderType(BlockState p_364446_) {
ChunkSectionLayer chunksectionlayer = getChunkRenderType(p_364446_);
return chunksectionlayer == ChunkSectionLayer.TRANSLUCENT ? Sheets.translucentItemSheet() : Sheets.cutoutBlockSheet();
}
+ /* Forge: Use {@link net.minecraft.client.resources.model.BakedModel#getRenderPasses(ItemStack, boolean)} and {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(ItemStack, boolean)}. */
public static RenderType getRenderType(ItemStack p_363859_) {
if (p_363859_.getItem() instanceof BlockItem blockitem) {
Block block = blockitem.getBlock();
@@ -407,12 +_,71 @@
}
return chunksectionlayer == ChunkSectionLayer.TRANSLUCENT ? Sheets.translucentBlockItemSheet() : Sheets.cutoutBlockSheet();
}
+ // Note: this method does NOT support model-based render types
@@ -59,16 +51,16 @@
return chunksectionlayer != null ? chunksectionlayer : ChunkSectionLayer.SOLID;
}
public static void setFancy(boolean p_109292_) {
renderCutout = p_109292_;
public static void setCutoutLeaves(boolean p_454762_) {
cutoutLeaves = p_454762_;
+ }
+
+ /** Forge: Check if we are running in {@linkplain net.minecraft.client.Minecraft#useFancyGraphics() fancy graphics} to account for fast graphics render types */
+ public static boolean isFancy() {
+ return renderCutout;
+ return cutoutLeaves;
+ }
+
+ private static final java.util.Collection<ChunkSectionLayer> CUTOUT_MIPPED = java.util.EnumSet.of(ChunkSectionLayer.CUTOUT_MIPPED);
+ private static final java.util.Collection<ChunkSectionLayer> CUTOUT_MIPPED = java.util.EnumSet.of(ChunkSectionLayer.CUTOUT);
+ private static final java.util.Collection<ChunkSectionLayer> SOLID = java.util.EnumSet.of(ChunkSectionLayer.SOLID);
+ private static final Map<net.minecraft.core.Holder.Reference<Block>, java.util.Collection<ChunkSectionLayer>> BLOCK_RENDER_TYPES = Util.make(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(TYPE_BY_BLOCK.size(), 0.5F), map -> {
+ map.defaultReturnValue(SOLID);
@@ -85,7 +77,7 @@
+ public static java.util.Collection<ChunkSectionLayer> getRenderLayers(BlockState state) {
+ Block block = state.getBlock();
+ if (block instanceof LeavesBlock) {
+ return renderCutout ? CUTOUT_MIPPED : SOLID;
+ return cutoutLeaves ? CUTOUT_MIPPED : SOLID;
+ } else {
+ return BLOCK_RENDER_TYPES.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block));
+ }
@@ -1,41 +1,41 @@
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
@@ -328,12 +_,14 @@
@@ -329,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);
float f5 = this.itemModelResolver.swapAnimationScale(this.mainHandItem) * (1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight));
+ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.MAIN_HAND, p_109316_, p_424174_, p_109319_, p_109315_, f1, f4, f5, this.mainHandItem))
this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.MAIN_HAND, f4, this.mainHandItem, f5, p_109316_, p_424174_, p_109319_);
}
if (iteminhandrenderer$handrenderselection.renderOffHand) {
float f6 = interactionhand == InteractionHand.OFF_HAND ? f : 0.0F;
float f7 = 1.0F - Mth.lerp(p_109315_, this.oOffHandHeight, this.offHandHeight);
float f7 = this.itemModelResolver.swapAnimationScale(this.offHandItem) * (1.0F - Mth.lerp(p_109315_, this.oOffHandHeight, this.offHandHeight));
+ if (!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(InteractionHand.OFF_HAND, p_109316_, p_424174_, p_109319_, p_109315_, f1, f6, f7, this.offHandItem))
this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_424174_, p_109319_);
}
@@ -400,7 +_,7 @@
@@ -401,7 +_,7 @@
} else {
this.renderOneHandedMap(p_109379_, p_425151_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_);
}
- } else if (p_109377_.is(Items.CROSSBOW)) {
+ } else if (p_109377_.getItem() instanceof CrossbowItem) {
this.applyItemArmTransform(p_109379_, humanoidarm, p_109378_);
boolean flag1 = CrossbowItem.isCharged(p_109377_);
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
int i = flag2 ? 1 : -1;
@@ -445,6 +_,7 @@
@@ -446,6 +_,7 @@
} else {
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
int j = flag3 ? 1 : -1;
+ if (!net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_109377_).applyForgeHandTransform(p_109379_, minecraft.player, humanoidarm, p_109377_, p_109373_, p_109378_, p_109376_)) // FORGE: Allow items to define custom arm animation
if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) {
switch (p_109377_.getUseAnimation()) {
case NONE:
@@ -572,8 +_,18 @@
ItemUseAnimation itemuseanimation = p_109377_.getUseAnimation();
if (!itemuseanimation.hasCustomArmTransform()) {
@@ -589,8 +_,18 @@
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
} else {
float f = localplayer.getAttackStrengthScale(1.0F);
float f = localplayer.getItemSwapScale(1.0F);
- float f1 = this.mainHandItem != itemstack ? 0.0F : f * f * f;
- float f2 = this.offHandItem != itemstack1 ? 0.0F : 1.0F;
+
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/LevelRenderer.java
+++ b/net/minecraft/client/renderer/LevelRenderer.java
@@ -175,6 +_,7 @@
@@ -184,6 +_,7 @@
this.submitNodeStorage = p_427160_.getSubmitNodeStorage();
this.levelRenderState = p_429507_;
this.featureRenderDispatcher = p_427160_;
@@ -8,7 +8,7 @@
}
@Override
@@ -460,9 +_,10 @@
@@ -485,9 +_,10 @@
profilerfiller.push("entities");
this.extractVisibleEntities(p_109604_, frustum, p_342180_, this.levelRenderState);
profilerfiller.popPush("blockEntities");
@@ -21,32 +21,32 @@
profilerfiller.popPush("blockBreaking");
this.extractBlockDestroyAnimation(p_109604_, this.levelRenderState);
profilerfiller.popPush("weather");
@@ -534,6 +_,7 @@
@@ -561,6 +_,7 @@
}
this.addLateDebugPass(framegraphbuilder, this.levelRenderState.cameraRenderState.pos, p_407881_, frustum);
this.addLateDebugPass(framegraphbuilder, this.levelRenderState.cameraRenderState, p_407881_, p_254120_);
+ net.minecraftforge.client.FramePassManager.insertForgePasses(framegraphbuilder, targets, this.levelRenderState); // Forge: Modded passes are inserted here.
profilerfiller.popPush("executeFrameGraph");
framegraphbuilder.execute(p_367325_, new FrameGraphBuilder.Inspector() {
@Override
@@ -801,7 +_,7 @@
@@ -841,7 +_,7 @@
}
}
- private void extractVisibleBlockEntities(Camera p_427254_, float p_426770_, LevelRenderState p_428920_) {
+ private void extractVisibleBlockEntities(Camera p_427254_, float p_426770_, LevelRenderState p_428920_, Frustum frustum) {
Vec3 vec3 = p_427254_.getPosition();
Vec3 vec3 = p_427254_.position();
double d0 = vec3.x();
double d1 = vec3.y();
@@ -812,6 +_,7 @@
@@ -852,6 +_,7 @@
List<BlockEntity> list = sectionrenderdispatcher$rendersection.getSectionMesh().getRenderableBlockEntities();
if (!list.isEmpty()) {
if (!list.isEmpty() && !(sectionrenderdispatcher$rendersection.getVisibility(Util.getMillis()) < 0.3F)) {
for (BlockEntity blockentity : list) {
+ if (!frustum.isVisible(blockentity.getRenderBoundingBox())) continue;
BlockPos blockpos = blockentity.getBlockPos();
SortedSet<BlockDestructionProgress> sortedset = this.destructionProgress.get(blockpos.asLong());
ModelFeatureRenderer.CrumblingOverlay modelfeaturerenderer$crumblingoverlay;
@@ -839,6 +_,7 @@
@@ -879,6 +_,7 @@
if (blockentity1.isRemoved()) {
iterator.remove();
} else {
@@ -54,7 +54,7 @@
BlockEntityRenderState blockentityrenderstate1 = this.blockEntityRenderDispatcher.tryExtractRenderState(blockentity1, p_426770_, null);
if (blockentityrenderstate1 != null) {
p_428920_.blockEntityRenderStates.add(blockentityrenderstate1);
@@ -895,13 +_,21 @@
@@ -935,13 +_,21 @@
VertexConsumer vertexconsumer = new SheetedDecalTextureGenerator(
p_365998_.getBuffer(ModelBakery.DESTROY_TYPES.get(blockbreakingrenderstate.progress)), posestack$pose, 1.0F
);
@@ -78,7 +78,7 @@
if (this.minecraft.hitResult instanceof BlockHitResult blockhitresult) {
if (blockhitresult.getType() != HitResult.Type.MISS) {
BlockPos blockpos = blockhitresult.getBlockPos();
@@ -927,6 +_,10 @@
@@ -967,6 +_,10 @@
private void renderBlockOutline(MultiBufferSource.BufferSource p_367206_, PoseStack p_365062_, boolean p_368189_, LevelRenderState p_422597_) {
BlockOutlineRenderState blockoutlinerenderstate = p_422597_.blockOutlineRenderState;
if (blockoutlinerenderstate != null) {
@@ -89,7 +89,7 @@
if (blockoutlinerenderstate.isTranslucent() == p_368189_) {
Vec3 vec3 = p_422597_.cameraRenderState.pos;
if (blockoutlinerenderstate.highContrast()) {
@@ -1356,7 +_,7 @@
@@ -1435,7 +_,7 @@
} else {
int i = p_398213_.packedBrightness(p_109538_, p_109540_);
int j = LightTexture.block(i);
@@ -98,7 +98,7 @@
if (j < k) {
int l = LightTexture.sky(i);
return LightTexture.pack(k, l);
@@ -1418,6 +_,18 @@
@@ -1492,6 +_,18 @@
public CloudRenderer getCloudRenderer() {
return this.cloudRenderer;
@@ -116,4 +116,4 @@
+ this.weatherEffectRenderer = value;
}
@FunctionalInterface
public Gizmos.TemporaryCollection collectPerFrameGizmos() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/LightTexture.java
+++ b/net/minecraft/client/renderer/LightTexture.java
@@ -189,7 +_,7 @@
@@ -171,7 +_,7 @@
}
public static int block(int p_109884_) {
@@ -1,56 +0,0 @@
--- a/net/minecraft/client/renderer/RenderType.java
+++ b/net/minecraft/client/renderer/RenderType.java
@@ -485,6 +_,11 @@
private final int bufferSize;
private final boolean affectsCrumbling;
private final boolean sortOnUpload;
+ private int chunkLayerId = -1;
+ /** {@return the unique ID of this {@link RenderType} for chunk rendering purposes, or {@literal -1} if this is not a chunk {@link RenderType}} */
+ public final int getChunkLayerId() {
+ return chunkLayerId;
+ }
public static RenderType solid() {
return SOLID;
@@ -665,7 +_,7 @@
}
public static RenderType text(ResourceLocation p_110498_) {
- return TEXT.apply(p_110498_);
+ return net.minecraftforge.client.ForgeRenderTypes.getText(p_110498_);
}
public static RenderType textBackground() {
@@ -673,19 +_,19 @@
}
public static RenderType textIntensity(ResourceLocation p_173238_) {
- return TEXT_INTENSITY.apply(p_173238_);
+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensity(p_173238_);
}
public static RenderType textPolygonOffset(ResourceLocation p_181445_) {
- return TEXT_POLYGON_OFFSET.apply(p_181445_);
+ return net.minecraftforge.client.ForgeRenderTypes.getTextPolygonOffset(p_181445_);
}
public static RenderType textIntensityPolygonOffset(ResourceLocation p_181447_) {
- return TEXT_INTENSITY_POLYGON_OFFSET.apply(p_181447_);
+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensityPolygonOffset(p_181447_);
}
public static RenderType textSeeThrough(ResourceLocation p_110501_) {
- return TEXT_SEE_THROUGH.apply(p_110501_);
+ return net.minecraftforge.client.ForgeRenderTypes.getTextSeeThrough(p_110501_);
}
public static RenderType textBackgroundSeeThrough() {
@@ -693,7 +_,7 @@
}
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
- return TEXT_INTENSITY_SEE_THROUGH.apply(p_173241_);
+ return net.minecraftforge.client.ForgeRenderTypes.getTextIntensitySeeThrough(p_173241_);
}
public static RenderType lightning() {
@@ -27,20 +27,19 @@
renderFire(posestack, this.bufferSource, textureatlassprite);
}
}
@@ -121,6 +_,12 @@
@@ -120,6 +_,11 @@
}
@Nullable
private static BlockState getViewBlockingState(Player p_110717_) {
private static @Nullable BlockState getViewBlockingState(Player p_110717_) {
+ var ret = getOverlayBlock(p_110717_);
+ return ret == null ? null : ret.getLeft();
+ }
+
+ @Nullable
+ private static org.apache.commons.lang3.tuple.Pair<BlockState, BlockPos> getOverlayBlock(Player p_110717_) {
+ private static org.apache.commons.lang3.tuple.@Nullable Pair<BlockState, BlockPos> getOverlayBlock(Player p_110717_) {
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int i = 0; i < 8; i++) {
@@ -130,7 +_,7 @@
@@ -129,7 +_,7 @@
blockpos$mutableblockpos.set(d0, d1, d2);
BlockState blockstate = p_110717_.level().getBlockState(blockpos$mutableblockpos);
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.isViewBlocking(p_110717_.level(), blockpos$mutableblockpos)) {
@@ -49,23 +48,23 @@
}
}
@@ -158,6 +_,10 @@
@@ -157,6 +_,10 @@
}
private static void renderWater(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_) {
+ renderFluid(p_110726_, p_110727_, p_376402_, UNDERWATER_LOCATION);
+ }
+
+ public static void renderFluid(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_, ResourceLocation texture) {
+ public static void renderFluid(Minecraft p_110726_, PoseStack p_110727_, MultiBufferSource p_376402_, Identifier texture) {
BlockPos blockpos = BlockPos.containing(p_110726_.player.getX(), p_110726_.player.getEyeY(), p_110726_.player.getZ());
float f = LightTexture.getBrightness(p_110726_.player.level().dimensionType(), p_110726_.player.level().getMaxLocalRawBrightness(blockpos));
int i = ARGB.colorFromFloat(0.1F, f, f, f);
@@ -170,7 +_,7 @@
@@ -169,7 +_,7 @@
float f7 = -p_110726_.player.getYRot() / 64.0F;
float f8 = p_110726_.player.getXRot() / 64.0F;
Matrix4f matrix4f = p_110727_.last().pose();
- VertexConsumer vertexconsumer = p_376402_.getBuffer(RenderType.blockScreenEffect(UNDERWATER_LOCATION));
+ VertexConsumer vertexconsumer = p_376402_.getBuffer(RenderType.blockScreenEffect(texture));
- VertexConsumer vertexconsumer = p_376402_.getBuffer(RenderTypes.blockScreenEffect(UNDERWATER_LOCATION));
+ VertexConsumer vertexconsumer = p_376402_.getBuffer(RenderTypes.blockScreenEffect(texture));
vertexconsumer.addVertex(matrix4f, -1.0F, -1.0F, -0.5F).setUv(4.0F + f7, 4.0F + f8).setColor(i);
vertexconsumer.addVertex(matrix4f, 1.0F, -1.0F, -0.5F).setUv(0.0F + f7, 4.0F + f8).setColor(i);
vertexconsumer.addVertex(matrix4f, 1.0F, 1.0F, -0.5F).setUv(0.0F + f7, 0.0F + f8).setColor(i);
@@ -1,20 +1,20 @@
--- a/net/minecraft/client/renderer/Sheets.java
+++ b/net/minecraft/client/renderer/Sheets.java
@@ -171,11 +_,11 @@
@@ -179,11 +_,11 @@
}
private static Material createSignMaterial(WoodType p_173386_) {
- return SIGN_MAPPER.defaultNamespaceApply(p_173386_.name());
+ return SIGN_MAPPER.apply(ResourceLocation.parse(p_173386_.name()));
+ return SIGN_MAPPER.apply(Identifier.parse(p_173386_.name()));
}
private static Material createHangingSignMaterial(WoodType p_251735_) {
- return HANGING_SIGN_MAPPER.defaultNamespaceApply(p_251735_.name());
+ return HANGING_SIGN_MAPPER.apply(ResourceLocation.parse(p_251735_.name()));
+ return HANGING_SIGN_MAPPER.apply(Identifier.parse(p_251735_.name()));
}
public static Material getSignMaterial(WoodType p_173382_) {
@@ -221,6 +_,23 @@
@@ -228,6 +_,23 @@
case SINGLE:
default:
return p_110773_;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/SpriteCoordinateExpander.java
+++ b/net/minecraft/client/renderer/SpriteCoordinateExpander.java
@@ -17,32 +_,38 @@
@@ -17,12 +_,14 @@
@Override
public VertexConsumer addVertex(float p_342932_, float p_342886_, float p_342696_) {
@@ -16,6 +16,9 @@
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@Override
@@ -32,22 +_,26 @@
@Override
public VertexConsumer setUv(float p_343856_, float p_344420_) {
- return this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/block/BlockRenderDispatcher.java
+++ b/net/minecraft/client/renderer/block/BlockRenderDispatcher.java
@@ -51,12 +_,17 @@
@@ -48,12 +_,17 @@
return this.blockModelShaper;
}
@@ -19,7 +19,7 @@
this.modelRenderer.tesselateBlock(p_110921_, this.singleThreadPartList, p_110919_, p_110920_, p_110922_, p_110923_, true, OverlayTexture.NO_OVERLAY);
}
}
@@ -99,7 +_,12 @@
@@ -96,7 +_,12 @@
return this.blockModelShaper.getBlockModel(p_110911_);
}
@@ -28,11 +28,11 @@
+ renderSingleBlock(p_110913_, p_110914_, p_110915_, p_110916_, p_110917_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
+ }
+
+ public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
+ public void renderSingleBlock(BlockState p_110913_, PoseStack p_110914_, MultiBufferSource p_110915_, int p_110916_, int p_110917_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.rendertype.@Nullable RenderType renderType) {
RenderShape rendershape = p_110913_.getRenderShape();
if (rendershape != RenderShape.INVISIBLE) {
BlockStateModel blockstatemodel = this.getBlockModel(p_110913_);
@@ -107,8 +_,9 @@
@@ -104,8 +_,9 @@
float f = (i >> 16 & 0xFF) / 255.0F;
float f1 = (i >> 8 & 0xFF) / 255.0F;
float f2 = (i & 0xFF) / 255.0F;
@@ -1,96 +1,99 @@
--- a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java
+++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java
@@ -70,8 +_,10 @@
@@ -71,9 +_,12 @@
public void tesselate(BlockAndTintGetter p_234370_, BlockPos p_234371_, VertexConsumer p_234372_, BlockState p_234373_, FluidState p_234374_) {
boolean flag = p_234374_.is(FluidTags.LAVA);
- TextureAtlasSprite[] atextureatlassprite = flag ? this.lavaIcons : this.waterIcons;
- TextureAtlasSprite textureatlassprite = flag ? this.lavaStill : this.waterStill;
- TextureAtlasSprite textureatlassprite1 = flag ? this.lavaFlowing : this.waterFlowing;
- int i = flag ? 16777215 : BiomeColors.getAverageWaterColor(p_234370_, p_234371_);
+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_234370_, p_234371_, p_234374_);
+ var sprites = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_234370_, p_234371_, p_234374_);
+ TextureAtlasSprite textureatlassprite = sprites[0];
+ TextureAtlasSprite textureatlassprite1 = sprites[1];
+ int i = net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(p_234374_).getTintColor(p_234374_, p_234370_, p_234371_);
+ float alpha = (float)(i >> 24 & 255) / 255.0F;
+
float f = (i >> 16 & 0xFF) / 255.0F;
float f1 = (i >> 8 & 0xFF) / 255.0F;
float f2 = (i & 0xFF) / 255.0F;
@@ -180,15 +_,15 @@
float f57 = f4 * f;
float f29 = f4 * f1;
float f30 = f4 * f2;
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
@@ -169,15 +_,15 @@
float f54 = f4 * f;
float f55 = f4 * f1;
float f56 = f4 * f2;
- this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l);
- this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l);
- this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l);
- this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l);
+ this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l, alpha);
+ this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l, alpha);
+ this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l, alpha);
+ this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l, alpha);
if (p_234374_.shouldRenderBackwardUpFace(p_234370_, p_234371_.above())) {
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
- this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l);
- this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l);
- this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l);
- this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l);
+ this.vertex(p_234372_, f37 + 0.0F, f38 + f8, f39 + 0.0F, f54, f55, f56, f17, f21, l, alpha);
+ this.vertex(p_234372_, f37 + 1.0F, f38 + f7, f39 + 0.0F, f54, f55, f56, f20, f24, l, alpha);
+ this.vertex(p_234372_, f37 + 1.0F, f38 + f9, f39 + 1.0F, f54, f55, f56, f19, f23, l, alpha);
+ this.vertex(p_234372_, f37 + 0.0F, f38 + f10, f39 + 1.0F, f54, f55, f56, f18, f22, l, alpha);
}
}
@@ -201,10 +_,10 @@
float f46 = f3 * f;
float f48 = f3 * f1;
float f50 = f3 * f2;
- this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k);
- this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k);
+ this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k, alpha);
+ this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k, alpha);
@@ -190,10 +_,10 @@
float f47 = f3 * f;
float f49 = f3 * f1;
float f51 = f3 * f2;
- this.vertex(p_234372_, f37, f38 + f16, f39 + 1.0F, f47, f49, f51, f41, f44, k);
- this.vertex(p_234372_, f37, f38 + f16, f39, f47, f49, f51, f41, f43, k);
- this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39, f47, f49, f51, f42, f43, k);
- this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39 + 1.0F, f47, f49, f51, f42, f44, k);
+ this.vertex(p_234372_, f37, f38 + f16, f39 + 1.0F, f47, f49, f51, f41, f44, k, alpha);
+ this.vertex(p_234372_, f37, f38 + f16, f39, f47, f49, f51, f41, f43, k, alpha);
+ this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39, f47, f49, f51, f42, f43, k, alpha);
+ this.vertex(p_234372_, f37 + 1.0F, f38 + f16, f39 + 1.0F, f47, f49, f51, f42, f44, k, alpha);
}
int j = this.getLightColor(p_234370_, p_234371_);
@@ -258,10 +_,9 @@
if (flag7 && !isFaceOccludedByNeighbor(direction, Math.max(f44, f45), p_234370_.getBlockState(p_234371_.relative(direction)))) {
@@ -247,10 +_,9 @@
if (flag7 && !isFaceOccludedByNeighbor(direction, Math.max(f45, f46), p_234370_.getBlockState(p_234371_.relative(direction)))) {
BlockPos blockpos = p_234371_.relative(direction);
TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1];
TextureAtlasSprite textureatlassprite2 = textureatlassprite1;
- if (!flag) {
- Block block = p_234370_.getBlockState(blockpos).getBlock();
- if (block instanceof HalfTransparentBlock || block instanceof LeavesBlock) {
- textureatlassprite2 = this.waterOverlay;
+ if (atextureatlassprite[2] != null) {
+ if (sprites[2] != null) {
+ if (p_234370_.getBlockState(blockpos).shouldDisplayFluidOverlay(p_234370_, blockpos, p_234374_)) {
+ textureatlassprite2 = atextureatlassprite[2];
+ textureatlassprite2 = sprites[2];
}
}
@@ -274,15 +_,15 @@
float f33 = f4 * f32 * f;
float f34 = f4 * f32 * f1;
float f35 = f4 * f32 * f2;
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
@@ -263,15 +_,15 @@
float f34 = f4 * f33 * f;
float f35 = f4 * f33 * f1;
float f36 = f4 * f33 * f2;
- this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j);
- this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j);
- this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j);
- this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j);
+ this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j, alpha);
+ this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j, alpha);
+ this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j, alpha);
+ this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j, alpha);
if (textureatlassprite2 != this.waterOverlay) {
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
- this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j);
- this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j);
- this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j);
- this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j);
+ this.vertex(p_234372_, f48, f38 + f16, f50, f34, f35, f36, f57, f32, j, alpha);
+ this.vertex(p_234372_, f52, f38 + f16, f53, f34, f35, f36, f29, f32, j, alpha);
+ this.vertex(p_234372_, f52, f38 + f46, f53, f34, f35, f36, f29, f31, j, alpha);
+ this.vertex(p_234372_, f48, f38 + f45, f50, f34, f35, f36, f57, f30, j, alpha);
}
}
}
@@ -344,10 +_,11 @@
@@ -333,10 +_,11 @@
float p_343128_,
float p_344448_,
float p_344284_,
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java
+++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java
@@ -48,7 +_,7 @@
@@ -49,7 +_,7 @@
int p_234389_
) {
if (!p_393688_.isEmpty()) {
@@ -9,7 +9,7 @@
p_234384_.translate(p_234382_.getOffset(p_234383_));
try {
@@ -322,6 +_,11 @@
@@ -319,6 +_,11 @@
}
}
@@ -21,7 +21,7 @@
public static void renderModel(
PoseStack.Pose p_111068_,
VertexConsumer p_111069_,
@@ -330,9 +_,11 @@
@@ -327,9 +_,11 @@
float p_111073_,
float p_111074_,
int p_111075_,
@@ -1,15 +1,21 @@
--- a/net/minecraft/client/renderer/block/model/BakedQuad.java
+++ b/net/minecraft/client/renderer/block/model/BakedQuad.java
@@ -6,7 +_,11 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public record BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission) {
+public record BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission, boolean ambientOcclusion) {
+ public BakedQuad(int[] vertices, int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission) {
+ this(vertices, tintIndex, direction, sprite, shade, lightEmission, true);
+ }
@@ -20,9 +_,17 @@
Direction direction,
TextureAtlasSprite sprite,
boolean shade,
- int lightEmission
+ int lightEmission,
+ boolean ambientOcclusion
) {
public static final int VERTEX_COUNT = 4;
+
+ public BakedQuad(
+ Vector3fc position0, Vector3fc position1, Vector3fc position2, Vector3fc position3,
+ long packedUV0, long packedUV1, long packedUV2, long packedUV3,
+ int tintIndex, Direction direction, TextureAtlasSprite sprite, boolean shade, int lightEmission) {
+ this(position0, position1, position2, position3, packedUV0, packedUV1, packedUV2, packedUV3, tintIndex, direction, sprite, shade, lightEmission, true);
+ }
public boolean isTinted() {
return this.tintIndex != -1;
}
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
@@ -15,9 +_,18 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, @Nullable BlockElementFace.UVs uvs, Quadrant rotation) {
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, @Nullable BlockElementFace.UVs uvs, Quadrant rotation, @Nullable net.minecraftforge.client.model.ForgeFaceData data) {
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockElementFace.@Nullable UVs uvs, Quadrant rotation) {
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockElementFace.@Nullable UVs uvs, Quadrant rotation, net.minecraftforge.client.model.@Nullable ForgeFaceData data) {
public static final int NO_TINT = -1;
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, @Nullable BlockElementFace.UVs uvs, Quadrant rotation) {
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockElementFace.@Nullable UVs uvs, Quadrant rotation) {
+ this(cullForDirection, tintIndex, texture, uvs, rotation, null);
+ }
+
@@ -1,20 +1,20 @@
--- a/net/minecraft/client/renderer/block/model/BlockModel.java
+++ b/net/minecraft/client/renderer/block/model/BlockModel.java
@@ -28,8 +_,20 @@
@@ -27,8 +_,20 @@
@Nullable Boolean ambientOcclusion,
@Nullable ItemTransforms transforms,
TextureSlots.Data textureSlots,
- @Nullable ResourceLocation parent
+ @Nullable ResourceLocation parent,
+ @Nullable net.minecraftforge.client.model.ForgeBlockModelData forgeData
- @Nullable Identifier parent
+ @Nullable Identifier parent,
+ net.minecraftforge.client.model.@Nullable ForgeBlockModelData forgeData
) implements UnbakedModel {
+ public BlockModel(
+ @Nullable UnbakedGeometry geometry,
+ @Nullable UnbakedModel.GuiLight guiLight,
+ UnbakedModel.@Nullable GuiLight guiLight,
+ @Nullable Boolean ambientOcclusion,
+ @Nullable ItemTransforms transforms,
+ TextureSlots.Data textureSlots,
+ @Nullable ResourceLocation parent
+ @Nullable Identifier parent
+ ) {
+ this(geometry, guiLight, ambientOcclusion, transforms, textureSlots, parent, null);
+ }
@@ -22,21 +22,21 @@
@VisibleForTesting
static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(BlockModel.class, new BlockModel.Deserializer())
@@ -97,8 +_,9 @@
@@ -91,8 +_,9 @@
unbakedmodel$guilight = UnbakedModel.GuiLight.getByName(GsonHelper.getAsString(jsonobject, "gui_light"));
}
+ var forgeData = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModel(jsonobject, p_111500_);
ResourceLocation resourcelocation = s.isEmpty() ? null : ResourceLocation.parse(s);
- return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, resourcelocation);
+ return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, resourcelocation, forgeData);
Identifier identifier = s.isEmpty() ? null : Identifier.parse(s);
- return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, identifier);
+ return new BlockModel(unbakedgeometry, unbakedmodel$guilight, obool, itemtransforms, textureslots$data, identifier, forgeData);
}
private TextureSlots.Data getTextureMap(JsonObject p_111510_) {
@@ -121,6 +_,9 @@
@@ -113,6 +_,9 @@
}
@Nullable
protected UnbakedGeometry getElements(JsonDeserializationContext p_111507_, JsonObject p_111508_) {
protected @Nullable UnbakedGeometry getElements(JsonDeserializationContext p_111507_, JsonObject p_111508_) {
+ var geo = net.minecraftforge.client.ForgeHooksClient.deserializeBlockModelGeometry(p_111508_, p_111507_);
+ if (geo != null)
+ return geo;
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/renderer/block/model/BlockModelPart.java
+++ b/net/minecraft/client/renderer/block/model/BlockModelPart.java
@@ -10,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jspecify.annotations.Nullable;
@OnlyIn(Dist.CLIENT)
-public interface BlockModelPart {
@@ -1,18 +1,12 @@
--- a/net/minecraft/client/renderer/block/model/FaceBakery.java
+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java
@@ -65,7 +_,14 @@
recalculateWinding(aint, direction);
}
- return new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, p_364904_);
+ var data = p_111603_.data();
+ var quad = new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, p_364904_, data.ambientOcclusion());
+ if (!net.minecraftforge.client.model.ForgeFaceData.DEFAULT.equals(data)) {
+ quad = net.minecraftforge.client.model.QuadTransformers.applyingLightmap(data.blockLight(), data.skyLight())
+ .andThen(net.minecraftforge.client.model.QuadTransformers.applyingColor(data.color()))
+ .process(quad);
+ }
+ return quad;
@@ -93,7 +_,8 @@
Objects.requireNonNullElse(direction, Direction.UP),
p_111604_,
p_111608_,
- p_364904_
+ p_364904_,
+ p_111603_.data().ambientOcclusion()
);
}
private static BlockElementFace.UVs shrinkUVs(TextureAtlasSprite p_397002_, BlockElementFace.UVs p_394057_) {
@@ -1,24 +1,26 @@
--- a/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java
+++ b/net/minecraft/client/renderer/block/model/SimpleModelWrapper.java
@@ -13,14 +_,19 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -18,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
-public record SimpleModelWrapper(QuadCollection quads, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon) implements BlockModelPart {
+public record SimpleModelWrapper(QuadCollection quads, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon, net.minecraft.client.renderer.chunk.ChunkSectionLayer layer, net.minecraft.client.renderer.chunk.ChunkSectionLayer layerFast) implements BlockModelPart {
public static SimpleModelWrapper bake(ModelBaker p_395631_, ResourceLocation p_396950_, ModelState p_396899_) {
ResolvedModel resolvedmodel = p_395631_.getModel(p_396950_);
TextureSlots textureslots = resolvedmodel.getTopTextureSlots();
boolean flag = resolvedmodel.getTopAmbientOcclusion();
TextureAtlasSprite textureatlassprite = resolvedmodel.resolveParticleSprite(textureslots, p_395631_);
QuadCollection quadcollection = resolvedmodel.bakeTopGeometry(textureslots, p_395631_, p_396899_);
- return new SimpleModelWrapper(quadcollection, flag, textureatlassprite);
+ var ctx = resolvedmodel.getContext();
+ return new SimpleModelWrapper(quadcollection, flag, textureatlassprite, ctx.getRenderType().block(), ctx.getRenderTypeFast().block());
private static final Logger LOGGER = LogUtils.getLogger();
public static BlockModelPart bake(ModelBaker p_395631_, Identifier p_457297_, ModelState p_396899_) {
@@ -44,8 +_,13 @@
LOGGER.warn("Rejecting block model {}, since it contains sprites from outside of supported atlas: {}", p_457297_, multimap);
return p_395631_.missingBlockModelPart();
} else {
- return new SimpleModelWrapper(quadcollection, flag, textureatlassprite);
+ var ctx = resolvedmodel.getContext();
+ return new SimpleModelWrapper(quadcollection, flag, textureatlassprite, ctx.getRenderType().block(), ctx.getRenderTypeFast().block());
}
+ }
+
+ public SimpleModelWrapper(QuadCollection quads, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon) {
+ this(quads, useAmbientOcclusion, particleIcon, null, null);
+ public SimpleModelWrapper(QuadCollection quadcollection, boolean useAmbientOcclusion, TextureAtlasSprite particleIcon) {
+ this(quadcollection, useAmbientOcclusion, particleIcon, null, null);
}
@Override
@@ -1,16 +1,15 @@
--- a/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java
+++ b/net/minecraft/client/renderer/block/model/multipart/MultiPartModel.java
@@ -26,6 +_,9 @@
@@ -25,6 +_,8 @@
private final MultiPartModel.SharedBakedState shared;
private final BlockState blockState;
@Nullable
private List<BlockStateModel> models;
private @Nullable List<BlockStateModel> models;
+ private boolean cacheKey = false;
+ @Nullable
+ private java.util.Collection<net.minecraft.client.renderer.chunk.ChunkSectionLayer> cache;
+ private java.util.@Nullable Collection<net.minecraft.client.renderer.chunk.ChunkSectionLayer> cache;
MultiPartModel(MultiPartModel.SharedBakedState p_391554_, BlockState p_397918_) {
this.shared = p_391554_;
@@ -38,6 +_,11 @@
@@ -37,6 +_,11 @@
}
@Override
@@ -22,7 +21,7 @@
public void collectParts(RandomSource p_391247_, List<BlockModelPart> p_397207_) {
if (this.models == null) {
this.models = this.shared.selectModels(this.blockState);
@@ -51,6 +_,33 @@
@@ -50,6 +_,33 @@
}
}
@@ -56,7 +55,7 @@
@OnlyIn(Dist.CLIENT)
public record Selector<T>(Predicate<BlockState> condition, T model) {
public <S> MultiPartModel.Selector<S> with(S p_393772_) {
@@ -62,6 +_,7 @@
@@ -61,6 +_,7 @@
static final class SharedBakedState {
private final List<MultiPartModel.Selector<BlockStateModel>> selectors;
final TextureAtlasSprite particleIcon;
@@ -64,7 +63,7 @@
private final Map<BitSet, List<BlockStateModel>> subsets = new ConcurrentHashMap<>();
private static BlockStateModel getFirstModel(List<MultiPartModel.Selector<BlockStateModel>> p_392132_) {
@@ -74,8 +_,8 @@
@@ -73,8 +_,8 @@
public SharedBakedState(List<MultiPartModel.Selector<BlockStateModel>> p_393647_) {
this.selectors = p_393647_;
@@ -1,13 +1,13 @@
--- a/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java
+++ b/net/minecraft/client/renderer/blockentity/SkullBlockRenderer.java
@@ -36,6 +_,7 @@
@@ -37,6 +_,7 @@
@OnlyIn(Dist.CLIENT)
public class SkullBlockRenderer implements BlockEntityRenderer<SkullBlockEntity, SkullBlockRenderState> {
+ private static Map<SkullBlock.Type, Function<EntityModelSet, SkullModelBase>> customModels;
private final Function<SkullBlock.Type, SkullModelBase> modelByType;
public static final Map<SkullBlock.Type, ResourceLocation> SKIN_BY_TYPE = Util.make(Maps.newHashMap(), p_340906_ -> {
p_340906_.put(SkullBlock.Types.SKELETON, ResourceLocation.withDefaultNamespace("textures/entity/skeleton/skeleton.png"));
public static final Map<SkullBlock.Type, Identifier> SKIN_BY_TYPE = Util.make(Maps.newHashMap(), p_340906_ -> {
p_340906_.put(SkullBlock.Types.SKELETON, Identifier.withDefaultNamespace("textures/entity/skeleton/skeleton.png"));
@@ -61,7 +_,9 @@
case PIGLIN -> new PiglinHeadModel(p_376421_.bakeLayer(ModelLayers.PIGLIN_HEAD));
});
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/chunk/RenderSectionRegion.java
+++ b/net/minecraft/client/renderer/chunk/RenderSectionRegion.java
@@ -90,4 +_,9 @@
@@ -89,4 +_,9 @@
public static int index(int p_409495_, int p_409337_, int p_407713_, int p_409077_, int p_406510_, int p_408332_) {
return p_409077_ - p_409495_ + (p_406510_ - p_409337_) * 3 + (p_408332_ - p_407713_) * 3 * 3;
}
Loaded 100 of 698 files, more files were not shown because too many files have changed in this diff. Show more