1.21 Update

Co-authored-by: RealMangoRage <64402114+RealMangorage@users.noreply.github.com>
Co-authored-by: Daniel Norris <dnorris443@gmail.com>
Co-authored-by: Ven <tudurap.com@gmail.com>
This commit is contained in:
committed 2024-06-13 10:42:32 -07:00
1 parent 3d9e12a71d
commit 4a2db246e0
941 files changed
+3119 -4266

No files matched your search

+3 -3
View File
@@ -5,11 +5,11 @@ org.gradle.daemon=false
org.gradle.parallel=true
JAVA_VERSION=21
MC_VERSION=1.20.6
MC_VERSION=1.21
MC_NEXT_VERSION=1.21
MCP_VERSION=20240429.135109
MCP_VERSION=20240613.102039
MAPPING_CHANNEL=official
MAPPING_VERSION=1.20.6
MAPPING_VERSION=1.21
// 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/pipeline/RenderTarget.java
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
@@ -106,7 +_,10 @@
@@ -104,7 +_,10 @@
GlStateManager._texParameter(3553, 34892, 0);
GlStateManager._texParameter(3553, 10242, 33071);
GlStateManager._texParameter(3553, 10243, 33071);
@@ -11,7 +11,7 @@
}
this.setFilterMode(9728, true);
@@ -116,8 +_,13 @@
@@ -114,8 +_,13 @@
GlStateManager._texImage2D(3553, 0, 32856, this.width, this.height, 0, 6408, 5121, null);
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
@@ -26,7 +26,7 @@
}
this.checkStatus();
@@ -280,5 +_,26 @@
@@ -257,5 +_,26 @@
public int getDepthTextureId() {
return this.depthBufferId;
@@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/Window.java
+++ b/com/mojang/blaze3d/platform/Window.java
@@ -82,7 +_,8 @@
@@ -84,7 +_,8 @@
GLFW.glfwWindowHint(139267, 2);
GLFW.glfwWindowHint(139272, 204801);
GLFW.glfwWindowHint(139270, 1);
@@ -10,7 +10,7 @@
if (monitor != null) {
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
@@ -94,6 +_,7 @@
@@ -96,6 +_,7 @@
this.windowedX = this.x = aint1[0];
this.windowedY = this.y = aint[0];
}
@@ -18,7 +18,7 @@
GLFW.glfwMakeContextCurrent(this.window);
GL.createCapabilities();
@@ -242,6 +_,9 @@
@@ -254,6 +_,9 @@
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
@@ -1,18 +0,0 @@
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
@@ -389,6 +_,15 @@
return MemoryUtil.memSlice(this.buffer, p_231170_, p_231171_ - p_231170_);
}
+ public void putBulkData(ByteBuffer buffer) {
+ ensureCapacity(buffer.limit() + this.format.getVertexSize());
+ this.buffer.position(this.nextElementByte);
+ this.buffer.put(buffer);
+ this.buffer.position(0);
+ this.vertices += buffer.limit() / this.format.getVertexSize();
+ this.nextElementByte += buffer.limit();
+ }
+
@OnlyIn(Dist.CLIENT)
public static record DrawState(
VertexFormat format, int vertexCount, int indexCount, VertexFormat.Mode mode, VertexFormat.IndexType indexType, boolean indexOnly, boolean sequentialIndex
@@ -1,11 +1,11 @@
--- a/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
@@ -47,7 +_,7 @@
@Override
public void endVertex() {
Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz));
@@ -62,7 +_,7 @@
public VertexConsumer setNormal(float p_344306_, float p_342091_, float p_344579_) {
this.delegate.setNormal(p_344306_, p_342091_, p_344579_);
Vector3f vector3f = this.normalInversePose.transform(p_344306_, p_342091_, p_344579_, this.normal);
- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F));
vector4f.rotateY((float) Math.PI);
vector4f.rotateX((float) (-Math.PI / 2));
Vector3f vector3f1 = this.cameraInversePose.transformPosition(this.x, this.y, this.z, this.worldPos);
vector3f1.rotateY((float) Math.PI);
vector3f1.rotateX((float) (-Math.PI / 2));
@@ -1,24 +1,24 @@
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
@@ -13,7 +_,7 @@
@@ -12,7 +_,7 @@
import org.lwjgl.system.MemoryStack;
@OnlyIn(Dist.CLIENT)
-public interface VertexConsumer {
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_);
VertexConsumer addVertex(float p_344294_, float p_342213_, float p_344859_);
VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
@@ -142,10 +_,11 @@
f5 = afloat[k] * p_85992_;
VertexConsumer setColor(int p_342749_, int p_344324_, int p_343336_, int p_342831_);
@@ -135,10 +_,11 @@
}
- int l = aint[k];
+ int l = applyBakedLighting(aint[k], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
int i1 = FastColor.ARGB32.color(k, (int)f3, (int)f4, (int)f5);
- int j1 = p_331444_[l];
+ int j1 = applyBakedLighting(p_331444_[l], 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.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, p_335371_, f9, f10, p_85993_, l, vector3f.x(), vector3f.y(), vector3f.z());
this.addVertex(vector3f1.x(), vector3f1.y(), vector3f1.z(), i1, f10, f9, p_85993_, j1, vector3f.x(), vector3f.y(), vector3f.z());
}
}
@@ -1,21 +1,41 @@
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
@@ -12,7 +_,7 @@
@@ -13,7 +_,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
-public class VertexFormat {
+public class VertexFormat implements net.minecraftforge.client.extensions.IForgeVertexFormat {
private final ImmutableList<VertexFormatElement> elements;
private final ImmutableMap<String, VertexFormatElement> elementMapping;
private final IntList offsets = new IntArrayList();
@@ -113,6 +_,9 @@
public static final int UNKNOWN_ELEMENT = -1;
private final List<VertexFormatElement> elements;
private final List<String> names;
@@ -22,6 +_,7 @@
private final int[] offsetsByElement = new int[32];
@Nullable
private VertexBuffer immediateDrawVertexBuffer;
+ 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_;
@@ -34,6 +_,11 @@
int j = vertexformatelement != null ? p_343616_.indexOf(vertexformatelement) : -1;
this.offsetsByElement[i] = j != -1 ? p_345522_.getInt(j) : -1;
}
+
+ ImmutableMap.Builder<String, VertexFormatElement> elements = ImmutableMap.builder();
+ for (int i = 0; i < p_343616_.size(); i++)
+ elements.put(p_345241_.get(i), p_343616_.get(i));
+ this.elementMapping = elements.buildOrThrow();
}
public static VertexFormat.Builder builder() {
@@ -158,6 +_,9 @@
return vertexbuffer;
}
+
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
+ public int getOffset(int index) { return offsets.getInt(index); }
+ public int getOffset(int index) { return offsetsByElement[index]; }
@OnlyIn(Dist.CLIENT)
public static enum IndexType {
public static class Builder {
@@ -1,6 +1,6 @@
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -59,14 +_,9 @@
@@ -58,14 +_,9 @@
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
p_127520_.append("-- Head --\n");
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
@@ -18,7 +18,7 @@
}
for (CrashReportCategory crashreportcategory : this.details) {
@@ -74,6 +_,7 @@
@@ -73,6 +_,7 @@
p_127520_.append("\n\n");
}
@@ -26,7 +26,7 @@
this.systemReport.appendToCrashReportString(p_127520_);
}
@@ -93,18 +_,7 @@
@@ -92,18 +_,7 @@
throwable.setStackTrace(this.exception.getStackTrace());
}
@@ -45,4 +45,4 @@
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
}
public String getFriendlyReport() {
public String getFriendlyReport(ReportType p_343869_, List<String> p_342487_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -181,6 +_,7 @@
@@ -171,6 +_,7 @@
}
static {
@@ -4,8 +4,8 @@
}
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
- AdvancementHolder advancementholder = this.build(new ResourceLocation(p_138391_));
+ return save(p_138390_, new ResourceLocation(p_138391_));
- AdvancementHolder advancementholder = this.build(ResourceLocation.parse(p_138391_));
+ return save(p_138390_, ResourceLocation.parse(p_138391_));
+ }
+
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
@@ -1,12 +1,24 @@
--- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java
@@ -227,6 +_,18 @@
return this.partialTickTime;
@@ -105,9 +_,13 @@
}
+ public void setAnglesInternal(float yaw, float pitch) {
+ this.yRot = yaw;
+ this.xRot = pitch;
protected void setRotation(float p_90573_, float p_90574_) {
+ setRotation(p_90573_, p_90574_, 0.0f);
+ }
+
+ public void setRotation(float p_90573_, float p_90574_, float z) {
this.xRot = p_90574_;
this.yRot = p_90573_;
- this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), 0.0F);
+ this.rotation.rotationYXZ((float) Math.PI - p_90573_ * (float) (Math.PI / 180.0), -p_90574_ * (float) (Math.PI / 180.0), z * (float) (Math.PI / 180.0));
FORWARDS.rotate(this.rotation, this.forwards);
UP.rotate(this.rotation, this.up);
LEFT.rotate(this.rotation, this.left);
@@ -223,6 +_,13 @@
public float getPartialTickTime() {
return this.partialTickTime;
+ }
+
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
@@ -14,8 +26,6 @@
+ return net.minecraft.world.level.block.Blocks.AIR.defaultBlockState();
+ else
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
+ }
+
}
@OnlyIn(Dist.CLIENT)
public static class NearPlane {
final Vec3 forward;
@@ -0,0 +1,25 @@
--- a/net/minecraft/client/DeltaTracker.java
+++ b/net/minecraft/client/DeltaTracker.java
@@ -87,18 +_,22 @@
private void pause() {
if (!this.paused) {
+ if (net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(true)) return;
this.pausedDeltaTickResidual = this.deltaTickResidual;
}
this.paused = true;
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(true);
}
private void unPause() {
if (this.paused) {
+ if (net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(false)) return;
this.deltaTickResidual = this.pausedDeltaTickResidual;
}
this.paused = false;
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(false);
}
public void updateFrozenState(boolean p_344005_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -410,9 +_,9 @@
@@ -405,9 +_,9 @@
Screen.wrapScreenError(() -> {
if (p_90897_ == 1 || p_90897_ == 2) {
screen.afterKeyboardAction();
@@ -12,7 +12,7 @@
}
}, "keyPressed event handler", screen.getClass().getCanonicalName());
if (aboolean[0]) {
@@ -481,20 +_,21 @@
@@ -476,20 +_,21 @@
}
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -259,7 +_,7 @@
@@ -254,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@@ -9,7 +9,7 @@
static Minecraft instance;
private static final Logger LOGGER = LogUtils.getLogger();
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
@@ -438,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;
@@ -475,15 +_,15 @@
@@ -468,15 +_,15 @@
}
this.window.setFramerateLimit(this.options.framerateLimit().get());
@@ -34,8 +34,8 @@
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
this.resourcePackRepository.reload();
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
this.languageManager = new LanguageManager(this.options.languageCode);
@@ -542,6 +_,7 @@
this.languageManager = new LanguageManager(this.options.languageCode, p_340763_ -> {
@@ -540,6 +_,7 @@
this.entityRenderDispatcher = new EntityRenderDispatcher(this, this.textureManager, this.itemRenderer, this.blockRenderer, this.font, this.options, this.entityModels);
this.resourceManager.registerReloadListener(this.entityRenderDispatcher);
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
@@ -43,16 +43,12 @@
this.resourceManager.registerReloadListener(this.particleEngine);
this.paintingTextures = new PaintingTextureManager(this.textureManager);
this.resourceManager.registerReloadListener(this.paintingTextures);
@@ -554,13 +_,18 @@
@@ -552,11 +_,15 @@
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
this.resourceManager.registerReloadListener(this.levelRenderer);
- this.createSearchTrees();
+ // Forge: We delay this to allow registration of modded creative mode tabs
+ //this.createSearchTrees();
this.resourceManager.registerReloadListener(this.searchRegistry);
this.gpuWarnlistManager = new GpuWarnlistManager();
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
this.resourceManager.registerReloadListener(this.regionalCompliancies);
@@ -63,7 +59,7 @@
this.debugRenderer = new DebugRenderer(this);
RealmsClient realmsclient = RealmsClient.create(this);
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
@@ -584,6 +_,7 @@
@@ -580,6 +_,7 @@
this.options.fullscreen().set(this.window.isFullscreen());
}
@@ -71,7 +67,7 @@
this.window.updateVsync(this.options.enableVsync().get());
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.window.setDefaultErrorCallback();
@@ -604,16 +_,17 @@
@@ -600,16 +_,17 @@
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
this.setOverlay(
@@ -92,7 +88,7 @@
);
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
}
@@ -702,6 +_,7 @@
@@ -698,6 +_,7 @@
StringBuilder stringbuilder = new StringBuilder("Minecraft");
if (checkModStatus().shouldReportAsModified()) {
stringbuilder.append("*");
@@ -100,7 +96,7 @@
}
stringbuilder.append(" ");
@@ -725,6 +_,8 @@
@@ -721,6 +_,8 @@
}
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
@@ -109,7 +105,7 @@
return p_193587_.user.user.getType() != User.Type.MSA
? UserApiService.OFFLINE
: p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
@@ -735,7 +_,7 @@
@@ -731,7 +_,7 @@
}
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
@@ -118,48 +114,7 @@
this.clearResourcePacksOnError(p_91240_, null, p_299515_);
} else {
Util.throwAsRuntime(p_91240_);
@@ -817,9 +_,12 @@
}
public void createSearchTrees() {
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
+ for (var nameSearchKey : nameSearchKeys.values())
this.searchRegistry
.register(
- SearchRegistry.CREATIVE_NAMES,
+ nameSearchKey,
p_231451_ -> new FullTextSearchTree<>(
p_325272_ -> p_325272_.getTooltipLines(Item.TooltipContext.EMPTY, null, TooltipFlag.Default.NORMAL.asCreative())
.stream()
@@ -829,8 +_,9 @@
p_231451_
)
);
+ for (var tagSearchKey : tagSearchKeys.values())
this.searchRegistry
- .register(SearchRegistry.CREATIVE_TAGS, p_231430_ -> new IdSearchTree<>(p_231353_ -> p_231353_.getTags().map(TagKey::location), p_231430_));
+ .register(tagSearchKey, p_231430_ -> new IdSearchTree<>(p_231353_ -> p_231353_.getTags().map(TagKey::location), p_231430_));
this.searchRegistry
.register(
SearchRegistry.RECIPE_COLLECTIONS,
@@ -854,9 +_,12 @@
p_301514_
)
);
- CreativeModeTabs.searchTab().setSearchTreeBuilder(p_255439_ -> {
- this.populateSearchTree(SearchRegistry.CREATIVE_NAMES, p_255439_);
- this.populateSearchTree(SearchRegistry.CREATIVE_TAGS, p_255439_);
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
+ var tagSearchKey = tagSearchKeys.get(tab);
+ tab.setSearchTreeBuilder(contents -> {
+ this.populateSearchTree(nameSearchKey, contents);
+ this.populateSearchTree(tagSearchKey, contents);
+ });
});
}
@@ -1039,12 +_,6 @@
@@ -991,12 +_,6 @@
LOGGER.error("setScreen called from non-game thread");
}
@@ -172,7 +127,7 @@
if (p_91153_ == null && this.clientLevelTeardownInProgress) {
throw new IllegalStateException("Trying to return to in-game GUI during disconnection");
} else {
@@ -1058,6 +_,23 @@
@@ -1010,6 +_,23 @@
}
}
@@ -196,37 +151,19 @@
this.screen = p_91153_;
if (this.screen != null) {
this.screen.added();
@@ -1204,9 +_,12 @@
@@ -1155,9 +_,11 @@
this.mouseHandler.handleAccumulatedMovement();
this.profiler.pop();
if (!this.noRender) {
+ this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickStart(this.timer);
this.profiler.popPush("gameRenderer");
this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_);
this.gameRenderer.render(this.timer, p_91384_);
this.profiler.pop();
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onRenderTickEnd(this.timer);
}
if (this.fpsPieResults != null) {
@@ -1240,7 +_,7 @@
boolean flag1 = this.hasSingleplayerServer()
&& (this.screen != null && this.screen.isPauseScreen() || this.overlay != null && this.overlay.isPauseScreen())
&& !this.singleplayerServer.isPublished();
- if (this.pause != flag1) {
+ if (this.pause != flag1 && !net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePre(flag1)) {
if (flag1) {
this.pausePartialTick = this.timer.partialTick;
} else {
@@ -1248,6 +_,7 @@
}
this.pause = flag1;
+ net.minecraftforge.client.ForgeHooksClient.onClientPauseChangePost(flag1);
}
long l = Util.getNanos();
@@ -1340,10 +_,12 @@
@@ -1283,10 +_,12 @@
this.window.setGuiScale((double)i);
if (this.screen != null) {
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
@@ -239,7 +176,7 @@
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
this.mouseHandler.setIgnoreFirstMove();
}
@@ -1619,6 +_,7 @@
@@ -1554,6 +_,7 @@
}
public void stop() {
@@ -247,7 +184,7 @@
this.running = false;
}
@@ -1647,10 +_,18 @@
@@ -1582,10 +_,18 @@
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
@@ -269,7 +206,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
}
}
@@ -1678,6 +_,8 @@
@@ -1613,6 +_,8 @@
return false;
} else {
boolean flag = false;
@@ -278,7 +215,7 @@
switch (this.hitResult.getType()) {
case ENTITY:
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
@@ -1685,7 +_,7 @@
@@ -1620,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.getBlockPos();
@@ -287,7 +224,7 @@
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
if (this.level.getBlockState(blockpos).isAir()) {
flag = true;
@@ -1698,8 +_,10 @@
@@ -1633,8 +_,10 @@
}
this.player.resetAttackStrengthTicker();
@@ -298,7 +235,7 @@
this.player.swing(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1715,6 +_,12 @@
@@ -1650,6 +_,12 @@
}
for (InteractionHand interactionhand : InteractionHand.values()) {
@@ -311,7 +248,7 @@
ItemStack itemstack = this.player.getItemInHand(interactionhand);
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
return;
@@ -1735,7 +_,7 @@
@@ -1670,7 +_,7 @@
}
if (interactionresult.consumesAction()) {
@@ -320,7 +257,7 @@
this.player.swing(interactionhand);
}
@@ -1747,7 +_,7 @@
@@ -1682,7 +_,7 @@
int i = itemstack.getCount();
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
if (interactionresult1.consumesAction()) {
@@ -329,7 +266,7 @@
this.player.swing(interactionhand);
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
@@ -1763,6 +_,9 @@
@@ -1698,6 +_,9 @@
}
}
@@ -339,7 +276,7 @@
if (!itemstack.isEmpty()) {
InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
if (interactionresult2.consumesAction()) {
@@ -1793,6 +_,8 @@
@@ -1728,6 +_,8 @@
this.rightClickDelay--;
}
@@ -348,7 +285,7 @@
this.profiler.push("gui");
this.chatListener.tick();
this.gui.tick(this.pause);
@@ -1877,6 +_,7 @@
@@ -1811,6 +_,7 @@
this.tutorial.tick();
@@ -356,7 +293,7 @@
try {
this.level.tick(() -> true);
} catch (Throwable throwable) {
@@ -1890,6 +_,7 @@
@@ -1824,6 +_,7 @@
throw new ReportedException(crashreport);
}
@@ -364,15 +301,15 @@
}
this.profiler.popPush("animateTick");
@@ -1909,6 +_,7 @@
@@ -1843,6 +_,7 @@
this.profiler.popPush("keyboard");
this.keyboardHandler.tick();
this.profiler.pop();
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
}
private boolean isMultiplayerServer() {
@@ -2105,6 +_,7 @@
private boolean isLevelRunningNormally() {
@@ -2043,6 +_,7 @@
}
public void setLevel(ClientLevel p_91157_, ReceivingLevelScreen.Reason p_335893_) {
@@ -380,7 +317,7 @@
this.updateScreenAndTick(new ReceivingLevelScreen(() -> false, p_335893_));
this.level = p_91157_;
this.updateLevelInEngines(p_91157_);
@@ -2142,6 +_,7 @@
@@ -2080,6 +_,7 @@
IntegratedServer integratedserver = this.singleplayerServer;
this.singleplayerServer = null;
this.gameRenderer.resetData();
@@ -388,7 +325,7 @@
this.gameMode = null;
this.narrator.clear();
this.clientLevelTeardownInProgress = true;
@@ -2149,6 +_,7 @@
@@ -2087,6 +_,7 @@
try {
this.updateScreenAndTick(p_335030_);
if (this.level != null) {
@@ -396,7 +333,7 @@
if (integratedserver != null) {
this.profiler.push("waitForServer");
@@ -2161,6 +_,7 @@
@@ -2099,6 +_,7 @@
this.gui.onDisconnected();
this.isLocalServer = false;
@@ -404,7 +341,7 @@
}
this.level = null;
@@ -2307,6 +_,7 @@
@@ -2245,6 +_,7 @@
private void pickBlock() {
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
@@ -412,7 +349,7 @@
boolean flag = this.player.getAbilities().instabuild;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.hitResult.getType();
@@ -2319,7 +_,7 @@
@@ -2257,7 +_,7 @@
}
Block block = blockstate.getBlock();
@@ -421,7 +358,7 @@
if (itemstack.isEmpty()) {
return;
}
@@ -2333,7 +_,7 @@
@@ -2271,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.hitResult).getEntity();
@@ -430,7 +367,7 @@
if (itemstack == null) {
return;
}
@@ -2931,6 +_,19 @@
@@ -2855,6 +_,10 @@
@Nullable
public static String getLauncherBrand() {
return System.getProperty("minecraft.launcher.brand");
@@ -438,15 +375,6 @@
+
+ public ItemColors getItemColors() {
+ return this.itemColors;
+ }
+
+ public SearchRegistry getSearchTreeManager() {
+ return this.searchRegistry;
+ }
+
+ private float realPartialTick;
+ public float getPartialTick() {
+ return this.realPartialTick;
}
@OnlyIn(Dist.CLIENT)
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/MouseHandler.java
+++ b/net/minecraft/client/MouseHandler.java
@@ -74,6 +_,7 @@
@@ -79,6 +_,7 @@
this.activeButton = -1;
}
@@ -8,7 +8,7 @@
boolean[] aboolean = new boolean[]{false};
if (this.minecraft.getOverlay() == null) {
if (this.minecraft.screen == null) {
@@ -86,9 +_,9 @@
@@ -91,9 +_,9 @@
Screen screen = this.minecraft.screen;
if (flag) {
screen.afterMouseAction();
@@ -20,7 +20,7 @@
}
}
}
@@ -111,6 +_,7 @@
@@ -116,6 +_,7 @@
}
}
}
@@ -28,7 +28,7 @@
}
}
@@ -124,7 +_,9 @@
@@ -129,7 +_,9 @@
if (this.minecraft.screen != null) {
double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
@@ -39,7 +39,7 @@
this.minecraft.screen.afterMouseAction();
} else if (this.minecraft.player != null) {
if (this.accumulatedScrollX != 0.0 && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
@@ -146,6 +_,7 @@
@@ -151,6 +_,7 @@
this.accumulatedScrollX -= (double)j;
this.accumulatedScrollY -= (double)i;
int k = i == 0 ? -j : i;
@@ -47,7 +47,7 @@
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
@@ -216,7 +_,7 @@
@@ -236,7 +_,7 @@
if (this.activeButton != -1 && this.mousePressedTime > 0.0) {
double d4 = this.accumulatedDX * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
double d5 = this.accumulatedDY * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
@@ -56,7 +56,7 @@
}
screen.afterMouseMove();
@@ -283,6 +_,14 @@
@@ -303,6 +_,14 @@
public double ypos() {
return this.ypos;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -680,7 +_,8 @@
@@ -681,7 +_,8 @@
},
new OptionInstance.LazyEnum<>(
() -> Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList(),
@@ -10,7 +10,7 @@
? Optional.empty()
: Optional.of(p_232011_),
Codec.STRING
@@ -1044,6 +_,7 @@
@@ -1050,6 +_,7 @@
}
public Options(Minecraft p_92138_, File p_92139_) {
@@ -18,7 +18,7 @@
this.minecraft = p_92138_;
this.optionsFile = new File(p_92139_, "options.txt");
boolean flag = Runtime.getRuntime().maxMemory() >= 1000000000L;
@@ -1178,12 +_,22 @@
@@ -1184,12 +_,22 @@
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
p_168428_.process("menuBackgroundBlurriness", this.menuBackgroundBlurriness);
@@ -42,7 +42,7 @@
}
}
@@ -1201,6 +_,10 @@
@@ -1207,6 +_,10 @@
}
public void load() {
@@ -53,7 +53,7 @@
try {
if (!this.optionsFile.exists()) {
return;
@@ -1228,7 +_,8 @@
@@ -1234,7 +_,8 @@
}
}
@@ -63,7 +63,7 @@
new Options.FieldAccess() {
@Nullable
private String getValueOrNull(String p_168459_) {
@@ -1422,6 +_,7 @@
@@ -1428,6 +_,7 @@
}
public void broadcastOptions() {
@@ -71,7 +71,7 @@
if (this.minecraft.player != null) {
this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
}
@@ -1544,6 +_,23 @@
@@ -1546,6 +_,23 @@
public static Component genericValueLabel(Component p_231901_, int p_231902_) {
return genericValueLabel(p_231901_, Component.literal(Integer.toString(p_231902_)));
@@ -94,4 +94,4 @@
+ keySmoothCamera.setKeyConflictContext(inGame);
}
@OnlyIn(Dist.CLIENT)
public static Component genericValueOrOffLabel(Component p_345288_, int p_344826_) {
@@ -9,7 +9,7 @@
private final SubtitleOverlay subtitleOverlay;
private final SpectatorGui spectatorGui;
private final PlayerTabOverlay tabList;
@@ -320,7 +_,7 @@
@@ -318,7 +_,7 @@
Window window = this.minecraft.getWindow();
int i = Mth.floor(this.minecraft.mouseHandler.xpos() * (double)window.getGuiScaledWidth() / (double)window.getScreenWidth());
int j = Mth.floor(this.minecraft.mouseHandler.ypos() * (double)window.getGuiScaledHeight() / (double)window.getScreenHeight());
@@ -18,7 +18,7 @@
}
}
@@ -444,6 +_,8 @@
@@ -434,6 +_,8 @@
for (MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
Holder<MobEffect> holder = mobeffectinstance.getEffect();
@@ -27,7 +27,7 @@
if (mobeffectinstance.showIcon()) {
int i = p_282812_.guiWidth();
int j = 1;
@@ -473,6 +_,7 @@
@@ -463,6 +_,7 @@
}
}
@@ -35,7 +35,7 @@
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(holder);
int l1 = i;
int i1 = j;
@@ -635,6 +_,10 @@
@@ -625,6 +_,10 @@
}
private void renderSelectedItemName(GuiGraphics p_283501_) {
@@ -46,7 +46,7 @@
this.minecraft.getProfiler().push("selectedItemName");
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color());
@@ -642,9 +_,10 @@
@@ -632,9 +_,10 @@
mutablecomponent.withStyle(ChatFormatting.ITALIC);
}
@@ -59,10 +59,10 @@
if (!this.minecraft.gameMode.canHurtPlayer()) {
k += 14;
}
@@ -657,6 +_,13 @@
@@ -646,6 +_,13 @@
if (l > 0) {
p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0));
p_283501_.drawString(this.getFont(), mutablecomponent, j, k, 16777215 + (l << 24));
p_283501_.drawStringWithBackdrop(this.getFont(), mutablecomponent, j, k, i, FastColor.ARGB32.color(l, -1));
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
+ if (font == null) {
+ p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24));
@@ -73,7 +73,7 @@
}
}
@@ -1155,7 +_,7 @@
@@ -1146,7 +_,7 @@
ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
if (itemstack.isEmpty()) {
this.toolHighlightTimer = 0;
@@ -9,7 +9,7 @@
public static final float MAX_GUI_Z = 10000.0F;
public static final float MIN_GUI_Z = -10000.0F;
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
@@ -280,6 +_,11 @@
@@ -268,6 +_,11 @@
}
public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
@@ -21,7 +21,7 @@
if (p_281896_ == null) {
return 0;
} else {
@@ -306,6 +_,11 @@
@@ -294,6 +_,11 @@
}
public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
@@ -33,7 +33,7 @@
int i = p_282636_.drawInBatch(
p_281596_,
(float)p_281586_,
@@ -872,6 +_,7 @@
@@ -864,6 +_,7 @@
CrashReport crashreport = CrashReport.forThrowable(throwable, "Rendering item");
CrashReportCategory crashreportcategory = crashreport.addCategory("Item being rendered");
crashreportcategory.setDetail("Item Type", () -> String.valueOf(p_281675_.getItem()));
@@ -41,7 +41,7 @@
crashreportcategory.setDetail("Item Components", () -> String.valueOf(p_281675_.getComponents()));
crashreportcategory.setDetail("Item Foil", () -> String.valueOf(p_281675_.hasFoil()));
throw new ReportedException(crashreport);
@@ -912,16 +_,26 @@
@@ -904,16 +_,26 @@
}
this.pose.popPose();
@@ -70,7 +70,7 @@
this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
}
@@ -930,7 +_,15 @@
@@ -922,7 +_,15 @@
}
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
@@ -87,7 +87,7 @@
}
public void renderTooltip(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
@@ -949,11 +_,13 @@
@@ -941,11 +_,13 @@
private void renderTooltipInternal(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
if (!p_282615_.isEmpty()) {
@@ -102,7 +102,7 @@
if (k > i) {
i = k;
}
@@ -963,18 +_,21 @@
@@ -955,18 +_,21 @@
int i2 = i;
int j2 = j;
@@ -127,7 +127,7 @@
k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0);
}
@@ -982,7 +_,7 @@
@@ -974,7 +_,7 @@
for (int k2 = 0; k2 < p_282615_.size(); k2++) {
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/AbstractButton.java
+++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -32,7 +_,7 @@
@@ -34,7 +_,7 @@
RenderSystem.enableDepthTest();
p_281670_.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
p_281670_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
@@ -79,13 +79,13 @@
+ protected void drawGameInformation(GuiGraphics p_281525_) {
+ List<String> list = this.getGameInformation();
+ list.addAll(this.getOverlayHelp());
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getFrameTime(), list, true);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281525_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, true);
+ this.renderLines(p_281525_, list, true);
}
protected void drawSystemInformation(GuiGraphics p_281261_) {
List<String> list = this.getSystemInformation();
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getFrameTime(), list, false);
+ net.minecraftforge.client.ForgeHooksClient.onCustomizeDebugEvent(p_281261_, minecraft.getWindow(), minecraft.getTimer().getRealtimeDeltaTicks(), list, false);
this.renderLines(p_281261_, list, false);
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/PauseScreen.java
+++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -86,6 +_,7 @@
@@ -94,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
@@ -204,7 +_,7 @@
@@ -201,7 +_,7 @@
}
public void onClose() {
@@ -9,7 +9,7 @@
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
@@ -320,8 +_,10 @@
@@ -312,8 +_,10 @@
this.width = p_96608_;
this.height = p_96609_;
if (!this.initialized) {
@@ -20,7 +20,7 @@
} else {
this.repositionElements();
}
@@ -334,8 +_,10 @@
@@ -326,8 +_,10 @@
protected void rebuildWidgets() {
this.clearWidgets();
this.clearFocus();
@@ -31,7 +31,7 @@
}
@Override
@@ -362,6 +_,7 @@
@@ -354,6 +_,7 @@
this.renderBlurredBackground(p_297268_);
this.renderMenuBackground(p_283688_);
@@ -39,7 +39,7 @@
}
protected void renderBlurredBackground(float p_336041_) {
@@ -492,6 +_,19 @@
@@ -463,6 +_,19 @@
}
public void onFilesDrop(List<Path> p_96591_) {
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/TitleScreen.java
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
@@ -61,6 +_,7 @@
@Nullable
private TitleScreen.WarningLabel warningLabel;
@@ -60,6 +_,7 @@
private boolean fading;
private long fadeInStart;
private final LogoRenderer logoRenderer;
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
public TitleScreen() {
this(false);
@@ -116,11 +_,15 @@
@@ -115,11 +_,15 @@
int j = this.width - i - 2;
int k = 24;
int l = this.height / 4 + 48;
@@ -24,7 +24,7 @@
SpriteIconButton spriteiconbutton = this.addRenderableWidget(
CommonButtons.language(
@@ -171,7 +_,7 @@
@@ -170,7 +_,7 @@
}).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build()).active = flag;
this.addRenderableWidget(
Button.builder(Component.translatable("menu.online"), p_325369_ -> this.minecraft.setScreen(new RealmsMainScreen(this)))
@@ -33,15 +33,15 @@
.tooltip(tooltip)
.build()
)
@@ -281,6 +_,7 @@
this.warningLabel.render(p_282860_, i);
}
@@ -276,6 +_,7 @@
if ((i & -67108864) != 0) {
super.render(p_282860_, p_281753_, p_283539_, p_282628_);
this.logoRenderer.renderLogo(p_282860_, this.width, f);
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
if (this.splash != null && !this.minecraft.options.hideSplashTexts().get()) {
this.splash.render(p_282860_, this.width, this.font, i);
}
@@ -296,11 +_,19 @@
@@ -291,11 +_,19 @@
s = s + I18n.get("menu.modded");
}
@@ -1,46 +0,0 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
@@ -33,7 +_,7 @@
this.keyBindsList = this.addRenderableWidget(new KeyBindsList(this, this.minecraft));
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_269619_ -> {
for (KeyMapping keymapping : this.options.keyMappings) {
- keymapping.setKey(keymapping.getDefaultKey());
+ keymapping.setToDefault();
}
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -70,11 +_,14 @@
public boolean keyPressed(int p_193987_, int p_193988_, int p_193989_) {
if (this.selectedKey != null) {
if (p_193987_ == 256) {
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
} else {
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_193987_, p_193988_));
this.options.setKey(this.selectedKey, InputConstants.getKey(p_193987_, p_193988_));
}
+ if (p_193987_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
this.selectedKey = null;
this.lastKeySelection = Util.getMillis();
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -82,6 +_,19 @@
} else {
return super.keyPressed(p_193987_, p_193988_, p_193989_);
}
+ }
+
+ @Override
+ public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
+ // Forge: We wait for a second key above if the first press is a modifier
+ // but if they release the modifier then set it explicitly.
+ var key = InputConstants.getKey(keyCode, scanCode);
+ if (this.selectedKey != null && this.selectedKey.getKey() == key) {
+ this.selectedKey = null;
+ this.lastKeySelection = Util.getMillis();
+ this.keyBindsList.resetMappingAndUpdateButtons();
+ }
+ return super.keyReleased(keyCode, scanCode, modifiers);
}
@Override
@@ -7,9 +7,9 @@
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.getInventory(), CommonComponents.EMPTY);
@@ -144,7 +_,7 @@
public CreativeModeInventoryScreen(LocalPlayer p_344408_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_344408_), p_344408_.getInventory(), CommonComponents.EMPTY);
@@ -159,7 +_,7 @@
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_);
@@ -307,6 +_,35 @@
@@ -322,6 +_,35 @@
protected void init() {
if (this.minecraft.gameMode.hasInfiniteItems()) {
super.init();
@@ -54,7 +54,7 @@
this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
this.searchBox.setMaxLength(50);
this.searchBox.setBordered(false);
@@ -353,7 +_,7 @@
@@ -368,7 +_,7 @@
public boolean charTyped(char p_98521_, int p_98522_) {
if (this.ignoreTextInput) {
return false;
@@ -63,7 +63,7 @@
return false;
} else {
String s = this.searchBox.getValue();
@@ -372,7 +_,7 @@
@@ -387,7 +_,7 @@
@Override
public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
this.ignoreTextInput = false;
@@ -72,7 +72,7 @@
if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
this.ignoreTextInput = true;
this.selectTab(CreativeModeTabs.searchTab());
@@ -408,6 +_,7 @@
@@ -423,6 +_,7 @@
}
private void refreshSearchResults() {
@@ -80,20 +80,20 @@
this.menu.items.clear();
this.visibleTags.clear();
String s = this.searchBox.getValue();
@@ -417,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
- searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_TAGS);
+ searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
this.updateVisibleTags(s);
} else {
- searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_NAMES);
+ searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
}
@@ -435,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
- searchtree = sessionsearchtrees.creativeTagSearch();
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
this.updateVisibleTags(s);
} else {
- searchtree = sessionsearchtrees.creativeNameSearch();
+ searchtree = sessionsearchtrees.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
}
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
@@ -447,7 +_,8 @@
this.menu.items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
@@ -466,7 +_,8 @@
@Override
protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
if (selectedTab.showTitle()) {
@@ -103,7 +103,7 @@
}
}
@@ -457,7 +_,7 @@
@@ -476,7 +_,7 @@
double d0 = p_98531_ - (double)this.leftPos;
double d1 = p_98532_ - (double)this.topPos;
@@ -112,7 +112,7 @@
if (this.checkTabClicked(creativemodetab, d0, d1)) {
return true;
}
@@ -479,7 +_,7 @@
@@ -498,7 +_,7 @@
double d1 = p_98623_ - (double)this.topPos;
this.scrolling = false;
@@ -121,7 +121,7 @@
if (this.checkTabClicked(creativemodetab, d0, d1)) {
this.selectTab(creativemodetab);
return true;
@@ -497,6 +_,7 @@
@@ -516,6 +_,7 @@
private void selectTab(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = selectedTab;
selectedTab = p_98561_;
@@ -129,7 +129,7 @@
this.quickCraftSlots.clear();
this.menu.items.clear();
this.clearDraggingState();
@@ -573,13 +_,15 @@
@@ -592,13 +_,15 @@
this.originalSlots = null;
}
@@ -146,7 +146,7 @@
this.refreshSearchResults();
} else {
@@ -642,7 +_,15 @@
@@ -661,7 +_,15 @@
public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) {
super.render(p_283000_, p_281317_, p_282770_, p_281295_);
@@ -163,7 +163,7 @@
if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
break;
}
@@ -654,6 +_,7 @@
@@ -673,6 +_,7 @@
p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
}
@@ -171,7 +171,7 @@
this.renderTooltip(p_283000_, p_281317_, p_282770_);
}
@@ -661,7 +_,7 @@
@@ -680,7 +_,7 @@
public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
@@ -180,7 +180,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);
@@ -680,7 +_,7 @@
@@ -699,7 +_,7 @@
int i = 1;
for (CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
@@ -189,7 +189,7 @@
list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
}
}
@@ -691,14 +_,14 @@
@@ -710,7 +_,7 @@
@Override
protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
@@ -198,15 +198,7 @@
if (creativemodetab != selectedTab) {
this.renderTabButton(p_282663_, creativemodetab);
}
}
p_282663_.blit(
- new ResourceLocation("textures/gui/container/creative_inventory/tab_" + selectedTab.getBackgroundSuffix()),
+ selectedTab.getBackgroundLocation(),
this.leftPos,
this.topPos,
0,
@@ -715,6 +_,7 @@
@@ -726,6 +_,7 @@
p_282663_.blitSprite(resourcelocation, j, k + (int)((float)(i - k - 17) * this.scrollOffs), 12, 15);
}
@@ -214,7 +206,7 @@
this.renderTabButton(p_282663_, selectedTab);
if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
InventoryScreen.renderEntityInInventoryFollowsMouse(
@@ -733,7 +_,7 @@
@@ -744,7 +_,7 @@
}
private int getTabX(CreativeModeTab p_260136_) {
@@ -223,7 +215,7 @@
int j = 27;
int k = 27 * i;
if (p_260136_.isAlignedRight()) {
@@ -745,7 +_,7 @@
@@ -756,7 +_,7 @@
private int getTabY(CreativeModeTab p_260181_) {
int i = 0;
@@ -232,7 +224,7 @@
i -= 32;
} else {
i += this.imageHeight;
@@ -773,8 +_,8 @@
@@ -784,8 +_,8 @@
protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
boolean flag = p_283489_ == selectedTab;
@@ -243,7 +235,7 @@
int j = this.leftPos + this.getTabX(p_283489_);
int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
ResourceLocation[] aresourcelocation;
@@ -784,6 +_,7 @@
@@ -795,6 +_,7 @@
aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
}
@@ -251,7 +243,7 @@
p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
p_283590_.pose().pushPose();
p_283590_.pose().translate(0.0F, 0.0F, 100.0F);
@@ -825,6 +_,14 @@
@@ -836,6 +_,14 @@
}
}
@@ -266,7 +258,7 @@
@OnlyIn(Dist.CLIENT)
static class CustomCreativeSlot extends Slot {
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
@@ -1009,6 +_,22 @@
@@ -1020,6 +_,22 @@
@Override
public boolean mayPickup(Player p_98665_) {
return this.target.mayPickup(p_98665_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -108,7 +_,7 @@
@@ -111,7 +_,7 @@
int l1 = 86 - this.font.width(s);
FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
int i2 = 6839882;
@@ -9,20 +9,24 @@
RenderSystem.enableBlend();
p_282430_.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
p_282430_.blitSprite(DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
@@ -173,10 +_,13 @@
Enchantment enchantment = Enchantment.byId(this.menu.enchantClue[j]);
int l = this.menu.levelClue[j];
int i1 = j + 1;
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && enchantment != null) {
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
List<Component> list = Lists.newArrayList();
- list.add(Component.translatable("container.enchant.clue", enchantment.getFullname(l)).withStyle(ChatFormatting.WHITE));
- if (!flag) {
+ list.add((Component.translatable("container.enchant.clue", enchantment == null ? "" : enchantment.getFullname(l))).withStyle(ChatFormatting.WHITE));
+ if (enchantment == null) {
+ list.add(Component.literal(""));
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
+ } else if (!flag) {
list.add(CommonComponents.EMPTY);
if (this.minecraft.player.experienceLevel < k) {
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
@@ -177,13 +_,16 @@
.registryAccess()
.registryOrThrow(Registries.ENCHANTMENT)
.getHolder(this.menu.enchantClue[j]);
- if (!optional.isEmpty()) {
+ {
int l = this.menu.levelClue[j];
int i1 = j + 1;
- if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && optional != null) {
+ if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
List<Component> list = Lists.newArrayList();
- list.add(Component.translatable("container.enchant.clue", Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
- if (!flag) {
+ list.add(Component.translatable("container.enchant.clue", optional.isEmpty() ? "" : Enchantment.getFullname(optional.get(), l)).withStyle(ChatFormatting.WHITE));
+ if (optional.isEmpty()) {
+ list.add(Component.literal(""));
+ list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
+ } else if (!flag) {
list.add(CommonComponents.EMPTY);
if (this.minecraft.player.experienceLevel < k) {
list.add(Component.translatable("container.enchant.level.requirement", this.menu.costs[j]).withStyle(ChatFormatting.RED));
@@ -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 = new ResourceLocation("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
+ private final ResourceLocation texture = new ResourceLocation(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/"); // possibly unnecessary patch(?) -Paint_Ninja
- 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/");
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit"));
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
@@ -20,6 +_,8 @@
if (p_169951_ instanceof BundleTooltip bundletooltip) {
return new ClientBundleTooltip(bundletooltip.contents());
@@ -22,6 +_,8 @@
} else if (p_169951_ instanceof ClientActivePlayersTooltip.ActivePlayersTooltip clientactiveplayerstooltip$activeplayerstooltip) {
return new ClientActivePlayersTooltip(clientactiveplayerstooltip$activeplayerstooltip);
} else {
+ ClientTooltipComponent result = net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
+ if (result != null) return result;
@@ -1,5 +1,5 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsList.java
@@ -69,6 +_,11 @@
return 340;
}
@@ -13,25 +13,25 @@
public class CategoryEntry extends KeyBindsList.Entry {
final Component name;
@@ -153,9 +_,10 @@
this.name = p_193917_;
this.changeButton = Button.builder(p_193917_, p_269618_ -> {
KeyBindsList.this.keyBindsScreen.selectedKey = p_193916_;
+ p_193916_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN);
this.name = p_343976_;
this.changeButton = Button.builder(p_343976_, p_342196_ -> {
KeyBindsList.this.keyBindsScreen.selectedKey = p_343088_;
+ p_343088_.setKeyModifierAndCode(null, com.mojang.blaze3d.platform.InputConstants.UNKNOWN);
KeyBindsList.this.resetMappingAndUpdateButtons();
})
- .bounds(0, 0, 75, 20)
+ .bounds(0, 0, 75 + 20 /* Forge: Add space */, 20)
.createNarration(
p_253311_ -> p_193916_.isUnbound()
? Component.translatable("narrator.controls.unbound", p_193917_)
p_342179_ -> p_343088_.isUnbound()
? Component.translatable("narrator.controls.unbound", p_343976_)
@@ -163,6 +_,7 @@
)
.build();
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_325376_ -> {
this.resetButton = Button.builder(RESET_BUTTON_TITLE, p_343650_ -> {
+ this.key.setToDefault();
KeyBindsList.this.minecraft.options.setKey(p_193916_, p_193916_.getDefaultKey());
KeyBindsList.this.minecraft.options.setKey(p_343088_, p_343088_.getDefaultKey());
KeyBindsList.this.resetMappingAndUpdateButtons();
}).bounds(0, 0, 50, 20).createNarration(p_253313_ -> Component.translatable("narrator.controls.reset", p_193917_)).build();
}).bounds(0, 0, 50, 20).createNarration(p_344192_ -> Component.translatable("narrator.controls.reset", p_343976_)).build();
@@ -215,7 +_,7 @@
MutableComponent mutablecomponent = Component.empty();
if (!this.key.isUnbound()) {
@@ -0,0 +1,45 @@
--- a/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
+++ b/net/minecraft/client/gui/screens/options/controls/KeyBindsScreen.java
@@ -41,7 +_,7 @@
protected void addFooter() {
this.resetButton = Button.builder(Component.translatable("controls.resetAll"), p_343640_ -> {
for (KeyMapping keymapping : this.options.keyMappings) {
- keymapping.setKey(keymapping.getDefaultKey());
+ keymapping.setToDefault();
}
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -73,11 +_,14 @@
public boolean keyPressed(int p_342715_, int p_342862_, int p_345515_) {
if (this.selectedKey != null) {
if (p_342715_ == 256) {
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.UNKNOWN);
this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
} else {
+ this.selectedKey.setKeyModifierAndCode(null, InputConstants.getKey(p_342715_, p_342862_));
this.options.setKey(this.selectedKey, InputConstants.getKey(p_342715_, p_342862_));
}
+ if (p_342715_ == 256 || !net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
this.selectedKey = null;
this.lastKeySelection = Util.getMillis();
this.keyBindsList.resetMappingAndUpdateButtons();
@@ -100,5 +_,18 @@
}
this.resetButton.active = flag;
+ }
+
+ @Override
+ public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
+ // Forge: We wait for a second key above if the first press is a modifier
+ // but if they release the modifier then set it explicitly.
+ var key = InputConstants.getKey(keyCode, scanCode);
+ if (this.selectedKey != null && this.selectedKey.getKey() == key) {
+ this.selectedKey = null;
+ this.lastKeySelection = Util.getMillis();
+ this.keyBindsList.resetMappingAndUpdateButtons();
+ }
+ return super.keyReleased(keyCode, scanCode, modifiers);
}
}
@@ -6,6 +6,6 @@
p_100014_.setSelected(null);
- p_100015_.forEach(
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach(
p_325390_ -> {
p_340813_ -> {
TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(
this.minecraft, p_100014_, p_325390_
this.minecraft, p_100014_, p_340813_
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -116,7 +_,7 @@
@@ -115,7 +_,7 @@
this.initFilterButtonTextures();
this.tabButtons.clear();
@@ -9,7 +9,7 @@
this.tabButtons.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -291,7 +_,7 @@
@@ -293,7 +_,7 @@
}
if (itemstack != null && this.minecraft.screen != null) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -119,6 +_,7 @@
@@ -118,6 +_,7 @@
public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) {
queueLoadScreen(p_232897_, PREPARING_WORLD_DATA);
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator()));
@@ -8,7 +8,7 @@
WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT);
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(
worldloader$initconfig,
@@ -419,7 +_,7 @@
@@ -415,7 +_,7 @@
if (p_269627_) {
p_270552_.accept(this.uiState.getSettings().dataConfiguration());
} else {
@@ -17,7 +17,7 @@
}
},
Component.translatable("dataPack.validation.failed"),
@@ -537,6 +_,7 @@
@@ -533,6 +_,7 @@
if (path != null) {
if (this.tempDataPackRepository == null) {
this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -75,6 +_,7 @@
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = new ResourceLocation("world_list/join_highlighted");
static final ResourceLocation JOIN_SPRITE = new ResourceLocation("world_list/join");
static final ResourceLocation JOIN_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join_highlighted");
static final ResourceLocation JOIN_SPRITE = ResourceLocation.withDefaultNamespace("world_list/join");
static final Logger LOGGER = LogUtils.getLogger();
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png");
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = ResourceLocation.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);
@@ -1,12 +1,12 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -154,8 +_,8 @@
CrashReport.preload();
try {
@@ -111,8 +_,8 @@
CrashReport.preload();
logger = LogUtils.getLogger();
s1 = "Bootstrap";
- Bootstrap.bootStrap();
GameLoadTimesEvent.INSTANCE.setBootstrapTime(Bootstrap.bootstrapDuration.get());
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(Bootstrap::bootStrap, net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.validate();
} catch (Throwable throwable2) {
CrashReport crashreport = CrashReport.forThrowable(throwable2, "Bootstrap");
s1 = "Argument parsing";
List<String> list = optionset.valuesOf(optionspec27);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -328,6 +_,7 @@
@@ -329,6 +_,7 @@
WoodType.values().forEach(p_171114_ -> builder.put(ModelLayers.createSignModelName(p_171114_), layerdefinition23));
LayerDefinition layerdefinition24 = HangingSignRenderer.createHangingSignLayer();
WoodType.values().forEach(p_247864_ -> builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24));
@@ -1,18 +1,18 @@
--- a/net/minecraft/client/model/geom/ModelLayers.java
+++ b/net/minecraft/client/model/geom/ModelLayers.java
@@ -228,11 +_,13 @@
@@ -229,11 +_,13 @@
}
public static ModelLayerLocation createSignModelName(WoodType p_171292_) {
- return createLocation("sign/" + p_171292_.name(), "main");
+ ResourceLocation location = new ResourceLocation(p_171292_.name());
+ return new ModelLayerLocation(new ResourceLocation(location.getNamespace(), "sign/" + location.getPath()), "main");
+ ResourceLocation location = ResourceLocation.parse(p_171292_.name());
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "sign/" + location.getPath()), "main");
}
public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_) {
- return createLocation("hanging_sign/" + p_252225_.name(), "main");
+ ResourceLocation location = new ResourceLocation(p_252225_.name());
+ return new ModelLayerLocation(new ResourceLocation(location.getNamespace(), "hanging_sign/" + location.getPath()), "main");
+ ResourceLocation location = ResourceLocation.parse(p_252225_.name());
+ return new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "hanging_sign/" + location.getPath()), "main");
}
public static Stream<ModelLayerLocation> getKnownLocations() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientCommonPacketListenerImpl.java
@@ -116,6 +_,7 @@
@@ -149,6 +_,7 @@
@Override
public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
@@ -141,6 +_,7 @@
@@ -143,6 +_,7 @@
);
this.connection.send(ServerboundFinishConfigurationPacket.INSTANCE);
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
this.connection.setupOutboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(registryaccess$frozen)));
+ net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection);
}
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -205,6 +_,7 @@
@@ -210,6 +_,7 @@
Component component = this.wasTransferredTo ? CommonComponents.TRANSFER_CONNECT_FAILED : CommonComponents.CONNECT_FAILED;
if (this.serverData != null && this.serverData.isRealm()) {
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_104543_));
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_104543_)) {
this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, component, p_342266_.reason()));
+ } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_342266_.reason())) {
} else {
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_104543_));
this.minecraft.setScreen(new DisconnectedScreen(this.parent, component, p_342266_));
}
@@ -229,6 +_,7 @@
@@ -234,6 +_,7 @@
@Override
public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -425,6 +_,7 @@
@@ -427,6 +_,7 @@
this.minecraft.debugRenderer.clear();
this.minecraft.player.resetPos();
@@ -8,8 +8,8 @@
this.minecraft.player.setId(p_105030_.playerId());
this.level.addEntity(this.minecraft.player);
this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
@@ -1159,7 +_,9 @@
localplayer1.getAttributes().assignValues(localplayer.getAttributes());
@@ -1164,7 +_,9 @@
localplayer1.getAttributes().assignBaseValues(localplayer.getAttributes());
}
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
@@ -18,7 +18,7 @@
this.level.addEntity(localplayer1);
localplayer1.setYRot(-180.0F);
localplayer1.input = new KeyboardInput(this.minecraft.options);
@@ -1294,10 +_,7 @@
@@ -1300,10 +_,7 @@
PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
BlockPos blockpos = p_104976_.getPos();
this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent(p_325478_ -> {
@@ -30,7 +30,7 @@
if (p_325478_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.minecraft.screen).updateGui();
@@ -1464,7 +_,9 @@
@@ -1465,7 +_,9 @@
@Override
public void handleCommands(ClientboundCommandsPacket p_104990_) {
PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
@@ -41,24 +41,24 @@
}
@Override
@@ -1486,6 +_,7 @@
@@ -1487,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook();
clientrecipebook.setupCollections(this.recipeManager.getOrderedRecipes(), this.minecraft.level.registryAccess());
this.minecraft.populateSearchTree(SearchRegistry.RECIPE_COLLECTIONS, clientrecipebook.getCollections());
this.searchTrees.updateRecipes(clientrecipebook, this.registryAccess);
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.recipeManager);
}
@Override
@@ -1582,6 +_,8 @@
TagCollector tagcollector = new TagCollector();
p_298004_.getTags().forEach(tagcollector::append);
@@ -1585,6 +_,8 @@
tagcollector.updateTags(this.registryAccess, this.connection.isMemoryConnection());
List<ItemStack> list = List.copyOf(CreativeModeTabs.searchTab().getDisplayItems());
this.searchTrees.updateCreativeTags(list);
+
+ net.minecraftforge.event.ForgeEventFactory.onTagsUpdated(this.registryAccess, true, this.connection.isMemoryConnection());
}
@Override
@@ -2388,6 +_,8 @@
@@ -2389,6 +_,8 @@
}
public void sendChat(String p_249888_) {
@@ -67,7 +67,7 @@
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.getLong();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
@@ -2396,6 +_,7 @@
@@ -2397,6 +_,7 @@
}
public void sendCommand(String p_250092_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
+++ b/net/minecraft/client/multiplayer/MultiPlayerGameMode.java
@@ -106,6 +_,7 @@
@@ -105,6 +_,7 @@
}
public boolean destroyBlock(BlockPos p_105268_) {
@@ -8,7 +8,7 @@
if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
return false;
} else {
@@ -120,9 +_,8 @@
@@ -119,9 +_,8 @@
} else if (blockstate.isAir()) {
return false;
} else {
@@ -19,7 +19,7 @@
if (flag) {
block.destroy(level, p_105268_, blockstate);
}
@@ -143,6 +_,7 @@
@@ -142,6 +_,7 @@
BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
this.startPrediction(this.minecraft.level, p_233757_ -> {
@@ -27,7 +27,7 @@
this.destroyBlock(p_105270_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
});
@@ -152,15 +_,18 @@
@@ -151,15 +_,18 @@
this.connection
.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
}
@@ -46,7 +46,7 @@
if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
this.destroyBlock(p_105270_);
} else {
@@ -171,6 +_,7 @@
@@ -170,6 +_,7 @@
this.destroyTicks = 0.0F;
this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
}
@@ -54,7 +54,7 @@
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
});
@@ -203,6 +_,7 @@
@@ -202,6 +_,7 @@
BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
this.startPrediction(this.minecraft.level, p_233753_ -> {
@@ -62,7 +62,7 @@
this.destroyBlock(p_105284_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
});
@@ -215,7 +_,7 @@
@@ -214,7 +_,7 @@
} else {
this.destroyProgress = this.destroyProgress + blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
if (this.destroyTicks % 4.0F == 0.0F) {
@@ -71,7 +71,7 @@
this.minecraft
.getSoundManager()
.play(
@@ -232,6 +_,7 @@
@@ -231,6 +_,7 @@
this.destroyTicks++;
this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
@@ -79,7 +79,7 @@
if (this.destroyProgress >= 1.0F) {
this.isDestroying = false;
this.startPrediction(this.minecraft.level, p_233739_ -> {
@@ -270,7 +_,7 @@
@@ -269,7 +_,7 @@
private boolean sameDestroyTarget(BlockPos p_105282_) {
ItemStack itemstack = this.minecraft.player.getMainHandItem();
@@ -88,7 +88,7 @@
}
private void ensureHasSentCarriedItem() {
@@ -298,12 +_,23 @@
@@ -297,12 +_,23 @@
private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.getBlockPos();
ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
@@ -114,7 +114,7 @@
BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
return InteractionResult.FAIL;
@@ -324,8 +_,10 @@
@@ -323,8 +_,10 @@
}
}
@@ -127,26 +127,26 @@
InteractionResult interactionresult1;
if (this.localPlayerMode.isCreative()) {
int i = itemstack.getCount();
@@ -361,10 +_,18 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
+ if (event.isCanceled()) {
+ mutableobject.setValue(event.getCancellationResult());
+ return serverbounduseitempacket;
+ }
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
ItemStack itemstack1 = interactionresultholder.getObject();
if (itemstack1 != itemstack) {
p_233722_.setItemInHand(p_233723_, itemstack1);
+ if (itemstack1.isEmpty()) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
@@ -358,10 +_,18 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
+ var event = net.minecraftforge.event.ForgeEventFactory.onRightClickItem(p_233722_, p_233723_);
+ if (event.isCanceled()) {
+ mutableobject.setValue(event.getCancellationResult());
+ return serverbounduseitempacket;
+ }
}
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
ItemStack itemstack1 = interactionresultholder.getObject();
if (itemstack1 != itemstack) {
p_233722_.setItemInHand(p_233723_, itemstack1);
+ if (itemstack1.isEmpty()) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
+ }
}
mutableobject.setValue(interactionresultholder.getResult());
@@ -395,6 +_,10 @@
mutableobject.setValue(interactionresultholder.getResult());
@@ -393,6 +_,10 @@
public InteractionResult interact(Player p_105227_, Entity p_105228_, InteractionHand p_105229_) {
this.ensureHasSentCarriedItem();
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105228_, p_105227_.isShiftKeyDown(), p_105229_));
@@ -157,7 +157,7 @@
return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105227_.interactOn(p_105228_, p_105229_);
}
@@ -402,6 +_,10 @@
@@ -400,6 +_,10 @@
this.ensureHasSentCarriedItem();
Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ServerStatusPinger.java
+++ b/net/minecraft/client/multiplayer/ServerStatusPinger.java
@@ -98,6 +_,7 @@
@@ -99,6 +_,7 @@
p_105461_.run();
}
});
@@ -0,0 +1,74 @@
--- a/net/minecraft/client/multiplayer/SessionSearchTrees.java
+++ b/net/minecraft/client/multiplayer/SessionSearchTrees.java
@@ -31,8 +_,8 @@
private static final SessionSearchTrees.Key RECIPE_COLLECTIONS = new SessionSearchTrees.Key();
public static final SessionSearchTrees.Key CREATIVE_NAMES = new SessionSearchTrees.Key();
public static final SessionSearchTrees.Key CREATIVE_TAGS = new SessionSearchTrees.Key();
- private CompletableFuture<SearchTree<ItemStack>> creativeByNameSearch = CompletableFuture.completedFuture(SearchTree.empty());
- private CompletableFuture<SearchTree<ItemStack>> creativeByTagSearch = CompletableFuture.completedFuture(SearchTree.empty());
+ private CompletableFuture<SearchTree<ItemStack>> EMPTY = CompletableFuture.completedFuture(SearchTree.empty());
+ private Map<SessionSearchTrees.Key, CompletableFuture<SearchTree<ItemStack>>> creativeSearch = new IdentityHashMap<>();
private CompletableFuture<SearchTree<RecipeCollection>> recipeSearch = CompletableFuture.completedFuture(SearchTree.empty());
private final Map<SessionSearchTrees.Key, Runnable> reloaders = new IdentityHashMap<>();
@@ -82,44 +_,50 @@
}
public void updateCreativeTags(List<ItemStack> p_344581_) {
+ for (var name : net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys().values())
this.register(
- CREATIVE_TAGS,
+ name,
() -> {
- CompletableFuture<?> completablefuture = this.creativeByTagSearch;
- this.creativeByTagSearch = CompletableFuture.supplyAsync(
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(name, EMPTY);
+ this.creativeSearch.put(name, CompletableFuture.supplyAsync(
() -> new IdSearchTree<>(p_342206_ -> p_342206_.getTags().map(TagKey::location), p_344581_), Util.backgroundExecutor()
- );
+ ));
completablefuture.cancel(true);
}
);
}
public SearchTree<ItemStack> creativeTagSearch() {
- return this.creativeByTagSearch.join();
+ return this.getSearchTree(CREATIVE_TAGS);
}
public void updateCreativeTooltips(HolderLookup.Provider p_343364_, List<ItemStack> p_342500_) {
+ for (var name : net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys().values())
this.register(
- CREATIVE_NAMES,
+ name,
() -> {
Item.TooltipContext item$tooltipcontext = Item.TooltipContext.of(p_343364_);
TooltipFlag tooltipflag = TooltipFlag.Default.NORMAL.asCreative();
- CompletableFuture<?> completablefuture = this.creativeByNameSearch;
- this.creativeByNameSearch = CompletableFuture.supplyAsync(
+ CompletableFuture<?> completablefuture = this.creativeSearch.getOrDefault(name, EMPTY);
+ this.creativeSearch.put(name, CompletableFuture.supplyAsync(
() -> new FullTextSearchTree<>(
p_345254_ -> getTooltipLines(Stream.of(p_345254_), item$tooltipcontext, tooltipflag),
p_344415_ -> p_344415_.getItemHolder().unwrapKey().map(ResourceKey::location).stream(),
p_342500_
),
Util.backgroundExecutor()
- );
+ ));
completablefuture.cancel(true);
}
);
}
public SearchTree<ItemStack> creativeNameSearch() {
- return this.creativeByNameSearch.join();
+ return this.getSearchTree(CREATIVE_NAMES);
+ }
+
+ public SearchTree<ItemStack> getSearchTree(SessionSearchTrees.Key key) {
+ return this.creativeSearch.getOrDefault(key, EMPTY).join();
}
@OnlyIn(Dist.CLIENT)
@@ -1,11 +0,0 @@
--- a/net/minecraft/client/multiplayer/TagCollector.java
+++ b/net/minecraft/client/multiplayer/TagCollector.java
@@ -23,7 +_,7 @@
}
private static void refreshCommonTagDependentData() {
- CreativeModeTabs.searchTab().rebuildSearchTree();
+ CreativeModeTabs.allTabs().stream().filter(tab -> tab.hasSearchBar()).forEach(tab -> tab.rebuildSearchTree());
}
private static void refreshBuiltInTagDependentData() {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/ParticleEngine.java
+++ b/net/minecraft/client/particle/ParticleEngine.java
@@ -75,11 +_,11 @@
@@ -77,11 +_,11 @@
ParticleRenderType.TERRAIN_SHEET, ParticleRenderType.PARTICLE_SHEET_OPAQUE, ParticleRenderType.PARTICLE_SHEET_LIT, ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT, ParticleRenderType.CUSTOM
);
protected ClientLevel level;
@@ -14,7 +14,7 @@
private final Queue<Particle> particlesToAdd = Queues.newArrayDeque();
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> spriteSets = Maps.newHashMap();
private final TextureAtlas textureAtlas;
@@ -210,10 +_,14 @@
@@ -212,10 +_,14 @@
this.register(ParticleTypes.OMINOUS_SPAWNING, FlyStraightTowardsParticle.OminousSpawnProvider::new);
}
@@ -30,7 +30,7 @@
public <T extends ParticleOptions> void register(ParticleType<T> p_273423_, ParticleProvider.Sprite<T> p_273134_) {
this.register(
p_273423_,
@@ -230,10 +_,12 @@
@@ -232,10 +_,12 @@
);
}
@@ -44,7 +44,7 @@
}
@Override
@@ -359,7 +_,7 @@
@@ -361,7 +_,7 @@
private <T extends ParticleOptions> Particle makeParticle(
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
) {
@@ -53,7 +53,7 @@
return particleprovider == null
? null
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
@@ -435,11 +_,19 @@
@@ -437,11 +_,19 @@
}
}
@@ -71,18 +71,18 @@
- for (ParticleRenderType particlerendertype : RENDER_ORDER) {
+ for (ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom IParticleRenderType's
+ if (particlerendertype == ParticleRenderType.NO_RENDER) continue;
Iterable<Particle> iterable = this.particles.get(particlerendertype);
if (iterable != null) {
Queue<Particle> queue = this.particles.get(particlerendertype);
if (queue != null && !queue.isEmpty()) {
RenderSystem.setShader(GameRenderer::getParticleShader);
@@ -448,6 +_,7 @@
particlerendertype.begin(bufferbuilder, this.textureManager);
for (Particle particle : iterable) {
+ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox())) continue;
try {
particle.render(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -475,7 +_,7 @@
@@ -449,6 +_,7 @@
BufferBuilder bufferbuilder = particlerendertype.begin(tesselator, this.textureManager);
if (bufferbuilder != null) {
for (Particle particle : queue) {
+ if (frustum != null && particle.shouldCull() && !frustum.isVisible(particle.getBoundingBox())) continue;
try {
particle.render(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -480,7 +_,7 @@
}
public void destroy(BlockPos p_107356_, BlockState p_107357_) {
@@ -91,7 +91,7 @@
VoxelShape voxelshape = p_107357_.getShape(this.level, p_107356_);
double d0 = 0.25;
voxelshape.forAllBoxes(
@@ -508,6 +_,7 @@
@@ -513,6 +_,7 @@
p_107357_,
p_107356_
)
@@ -99,7 +99,7 @@
);
}
}
@@ -517,6 +_,13 @@
@@ -522,6 +_,13 @@
}
}
@@ -113,7 +113,7 @@
public void crack(BlockPos p_107368_, Direction p_107369_) {
BlockState blockstate = this.level.getBlockState(p_107368_);
if (blockstate.getRenderShape() != RenderShape.INVISIBLE && blockstate.shouldSpawnTerrainParticles()) {
@@ -552,7 +_,7 @@
@@ -557,7 +_,7 @@
d0 = (double)i + aabb.maxX + 0.1F;
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/particle/VibrationSignalParticle.java
+++ b/net/minecraft/client/particle/VibrationSignalParticle.java
@@ -122,6 +_,7 @@
@@ -76,6 +_,7 @@
this.x = Mth.lerp(d0, this.x, vec3.x());
this.y = Mth.lerp(d0, this.y, vec3.y());
this.z = Mth.lerp(d0, this.z, vec3.z());
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -160,6 +_,7 @@
@@ -161,6 +_,7 @@
@Override
public boolean hurt(DamageSource p_108662_, float p_108663_) {
@@ -8,7 +8,7 @@
return false;
}
@@ -303,6 +_,7 @@
@@ -304,6 +_,7 @@
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_
? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS
: ServerboundPlayerActionPacket.Action.DROP_ITEM;
@@ -16,7 +16,7 @@
ItemStack itemstack = this.getInventory().removeFromSelected(p_108701_);
this.connection.send(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.ZERO, Direction.DOWN));
return !itemstack.isEmpty();
@@ -505,7 +_,11 @@
@@ -501,7 +_,11 @@
@Override
public void playSound(SoundEvent p_108651_, float p_108652_, float p_108653_) {
@@ -29,15 +29,15 @@
}
@Override
@@ -697,6 +_,7 @@
@@ -694,6 +_,7 @@
&& (this.isShiftKeyDown() || !this.isSleeping() && !this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.STANDING));
float f = Mth.clamp(0.3F + EnchantmentHelper.getSneakingSpeedBonus(this), 0.0F, 1.0F);
float f = (float)this.getAttributeValue(Attributes.SNEAKING_SPEED);
this.input.tick(this.isMovingSlowly(), f);
+ net.minecraftforge.client.ForgeHooksClient.onMovementInputUpdate(this, this.input);
this.minecraft.getTutorial().onInput(this.input);
if (this.isUsingItem() && !this.isPassenger()) {
this.input.leftImpulse *= 0.2F;
@@ -725,7 +_,7 @@
@@ -722,7 +_,7 @@
boolean flag4 = this.canStartSprinting();
boolean flag5 = this.isPassenger() ? this.getVehicle().onGround() : this.onGround();
boolean flag6 = !flag1 && !flag2;
@@ -46,7 +46,7 @@
if (this.sprintTriggerTime <= 0 && !this.minecraft.options.keySprint.isDown()) {
this.sprintTriggerTime = 7;
} else {
@@ -733,15 +_,15 @@
@@ -730,15 +_,15 @@
}
}
@@ -65,7 +65,7 @@
this.setSprinting(false);
}
} else if (flag8) {
@@ -775,14 +_,15 @@
@@ -772,14 +_,15 @@
if (this.input.jumping && !flag9 && !flag && !abilities.flying && !this.isPassenger() && !this.onClimbable()) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
@@ -84,7 +84,7 @@
}
if (this.isEyeInFluid(FluidTags.WATER)) {
@@ -882,6 +_,7 @@
@@ -885,6 +_,7 @@
@Override
public void rideTick() {
super.rideTick();
@@ -92,7 +92,7 @@
this.handsBusy = false;
if (this.getControlledVehicle() instanceof Boat boat) {
boat.setInput(this.input.left, this.input.right, this.input.up, this.input.down);
@@ -1139,5 +_,17 @@
@@ -1142,5 +_,17 @@
@Override
public float getVisualRotationYInDegrees() {
return this.getYRot();
@@ -1,22 +1,20 @@
--- a/net/minecraft/client/renderer/EffectInstance.java
+++ b/net/minecraft/client/renderer/EffectInstance.java
@@ -58,7 +_,8 @@
@@ -58,7 +_,7 @@
private final EffectProgram fragmentProgram;
public EffectInstance(ResourceProvider p_334130_, String p_108942_) throws IOException {
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_108942_ + ".json");
+ ResourceLocation rl = ResourceLocation.tryParse(p_108942_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + ".json");
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_108942_ + ".json");
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_108942_).withPath(p -> "shaders/program/" + p + ".json");
this.name = p_108942_;
Resource resource = p_334130_.getResourceOrThrow(resourcelocation);
@@ -150,7 +_,8 @@
@@ -150,7 +_,7 @@
} else {
EffectProgram effectprogram;
if (program == null) {
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_172569_ + p_172568_.getExtension());
+ ResourceLocation rl = ResourceLocation.tryParse(p_172569_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "shaders/program/" + rl.getPath() + p_172568_.getExtension());
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/program/" + p_172569_ + p_172568_.getExtension());
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(p_172569_).withPath(p -> "shaders/program/" + p + p_172568_.getExtension());
Resource resource = p_331503_.getResourceOrThrow(resourcelocation);
try (InputStream inputstream = resource.open()) {
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -310,6 +_,8 @@
this.loadEffect(new ResourceLocation("shaders/post/spider.json"));
@@ -311,6 +_,8 @@
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/spider.json"));
} else if (p_109107_ instanceof EnderMan) {
this.loadEffect(new ResourceLocation("shaders/post/invert.json"));
this.loadEffect(ResourceLocation.withDefaultNamespace("shaders/post/invert.json"));
+ } else {
+ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_109107_, this);
}
}
@@ -532,6 +_,7 @@
@@ -526,6 +_,7 @@
Pair.of(new ShaderInstance(p_250719_, "rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.POSITION_COLOR), p_286147_ -> rendertypeGuiGhostRecipeOverlayShader = p_286147_)
);
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_breeze_wind", DefaultVertexFormat.NEW_ENTITY), p_308287_ -> rendertypeBreezeWindShader = p_308287_));
@@ -17,7 +17,7 @@
this.loadBlurEffect(p_250719_);
} catch (IOException ioexception) {
list1.forEach(p_172729_ -> p_172729_.getFirst().close());
@@ -691,7 +_,7 @@
@@ -685,7 +_,7 @@
d0 *= Mth.lerp(this.minecraft.options.fovEffectScale().get(), 1.0, 0.85714287F);
}
@@ -26,7 +26,7 @@
}
}
@@ -850,12 +_,12 @@
@@ -843,12 +_,12 @@
(float)((double)window.getHeight() / window.getGuiScale()),
0.0F,
1000.0F,
@@ -41,29 +41,28 @@
RenderSystem.applyModelViewMatrix();
Lighting.setupFor3DItems();
GuiGraphics guigraphics = new GuiGraphics(this.minecraft, this.renderBuffers.bufferSource());
@@ -889,7 +_,7 @@
@@ -882,7 +_,7 @@
}
} else if (flag && this.minecraft.screen != null) {
try {
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, this.minecraft.getDeltaFrameTime());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, this.minecraft.getDeltaFrameTime());
- this.minecraft.screen.renderWithTooltip(guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.minecraft.screen, guigraphics, i, j, p_343467_.getRealtimeDeltaTicks());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.forThrowable(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.addCategory("Screen render details");
@@ -1064,12 +_,17 @@
@@ -1053,12 +_,17 @@
}
this.resetProjectionMatrix(matrix4f);
+
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, p_109090_);
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
Matrix4f matrix4f1 = new Matrix4f()
- .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, 0.0F);
+ .rotationXYZ(camera.getXRot() * (float) (Math.PI / 180.0), camera.getYRot() * (float) (Math.PI / 180.0) + (float) Math.PI, cameraSetup.getRoll() * (float) (Math.PI / 180.0));
+ var cameraSetup = net.minecraftforge.client.event.ForgeEventFactoryClient.fireComputeCameraAngles(this, camera, f);
+ camera.setRotation(cameraSetup.getYaw(), cameraSetup.getPitch(), cameraSetup.getRoll());
Quaternionf quaternionf = camera.rotation().conjugate(new Quaternionf());
Matrix4f matrix4f1 = new Matrix4f().rotation(quaternionf);
this.minecraft
.levelRenderer
.prepareCullFrustum(camera.getPosition(), matrix4f1, this.getProjectionMatrix(Math.max(d0, (double)this.minecraft.options.fov().get().intValue())));
this.minecraft.levelRenderer.renderLevel(p_109090_, p_109091_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
this.minecraft.levelRenderer.renderLevel(p_342230_, flag, camera, this, this.lightTexture, matrix4f1, matrix4f);
+ this.minecraft.getProfiler().popPush("forge_render_last");
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL.dispatch(this.minecraft.levelRenderer, posestack.last().pose(), matrix4f, this.minecraft.levelRenderer.getTicks(), camera, this.minecraft.levelRenderer.getFrustum());
this.minecraft.getProfiler().popPush("hand");
@@ -5,18 +5,18 @@
@OnlyIn(Dist.CLIENT)
public class ItemBlockRenderTypes {
+ @Deprecated
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_325496_ -> {
private static final Map<Block, RenderType> TYPE_BY_BLOCK = Util.make(Maps.newHashMap(), p_340896_ -> {
RenderType rendertype = RenderType.tripwire();
p_325496_.put(Blocks.TRIPWIRE, rendertype);
@@ -336,6 +_,7 @@
p_325496_.put(Blocks.BUBBLE_COLUMN, rendertype3);
p_325496_.put(Blocks.TINTED_GLASS, rendertype3);
p_340896_.put(Blocks.TRIPWIRE, rendertype);
@@ -335,6 +_,7 @@
p_340896_.put(Blocks.BUBBLE_COLUMN, rendertype3);
p_340896_.put(Blocks.TINTED_GLASS, rendertype3);
});
+ @Deprecated
private static final Map<Fluid, RenderType> TYPE_BY_FLUID = Util.make(Maps.newHashMap(), p_109290_ -> {
RenderType rendertype = RenderType.translucent();
p_109290_.put(Fluids.FLOWING_WATER, rendertype);
@@ -343,6 +_,8 @@
@@ -342,6 +_,8 @@
});
private static boolean renderCutout;
@@ -25,7 +25,7 @@
public static RenderType getChunkRenderType(BlockState p_109283_) {
Block block = p_109283_.getBlock();
if (block instanceof LeavesBlock) {
@@ -353,6 +_,8 @@
@@ -352,6 +_,8 @@
}
}
@@ -34,7 +34,7 @@
public static RenderType getMovingBlockRenderType(BlockState p_109294_) {
Block block = p_109294_.getBlock();
if (block instanceof LeavesBlock) {
@@ -367,6 +_,8 @@
@@ -366,6 +_,8 @@
}
}
@@ -43,7 +43,7 @@
public static RenderType getRenderType(BlockState p_109285_, boolean p_109286_) {
RenderType rendertype = getChunkRenderType(p_109285_);
if (rendertype == RenderType.translucent()) {
@@ -380,6 +_,8 @@
@@ -379,6 +_,8 @@
}
}
@@ -52,7 +52,7 @@
public static RenderType getRenderType(ItemStack p_109280_, boolean p_109281_) {
Item item = p_109280_.getItem();
if (item instanceof BlockItem) {
@@ -391,11 +_,74 @@
@@ -390,11 +_,74 @@
}
public static RenderType getRenderLayer(FluidState p_109288_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
@@ -331,12 +_,14 @@
@@ -332,12 +_,14 @@
if (iteminhandrenderer$handrenderselection.renderMainHand) {
float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F;
float f5 = 1.0F - Mth.lerp(p_109315_, this.oMainHandHeight, this.mainHandHeight);
@@ -15,7 +15,7 @@
this.renderArmWithItem(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.offHandItem, f7, p_109316_, p_109317_, p_109319_);
}
@@ -402,7 +_,7 @@
@@ -403,7 +_,7 @@
} else {
this.renderOneHandedMap(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_);
}
@@ -24,7 +24,7 @@
boolean flag1 = CrossbowItem.isCharged(p_109377_);
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
int i = flag2 ? 1 : -1;
@@ -452,6 +_,7 @@
@@ -453,6 +_,7 @@
);
} else {
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
@@ -32,7 +32,7 @@
if (p_109372_.isUsingItem() && p_109372_.getUseItemRemainingTicks() > 0 && p_109372_.getUsedItemHand() == p_109375_) {
int k = flag3 ? 1 : -1;
switch (p_109377_.getUseAnimation()) {
@@ -566,8 +_,16 @@
@@ -567,8 +_,16 @@
this.offHandHeight = Mth.clamp(this.offHandHeight - 0.4F, 0.0F, 1.0F);
} else {
float f = localplayer.getAttackStrengthScale(1.0F);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/LevelRenderer.java
+++ b/net/minecraft/client/renderer/LevelRenderer.java
@@ -251,6 +_,9 @@
@@ -256,6 +_,9 @@
}
private void renderSnowAndRain(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) {
@@ -10,7 +10,7 @@
float f = this.minecraft.level.getRainLevel(p_109705_);
if (!(f <= 0.0F)) {
p_109704_.turnOnLightLayer();
@@ -405,6 +_,9 @@
@@ -418,6 +_,9 @@
}
public void tickRain(Camera p_109694_) {
@@ -20,11 +20,11 @@
float f = this.minecraft.level.getRainLevel(1.0F) / (Minecraft.useFancyGraphics() ? 1.0F : 2.0F);
if (!(f <= 0.0F)) {
RandomSource randomsource = RandomSource.create((long)this.ticks * 312987231L);
@@ -956,9 +_,11 @@
@@ -929,9 +_,11 @@
RenderSystem.clear(16640, Minecraft.ON_OSX);
float f1 = p_109605_.getRenderDistance();
boolean flag1 = this.minecraft.level.effects().isFoggyAt(Mth.floor(d0), Mth.floor(d1)) || this.minecraft.gui.getBossOverlay().shouldCreateWorldFog();
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_);
+ FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f);
profilerfiller.popPush("sky");
RenderSystem.setShader(GameRenderer::getPositionShader);
this.renderSky(p_254120_, p_330527_, f, p_109604_, flag1, () -> FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_SKY, f1, flag1, f));
@@ -32,7 +32,7 @@
profilerfiller.popPush("fog");
FogRenderer.setupFog(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f1, 32.0F), flag1, f);
profilerfiller.popPush("terrain_setup");
@@ -967,7 +_,9 @@
@@ -940,7 +_,9 @@
this.compileSections(p_109604_);
profilerfiller.popPush("terrain");
this.renderSectionLayer(RenderType.solid(), d0, d1, d2, p_254120_, p_330527_);
@@ -42,7 +42,7 @@
this.renderSectionLayer(RenderType.cutout(), d0, d1, d2, p_254120_, p_330527_);
if (this.level.effects().constantAmbientLight()) {
Lighting.setupNetherLevel();
@@ -1010,7 +_,7 @@
@@ -983,7 +_,7 @@
|| p_109604_.isDetached()
|| p_109604_.getEntity() instanceof LivingEntity && ((LivingEntity)p_109604_.getEntity()).isSleeping()
)
@@ -51,7 +51,7 @@
this.renderedEntities++;
if (entity.tickCount == 0) {
entity.xOld = entity.getX();
@@ -1026,6 +_,9 @@
@@ -999,6 +_,9 @@
int i = entity.getTeamColor();
outlinebuffersource.setColor(FastColor.ARGB32.red(i), FastColor.ARGB32.green(i), FastColor.ARGB32.blue(i), 255);
} else {
@@ -61,7 +61,7 @@
multibuffersource = multibuffersource$buffersource;
}
@@ -1041,12 +_,14 @@
@@ -1014,12 +_,14 @@
multibuffersource$buffersource.endBatch(RenderType.entityCutout(TextureAtlas.LOCATION_BLOCKS));
multibuffersource$buffersource.endBatch(RenderType.entityCutoutNoCull(TextureAtlas.LOCATION_BLOCKS));
multibuffersource$buffersource.endBatch(RenderType.entitySmoothCutout(TextureAtlas.LOCATION_BLOCKS));
@@ -76,7 +76,7 @@
BlockPos blockpos4 = blockentity1.getBlockPos();
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
posestack.pushPose();
@@ -1066,6 +_,10 @@
@@ -1039,6 +_,10 @@
}
}
@@ -87,7 +87,7 @@
this.blockEntityRenderDispatcher.render(blockentity1, f, posestack, multibuffersource1);
posestack.popPose();
}
@@ -1074,9 +_,13 @@
@@ -1047,9 +_,13 @@
synchronized (this.globalBlockEntities) {
for (BlockEntity blockentity : this.globalBlockEntities) {
@@ -101,7 +101,7 @@
this.blockEntityRenderDispatcher.render(blockentity, f, posestack, multibuffersource$buffersource);
posestack.popPose();
}
@@ -1099,6 +_,7 @@
@@ -1072,6 +_,7 @@
this.minecraft.getMainRenderTarget().bindWrite(false);
}
@@ -109,7 +109,7 @@
profilerfiller.popPush("destroyProgress");
for (Entry<SortedSet<BlockDestructionProgress>> entry : this.destructionProgress.long2ObjectEntrySet()) {
@@ -1116,7 +_,8 @@
@@ -1089,7 +_,8 @@
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(
this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(k)), posestack$pose1, 1.0F
);
@@ -119,21 +119,21 @@
posestack.popPose();
}
}
@@ -1128,10 +_,13 @@
@@ -1101,10 +_,13 @@
profilerfiller.popPush("outline");
BlockPos blockpos1 = ((BlockHitResult)hitresult).getBlockPos();
BlockState blockstate = this.level.getBlockState(blockpos1);
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_254120_, multibuffersource$buffersource))
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, p_254120_, multibuffersource$buffersource))
if (!blockstate.isAir() && this.level.getWorldBorder().isWithinBounds(blockpos1)) {
VertexConsumer vertexconsumer2 = multibuffersource$buffersource.getBuffer(RenderType.lines());
this.renderHitOutline(posestack, vertexconsumer2, p_109604_.getEntity(), d0, d1, d2, blockpos1, blockstate);
}
+ } else if (hitresult != null && hitresult.getType() == HitResult.Type.ENTITY) {
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, p_109601_, p_254120_, multibuffersource$buffersource);
+ net.minecraftforge.client.ForgeHooksClient.onDrawHighlight(this, p_109604_, hitresult, f, p_254120_, multibuffersource$buffersource);
}
this.minecraft.debugRenderer.render(posestack, multibuffersource$buffersource, d0, d1, d2);
@@ -1161,7 +_,8 @@
@@ -1132,7 +_,8 @@
this.particlesTarget.copyDepthFrom(this.minecraft.getMainRenderTarget());
RenderStateShard.PARTICLES_TARGET.setupRenderState();
profilerfiller.popPush("particles");
@@ -143,7 +143,7 @@
RenderStateShard.PARTICLES_TARGET.clearRenderState();
} else {
profilerfiller.popPush("translucent");
@@ -1175,7 +_,8 @@
@@ -1146,7 +_,8 @@
profilerfiller.popPush("string");
this.renderSectionLayer(RenderType.tripwire(), d0, d1, d2, p_254120_, p_330527_);
profilerfiller.popPush("particles");
@@ -153,15 +153,15 @@
}
if (this.minecraft.options.getCloudsType() != CloudStatus.OFF) {
@@ -1191,6 +_,7 @@
@@ -1162,6 +_,7 @@
RenderStateShard.WEATHER_TARGET.setupRenderState();
profilerfiller.popPush("weather");
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
+ net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER.dispatch(this, posestack.last().pose(), p_254120_, this.ticks, p_109604_, frustum);
this.renderWorldBorder(p_109604_);
RenderStateShard.WEATHER_TARGET.clearRenderState();
this.transparencyChain.process(f);
@@ -1199,6 +_,7 @@
this.transparencyChain.process(p_342180_.getGameTimeDeltaTicks());
@@ -1170,6 +_,7 @@
RenderSystem.depthMask(false);
profilerfiller.popPush("weather");
this.renderSnowAndRain(p_109606_, f, d0, d1, d2);
@@ -169,7 +169,7 @@
this.renderWorldBorder(p_109604_);
RenderSystem.depthMask(true);
}
@@ -1344,6 +_,7 @@
@@ -1269,6 +_,7 @@
shaderinstance.clear();
VertexBuffer.unbind();
this.minecraft.getProfiler().pop();
@@ -177,7 +177,7 @@
p_298012_.clearRenderState();
}
@@ -1604,6 +_,9 @@
@@ -1519,6 +_,9 @@
}
public void renderSky(Matrix4f p_254034_, Matrix4f p_333200_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
@@ -187,7 +187,7 @@
p_202429_.run();
if (!p_202428_) {
FogType fogtype = p_202427_.getFluidInCamera();
@@ -1728,6 +_,9 @@
@@ -1642,6 +_,9 @@
}
public void renderClouds(PoseStack p_254145_, Matrix4f p_254537_, Matrix4f p_330176_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) {
@@ -197,7 +197,7 @@
float f = this.level.effects().getCloudHeight();
if (!Float.isNaN(f)) {
float f1 = 12.0F;
@@ -2017,7 +_,7 @@
@@ -1901,7 +_,7 @@
boolean flag = false;
if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.NEARBY) {
BlockPos blockpos1 = sectionrenderdispatcher$rendersection.getOrigin().offset(8, 8, 8);
@@ -206,7 +206,7 @@
} else if (this.minecraft.options.prioritizeChunkUpdates().get() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
flag = sectionrenderdispatcher$rendersection.isDirtyFromPlayer();
}
@@ -2609,7 +_,23 @@
@@ -2477,6 +_,14 @@
this.viewArea.setDirty(p_109502_, p_109503_, p_109504_, p_109505_);
}
@@ -218,37 +218,10 @@
+ return this.ticks;
+ }
+
+ /**
+ * @deprecated Forge: Use item aware function below
+ */
+ @Deprecated
public void playStreamingMusic(@Nullable SoundEvent p_109515_, BlockPos p_109516_) {
+ this.playStreamingMusic(p_109515_, p_109516_, p_109515_ == null? null : RecordItem.getBySound(p_109515_));
+ }
+
+ public void playStreamingMusic(@Nullable SoundEvent p_109515_, BlockPos p_109516_, @Nullable RecordItem musicDiscItem) {
SoundInstance soundinstance = this.playingRecords.get(p_109516_);
if (soundinstance != null) {
this.minecraft.getSoundManager().stop(soundinstance);
@@ -2617,7 +_,7 @@
}
if (p_109515_ != null) {
- RecordItem recorditem = RecordItem.getBySound(p_109515_);
+ RecordItem recorditem = musicDiscItem;
if (recorditem != null) {
this.minecraft.gui.setNowPlaying(recorditem.getDisplayName());
}
@@ -2809,7 +_,7 @@
break;
case 1010:
if (Item.byId(p_234307_) instanceof RecordItem recorditem) {
- this.playStreamingMusic(recorditem.getSound(), p_234306_);
+ this.playStreamingMusic(recorditem.getSound(), p_234306_, recorditem);
}
break;
case 1011:
@@ -3011,7 +_,7 @@
public void playJukeboxSong(Holder<JukeboxSong> p_343944_, BlockPos p_342259_) {
if (this.level != null) {
this.stopJukeboxSong(p_342259_);
@@ -2886,7 +_,7 @@
case 2001:
BlockState blockstate1 = Block.stateById(p_234307_);
if (!blockstate1.isAir()) {
@@ -257,7 +230,7 @@
this.level
.playLocalSound(
p_234306_, soundtype.getBreakSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F, false
@@ -3466,7 +_,7 @@
@@ -3338,7 +_,7 @@
} else {
int i = p_109538_.getBrightness(LightLayer.SKY, p_109540_);
int j = p_109538_.getBrightness(LightLayer.BLOCK, p_109540_);
@@ -1,12 +1,11 @@
--- a/net/minecraft/client/renderer/PostChain.java
+++ b/net/minecraft/client/renderer/PostChain.java
@@ -156,7 +_,8 @@
@@ -156,7 +_,7 @@
throw new ChainedJsonException("Render target '" + s4 + "' can't be used as depth buffer");
}
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s4 + ".png");
+ ResourceLocation rl = ResourceLocation.tryParse(s4);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.getNamespace(), "textures/effect/" + rl.getPath() + ".png");
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("textures/effect/" + s4 + ".png");
+ ResourceLocation resourcelocation = ResourceLocation.tryParse(s4).withPath(p -> "textures/effect/" + p + ".png");
this.resourceProvider
.getResource(resourcelocation)
.orElseThrow(() -> new ChainedJsonException("Render target or texture '" + s4 + "' does not exist"));
@@ -1,6 +1,29 @@
--- a/net/minecraft/client/renderer/RenderType.java
+++ b/net/minecraft/client/renderer/RenderType.java
@@ -907,7 +_,7 @@
@@ -674,11 +_,22 @@
RenderType.CompositeState.builder().setShaderState(RENDERTYPE_GUI_GHOST_RECIPE_OVERLAY_SHADER).setTransparencyState(TRANSLUCENT_TRANSPARENCY).setDepthTestState(GREATER_DEPTH_TEST).setWriteMaskState(COLOR_WRITE).createCompositeState(false)
);
private static final ImmutableList<RenderType> CHUNK_BUFFER_LAYERS = ImmutableList.of(solid(), cutoutMipped(), cutout(), translucent(), tripwire());
+ static {
+ int i = 0;
+ for (var layer : CHUNK_BUFFER_LAYERS)
+ layer.chunkLayerId = i++;
+ }
+
private final VertexFormat format;
private final VertexFormat.Mode mode;
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;
@@ -899,7 +_,7 @@
}
public static RenderType text(ResourceLocation p_110498_) {
@@ -9,7 +32,7 @@
}
public static RenderType textBackground() {
@@ -915,19 +_,19 @@
@@ -907,19 +_,19 @@
}
public static RenderType textIntensity(ResourceLocation p_173238_) {
@@ -33,7 +56,7 @@
}
public static RenderType textBackgroundSeeThrough() {
@@ -935,12 +_,25 @@
@@ -927,7 +_,7 @@
}
public static RenderType textIntensitySeeThrough(ResourceLocation p_173241_) {
@@ -42,21 +65,3 @@
}
public static RenderType lightning() {
return LIGHTNING;
}
+
+ // Forge start
+ 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;
+ }
+ static {
+ int i = 0;
+ for (var layer : chunkBufferLayers())
+ layer.chunkLayerId = i++;
+ }
+ // Forge end
private static RenderType.CompositeState tripwireState() {
return RenderType.CompositeState.builder()
@@ -49,7 +49,7 @@
}
}
@@ -89,8 +_,12 @@
@@ -88,8 +_,12 @@
}
private static void renderWater(Minecraft p_110726_, PoseStack p_110727_) {
@@ -60,6 +60,6 @@
RenderSystem.setShader(GameRenderer::getPositionTexShader);
- RenderSystem.setShaderTexture(0, UNDERWATER_LOCATION);
+ RenderSystem.setShaderTexture(0, texture);
BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
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));
RenderSystem.enableBlend();
@@ -7,31 +7,30 @@
+ @Deprecated // Forge: Use the ResourceLocation variant below
public ShaderInstance(ResourceProvider p_173336_, String p_173337_, VertexFormat p_173338_) throws IOException {
- this.name = p_173337_;
+ this(p_173336_, new ResourceLocation(p_173337_), p_173338_);
+ this(p_173336_, ResourceLocation.parse(p_173337_), p_173338_);
+ }
+
+ public ShaderInstance(ResourceProvider p_173336_, ResourceLocation shaderLocation, VertexFormat p_173338_) throws IOException {
+ this.name = shaderLocation.getNamespace().equals("minecraft") ? shaderLocation.getPath() : shaderLocation.toString();
this.vertexFormat = p_173338_;
- ResourceLocation resourcelocation = new ResourceLocation("shaders/core/" + p_173337_ + ".json");
+ ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.getNamespace(), "shaders/core/" + shaderLocation.getPath() + ".json");
- ResourceLocation resourcelocation = ResourceLocation.withDefaultNamespace("shaders/core/" + p_173337_ + ".json");
+ ResourceLocation resourcelocation = shaderLocation.withPath(p -> "shaders/core/" + p + ".json");
try (Reader reader = p_173336_.openAsReader(resourcelocation)) {
JsonObject jsonobject = GsonHelper.parse(reader);
@@ -178,8 +_,10 @@
@@ -177,8 +_,9 @@
Program program1 = p_173342_.getPrograms().get(p_173343_);
Program program;
if (program1 == null) {
- String s = "shaders/core/" + p_173343_ + p_173342_.getExtension();
- Resource resource = p_173341_.getResourceOrThrow(new ResourceLocation(s));
+ ResourceLocation loc = new ResourceLocation(p_173343_);
+ String s = "shaders/core/" + loc.getPath() + p_173342_.getExtension();
+ ResourceLocation resourcelocation = new ResourceLocation(loc.getNamespace(), s);
- Resource resource = p_173341_.getResourceOrThrow(ResourceLocation.withDefaultNamespace(s));
+ ResourceLocation resourcelocation = ResourceLocation.parse(p_173343_).withPath(p -> "shaders/core/" + p + p_173342_.getExtension());
+ String s = resourcelocation.getPath();
+ Resource resource = p_173341_.getResourceOrThrow(resourcelocation);
try (InputStream inputstream = resource.open()) {
final String s1 = FileUtil.getFullResourcePath(s);
@@ -188,12 +_,11 @@
@@ -187,12 +_,11 @@
@Override
public String applyImport(boolean p_173374_, String p_173375_) {
@@ -42,12 +41,12 @@
+ if (!this.importedPaths.add(resourcelocation.toString())) {
return null;
} else {
- ResourceLocation resourcelocation = new ResourceLocation(p_173375_);
- ResourceLocation resourcelocation = ResourceLocation.parse(p_173375_);
-
try {
String s2;
try (Reader reader = p_173341_.openAsReader(resourcelocation)) {
@@ -202,7 +_,8 @@
@@ -201,7 +_,8 @@
return s2;
} catch (IOException ioexception) {
@@ -1,22 +1,20 @@
--- a/net/minecraft/client/renderer/Sheets.java
+++ b/net/minecraft/client/renderer/Sheets.java
@@ -144,11 +_,13 @@
@@ -145,11 +_,11 @@
}
private static Material createSignMaterial(WoodType p_173386_) {
- return new Material(SIGN_SHEET, new ResourceLocation("entity/signs/" + p_173386_.name()));
+ ResourceLocation location = new ResourceLocation(p_173386_.name());
+ return new Material(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/" + location.getPath()));
- return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/" + p_173386_.name()));
+ return new Material(SIGN_SHEET, ResourceLocation.parse(p_173386_.name()).withPrefix("entity/signs/"));
}
private static Material createHangingSignMaterial(WoodType p_251735_) {
- return new Material(SIGN_SHEET, new ResourceLocation("entity/signs/hanging/" + p_251735_.name()));
+ ResourceLocation location = new ResourceLocation(p_251735_.name());
+ return new Material(SIGN_SHEET, new ResourceLocation(location.getNamespace(), "entity/signs/hanging/" + location.getPath()));
- return new Material(SIGN_SHEET, ResourceLocation.withDefaultNamespace("entity/signs/hanging/" + p_251735_.name()));
+ return new Material(SIGN_SHEET, ResourceLocation.parse(p_251735_.name()).withPrefix("entity/signs/hanging/"));
}
public static Material getSignMaterial(WoodType p_173382_) {
@@ -207,6 +_,23 @@
@@ -208,6 +_,23 @@
case SINGLE:
default:
return p_110773_;
@@ -3,44 +3,44 @@
@@ -17,32 +_,38 @@
@Override
public VertexConsumer vertex(double p_110801_, double p_110802_, double p_110803_) {
- return this.delegate.vertex(p_110801_, p_110802_, p_110803_);
+ this.delegate.vertex(p_110801_, p_110802_, p_110803_);
public VertexConsumer addVertex(float p_342932_, float p_342886_, float p_342696_) {
- return this.delegate.addVertex(p_342932_, p_342886_, p_342696_);
+ this.delegate.addVertex(p_342932_, p_342886_, p_342696_);
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@Override
public VertexConsumer color(int p_110826_, int p_110827_, int p_110828_, int p_110829_) {
- return this.delegate.color(p_110826_, p_110827_, p_110828_, p_110829_);
+ this.delegate.color(p_110826_, p_110827_, p_110828_, p_110829_);
public VertexConsumer setColor(int p_344589_, int p_342555_, int p_344320_, int p_345258_) {
- return this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_);
+ this.delegate.setColor(p_344589_, p_342555_, p_344320_, p_345258_);
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@Override
public VertexConsumer uv(float p_110805_, float p_110806_) {
- return this.delegate.uv(this.sprite.getU(p_110805_), this.sprite.getV(p_110806_));
+ this.delegate.uv(this.sprite.getU(p_110805_), this.sprite.getV(p_110806_));
public VertexConsumer setUv(float p_343856_, float p_344420_) {
- return this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
+ this.delegate.setUv(this.sprite.getU(p_343856_), this.sprite.getV(p_344420_));
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@Override
public VertexConsumer overlayCoords(int p_110823_, int p_110824_) {
- return this.delegate.overlayCoords(p_110823_, p_110824_);
+ this.delegate.overlayCoords(p_110823_, p_110824_);
public VertexConsumer setUv1(int p_343784_, int p_344827_) {
- return this.delegate.setUv1(p_343784_, p_344827_);
+ this.delegate.setUv1(p_343784_, p_344827_);
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@Override
public VertexConsumer uv2(int p_110835_, int p_110836_) {
- return this.delegate.uv2(p_110835_, p_110836_);
+ this.delegate.uv2(p_110835_, p_110836_);
public VertexConsumer setUv2(int p_345257_, int p_344124_) {
- return this.delegate.setUv2(p_345257_, p_344124_);
+ this.delegate.setUv2(p_345257_, p_344124_);
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@Override
public VertexConsumer normal(float p_110831_, float p_110832_, float p_110833_) {
- return this.delegate.normal(p_110831_, p_110832_, p_110833_);
+ this.delegate.normal(p_110831_, p_110832_, p_110833_);
public VertexConsumer setNormal(float p_342779_, float p_342534_, float p_344783_) {
- return this.delegate.setNormal(p_342779_, p_342534_, p_344783_);
+ this.delegate.setNormal(p_342779_, p_342534_, p_344783_);
+ return this; // Forge: Fix MC-263524 not working with chained methods
}
@@ -43,19 +43,19 @@
+ net.minecraft.client.renderer.RenderType renderType
) {
try {
RenderShape rendershape = p_234356_.getRenderShape();
@@ -76,7 +_,9 @@
p_234361_,
p_234362_,
p_234356_.getSeed(p_234357_),
- OverlayTexture.NO_OVERLAY
+ OverlayTexture.NO_OVERLAY,
+ modelData,
+ renderType
);
}
this.modelRenderer
@@ -74,7 +_,9 @@
p_234361_,
p_234362_,
p_234356_.getSeed(p_234357_),
- OverlayTexture.NO_OVERLAY
+ OverlayTexture.NO_OVERLAY,
+ modelData,
+ renderType
);
} catch (Throwable throwable) {
@@ -106,7 +_,12 @@
CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block in world");
@@ -103,7 +_,12 @@
return this.blockModelShaper.getBlockModel(p_110911_);
}
@@ -68,7 +68,7 @@
RenderShape rendershape = p_110913_.getRenderShape();
if (rendershape != RenderShape.INVISIBLE) {
switch (rendershape) {
@@ -116,21 +_,26 @@
@@ -113,21 +_,26 @@
float f = (float)(i >> 16 & 0xFF) / 255.0F;
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
float f2 = (float)(i & 0xFF) / 255.0F;
@@ -14,41 +14,41 @@
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
float f2 = (float)(i & 0xFF) / 255.0F;
@@ -181,15 +_,15 @@
float f52 = f4 * f;
float f30 = f4 * f1;
float f31 = f4 * f2;
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l);
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l);
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l);
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l);
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l, alpha);
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l, alpha);
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l, alpha);
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l, alpha);
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);
if (p_234374_.shouldRenderBackwardUpFace(p_234370_, p_234371_.above())) {
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l);
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l);
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l);
- this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l);
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f8, d0 + 0.0, f52, f30, f31, f18, f22, l, alpha);
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f7, d0 + 0.0, f52, f30, f31, f21, f25, l, alpha);
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f9, d0 + 1.0, f52, f30, f31, f20, f24, l, alpha);
+ this.vertex(p_234372_, d1 + 0.0, d2 + (double)f10, d0 + 1.0, f52, f30, f31, f19, f23, l, alpha);
- 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);
}
}
@@ -202,10 +_,10 @@
float f46 = f3 * f;
float f47 = f3 * f1;
float f48 = f3 * f2;
- this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f40, f43, k);
- this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k);
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k);
- this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f41, f43, k);
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f40, f43, k, alpha);
+ this.vertex(p_234372_, d1, d2 + (double)f17, d0, f46, f47, f48, f40, f42, k, alpha);
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0, f46, f47, f48, f41, f42, k, alpha);
+ this.vertex(p_234372_, d1 + 1.0, d2 + (double)f17, d0 + 1.0, f46, f47, f48, f41, f43, k, alpha);
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);
}
int j = this.getLightColor(p_234370_, p_234371_);
@@ -67,40 +67,40 @@
}
@@ -275,15 +_,15 @@
float f37 = f4 * f36 * f;
float f38 = f4 * f36 * f1;
float f39 = f4 * f36 * f2;
- this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
- this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
- this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
- this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j, alpha);
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j, alpha);
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j, alpha);
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j, alpha);
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);
if (textureatlassprite2 != this.waterOverlay) {
- this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j);
- this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j);
- this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j);
- this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j);
+ this.vertex(p_234372_, d3, d2 + (double)f17, d4, f37, f38, f39, f53, f35, j, alpha);
+ this.vertex(p_234372_, d5, d2 + (double)f17, d6, f37, f38, f39, f32, f35, j, alpha);
+ this.vertex(p_234372_, d5, d2 + (double)f45, d6, f37, f38, f39, f32, f34, j, alpha);
+ this.vertex(p_234372_, d3, d2 + (double)f44, d4, f37, f38, f39, f53, f33, j, alpha);
- 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);
}
}
}
@@ -345,10 +_,11 @@
float p_110991_,
float p_110992_,
float p_110993_,
float p_343128_,
float p_344448_,
float p_344284_,
- int p_110994_
+ int p_110994_,
+ float alpha
) {
p_110985_.vertex(p_110986_, p_110987_, p_110988_)
- .color(p_110989_, p_110990_, p_110991_, 1.0F)
+ .color(p_110989_, p_110990_, p_110991_, alpha)
.uv(p_110992_, p_110993_)
.uv2(p_110994_)
.normal(0.0F, 1.0F, 0.0F)
p_110985_.addVertex(p_110989_, p_110990_, p_110991_)
- .setColor(p_110992_, p_110993_, p_343128_, 1.0F)
+ .setColor(p_110992_, p_110993_, p_343128_, alpha)
.setUv(p_344448_, p_344284_)
.setLight(p_110994_)
.setNormal(0.0F, 1.0F, 0.0F);
@@ -1,50 +0,0 @@
--- a/net/minecraft/client/renderer/block/model/BlockElement.java
+++ b/net/minecraft/client/renderer/block/model/BlockElement.java
@@ -29,16 +_,23 @@
public final Map<Direction, BlockElementFace> faces;
public final BlockElementRotation rotation;
public final boolean shade;
+ private net.minecraftforge.client.model.ForgeFaceData faceData;
public BlockElement(
Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_
) {
+ this(p_253626_, p_254426_, p_254454_, p_254229_, p_253661_, net.minecraftforge.client.model.ForgeFaceData.DEFAULT);
+ }
+
+ public BlockElement(Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_, net.minecraftforge.client.model.ForgeFaceData faceData) {
this.from = p_253626_;
this.to = p_254426_;
this.faces = p_254454_;
this.rotation = p_254229_;
this.shade = p_253661_;
this.fillUvs();
+ this.setFaceData(faceData);
+ this.faces.values().forEach(face -> face.parent = this);
}
private void fillUvs() {
@@ -66,6 +_,14 @@
}
}
+ public net.minecraftforge.client.model.ForgeFaceData getFaceData() {
+ return this.faceData;
+ }
+
+ public void setFaceData(net.minecraftforge.client.model.ForgeFaceData faceData) {
+ this.faceData = java.util.Objects.requireNonNull(faceData);
+ }
+
@OnlyIn(Dist.CLIENT)
public static class Deserializer implements JsonDeserializer<BlockElement> {
private static final boolean DEFAULT_SHADE = true;
@@ -80,7 +_,7 @@
throw new JsonParseException("Expected shade to be a Boolean");
} else {
boolean flag = GsonHelper.getAsBoolean(jsonobject, "shade", true);
- return new BlockElement(vector3f, vector3f1, map, blockelementrotation, flag);
+ return new BlockElement(vector3f, vector3f1, map, blockelementrotation, flag, net.minecraftforge.client.model.ForgeFaceData.read(jsonobject.get("forge_data"), net.minecraftforge.client.model.ForgeFaceData.DEFAULT));
}
}
@@ -1,38 +1,26 @@
--- a/net/minecraft/client/renderer/block/model/BlockElementFace.java
+++ b/net/minecraft/client/renderer/block/model/BlockElementFace.java
@@ -19,13 +_,31 @@
public final int tintIndex;
public final String texture;
public final BlockFaceUV uv;
+ @Nullable
+ private final net.minecraftforge.client.model.ForgeFaceData faceData; // If null, we defer to the parent BlockElement's ForgeFaceData, which is not nullable.
+ @Nullable
+ BlockElement parent; // Parent canot be set by the constructor due to instantiation ordering. This shouldn't really ever be null, but it could theoretically be.
@@ -13,9 +_,18 @@
import net.minecraftforge.api.distmarker.OnlyIn;
public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_) {
+ this(p_111359_, p_111360_, p_111361_, p_111362_, null);
@OnlyIn(Dist.CLIENT)
-public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
+public record BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv, @Nullable net.minecraftforge.client.model.ForgeFaceData data) {
public static final int NO_TINT = -1;
+ public BlockElementFace(@Nullable Direction cullForDirection, int tintIndex, String texture, BlockFaceUV uv) {
+ this(cullForDirection, tintIndex, texture, uv, null);
+ }
+
+ public BlockElementFace(@Nullable Direction p_111359_, int p_111360_, String p_111361_, BlockFaceUV p_111362_, @Nullable net.minecraftforge.client.model.ForgeFaceData faceData) {
this.cullForDirection = p_111359_;
this.tintIndex = p_111360_;
this.texture = p_111361_;
this.uv = p_111362_;
+ this.faceData = faceData;
}
+ @Override
+ public net.minecraftforge.client.model.ForgeFaceData data() {
+ return this.data == null ? net.minecraftforge.client.model.ForgeFaceData.DEFAULT : this.data;
+ }
+
+ public net.minecraftforge.client.model.ForgeFaceData getFaceData() {
+ if (this.faceData != null) {
+ return this.faceData;
+ } else if (this.parent != null) {
+ return this.parent.getFaceData();
+ }
+ return net.minecraftforge.client.model.ForgeFaceData.DEFAULT;
+ }
@OnlyIn(Dist.CLIENT)
public static class Deserializer implements JsonDeserializer<BlockElementFace> {
@@ -37,7 +_,7 @@
private static final int DEFAULT_TINT_INDEX = -1;
@@ -26,7 +_,7 @@
int i = this.getTintIndex(jsonobject);
String s = this.getTexture(jsonobject);
BlockFaceUV blockfaceuv = p_111367_.deserialize(jsonobject, BlockFaceUV.class);
@@ -52,7 +52,7 @@
this.overrides.forEach(p_247932_ -> {
UnbakedModel unbakedmodel1 = p_249059_.apply(p_247932_.getModel());
if (!Objects.equals(unbakedmodel1, this)) {
@@ -192,18 +_,27 @@
@@ -192,13 +_,21 @@
});
}
@@ -61,27 +61,21 @@
+ */
+ @Deprecated
@Override
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_, ResourceLocation p_252208_) {
return this.bake(p_252120_, this, p_250023_, p_251130_, p_252208_, true);
public BakedModel bake(ModelBaker p_252120_, Function<Material, TextureAtlasSprite> p_250023_, ModelState p_251130_) {
return this.bake(p_252120_, this, p_250023_, p_251130_, true);
}
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_) {
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111454_, p_111455_);
+ public BakedModel bake(ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_) {
+ return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111455_);
+ }
+
public BakedModel bake(
ModelBaker p_249720_,
BlockModel p_111451_,
Function<Material, TextureAtlasSprite> p_111452_,
ModelState p_111453_,
ResourceLocation p_111454_,
- boolean p_111455_
+ boolean p_111455_,
+ net.minecraftforge.client.RenderTypeGroup renderTypes
- ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_
+ ModelBaker p_249720_, BlockModel p_111451_, Function<Material, TextureAtlasSprite> p_111452_, ModelState p_111453_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes
) {
TextureAtlasSprite textureatlassprite = p_111452_.apply(this.getMaterial("particle"));
if (this.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) {
@@ -295,7 +_,18 @@
@@ -290,7 +_,18 @@
ItemTransform itemtransform5 = this.getTransform(ItemDisplayContext.GUI);
ItemTransform itemtransform6 = this.getTransform(ItemDisplayContext.GROUND);
ItemTransform itemtransform7 = this.getTransform(ItemDisplayContext.FIXED);
@@ -101,7 +95,7 @@
}
private ItemTransform getTransform(ItemDisplayContext p_270662_) {
@@ -413,6 +_,10 @@
@@ -408,6 +_,10 @@
public boolean lightLikeBlock() {
return this == SIDE;
@@ -1,13 +1,13 @@
--- a/net/minecraft/client/renderer/block/model/FaceBakery.java
+++ b/net/minecraft/client/renderer/block/model/FaceBakery.java
@@ -59,7 +_,14 @@
@@ -57,7 +_,14 @@
this.recalculateWinding(aint, direction);
}
- return new BakedQuad(aint, p_111603_.tintIndex, direction, p_111604_, p_111608_);
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, p_111603_.getFaceData().calculateNormals());
+ var data = p_111603_.getFaceData();
+ var quad = new BakedQuad(aint, p_111603_.tintIndex, direction, p_111604_, p_111608_, data.ambientOcclusion());
- return new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_);
+ var data = p_111603_.data();
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, direction, data.calculateNormals());
+ var quad = new BakedQuad(aint, p_111603_.tintIndex(), direction, p_111604_, p_111608_, data.ambientOcclusion());
+ if (!net.minecraftforge.client.model.ForgeFaceData.DEFAULT.equals(data)) {
+ net.minecraftforge.client.model.QuadTransformers.applyingLightmap(data.blockLight(), data.skyLight()).processInPlace(quad);
+ net.minecraftforge.client.model.QuadTransformers.applyingColor(data.color()).processInPlace(quad);
@@ -15,4 +15,4 @@
+ return quad;
}
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_, ResourceLocation p_111585_) {
public static BlockFaceUV recomputeUVs(BlockFaceUV p_111582_, Direction p_111583_, Transformation p_111584_) {
@@ -1,8 +1,8 @@
--- a/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
+++ b/net/minecraft/client/renderer/chunk/RenderChunkRegion.java
@@ -74,4 +_,14 @@
public int getHeight() {
return this.level.getHeight();
@@ -78,4 +_,14 @@
public static int index(int p_345383_, int p_342744_, int p_343921_, int p_343462_) {
return p_343921_ - p_345383_ + (p_343462_ - p_342744_) * 3;
}
+
+ @Override
@@ -0,0 +1,46 @@
--- a/net/minecraft/client/renderer/chunk/SectionCompiler.java
+++ b/net/minecraft/client/renderer/chunk/SectionCompiler.java
@@ -41,6 +_,7 @@
}
public SectionCompiler.Results compile(SectionPos p_344383_, RenderChunkRegion p_342669_, VertexSorting p_342522_, SectionBufferBuilderPack p_343546_) {
+ var modelDataMap = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(p_344383_);
SectionCompiler.Results sectioncompiler$results = new SectionCompiler.Results();
BlockPos blockpos = p_344383_.origin();
BlockPos blockpos1 = blockpos.offset(15, 15, 15);
@@ -71,7 +_,11 @@
}
if (blockstate.getRenderShape() == RenderShape.MODEL) {
- RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate);
+ var model = this.blockRenderer.getBlockModel(blockstate);
+ var data = modelDataMap.getOrDefault(blockpos2, net.minecraftforge.client.model.data.ModelData.EMPTY);
+ data = model.getModelData(p_342669_, blockpos2, blockstate, data);
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, data)) {
BufferBuilder bufferbuilder1 = this.getOrBeginLayer(map, p_343546_, rendertype2);
posestack.pushPose();
posestack.translate(
@@ -79,8 +_,9 @@
(float)SectionPos.sectionRelative(blockpos2.getY()),
(float)SectionPos.sectionRelative(blockpos2.getZ())
);
- this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource);
+ this.blockRenderer.renderBatched(blockstate, blockpos2, p_342669_, posestack, bufferbuilder1, true, randomsource, data, rendertype2);
posestack.popPose();
+ }
}
}
@@ -115,9 +_,10 @@
private <E extends BlockEntity> void handleBlockEntity(SectionCompiler.Results p_343713_, E p_343478_) {
BlockEntityRenderer<E> blockentityrenderer = this.blockEntityRenderer.getRenderer(p_343478_);
if (blockentityrenderer != null) {
- p_343713_.blockEntities.add(p_343478_);
if (blockentityrenderer.shouldRenderOffScreen(p_343478_)) {
p_343713_.globalBlockEntities.add(p_343478_);
+ } else {
+ p_343713_.blockEntities.add(p_343478_); //FORGE: Fix MC-112730
}
}
}
@@ -1,118 +0,0 @@
--- a/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java
+++ b/net/minecraft/client/renderer/chunk/SectionRenderDispatcher.java
@@ -402,7 +_,7 @@
if (!sectionrenderdispatcher$compiledsection.hasBlocks.contains(p_301074_)) {
return false;
} else {
- this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(this.getDistToPlayerSqr(), sectionrenderdispatcher$compiledsection);
+ this.lastResortTransparencyTask = new SectionRenderDispatcher.RenderSection.ResortTransparencyTask(new net.minecraft.world.level.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), sectionrenderdispatcher$compiledsection);
p_298196_.schedule(this.lastResortTransparencyTask);
return true;
}
@@ -436,7 +_,7 @@
this.initialCompilationCancelCount.incrementAndGet();
}
- this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask(this.getDistToPlayerSqr(), renderchunkregion, !flag1 || this.initialCompilationCancelCount.get() > 2);
+ this.lastRebuildTask = new SectionRenderDispatcher.RenderSection.RebuildTask(new net.minecraft.world.level.ChunkPos(getOrigin()), this.getDistToPlayerSqr(), renderchunkregion, !flag1 || this.initialCompilationCancelCount.get() > 2);
return this.lastRebuildTask;
}
@@ -476,10 +_,21 @@
protected final double distAtCreation;
protected final AtomicBoolean isCancelled = new AtomicBoolean(false);
protected final boolean isHighPriority;
+ protected java.util.Map<net.minecraft.core.BlockPos, net.minecraftforge.client.model.data.ModelData> modelData;
+ @Deprecated
public CompileTask(final double p_300617_, final boolean p_299251_) {
+ this(null, p_300617_, p_299251_);
+ }
+
+ public CompileTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_300617_, boolean p_299251_) {
this.distAtCreation = p_300617_;
this.isHighPriority = p_299251_;
+ if (pos == null) {
+ this.modelData = java.util.Collections.emptyMap();
+ } else {
+ this.modelData = net.minecraft.client.Minecraft.getInstance().level.getModelDataManager().getAt(pos);
+ }
}
public abstract CompletableFuture<SectionRenderDispatcher.SectionTaskResult> doTask(SectionBufferBuilderPack p_300298_);
@@ -491,6 +_,10 @@
public int compareTo(SectionRenderDispatcher.RenderSection.CompileTask p_298947_) {
return Doubles.compare(this.distAtCreation, p_298947_.distAtCreation);
}
+
+ public net.minecraftforge.client.model.data.ModelData getModelData(net.minecraft.core.BlockPos pos) {
+ return modelData.getOrDefault(pos, net.minecraftforge.client.model.data.ModelData.EMPTY);
+ }
}
@OnlyIn(Dist.CLIENT)
@@ -498,8 +_,13 @@
@Nullable
protected RenderChunkRegion region;
+ @Deprecated
public RebuildTask(final double p_301300_, @Nullable final RenderChunkRegion p_300496_, final boolean p_299891_) {
- super(p_301300_, p_299891_);
+ this(null, p_301300_, p_300496_, p_299891_);
+ }
+
+ public RebuildTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_301300_, @Nullable RenderChunkRegion p_300496_, boolean p_299891_) {
+ super(pos, p_301300_, p_299891_);
this.region = p_300496_;
}
@@ -601,7 +_,10 @@
}
if (blockstate.getRenderShape() != RenderShape.INVISIBLE) {
- RenderType rendertype2 = ItemBlockRenderTypes.getChunkRenderType(blockstate);
+ var model = blockrenderdispatcher.getBlockModel(blockstate);
+ var modelData = model.getModelData(renderchunkregion, blockpos2, blockstate, getModelData(blockpos2));
+ randomsource.setSeed(blockstate.getSeed(blockpos2));
+ for (RenderType rendertype2 : model.getRenderTypes(blockstate, randomsource, modelData)) {
BufferBuilder bufferbuilder2 = p_300020_.builder(rendertype2);
if (set.add(rendertype2)) {
RenderSection.this.beginLayer(bufferbuilder2);
@@ -609,8 +_,9 @@
posestack.pushPose();
posestack.translate((float)(blockpos2.getX() & 15), (float)(blockpos2.getY() & 15), (float)(blockpos2.getZ() & 15));
- blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource);
+ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2);
posestack.popPose();
+ }
}
}
@@ -643,9 +_,10 @@
private <E extends BlockEntity> void handleBlockEntity(SectionRenderDispatcher.RenderSection.RebuildTask.CompileResults p_297364_, E p_299361_) {
BlockEntityRenderer<E> blockentityrenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(p_299361_);
if (blockentityrenderer != null) {
- p_297364_.blockEntities.add(p_299361_);
if (blockentityrenderer.shouldRenderOffScreen(p_299361_)) {
p_297364_.globalBlockEntities.add(p_299361_);
+ } else {
+ p_297364_.blockEntities.add(p_299361_); //FORGE: Fix MC-112730
}
}
}
@@ -673,8 +_,13 @@
class ResortTransparencyTask extends SectionRenderDispatcher.RenderSection.CompileTask {
private final SectionRenderDispatcher.CompiledSection compiledSection;
+ @Deprecated
public ResortTransparencyTask(final double p_300619_, final SectionRenderDispatcher.CompiledSection p_297742_) {
- super(p_300619_, true);
+ this(null, p_300619_, p_297742_);
+ }
+
+ public ResortTransparencyTask(@Nullable net.minecraft.world.level.ChunkPos pos, double p_300619_, SectionRenderDispatcher.CompiledSection p_297742_) {
+ super(pos, p_300619_, true);
this.compiledSection = p_297742_;
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/entity/BoatRenderer.java
+++ b/net/minecraft/client/renderer/entity/BoatRenderer.java
@@ -75,7 +_,7 @@
@@ -76,7 +_,7 @@
p_113932_.mulPose(new Quaternionf().setAngleAxis(p_113929_.getBubbleAngle(p_113931_) * (float) (Math.PI / 180.0), 1.0F, 0.0F, 1.0F));
}
@@ -9,7 +9,7 @@
ResourceLocation resourcelocation = pair.getFirst();
ListModel<Boat> listmodel = pair.getSecond();
p_113932_.scale(-1.0F, -1.0F, 1.0F);
@@ -94,7 +_,12 @@
@@ -95,7 +_,12 @@
super.render(p_113929_, p_113930_, p_113931_, p_113932_, p_113933_, p_113934_);
}
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java
+++ b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java
@@ -190,12 +_,12 @@
private static void renderHitbox(PoseStack p_114442_, VertexConsumer p_114443_, Entity p_114444_, float p_114445_) {
@@ -222,12 +_,12 @@
) {
AABB aabb = p_114444_.getBoundingBox().move(-p_114444_.getX(), -p_114444_.getY(), -p_114444_.getZ());
LevelRenderer.renderLineBox(p_114442_, p_114443_, aabb, 1.0F, 1.0F, 1.0F, 1.0F);
LevelRenderer.renderLineBox(p_114442_, p_114443_, aabb, p_343193_, p_342304_, p_342638_, 1.0F);
- if (p_114444_ instanceof EnderDragon) {
+ if (p_114444_.isMultipartEntity()) {
double d0 = -Mth.lerp((double)p_114445_, p_114444_.xOld, p_114444_.getX());
@@ -15,7 +15,7 @@
p_114442_.pushPose();
double d3 = d0 + Mth.lerp((double)p_114445_, enderdragonpart.xOld, enderdragonpart.getX());
double d4 = d1 + Mth.lerp((double)p_114445_, enderdragonpart.yOld, enderdragonpart.getY());
@@ -440,6 +_,10 @@
@@ -467,6 +_,10 @@
return this.itemInHandRenderer;
}
@@ -26,7 +26,7 @@
@Override
public void onResourceManagerReload(ResourceManager p_174004_) {
EntityRendererProvider.Context entityrendererprovider$context = new EntityRendererProvider.Context(
@@ -447,5 +_,6 @@
@@ -474,5 +_,6 @@
);
this.renderers = EntityRenderers.createEntityRenderers(entityrendererprovider$context);
this.playerRenderers = EntityRenderers.createPlayerRenderers(entityrendererprovider$context);
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/renderer/entity/EntityRenderer.java
+++ b/net/minecraft/client/renderer/entity/EntityRenderer.java
@@ -71,8 +_,9 @@
}
@@ -94,8 +_,9 @@
}
}
public void render(T p_114485_, float p_114486_, float p_114487_, PoseStack p_114488_, MultiBufferSource p_114489_, int p_114490_) {
- if (this.shouldShowName(p_114485_)) {
- this.renderNameTag(p_114485_, p_114485_.getDisplayName(), p_114488_, p_114489_, p_114490_, p_114487_);
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.fireRenderNameTagEvent(p_114485_, p_114485_.getDisplayName(), this, p_114488_, p_114489_, p_114490_, p_114487_);
@@ -12,7 +12,7 @@
}
}
@@ -88,7 +_,7 @@
@@ -181,7 +_,7 @@
protected void renderNameTag(T p_114498_, Component p_114499_, PoseStack p_114500_, MultiBufferSource p_114501_, int p_114502_, float p_334448_) {
double d0 = this.entityRenderDispatcher.distanceToSqr(p_114498_);
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/entity/FishingHookRenderer.java
+++ b/net/minecraft/client/renderer/entity/FishingHookRenderer.java
@@ -66,7 +_,7 @@
@@ -64,7 +_,7 @@
private Vec3 getPlayerHandPos(Player p_328037_, float p_328369_, float p_332926_) {
int i = p_328037_.getMainArm() == HumanoidArm.RIGHT ? 1 : -1;
ItemStack itemstack = p_328037_.getMainHandItem();
@@ -28,7 +28,7 @@
VertexConsumer vertexconsumer;
if (hasAnimatedTexture(p_115144_) && p_115144_.hasFoil()) {
PoseStack.Pose posestack$pose = p_115147_.last().copy();
@@ -150,9 +_,11 @@
@@ -146,9 +_,11 @@
vertexconsumer = getFoilBuffer(p_115148_, rendertype, true, p_115144_.hasFoil());
}
@@ -42,7 +42,7 @@
}
p_115147_.popPose();
@@ -211,7 +_,7 @@
@@ -199,7 +_,7 @@
float f1 = (float)FastColor.ARGB32.red(i) / 255.0F;
float f2 = (float)FastColor.ARGB32.green(i) / 255.0F;
float f3 = (float)FastColor.ARGB32.blue(i) / 255.0F;
@@ -51,7 +51,7 @@
}
}
@@ -264,5 +_,9 @@
@@ -252,5 +_,9 @@
@Override
public void onResourceManagerReload(ResourceManager p_115105_) {
this.itemModelShaper.rebuildCache();
@@ -6,7 +6,7 @@
@OnlyIn(Dist.CLIENT)
-public class ElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> {
+public class ElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> implements net.minecraftforge.client.extensions.IForgeElytraLayer<T> {
public static final ResourceLocation WINGS_LOCATION = new ResourceLocation("textures/entity/elytra.png");
public static final ResourceLocation WINGS_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/elytra.png");
private final ElytraModel<T> elytraModel;
@@ -45,7 +_,7 @@
@@ -1,21 +1,19 @@
--- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
+++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
@@ -66,6 +_,7 @@
@@ -66,22 +_,24 @@
if (armoritem.getEquipmentSlot() == p_117122_) {
this.getParentModel().copyPropertiesTo(p_117124_);
this.setPartVisibility(p_117124_, p_117122_);
+ net.minecraft.client.model.Model model = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_);
boolean flag = this.usesInnerModel(p_117122_);
ArmorMaterial armormaterial = armoritem.getMaterial().value();
int i = itemstack.is(ItemTags.DYEABLE) ? DyedItemColor.getOrDefault(itemstack, -6265536) : -1;
@@ -83,17 +_,17 @@
f1 = 1.0F;
f2 = 1.0F;
}
-
- this.renderModel(p_117119_, p_117120_, p_117123_, p_117124_, f, f1, f2, armormaterial$layer.texture(flag));
int i = itemstack.is(ItemTags.DYEABLE) ? FastColor.ARGB32.opaque(DyedItemColor.getOrDefault(itemstack, -6265536)) : -1;
for (ArmorMaterial.Layer armormaterial$layer : armormaterial.layers()) {
int j = armormaterial$layer.dyeable() ? i : -1;
- this.renderModel(p_117119_, p_117120_, p_117123_, p_117124_, j, armormaterial$layer.texture(flag));
+ var texture = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(p_117121_, itemstack, p_117122_, armormaterial$layer, flag);
+ this.renderModel(p_117119_, p_117120_, p_117123_, model, f, f1, f2, texture);
+ this.renderModel(p_117119_, p_117120_, p_117123_, model, j, texture);
}
ArmorTrim armortrim = itemstack.get(DataComponents.TRIM);
@@ -30,25 +28,16 @@
}
}
}
@@ -122,11 +_,15 @@
}
@@ -111,12 +_,20 @@
}
+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, A p_289658_, float p_289678_, float p_289674_, float p_289693_, ResourceLocation p_328978_) {
+ renderModel(p_289664_, p_289689_, p_289681_, (net.minecraft.client.model.Model)p_289658_, p_289678_, p_289674_, p_289693_, p_328978_);
private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, A p_289658_, int p_342257_, ResourceLocation p_328978_) {
+ renderModel(p_289664_, p_289689_, p_289681_, (net.minecraft.client.model.Model)p_289658_, p_342257_, p_328978_);
+ }
+
private void renderModel(
PoseStack p_289664_,
MultiBufferSource p_289689_,
int p_289681_,
- A p_289658_,
+ net.minecraft.client.model.Model p_289658_,
float p_289678_,
float p_289674_,
float p_289693_,
@@ -136,8 +_,12 @@
p_289658_.renderToBuffer(p_289664_, vertexconsumer, p_289681_, OverlayTexture.NO_OVERLAY, p_289678_, p_289674_, p_289693_, 1.0F);
+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, net.minecraft.client.model.Model p_289658_, int p_342257_, ResourceLocation p_328978_) {
VertexConsumer vertexconsumer = p_289689_.getBuffer(RenderType.armorCutoutNoCull(p_328978_));
p_289658_.renderToBuffer(p_289664_, vertexconsumer, p_289681_, OverlayTexture.NO_OVERLAY, p_342257_);
}
+ private void renderTrim(Holder<ArmorMaterial> p_331988_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_) {
@@ -61,7 +50,7 @@
) {
TextureAtlasSprite textureatlassprite = this.armorTrimAtlas.getSprite(p_289651_ ? p_289692_.innerTexture(p_331988_) : p_289692_.outerTexture(p_331988_));
VertexConsumer vertexconsumer = textureatlassprite.wrap(p_289643_.getBuffer(Sheets.armorTrimsSheet(p_289692_.pattern().value().decal())));
@@ -145,6 +_,10 @@
@@ -124,6 +_,10 @@
}
private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, A p_289659_) {
@@ -69,10 +58,10 @@
+ }
+
+ private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, net.minecraft.client.model.Model p_289659_) {
p_289659_.renderToBuffer(p_289673_, p_289654_.getBuffer(RenderType.armorEntityGlint()), p_289649_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
p_289659_.renderToBuffer(p_289673_, p_289654_.getBuffer(RenderType.armorEntityGlint()), p_289649_, OverlayTexture.NO_OVERLAY);
}
@@ -154,5 +_,12 @@
@@ -133,5 +_,12 @@
private boolean usesInnerModel(EquipmentSlot p_117129_) {
return p_117129_ == EquipmentSlot.LEGS;
@@ -1,16 +1,17 @@
--- a/net/minecraft/client/resources/language/LanguageManager.java
+++ b/net/minecraft/client/resources/language/LanguageManager.java
@@ -28,7 +_,7 @@
private String currentCode;
@@ -30,8 +_,8 @@
private final Consumer<ClientLanguage> reloadCallback;
public LanguageManager(String p_118971_) {
public LanguageManager(String p_118971_, Consumer<ClientLanguage> p_342376_) {
- this.currentCode = p_118971_;
this.reloadCallback = p_342376_;
+ setSelected(p_118971_);
}
private static Map<String, LanguageInfo> extractLanguages(Stream<PackResources> p_118982_) {
@@ -65,8 +_,12 @@
Language.inject(clientlanguage);
@@ -69,8 +_,12 @@
this.reloadCallback.accept(clientlanguage);
}
+ private java.util.Locale javaLocale; // Forge: add locale information for modders
@@ -18,7 +19,7 @@
public void setSelected(String p_265224_) {
this.currentCode = p_265224_;
+ final String[] langSplit = p_265224_.split("_", 2);
+ this.javaLocale = langSplit.length == 1 ? new java.util.Locale(langSplit[0]) : new java.util.Locale(langSplit[0], langSplit[1]);
+ this.javaLocale = langSplit.length == 1 ? java.util.Locale.of(langSplit[0]) : java.util.Locale.of(langSplit[0], langSplit[1]);
}
public String getSelected() {
@@ -1,20 +1,17 @@
--- a/net/minecraft/client/resources/model/ModelBakery.java
+++ b/net/minecraft/client/resources/model/ModelBakery.java
@@ -161,6 +_,13 @@
@@ -115,6 +_,10 @@
p_252014_.popPush("special");
this.loadTopLevel(ItemRenderer.TRIDENT_IN_HAND_MODEL);
this.loadTopLevel(ItemRenderer.SPYGLASS_IN_HAND_MODEL);
+ Set<ResourceLocation> additionalModels = Sets.newHashSet();
this.loadSpecialItemModelAndDependencies(ItemRenderer.TRIDENT_IN_HAND_MODEL);
this.loadSpecialItemModelAndDependencies(ItemRenderer.SPYGLASS_IN_HAND_MODEL);
+ Set<ModelResourceLocation> additionalModels = new HashSet<>();
+ net.minecraftforge.client.ForgeHooksClient.onRegisterAdditionalModels(additionalModels);
+ for (ResourceLocation rl : additionalModels) {
+ UnbakedModel unbakedmodel = this.getModel(rl); // loadTopLevel(...), but w/o ModelResourceLocation limitation
+ this.unbakedCache.put(rl, unbakedmodel);
+ this.topLevelModels.put(rl, unbakedmodel);
+ }
+ for (var rl : additionalModels)
+ this.registerModel(rl, this.getModel(rl.id()));
this.topLevelModels.values().forEach(p_247954_ -> p_247954_.resolveParents(this::getModel));
p_252014_.pop();
}
@@ -478,7 +_,17 @@
@@ -244,14 +_,24 @@
}
@Override
@@ -32,16 +29,30 @@
ModelBakery.BakedCacheKey modelbakery$bakedcachekey = new ModelBakery.BakedCacheKey(p_252176_, p_249765_.getRotation(), p_249765_.isUvLocked());
BakedModel bakedmodel = ModelBakery.this.bakedCache.get(modelbakery$bakedcachekey);
if (bakedmodel != null) {
@@ -486,10 +_,10 @@
return bakedmodel;
} else {
UnbakedModel unbakedmodel = this.getModel(p_252176_);
if (unbakedmodel instanceof BlockModel blockmodel && blockmodel.getRootModel() == ModelBakery.GENERATION_MARKER) {
- return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(this.modelTextureGetter, blockmodel).bake(this, blockmodel, this.modelTextureGetter, p_249765_, p_252176_, false);
+ return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(sprites, blockmodel).bake(this, blockmodel, sprites, p_249765_, p_252176_, false);
}
- BakedModel bakedmodel1 = unbakedmodel.bake(this, this.modelTextureGetter, p_249765_, p_252176_);
+ BakedModel bakedmodel1 = unbakedmodel.bake(this, sprites, p_249765_, p_252176_);
- BakedModel bakedmodel1 = this.bakeUncached(unbakedmodel, p_249765_);
+ BakedModel bakedmodel1 = this.bakeUncached(unbakedmodel, p_249765_, sprites);
ModelBakery.this.bakedCache.put(modelbakery$bakedcachekey, bakedmodel1);
return bakedmodel1;
}
@@ -259,11 +_,16 @@
@Nullable
BakedModel bakeUncached(UnbakedModel p_343761_, ModelState p_342939_) {
+ return bakeUncached(p_343761_, p_342939_, this.modelTextureGetter);
+ }
+
+ @Nullable
+ BakedModel bakeUncached(UnbakedModel p_343761_, ModelState p_342939_, Function<Material, TextureAtlasSprite> sprites) {
if (p_343761_ instanceof BlockModel blockmodel && blockmodel.getRootModel() == ModelBakery.GENERATION_MARKER) {
- return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(this.modelTextureGetter, blockmodel).bake(this, blockmodel, this.modelTextureGetter, p_342939_, false);
+ return ModelBakery.ITEM_MODEL_GENERATOR.generateBlockModel(sprites, blockmodel).bake(this, blockmodel, sprites, p_342939_, false);
}
- return p_343761_.bake(this, this.modelTextureGetter, p_342939_);
+ return p_343761_.bake(this, sprites, p_342939_);
}
}
@@ -2,10 +2,10 @@
+++ b/net/minecraft/client/resources/model/ModelManager.java
@@ -63,13 +_,14 @@
TextureAtlas.LOCATION_BLOCKS,
new ResourceLocation("blocks")
ResourceLocation.withDefaultNamespace("blocks")
);
- private Map<ResourceLocation, BakedModel> bakedRegistry;
+ private Map<ResourceLocation, BakedModel> bakedRegistry = new java.util.HashMap<>();
- private Map<ModelResourceLocation, BakedModel> bakedRegistry;
+ private Map<ModelResourceLocation, BakedModel> bakedRegistry = new java.util.HashMap<>();
private final AtlasSet atlases;
private final BlockModelShaper blockModelShaper;
private final BlockColors blockColors;
@@ -16,35 +16,24 @@
public ModelManager(TextureManager p_119406_, BlockColors p_119407_, int p_119408_) {
this.blockColors = p_119407_;
@@ -78,6 +_,10 @@
this.atlases = new AtlasSet(VANILLA_ATLASES, p_119406_);
}
+ public BakedModel getModel(ResourceLocation modelLocation) {
+ return this.bakedRegistry.getOrDefault(modelLocation, this.missingModel);
+ }
+
public BakedModel getModel(ModelResourceLocation p_119423_) {
return this.bakedRegistry.getOrDefault(p_119423_, this.missingModel);
}
@@ -100,6 +_,7 @@
Executor p_249221_
) {
p_250336_.startTick();
+ net.minecraftforge.client.model.geometry.GeometryLoaderManager.init();
CompletableFuture<Map<ResourceLocation, BlockModel>> completablefuture = loadBlockModels(p_251134_, p_250550_);
CompletableFuture<Map<ResourceLocation, List<ModelBakery.LoadedJson>>> completablefuture1 = loadBlockStates(p_251134_, p_250550_);
CompletableFuture<Map<ResourceLocation, List<BlockStateModelLoader.LoadedJson>>> completablefuture1 = loadBlockStates(p_251134_, p_250550_);
CompletableFuture<ModelBakery> completablefuture2 = completablefuture.thenCombineAsync(
@@ -211,6 +_,8 @@
@@ -214,6 +_,8 @@
.collect(Collectors.joining("\n"))
)
);
+ p_252136_.popPush("forge_modify_baking_result");
+ net.minecraftforge.client.ForgeHooksClient.onModifyBakingResult(p_248945_.getBakedTopLevelModels(), p_248945_);
p_252136_.popPush("dispatch");
Map<ResourceLocation, BakedModel> map = p_248945_.getBakedTopLevelModels();
BakedModel bakedmodel = map.get(ModelBakery.MISSING_MODEL_LOCATION);
@@ -240,6 +_,8 @@
Map<ModelResourceLocation, BakedModel> map = p_248945_.getBakedTopLevelModels();
BakedModel bakedmodel = map.get(ModelBakery.MISSING_MODEL_VARIANT);
@@ -243,6 +_,8 @@
this.bakedRegistry = modelbakery.getBakedTopLevelModels();
this.modelGroups = modelbakery.getModelGroups();
this.missingModel = p_248996_.missingModel;
@@ -53,7 +42,7 @@
p_251960_.popPush("cache");
this.blockModelShaper.replaceCache(p_248996_.modelCache);
p_251960_.pop();
@@ -265,6 +_,7 @@
@@ -268,6 +_,7 @@
}
public TextureAtlas getAtlas(ResourceLocation p_119429_) {
@@ -61,7 +50,7 @@
return this.atlases.getAtlas(p_119429_);
}
@@ -275,6 +_,10 @@
@@ -278,6 +_,10 @@
public void updateMaxMipLevel(int p_119411_) {
this.maxMipmapLevels = p_119411_;
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/server/IntegratedServer.java
+++ b/net/minecraft/client/server/IntegratedServer.java
@@ -72,11 +_,12 @@
@@ -73,11 +_,12 @@
this.setPvpAllowed(true);
this.setFlightAllowed(true);
this.initializeKeyPair();
@@ -14,7 +14,7 @@
}
@Override
@@ -224,6 +_,7 @@
@@ -225,6 +_,7 @@
@Override
public void halt(boolean p_120053_) {
@@ -1,15 +1,15 @@
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -215,7 +_,7 @@
@@ -214,7 +_,7 @@
JfrCommand.register(this.dispatcher);
}
- if (SharedConstants.IS_RUNNING_IN_IDE) {
+ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) {
TestCommand.register(this.dispatcher);
ResetChunksCommand.register(this.dispatcher);
RaidCommand.register(this.dispatcher, p_230944_);
@@ -250,6 +_,7 @@
DebugPathCommand.register(this.dispatcher);
@@ -248,6 +_,7 @@
if (p_230943_.includeIntegrated) {
PublishCommand.register(this.dispatcher);
}
@@ -17,7 +17,7 @@
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
}
@@ -268,9 +_,18 @@
@@ -266,9 +_,18 @@
public void performCommand(ParseResults<CommandSourceStack> p_242844_, String p_242841_) {
CommandSourceStack commandsourcestack = p_242844_.getContext().getSource();
commandsourcestack.getServer().getProfiler().push(() -> "/" + p_242841_);
@@ -37,7 +37,7 @@
if (contextchain != null) {
executeCommandInContext(
commandsourcestack,
@@ -361,7 +_,8 @@
@@ -359,7 +_,8 @@
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newHashMap();
RootCommandNode<SharedSuggestionProvider> rootcommandnode = new RootCommandNode<>();
map.put(this.dispatcher.getRoot(), rootcommandnode);
@@ -1,6 +1,6 @@
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -104,7 +_,7 @@
@@ -105,7 +_,7 @@
}
private void checkPermissions(CommandSourceStack p_121169_) throws CommandSyntaxException {
@@ -1,6 +1,6 @@
--- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java
@@ -453,6 +_,11 @@
@@ -472,6 +_,11 @@
}
this.reader.skip();
@@ -12,10 +12,10 @@
this.parseSelector();
} else {
this.parseNameOrUUID();
@@ -468,6 +_,7 @@
p_121248_.suggest("@r", Component.translatable("argument.entity.selector.randomPlayer"));
@@ -488,6 +_,7 @@
p_121248_.suggest("@s", Component.translatable("argument.entity.selector.self"));
p_121248_.suggest("@e", Component.translatable("argument.entity.selector.allEntities"));
p_121248_.suggest("@n", Component.translatable("argument.entity.selector.nearestEntity"));
+ net.minecraftforge.common.command.EntitySelectorManager.fillSelectorSuggestions(p_121248_);
}
@@ -17,7 +17,7 @@
}
this.byKey.put(p_256252_, reference);
@@ -322,7 +_,6 @@
@@ -327,7 +_,6 @@
return this;
} else {
this.frozen = true;
@@ -25,7 +25,7 @@
List<ResourceLocation> list = this.byKey
.entrySet()
.stream()
@@ -338,7 +_,8 @@
@@ -343,7 +_,8 @@
throw new IllegalStateException("Some intrusive holders were not registered: " + this.unregisteredIntrusiveHolders.values());
}
@@ -35,7 +35,7 @@
}
return this;
@@ -435,5 +_,24 @@
@@ -440,5 +_,24 @@
@Override
public HolderLookup.RegistryLookup<T> asLookup() {
return this.lookup;
@@ -7,19 +7,19 @@
- if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null)) {
+ if (dispensiblecontaineritem.emptyContents(null, level, blockpos, null, p_333855_)) {
dispensiblecontaineritem.checkExtraContent(null, level, p_333855_, blockpos);
return new ItemStack(Items.BUCKET);
return this.consumeWithRemainder(p_333645_, p_333855_, new ItemStack(Items.BUCKET));
} else {
@@ -294,9 +_,11 @@
@@ -283,9 +_,11 @@
} else if (CampfireBlock.canLight(blockstate) || CandleBlock.canLight(blockstate) || CandleCakeBlock.canLight(blockstate)) {
level.setBlockAndUpdate(blockpos, blockstate.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)));
level.gameEvent(null, GameEvent.BLOCK_CHANGE, blockpos);
serverlevel.setBlockAndUpdate(blockpos, blockstate.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)));
serverlevel.gameEvent(null, GameEvent.BLOCK_CHANGE, blockpos);
- } else if (blockstate.getBlock() instanceof TntBlock) {
- TntBlock.explode(level, blockpos);
- level.removeBlock(blockpos, false);
+ } else if (blockstate.isFlammable(level, blockpos, p_333039_.state().getValue(DispenserBlock.FACING).getOpposite())) {
+ blockstate.onCaughtFire(level, blockpos, p_333039_.state().getValue(DispenserBlock.FACING).getOpposite(), null);
- TntBlock.explode(serverlevel, blockpos);
- serverlevel.removeBlock(blockpos, false);
+ } else if (blockstate.isFlammable(serverlevel, blockpos, p_333039_.state().getValue(DispenserBlock.FACING).getOpposite())) {
+ blockstate.onCaughtFire(serverlevel, blockpos, p_333039_.state().getValue(DispenserBlock.FACING).getOpposite(), null);
+ if (blockstate.getBlock() instanceof TntBlock) {
+ level.removeBlock(blockpos, false);
+ serverlevel.removeBlock(blockpos, false);
+ }
} else {
this.setSuccess(false);
@@ -1,6 +1,6 @@
--- a/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/net/minecraft/core/registries/BuiltInRegistries.java
@@ -230,7 +_,9 @@
@@ -240,7 +_,9 @@
) {
Bootstrap.checkBootstrapCalled(() -> "registry " + p_259230_);
ResourceLocation resourcelocation = p_259230_.location();
@@ -11,7 +11,7 @@
WRITABLE_REGISTRY.register((ResourceKey)p_259230_, p_260327_, RegistrationInfo.BUILT_IN);
return p_260327_;
}
@@ -265,7 +_,7 @@
@@ -275,7 +_,7 @@
if (p_325821_ instanceof DefaultedRegistry) {
ResourceLocation resourcelocation = ((DefaultedRegistry)p_325821_).getDefaultKey();
@@ -0,0 +1,17 @@
--- a/net/minecraft/core/registries/Registries.java
+++ b/net/minecraft/core/registries/Registries.java
@@ -237,10 +_,14 @@
}
public static String elementsDirPath(ResourceKey<? extends Registry<?>> p_343743_) {
+ if (!p_343743_.location().getNamespace().equals("minecraft"))
+ return p_343743_.location().getNamespace() + '/' + p_343743_.location().getPath();
return p_343743_.location().getPath();
}
public static String tagsDirPath(ResourceKey<? extends Registry<?>> p_343025_) {
+ if (!p_343025_.location().getNamespace().equals("minecraft"))
+ return "tags/" + p_343025_.location().getNamespace() + '/' + p_343025_.location().getPath();
return "tags/" + p_343025_.location().getPath();
}
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/Main.java
+++ b/net/minecraft/data/Main.java
@@ -86,8 +_,15 @@
@@ -77,8 +_,15 @@
OptionSpec<Void> optionspec6 = optionparser.accepts("all", "Include all generators");
OptionSpec<String> optionspec7 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
OptionSpec<String> optionspec8 = optionparser.accepts("input", "Input folder").withRequiredArg();
@@ -17,7 +17,7 @@
Path path = Paths.get(optionspec7.value(optionset));
boolean flag = optionset.has(optionspec6);
boolean flag1 = flag || optionset.has(optionspec2);
@@ -95,6 +_,13 @@
@@ -86,6 +_,13 @@
boolean flag3 = flag || optionset.has(optionspec3);
boolean flag4 = flag || optionset.has(optionspec4);
boolean flag5 = flag || optionset.has(optionspec5);
@@ -31,7 +31,7 @@
DataGenerator datagenerator = createStandardGenerator(
path,
optionset.valuesOf(optionspec8).stream().map(p_129659_ -> Paths.get(p_129659_)).collect(Collectors.toList()),
@@ -107,6 +_,7 @@
@@ -98,6 +_,7 @@
true
);
datagenerator.run();
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/advancements/AdvancementProvider.java
+++ b/net/minecraft/data/advancements/AdvancementProvider.java
@@ -15,6 +_,11 @@
@@ -16,6 +_,11 @@
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/loot/BlockLootSubProvider.java
+++ b/net/minecraft/data/loot/BlockLootSubProvider.java
@@ -605,12 +_,16 @@
@@ -641,12 +_,16 @@
protected abstract void generate();
@@ -9,7 +9,7 @@
+ }
+
@Override
public void generate(HolderLookup.Provider p_331289_, BiConsumer<ResourceKey<LootTable>, LootTable.Builder> p_249322_) {
public void generate(BiConsumer<ResourceKey<LootTable>, LootTable.Builder> p_249322_) {
this.generate();
Set<ResourceKey<LootTable>> set = new HashSet<>();
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/loot/EntityLootSubProvider.java
+++ b/net/minecraft/data/loot/EntityLootSubProvider.java
@@ -58,12 +_,16 @@
@@ -96,12 +_,16 @@
public abstract void generate();
@@ -9,7 +9,7 @@
+ }
+
@Override
public void generate(HolderLookup.Provider p_327798_, BiConsumer<ResourceKey<LootTable>, LootTable.Builder> p_251751_) {
public void generate(BiConsumer<ResourceKey<LootTable>, LootTable.Builder> p_251751_) {
this.generate();
Set<ResourceKey<LootTable>> set = new HashSet<>();
- BuiltInRegistries.ENTITY_TYPE
@@ -19,7 +19,7 @@
.forEach(
p_266624_ -> {
EntityType<?> entitytype = p_266624_.value();
@@ -113,7 +_,7 @@
@@ -151,7 +_,7 @@
}
}
@@ -4,8 +4,8 @@
private CompletableFuture<?> run(CachedOutput p_327970_, HolderLookup.Provider p_331092_) {
WritableRegistry<LootTable> writableregistry = new MappedRegistry<>(Registries.LOOT_TABLE, Lifecycle.experimental());
Map<RandomSupport.Seed128bit, ResourceLocation> map = new Object2ObjectOpenHashMap<>();
- this.subProviders.forEach(p_325858_ -> p_325858_.provider().get().generate(p_331092_, (p_325864_, p_325865_) -> {
+ this.getTables().forEach(p_325858_ -> p_325858_.provider().get().generate(p_331092_, (p_325864_, p_325865_) -> {
- this.subProviders.forEach(p_341016_ -> p_341016_.provider().apply(p_331092_).generate((p_325864_, p_325865_) -> {
+ this.getTables().forEach(p_341016_ -> p_341016_.provider().apply(p_331092_).generate((p_325864_, p_325865_) -> {
ResourceLocation resourcelocation = sequenceIdForLootTable(p_325864_);
ResourceLocation resourcelocation1 = map.put(RandomSequence.seedForKey(resourcelocation), resourcelocation);
if (resourcelocation1 != null) {
@@ -50,4 +50,4 @@
+ ));
}
public static record SubProviderEntry(Supplier<LootTableSubProvider> provider, LootContextParamSet paramSet) {
public static record SubProviderEntry(Function<HolderLookup.Provider, LootTableSubProvider> provider, LootContextParamSet paramSet) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/recipes/RecipeProvider.java
+++ b/net/minecraft/data/recipes/RecipeProvider.java
@@ -83,21 +_,16 @@
@@ -84,21 +_,16 @@
this.buildRecipes(
new RecipeOutput() {
@Override
@@ -28,7 +28,7 @@
}
}
}
@@ -106,9 +_,24 @@
@@ -107,9 +_,24 @@
public Advancement.Builder advancement() {
return Advancement.Builder.recipeAdvancement().parent(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT);
}
@@ -1,7 +1,7 @@
--- a/net/minecraft/data/registries/RegistriesDatapackGenerator.java
+++ b/net/minecraft/data/registries/RegistriesDatapackGenerator.java
@@ -22,10 +_,21 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -20,10 +_,21 @@
public class RegistriesDatapackGenerator implements DataProvider {
private final PackOutput output;
private final CompletableFuture<HolderLookup.Provider> registries;
+ private final java.util.function.Predicate<String> namespacePredicate;
@@ -22,7 +22,7 @@
}
@Override
@@ -35,8 +_,7 @@
@@ -33,8 +_,7 @@
p_325918_ -> {
DynamicOps<JsonElement> dynamicops = p_325918_.createSerializationContext(JsonOps.INSTANCE);
return CompletableFuture.allOf(
@@ -32,14 +32,10 @@
.flatMap(p_256552_ -> this.dumpRegistryCap(p_255785_, p_325918_, dynamicops, (RegistryDataLoader.RegistryData<?>)p_256552_).stream())
.toArray(CompletableFuture[]::new)
);
@@ -52,9 +_,10 @@
.map(
p_255847_ -> {
PackOutput.PathProvider packoutput$pathprovider = this.output
- .createPathProvider(PackOutput.Target.DATA_PACK, resourcekey.location().getPath());
+ .createPathProvider(PackOutput.Target.DATA_PACK, net.minecraftforge.common.ForgeHooks.prefixNamespace(resourcekey.location()));
@@ -52,6 +_,7 @@
PackOutput.PathProvider packoutput$pathprovider = this.output.createRegistryElementsPathProvider(resourcekey);
return CompletableFuture.allOf(
p_255847_.listElements()
p_341079_.listElements()
+ .filter(holder -> this.namespacePredicate.test(holder.key().location().getNamespace()))
.map(
p_256105_ -> dumpValue(
@@ -1,9 +1,9 @@
--- a/net/minecraft/data/registries/VanillaRegistries.java
+++ b/net/minecraft/data/registries/VanillaRegistries.java
@@ -60,6 +_,7 @@
.add(Registries.WOLF_VARIANT, WolfVariants::bootstrap)
.add(Registries.DAMAGE_TYPE, DamageTypes::bootstrap)
.add(Registries.BANNER_PATTERN, BannerPatterns::bootstrap);
@@ -68,6 +_,7 @@
.add(Registries.ENCHANTMENT, Enchantments::bootstrap)
.add(Registries.ENCHANTMENT_PROVIDER, VanillaEnchantmentProviders::bootstrap)
.add(Registries.JUKEBOX_SONG, JukeboxSongs::bootstrap);
+ public static final List<? extends net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>> DATAPACK_REGISTRY_KEYS = BUILDER.getEntryKeys();
private static void validateThatAllBiomeFeaturesHaveBiomeFilter(HolderLookup.Provider p_256242_) {
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/tags/BiomeTagsProvider.java
+++ b/net/minecraft/data/tags/BiomeTagsProvider.java
@@ -14,6 +_,10 @@
@@ -15,6 +_,10 @@
super(p_255800_, Registries.BIOME, p_256205_);
}
@@ -1,15 +0,0 @@
--- a/net/minecraft/data/tags/EnchantmentTagsProvider.java
+++ b/net/minecraft/data/tags/EnchantmentTagsProvider.java
@@ -16,7 +_,11 @@
private final FeatureFlagSet enabledFeatures;
public EnchantmentTagsProvider(PackOutput p_332794_, CompletableFuture<HolderLookup.Provider> p_331070_, FeatureFlagSet p_328046_) {
- super(p_332794_, Registries.ENCHANTMENT, p_331070_, p_328708_ -> p_328708_.builtInRegistryHolder().key());
+ this(p_332794_, p_331070_, p_328046_, "vanilla", null);
+ }
+
+ public EnchantmentTagsProvider(PackOutput p_332794_, CompletableFuture<HolderLookup.Provider> p_331070_, FeatureFlagSet p_328046_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
+ super(p_332794_, Registries.ENCHANTMENT, p_331070_, p_328708_ -> p_328708_.builtInRegistryHolder().key(), modId, existingFileHelper);
this.enabledFeatures = p_328046_;
}
@@ -10,4 +10,4 @@
+
@Override
protected void addTags(HolderLookup.Provider p_255894_) {
this.tag(EntityTypeTags.SKELETONS).add(EntityType.SKELETON, EntityType.STRAY, EntityType.WITHER_SKELETON, EntityType.SKELETON_HORSE);
this.tag(EntityTypeTags.SKELETONS)
@@ -1,6 +1,6 @@
--- a/net/minecraft/data/tags/TagsProvider.java
+++ b/net/minecraft/data/tags/TagsProvider.java
@@ -36,26 +_,57 @@
@@ -32,26 +_,57 @@
private final CompletableFuture<TagsProvider.TagLookup<T>> parentProvider;
protected final ResourceKey<? extends Registry<T>> registryKey;
protected final Map<ResourceLocation, TagBuilder> builders = Maps.newLinkedHashMap();
@@ -38,14 +38,14 @@
+ String modId,
+ @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper
) {
this.pathProvider = p_275432_.createPathProvider(PackOutput.Target.DATA_PACK, TagManager.getTagDir(p_275476_));
this.pathProvider = p_275432_.createRegistryTagsPathProvider(p_275476_);
this.registryKey = p_275476_;
this.parentProvider = p_275565_;
this.lookupProvider = p_275222_;
+ this.modId = modId;
+ this.existingFileHelper = existingFileHelper;
+ this.resourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", TagManager.getTagDir(p_275476_));
+ this.elementResourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraftforge.common.ForgeHooks.prefixNamespace(p_275476_.location()));
+ this.resourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraft.core.registries.Registries.tagsDirPath(p_275476_));
+ this.elementResourceType = new net.minecraftforge.common.data.ExistingFileHelper.ResourceType(net.minecraft.server.packs.PackType.SERVER_DATA, ".json", net.minecraft.core.registries.Registries.elementsDirPath(p_275476_));
+ }
+
+ // Forge: Allow customizing the path for a given tag or returning null
@@ -61,7 +61,7 @@
}
protected abstract void addTags(HolderLookup.Provider p_256380_);
@@ -73,7 +_,13 @@
@@ -69,7 +_,13 @@
.thenCombineAsync(this.parentProvider, (p_274778_, p_274779_) -> new CombinedData<>(p_274778_, (TagsProvider.TagLookup<T>)p_274779_), Util.backgroundExecutor())
.thenCompose(
p_325926_ -> {
@@ -76,7 +76,7 @@
Predicate<ResourceLocation> predicate = p_255496_ -> registrylookup.get(ResourceKey.create(this.registryKey, p_255496_)).isPresent();
Predicate<ResourceLocation> predicate1 = p_274776_ -> this.builders.containsKey(p_274776_)
|| p_325926_.parent.contains(TagKey.create(this.registryKey, p_274776_));
@@ -86,7 +_,7 @@
@@ -82,7 +_,7 @@
ResourceLocation resourcelocation = p_325931_.getKey();
TagBuilder tagbuilder = p_325931_.getValue();
List<TagEntry> list = tagbuilder.build();
@@ -85,7 +85,7 @@
if (!list1.isEmpty()) {
throw new IllegalArgumentException(
String.format(
@@ -97,8 +_,11 @@
@@ -93,8 +_,11 @@
)
);
} else {
@@ -99,7 +99,7 @@
}
}
)
@@ -110,11 +_,16 @@
@@ -106,11 +_,16 @@
protected TagsProvider.TagAppender<T> tag(TagKey<T> p_206425_) {
TagBuilder tagbuilder = this.getOrCreateRawBuilder(p_206425_);
@@ -118,7 +118,7 @@
}
public CompletableFuture<TagsProvider.TagLookup<T>> contentsGetter() {
@@ -129,11 +_,26 @@
@@ -125,11 +_,26 @@
});
}
@@ -146,7 +146,7 @@
}
public final TagsProvider.TagAppender<T> add(ResourceKey<T> p_256138_) {
@@ -171,6 +_,19 @@
@@ -167,6 +_,19 @@
public TagsProvider.TagAppender<T> addOptionalTag(ResourceLocation p_176842_) {
this.builder.addOptionalTag(p_176842_);
return this;
@@ -1,7 +1,7 @@
--- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java
@@ -107,9 +_,17 @@
private volatile Component delayedDisconnect;
private volatile DisconnectionDetails delayedDisconnect;
@Nullable
BandwidthDebugMonitor bandwidthDebugMonitor;
+ private java.util.function.Consumer<Connection> activationHandler;
@@ -26,7 +26,7 @@
if (this.delayedDisconnect != null) {
this.disconnect(this.delayedDisconnect);
}
@@ -169,6 +_,7 @@
@@ -177,6 +_,7 @@
} else {
if (packetlistener.shouldHandleMessage(p_129488_)) {
try {
@@ -34,7 +34,7 @@
genericsFtw(p_129488_, packetlistener);
} catch (RunningOnDifferentThreadException runningondifferentthreadexception) {
} catch (RejectedExecutionException rejectedexecutionexception) {
@@ -218,6 +_,7 @@
@@ -226,6 +_,7 @@
if (p_333271_.flow() != this.getReceiving()) {
throw new IllegalStateException("Invalid inbound protocol: " + p_333271_.id());
} else {
@@ -42,7 +42,7 @@
this.packetListener = p_330962_;
this.disconnectListener = null;
UnconfiguredPipelineHandler.InboundConfigurationTask unconfiguredpipelinehandler$inboundconfigurationtask = UnconfiguredPipelineHandler.setupInboundProtocol(
@@ -241,6 +_,8 @@
@@ -249,6 +_,8 @@
} else {
UnconfiguredPipelineHandler.OutboundConfigurationTask unconfiguredpipelinehandler$outboundconfigurationtask = UnconfiguredPipelineHandler.setupOutboundProtocol(
p_329145_
@@ -51,7 +51,7 @@
);
BundlerInfo bundlerinfo = p_329145_.bundlerInfo();
if (bundlerinfo != null) {
@@ -290,7 +_,8 @@
@@ -298,7 +_,8 @@
this.disconnectListener = p_330656_;
this.runOnceConnected(p_326042_ -> {
this.setupInboundProtocol(p_329827_, p_330656_);
@@ -61,7 +61,7 @@
this.setupOutboundProtocol(p_328134_);
});
}
@@ -333,6 +_,7 @@
@@ -341,6 +_,7 @@
private void doSendPacket(Packet<?> p_243260_, @Nullable PacketSendListener p_243290_, boolean p_299937_) {
ChannelFuture channelfuture = p_299937_ ? this.channel.writeAndFlush(p_243260_) : this.channel.write(p_243260_);
@@ -69,7 +69,7 @@
if (p_243290_ != null) {
channelfuture.addListener(p_243167_ -> {
if (p_243167_.isSuccess()) {
@@ -415,7 +_,7 @@
@@ -423,7 +_,7 @@
if (this.address == null) {
return "local";
} else {
@@ -78,7 +78,7 @@
}
}
@@ -454,6 +_,8 @@
@@ -466,6 +_,8 @@
}
public static ChannelFuture connect(InetSocketAddress p_290034_, boolean p_290035_, final Connection p_290031_) {
@@ -87,7 +87,7 @@
Class<? extends SocketChannel> oclass;
EventLoopGroup eventloopgroup;
if (Epoll.isAvailable() && p_290035_) {
@@ -525,6 +_,7 @@
@@ -537,6 +_,7 @@
public static Connection connectToLocalServer(SocketAddress p_129494_) {
final Connection connection = new Connection(PacketFlow.CLIENTBOUND);
@@ -95,7 +95,7 @@
new Bootstrap().group(LOCAL_WORKER_GROUP.get()).handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel p_332618_) {
@@ -616,6 +_,22 @@
@@ -630,6 +_,22 @@
public float getAverageSentPackets() {
return this.averageSentPackets;
@@ -0,0 +1,19 @@
--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
+++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
@@ -18,7 +_,15 @@
}
static <T extends CustomPacketPayload> CustomPacketPayload.Type<T> createType(String p_331650_) {
- return new CustomPacketPayload.Type<>(ResourceLocation.withDefaultNamespace(p_331650_));
+ return new CustomPacketPayload.Type<>(ResourceLocation.parse(p_331650_));
+ }
+
+ static <T extends CustomPacketPayload> CustomPacketPayload.Type<T> createType(String namespace, String path) {
+ return new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(namespace, path));
+ }
+
+ static <T extends CustomPacketPayload> CustomPacketPayload.Type<T> createType(ResourceLocation name) {
+ return new CustomPacketPayload.Type<>(name);
}
static <B extends FriendlyByteBuf> StreamCodec<B, CustomPacketPayload> codec(
Loaded 100 of 941 files, more files were not shown because too many files have changed in this diff. Show more