Compare commits

...
15 Commits
Author SHA1 Message Date
LexManos baa3098435 1.20.1 Update 2023-06-12 15:09:50 -07:00
SizableShrimp 1a413eeed2 Fix JAR compatibility checks for 1.20 (#9556) 2023-06-11 18:26:34 +02:00
SizableShrimp 497274fd93 [1.20] Add AFTER_LEVEL render level stage (#9555) 2023-06-11 12:28:55 +02:00
ChampionAsh5357 2eddcabdb7 Reorder overlay layers to match vanilla (#9550) 2023-06-10 12:01:33 +01:00
Dennis C ce84ba86f0 Re-implement missing level-sensitive block light hook in ChunkAccess (#9536) 2023-06-10 09:13:29 +01:00
Dennis C 622c47c075 Fix issues in the deserialization of empty ingredients (#9537) 2023-06-09 14:49:13 -07:00
agnor99 7614e024ed Fix wrong variable passed into EnchantmentClue lookup Fixes #9543 (#9544) 2023-06-09 14:48:53 -07:00
Dennis C a4570cb22f Fix incorrect depth test state in debug graph rendering Fixes #9534 (#9539) 2023-06-09 14:48:09 -07:00
ChampionAsh5357 76349744f7 Fix initCapabilities patch location in ServerLevel Fixes #9526 (#9531) 2023-06-09 14:47:38 -07:00
ChampionAsh5357 75d647615e Use Spinning Effect Intensity instead of Partial Tick for Portal Overlay Fixes #9529 (#9530) 2023-06-09 14:47:05 -07:00
Matei M 8482714375 Fix getArmorModelHook patch, Fixex #9523 (#9528) 2023-06-09 14:46:26 -07:00
Mgazul 2d8a935695 Fix duplicate Map writes in PlayerList patch. (#9521) 2023-06-09 14:45:57 -07:00
LexManos f6c13682d2 Fix Forge Version including MC version in MDK. 2023-06-09 14:45:07 -07:00
agnor99 18c3ea9625 Fix patch in light propagation (#9532) 2023-06-08 21:48:23 +01:00
SizableShrimp 09de4a2dcc Attempt to fix jar signing
Gradle 8 is stupid and doesn't (easily) allow in-place tasks, so a temporary fix has been made in ForgeGradle 6

Signed-off-by: SizableShrimp <[email protected]>
2023-06-07 22:17:25 -05:00
25 changed files with 393 additions and 76 deletions

No files matched your search

+10 -10
View File
@@ -27,8 +27,8 @@ plugins {
id 'net.minecraftforge.gradleutils' version '2.+'
id 'eclipse'
id 'de.undercouch.download' version '5.4.0'
id 'net.minecraftforge.gradle.patcher' version '[6.0,6.2)' apply false
id 'net.minecraftforge.gradle.mcp' version '[6.0,6.2)' apply false
id 'net.minecraftforge.gradle.patcher' version '[6.0.6,6.2)' apply false
id 'net.minecraftforge.gradle.mcp' version '[6.0.6,6.2)' apply false
}
Util.init() //Init all our extension methods!
@@ -43,10 +43,10 @@ ext {
]
}
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.20'
MC_VERSION = '1.20'
MAPPING_VERSION = '1.20.1'
MC_VERSION = '1.20.1'
MC_NEXT_VERSION = '1.21'
MCP_VERSION = '20230608.053357'
MCP_VERSION = '20230612.114412'
SNAPSHOT = false
SPI_VERSION = '7.0.0'
@@ -366,9 +366,6 @@ def sharedFmlonlyForge = { Project prj ->
keyStore = jarsigner.keystore
inputFile = t.archiveFile.get().asFile
outputFile = t.archiveFile.get().asFile
doFirst {
prj.logger.lifecycle('Signing: ' + inputFile)
}
}
t.finalizedBy(signTask)
}
@@ -888,7 +885,10 @@ project(':forge') {
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'org.cadixdev.licenser'
applyPatches { verbose = true }
applyPatches {
verbose = true
//failOnError = false
}
sourceSets {
main {
@@ -1631,7 +1631,7 @@ project(':forge') {
exclude it
}
filter(ReplaceTokens, tokens: [
FORGE_VERSION: project.version,
FORGE_VERSION: FORGE_VERSION,
FORGE_GROUP: project.group,
FORGE_NAME: project.name,
MC_VERSION: MC_VERSION,
@@ -32,7 +32,7 @@ class TeamcityRequests {
@Nullable
static Map<String, Build> buildsByCommit() throws IOException {
final Map<String, Build> builds = [:]
jsonRequest(new TypeToken<Builds>() {}, "https://teamcity.minecraftforge.net/guestAuth/app/rest/builds?fields=build:(revisions,number)&locator=buildType:(id:MinecraftForge_MinecraftForge_MinecraftForge_MinecraftForge__Build),count:300,status:SUCCESS")
jsonRequest(new TypeToken<Builds>() {}, 'https://teamcity.minecraftforge.net/guestAuth/app/rest/builds?fields=build:(revisions,number)&locator=buildType:(id:MinecraftForge_MinecraftForge_MinecraftForge_MinecraftForge__Build),defaultFilter:false,count:300,status:SUCCESS')
?.build?.forEach {
it.revisions.revision.each { rev -> builds[rev.version] = it }
}
+1 -1
View File
@@ -3,7 +3,7 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19.4-&query=$.promos["1.19.4-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.20-&query=$.promos["1.20-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.20.1-&query=$.promos["1.20.1-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)][Download] [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)][Discord] [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)][Patreon]
Forge is a free, open-source modding API all of your favourite mods use!
@@ -5,7 +5,7 @@
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, l1);
int i2 = 6839882;
- if ((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) {
+ if (((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
+ if (((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
p_282430_.m_280218_(f_98747_, i1, j + 14 + 19 * l, 0, 185, 108, 19);
p_282430_.m_280218_(f_98747_, i1 + 1, j + 15 + 19 * l, 16 * l, 239, 16, 16);
p_282430_.m_280554_(this.f_96547_, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1);
@@ -99,7 +99,7 @@
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details");
@@ -1099,12 +_,18 @@
@@ -1099,12 +_,19 @@
Matrix4f matrix4f = posestack.m_85850_().m_252922_();
this.m_252879_(matrix4f);
camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_);
@@ -115,6 +115,7 @@
this.f_109059_.f_91060_.m_253210_(p_109092_, camera.m_90583_(), this.m_253088_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue())));
this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f);
+ this.f_109059_.m_91307_().m_6182_("forge_render_last");
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_LEVEL, this.f_109059_.f_91060_, posestack, matrix4f, this.f_109059_.f_91060_.getTicks(), camera, this.f_109059_.f_91060_.getFrustum());
this.f_109059_.m_91307_().m_6182_("hand");
if (this.f_109070_) {
RenderSystem.clear(256, Minecraft.f_91002_);
@@ -172,7 +172,7 @@
shaderinstance.m_173362_();
VertexBuffer.m_85931_();
this.f_109461_.m_91307_().m_7238_();
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(p_172994_, this, p_172995_, p_254039_, this.f_109477_, this.f_109461_.f_91063_.m_109153_(), this.f_109442_ != null ? this.f_109442_ : this.f_172938_);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(p_172994_, this, p_172995_, p_254039_, this.f_109477_, this.f_109461_.f_91063_.m_109153_(), this.getFrustum());
p_172994_.m_110188_();
}
@@ -203,11 +203,22 @@
} else if (this.f_109461_.f_91066_.m_232080_().m_231551_() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
flag = chunkrenderdispatcher$renderchunk.m_112842_();
}
@@ -2396,7 +_,12 @@
@@ -2396,7 +_,23 @@
this.f_109469_.m_110859_(p_109502_, p_109503_, p_109504_, p_109505_);
}
+ @Deprecated // Forge: use item aware function below
+ public Frustum getFrustum() {
+ return this.f_109442_ != null ? this.f_109442_ : this.f_172938_;
+ }
+
+ public int getTicks() {
+ return this.f_109477_;
+ }
+
+ /**
+ * @deprecated Forge: Use item aware function below
+ */
+ @Deprecated
public void m_109514_(@Nullable SoundEvent p_109515_, BlockPos p_109516_) {
+ this.playStreamingMusic(p_109515_, p_109516_, p_109515_ == null? null : RecordItem.m_43040_(p_109515_));
+ }
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
+++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java
@@ -54,17 +_,17 @@
@@ -54,24 +_,24 @@
if (armoritem.m_40402_() == p_117122_) {
this.m_117386_().m_102872_(p_117124_);
this.m_117125_(p_117124_, p_117122_);
@@ -16,26 +16,51 @@
float f2 = (float)(i & 255) / 255.0F;
- this.m_289609_(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, f, f1, f2, (String)null);
- this.m_289609_(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, "overlay");
+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay"));
+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay"));
} else {
- this.m_289609_(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, (String)null);
+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
+ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, model, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null));
}
ArmorTrim.m_266285_(p_117121_.m_9236_().m_9598_(), itemstack).ifPresent((p_289638_) -> {
@@ -103,7 +_,10 @@
- this.m_289604_(armoritem.m_40401_(), p_117119_, p_117120_, p_117123_, p_289638_, p_117124_, flag);
+ this.renderTrim(armoritem.m_40401_(), p_117119_, p_117120_, p_117123_, p_289638_, model, flag);
});
if (itemstack.m_41790_()) {
- this.m_289597_(p_117119_, p_117120_, p_117123_, p_117124_);
+ this.renderGlint(p_117119_, p_117120_, p_117123_, model);
}
}
@@ -103,17 +_,26 @@
}
private void m_289609_(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, A p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, @Nullable String p_289682_) {
- VertexConsumer vertexconsumer = p_289689_.m_6299_(RenderType.m_110431_(this.m_117080_(p_289650_, p_289668_, p_289682_)));
+ renderModel(p_289664_, p_289689_, p_289681_, p_289650_, p_289658_, p_289668_, p_289678_, p_289674_, p_289693_, this.m_117080_(p_289650_, p_289668_, p_289682_));
+ }
+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, A p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, ResourceLocation armorResource) {
+ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, net.minecraft.client.model.Model p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, ResourceLocation armorResource) {
+ VertexConsumer vertexconsumer = net.minecraft.client.renderer.entity.ItemRenderer.m_115184_(p_289689_, RenderType.m_110431_(armorResource), false, p_289668_);
p_289658_.m_7695_(p_289664_, vertexconsumer, p_289681_, OverlayTexture.f_118083_, p_289678_, p_289674_, p_289693_, 1.0F);
}
private void m_289604_(ArmorMaterial p_289690_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, A p_289663_, boolean p_289651_) {
+ m_289604_(p_289690_, p_289687_, p_289643_, p_289683_, p_289692_, p_289663_, p_289651_);
+ }
+ private void renderTrim(ArmorMaterial p_289690_, PoseStack p_289687_, MultiBufferSource p_289643_, int p_289683_, ArmorTrim p_289692_, net.minecraft.client.model.Model p_289663_, boolean p_289651_) {
TextureAtlasSprite textureatlassprite = this.f_266073_.m_118316_(p_289651_ ? p_289692_.m_267774_(p_289690_) : p_289692_.m_267606_(p_289690_));
VertexConsumer vertexconsumer = textureatlassprite.m_118381_(p_289643_.m_6299_(Sheets.m_266442_()));
p_289663_.m_7695_(p_289687_, vertexconsumer, p_289683_, OverlayTexture.f_118083_, 1.0F, 1.0F, 1.0F, 1.0F);
}
private void m_289597_(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, A p_289659_) {
+ m_289597_(p_289673_, p_289654_, p_289649_, p_289659_);
+ }
+ private void renderGlint(PoseStack p_289673_, MultiBufferSource p_289654_, int p_289649_, net.minecraft.client.model.Model p_289659_) {
p_289659_.m_7695_(p_289673_, p_289654_.m_6299_(RenderType.m_110484_()), p_289649_, OverlayTexture.f_118083_, 1.0F, 1.0F, 1.0F, 1.0F);
}
@@ -125,8 +_,50 @@
return p_117129_ == EquipmentSlot.LEGS;
}
@@ -1,14 +1,14 @@
--- a/net/minecraft/network/Connection.java
+++ b/net/minecraft/network/Connection.java
@@ -84,6 +_,7 @@
private float f_129477_;
private int f_129478_;
@@ -86,6 +_,7 @@
private boolean f_129479_;
@Nullable
private volatile Component f_290021_;
+ private java.util.function.Consumer<Connection> activationHandler;
public Connection(PacketFlow p_129482_) {
this.f_129466_ = p_129482_;
@@ -93,6 +_,7 @@
@@ -95,6 +_,7 @@
super.channelActive(p_129525_);
this.f_129468_ = p_129525_.channel();
this.f_129469_ = this.f_129468_.remoteAddress();
@@ -16,26 +16,27 @@
try {
this.m_129498_(ConnectionProtocol.HANDSHAKING);
@@ -193,7 +_,7 @@
}
f_129465_.debug("Disabled auto read");
- this.f_129468_.config().setAutoRead(false);
+ this.f_129468_.eventLoop().execute(()->this.f_129468_.config().setAutoRead(false));
}
if (this.f_129468_.eventLoop().inEventLoop()) {
@@ -299,7 +_,9 @@
@@ -111,8 +_,10 @@
public void m_129498_(ConnectionProtocol p_129499_) {
this.f_129468_.attr(f_129461_).set(p_129499_);
this.f_129468_.attr(BundlerInfo.f_263730_).set(p_129499_);
+ this.f_129468_.eventLoop().execute(()-> {
this.f_129468_.config().setAutoRead(true);
f_129465_.debug("Enabled auto read");
+ });
}
public static Connection m_178300_(InetSocketAddress p_178301_, boolean p_178302_) {
+ net.minecraftforge.network.DualStackUtils.checkIPv6(p_178301_.getAddress());
final Connection connection = new Connection(PacketFlow.CLIENTBOUND);
+ connection.activationHandler = net.minecraftforge.network.NetworkHooks::registerClientLoginChannel;
public void channelInactive(ChannelHandlerContext p_129527_) {
@@ -316,6 +_,8 @@
}
public static ChannelFuture m_290025_(InetSocketAddress p_290034_, boolean p_290035_, final Connection p_290031_) {
+ net.minecraftforge.network.DualStackUtils.checkIPv6(p_290034_.getAddress());
+ p_290031_.activationHandler = net.minecraftforge.network.NetworkHooks::registerClientLoginChannel;
Class<? extends SocketChannel> oclass;
LazyLoadedValue<? extends EventLoopGroup> lazyloadedvalue;
if (Epoll.isAvailable() && p_178302_) {
@@ -332,6 +_,7 @@
if (Epoll.isAvailable() && p_290035_) {
@@ -347,6 +_,7 @@
public static Connection m_129493_(SocketAddress p_129494_) {
final Connection connection = new Connection(PacketFlow.CLIENTBOUND);
@@ -43,14 +44,14 @@
(new Bootstrap()).group(f_129464_.m_13971_()).handler(new ChannelInitializer<Channel>() {
protected void initChannel(Channel p_129557_) {
ChannelPipeline channelpipeline = p_129557_.pipeline();
@@ -422,6 +_,14 @@
@@ -437,6 +_,14 @@
public float m_129543_() {
return this.f_129477_;
+ }
+
+ public Channel channel() {
+ return f_129468_;
+ return this.f_129468_;
+ }
+
+ public PacketFlow getDirection() {
@@ -14,14 +14,14 @@
public ServerLevel(MinecraftServer p_214999_, Executor p_215000_, LevelStorageSource.LevelStorageAccess p_215001_, ServerLevelData p_215002_, ResourceKey<Level> p_215003_, LevelStem p_215004_, ChunkProgressListener p_215005_, boolean p_215006_, long p_215007_, List<CustomSpawner> p_215008_, boolean p_215009_, @Nullable RandomSequences p_288977_) {
super(p_215002_, p_215003_, p_214999_.m_206579_(), p_215004_.f_63975_(), p_214999_::m_129905_, false, p_215006_, p_215007_, p_214999_.m_213994_());
@@ -247,6 +_,7 @@
@VisibleForTesting
public void m_287200_(@Nullable EndDragonFight p_287779_) {
this.f_8559_ = p_287779_;
@@ -240,6 +_,7 @@
return new RandomSequences(i);
}, "random_sequences");
});
+ this.initCapabilities();
}
public void m_8606_(int p_8607_, int p_8608_, boolean p_8609_, boolean p_8610_) {
/** @deprecated */
@@ -275,8 +_,8 @@
int i = this.m_46469_().m_46215_(GameRules.f_151486_);
if (this.f_143245_.m_144002_(i) && this.f_143245_.m_144004_(i, this.f_8546_)) {
@@ -94,11 +94,8 @@
serverstatscounter = new ServerStatsCounter(this.f_11195_, file2);
this.f_11202_.put(uuid, serverstatscounter);
@@ -807,8 +_,11 @@
Path path = this.f_11195_.m_129843_(LevelResource.f_78174_).resolve(uuid + ".json");
playeradvancements = new PlayerAdvancements(this.f_11195_.m_129933_(), this, this.f_11195_.m_129889_(), path, p_11297_);
@@ -809,6 +_,8 @@
this.f_11203_.put(uuid, playeradvancements);
+ this.f_11203_.put(uuid, playeradvancements);
}
+ // Forge: don't overwrite active player with a fake one.
@@ -1,5 +1,41 @@
--- a/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -299,25 +_,30 @@
public abstract CompoundTag m_8051_(BlockPos p_62104_);
public final void m_284254_(BiConsumer<BlockPos, BlockState> p_285269_) {
- this.m_284478_((p_284897_) -> {
- return p_284897_.m_60791_() != 0;
+ this.findBlocks((p_284897_, pos) -> {
+ return p_284897_.getLightEmission(this, pos) != 0;
}, p_285269_);
}
public void m_284478_(Predicate<BlockState> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) {
+ findBlocks((state, pos) -> p_285343_.test(state), p_285030_);
+ }
+
+ public void findBlocks(java.util.function.BiPredicate<BlockState, BlockPos> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) {
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for(int i = this.m_151560_(); i < this.m_151561_(); ++i) {
LevelChunkSection levelchunksection = this.m_183278_(this.m_151566_(i));
- if (levelchunksection.m_63002_(p_285343_)) {
+ if (levelchunksection.m_63002_((state) -> p_285343_.test(state, BlockPos.f_121853_))) {
BlockPos blockpos = SectionPos.m_123196_(this.f_187604_, i).m_123249_();
for(int j = 0; j < 16; ++j) {
for(int k = 0; k < 16; ++k) {
for(int l = 0; l < 16; ++l) {
BlockState blockstate = levelchunksection.m_62982_(l, j, k);
- if (p_285343_.test(blockstate)) {
- p_285030_.accept(blockpos$mutableblockpos.m_122154_(blockpos, l, j, k), blockstate);
+ blockpos$mutableblockpos.m_122154_(blockpos, l, j, k);
+ if (p_285343_.test(blockstate, blockpos$mutableblockpos.m_7949_())) {
+ p_285030_.accept(blockpos$mutableblockpos, blockstate);
}
}
}
@@ -463,4 +_,7 @@
public static record TicksToSave(SerializableTickContainer<Block> f_187680_, SerializableTickContainer<Fluid> f_187681_) {
@@ -0,0 +1,14 @@
--- a/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -181,6 +_,11 @@
this.f_62685_.m_284478_(p_285465_, p_285061_);
}
+ @Override
+ public void findBlocks(java.util.function.BiPredicate<BlockState, BlockPos> p_285343_, BiConsumer<BlockPos, BlockState> p_285030_) {
+ this.f_62685_.findBlocks(p_285343_, p_285030_);
+ }
+
public TickContainerAccess<Block> m_183531_() {
return this.f_187918_ ? this.f_62685_.m_183531_() : BlackholeTickAccess.m_193144_();
}
@@ -5,7 +5,7 @@
return false;
} else {
- return p_285372_.m_60739_(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.m_60791_() != p_285110_.m_60791_() || p_285372_.m_60787_() || p_285110_.m_60787_();
+ return p_285372_.m_60739_(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.getLightEmission(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.m_60787_() || p_285110_.m_60787_();
+ return p_285372_.m_60739_(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.getLightEmission(p_285159_, p_284985_) != p_285110_.getLightEmission(p_285159_, p_284985_) || p_285372_.m_60787_() || p_285110_.m_60787_();
}
}
@@ -13,13 +13,19 @@ import javax.annotation.Nullable;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.ForgeRenderTypes;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.LogicalSide;
import net.minecraftforge.fml.event.IModBusEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.joml.Matrix4f;
/**
@@ -201,6 +207,11 @@ public class RenderLevelStageEvent extends Event
* Called within a fabulous graphics target.
*/
public static final Stage AFTER_WEATHER = register("after_weather", null);
/**
* Use this to render after everything in the level has been rendered.
* Called after {@link LevelRenderer#renderLevel(PoseStack, float, long, boolean, Camera, GameRenderer, LightTexture, Matrix4f)} finishes.
*/
public static final Stage AFTER_LEVEL = register("after_level", null);
private final String name;
@@ -654,7 +654,12 @@ public class ForgeGui extends Gui
}
@Override
protected void drawGameInformation(GuiGraphics guiGraphics) {}
protected void drawGameInformation(GuiGraphics guiGraphics)
{
// Replicate the depth test state "leak" caused by the text that is rendered here in vanilla
// being flushed when the graphs start drawing (PR #9539)
RenderSystem.disableDepthTest();
}
@Override
protected void drawSystemInformation(GuiGraphics guiGraphics) {}
@@ -47,7 +47,7 @@ public enum VanillaGuiOverlay
float f1 = Mth.lerp(partialTick, gui.getMinecraft().player.oSpinningEffectIntensity, gui.getMinecraft().player.spinningEffectIntensity);
if (f1 > 0.0F && !gui.getMinecraft().player.hasEffect(MobEffects.CONFUSION)) {
gui.setupOverlayRenderState(true, false);
gui.renderPortalOverlay(guiGraphics, partialTick);
gui.renderPortalOverlay(guiGraphics, f1);
}
}),
HOTBAR("hotbar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
@@ -109,13 +109,6 @@ public enum VanillaGuiOverlay
gui.renderFood(screenWidth, screenHeight, guiGraphics);
}
}),
MOUNT_HEALTH("mount_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements())
{
gui.setupOverlayRenderState(true, false);
gui.renderHealthMount(screenWidth, screenHeight, guiGraphics);
}
}),
AIR_LEVEL("air_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements())
{
@@ -123,6 +116,13 @@ public enum VanillaGuiOverlay
gui.renderAir(screenWidth, screenHeight, guiGraphics);
}
}),
MOUNT_HEALTH("mount_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements())
{
gui.setupOverlayRenderState(true, false);
gui.renderHealthMount(screenWidth, screenHeight, guiGraphics);
}
}),
JUMP_BAR("jump_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
PlayerRideableJumping playerRideableJumping = gui.getMinecraft().player.jumpableVehicle();
if (playerRideableJumping != null && !gui.getMinecraft().options.hideGui)
@@ -155,33 +155,33 @@ public enum VanillaGuiOverlay
SLEEP_FADE("sleep_fade", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
gui.renderSleepFade(screenWidth, screenHeight, guiGraphics);
}),
POTION_ICONS("potion_icons", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
gui.renderEffects(guiGraphics);
}),
DEBUG_TEXT("debug_text", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
gui.renderHUDText(screenWidth, screenHeight, guiGraphics);
}),
FPS_GRAPH("fps_graph", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
gui.renderFPSGraph(guiGraphics);
}),
POTION_ICONS("potion_icons", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
gui.renderEffects(guiGraphics);
}),
RECORD_OVERLAY("record_overlay", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui)
{
gui.renderRecordOverlay(screenWidth, screenHeight, partialTick, guiGraphics);
}
}),
SUBTITLES("subtitles", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui)
{
gui.renderSubtitles(guiGraphics);
}
}),
TITLE_TEXT("title_text", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui)
{
gui.renderTitle(screenWidth, screenHeight, partialTick, guiGraphics);
}
}),
SUBTITLES("subtitles", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
if (!gui.getMinecraft().options.hideGui)
{
gui.renderSubtitles(guiGraphics);
}
}),
SCOREBOARD("scoreboard", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
Scoreboard scoreboard = gui.getMinecraft().level.getScoreboard();
@@ -118,7 +118,13 @@ public class CraftingHelper
ingredients.add(Ingredient.merge(vanilla));
if (ingredients.size() == 0)
{
if (allowEmpty)
{
return Ingredient.EMPTY;
}
throw new JsonSyntaxException("Item array cannot be empty, at least one item must be defined");
}
if (ingredients.size() == 1)
return ingredients.get(0);
@@ -120,8 +120,8 @@ public class DifferenceIngredient extends AbstractIngredient
@Override
public DifferenceIngredient parse(JsonObject json)
{
Ingredient base = Ingredient.fromJson(json.get("base"));
Ingredient without = Ingredient.fromJson(json.get("subtracted"));
Ingredient base = Ingredient.fromJson(json.get("base"), false);
Ingredient without = Ingredient.fromJson(json.get("subtracted"), false);
return new DifferenceIngredient(base, without);
}
@@ -152,7 +152,12 @@ public class IntersectionIngredient extends AbstractIngredient
JsonArray children = GsonHelper.getAsJsonArray(json, "children");
if (children.size() < 2)
throw new JsonSyntaxException("Must have at least two children for an intersection ingredient");
return new IntersectionIngredient(IntStream.range(0, children.size()).mapToObj(i -> Ingredient.fromJson(children.get(i))).toList());
return new IntersectionIngredient(
IntStream.range(0, children.size())
.mapToObj(i -> Ingredient.fromJson(children.get(i), false))
.toList()
);
}
@Override
@@ -87,7 +87,27 @@ public interface IForgeBlock
/**
* Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
*
* @param state The state of this block
* @param level The level this block is in
* @param pos The position of this block in the level, will be {@link BlockPos#ZERO} when the chunk being loaded or
* generated calls this to check whether it contains any light sources
* @return The light value
* @implNote <ul>
* <li>
* If the given state of this block may emit light but requires position context to determine the light
* value, then it must return a non-zero light value if {@code (pos == BlockPos.ZERO)} in order for the
* chunk calling this to be considered as containing light sources.
* </li>
* <li>
* The given {@link BlockGetter} may be a chunk. Block, fluid or block entity accesses outside of its bounds
* will cause issues such as wrapping coordinates returning values from the opposing chunk edge
* </li>
* <li>
* This method may be called on a worker thread and must therefore use
* {@link IForgeBlockGetter#getExistingBlockEntity(BlockPos)} to retrieve the {@link BlockEntity}
* at the given position
* </li>
* </ul>
*/
default int getLightEmission(BlockState state, BlockGetter level, BlockPos pos)
{
+5
View File
@@ -27,6 +27,9 @@ net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ChunkCompi
net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$RebuildTask.<init>(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;DLnet/minecraft/client/renderer/chunk/RenderChunkRegion;Z)V=|p_194426_,pos,p_194427_,p_194428_,p_194429_
net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ResortTransparencyTask.<init>(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;DLnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$CompiledChunk;)V=|p_112888_,pos,p_112889_,p_112890_
net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.<init>(Lnet/minecraft/client/multiplayer/ClientLevel;Lnet/minecraft/client/renderer/LevelRenderer;Ljava/util/concurrent/Executor;ZLnet/minecraft/client/renderer/ChunkBufferBuilderPack;I)V=|p_194405_,p_194406_,p_194407_,p_194408_,p_194409_,countRenderBuilders
net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.renderGlint(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/model/Model;)V|=p_289673_,p_289654_,p_289649_,p_289659_
net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/item/ArmorItem;Lnet/minecraft/client/model/Model;ZFFFLnet/minecraft/resources/ResourceLocation;)V=|p_289664_,p_289689_,p_289681_,p_289650_,p_289658_,p_289668_,p_289678_,p_289674_,p_289693_,armorResource
net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.renderTrim(Lnet/minecraft/world/item/ArmorMaterial;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/item/armortrim/ArmorTrim;Lnet/minecraft/client/model/Model;Z)V=|p_289690_,p_289687_,p_289643_,p_289683_,p_289692_,p_289663_,p_289651_
net/minecraft/client/renderer/texture/SpriteContents.<init>(Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/resources/metadata/animation/FrameSize;Lcom/mojang/blaze3d/platform/NativeImage;Lnet/minecraft/client/resources/metadata/animation/AnimationMetadataSection;Lnet/minecraftforge/client/textures/ForgeTextureMetadata;)V=|p_249787_,p_251031_,p_252131_,p_250432_,forgeMeta
net/minecraft/client/resources/model/MultiPartBakedModel.getQuads(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/Direction;Lnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)Ljava/util/List;=|p_235050_,p_235051_,p_235052_,modelData,renderType
net/minecraft/client/resources/model/SimpleBakedModel$Builder.build(Lnet/minecraftforge/client/RenderTypeGroup;)Lnet/minecraft/client/resources/model/BakedModel;=|renderTypes
@@ -93,6 +96,8 @@ net/minecraft/world/level/block/FlowerBlock.<init>(Ljava/util/function/Supplier;
net/minecraft/world/level/block/FlowerPotBlock.<init>(Ljava/util/function/Supplier;Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|emptyPot,p_53528_,properties
net/minecraft/world/level/block/LiquidBlock.<init>(Ljava/util/function/Supplier;Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V=|p_54694_,p_54695_
net/minecraft/world/level/block/PoweredRailBlock.<init>(Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Z)V=|p_55218_,isPoweredRail
net/minecraft/world/level/chunk/ChunkAccess.findBlocks(Ljava/util/function/BiPredicate;Ljava/util/function/BiConsumer;)V=|p_285343_,p_285030_
net/minecraft/world/level/chunk/ImposterProtoChunk.findBlocks(Ljava/util/function/BiPredicate;Ljava/util/function/BiConsumer;)V=|p_285343_,p_285030_
net/minecraft/world/level/entity/PersistentEntitySectionManager.addEntityWithoutEvent(Lnet/minecraft/world/level/entity/EntityAccess;Z)Z=|p_157539_,p_157540_
net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.processEntityInfos(Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/List;)Ljava/util/List;=|template,p_215387_0_,p_215387_1_,p_215387_2_,p_215387_3_
net/minecraft/world/level/storage/loot/LootContext.<init>(Lnet/minecraft/world/level/storage/loot/LootParams;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/storage/loot/LootDataResolver;Lnet/minecraft/resources/ResourceLocation;)V=|p_287722_,p_287702_,p_287619_,queriedLootTableId
@@ -0,0 +1,168 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.debug.block;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
/**
* Adds a light source block that can be switched on and off by right-clicking and saves its state in a BlockEntity
* to test whether level/pos-sensitive light sources work correctly
*/
@Mod(LevelSensitiveLightBlockTest.MOD_ID)
public class LevelSensitiveLightBlockTest
{
static final String MOD_ID = "level_sensitive_light_block_test";
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID);
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID);
private static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MOD_ID);
private static final RegistryObject<Block> LIGHT_BLOCK = BLOCKS.register("light_block", LightBlock::new);
private static final RegistryObject<Item> LIGHT_BLOCK_ITEM = ITEMS.register(
"light_block", () -> new BlockItem(LIGHT_BLOCK.get(), new Item.Properties())
);
private static final RegistryObject<BlockEntityType<LightBlockEntity>> LIGHT_BLOCK_ENTITY = BLOCK_ENTITIES.register(
"light_block", () -> BlockEntityType.Builder.of(LightBlockEntity::new, LIGHT_BLOCK.get()).build(null)
);
public LevelSensitiveLightBlockTest()
{
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
BLOCKS.register(bus);
ITEMS.register(bus);
BLOCK_ENTITIES.register(bus);
}
private static class LightBlock extends Block implements EntityBlock
{
public LightBlock()
{
super(BlockBehaviour.Properties.of());
}
@Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
{
if (!level.isClientSide() && level.getBlockEntity(pos) instanceof LightBlockEntity be)
{
be.switchLight();
}
return InteractionResult.SUCCESS;
}
@Override
public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos)
{
if (pos == BlockPos.ZERO || (level.getExistingBlockEntity(pos) instanceof LightBlockEntity be && be.lit))
{
return 15;
}
return 0;
}
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state)
{
return new LightBlockEntity(pos, state);
}
}
private static class LightBlockEntity extends BlockEntity
{
private boolean lit = false;
public LightBlockEntity(BlockPos pos, BlockState state)
{
super(LIGHT_BLOCK_ENTITY.get(), pos, state);
}
public void switchLight()
{
setLit(!lit);
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_ALL);
setChanged();
}
private void setLit(boolean lit)
{
if (lit != this.lit)
{
this.lit = lit;
level.getLightEngine().checkBlock(worldPosition);
}
}
@Override
public Packet<ClientGamePacketListener> getUpdatePacket()
{
return ClientboundBlockEntityDataPacket.create(this);
}
@Override
public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt)
{
CompoundTag tag = pkt.getTag();
if (tag != null)
{
setLit(tag.getBoolean("lit"));
}
}
@Override
public CompoundTag getUpdateTag()
{
CompoundTag tag = super.getUpdateTag();
tag.putBoolean("lit", lit);
return tag;
}
@Override
public void handleUpdateTag(CompoundTag tag)
{
super.handleUpdateTag(tag);
lit = tag.getBoolean("lit");
}
@Override
public void load(CompoundTag tag)
{
super.load(tag);
lit = tag.getBoolean("lit");
}
@Override
protected void saveAdditional(CompoundTag tag)
{
super.saveAdditional(tag);
tag.putBoolean("lit", lit);
}
}
}
+2
View File
@@ -32,6 +32,8 @@ modId="mdk_datagen"
modId="custom_game_rule_test"
[[mods]]
modId="custom_preset_editor_test"
[[mods]]
modId="level_sensitive_light_block_test"
# LEGACY TEST CASES
###### The mods below are from the old test framework and need to be yeeted later again.
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "minecraft:block/glowstone"
}
}
}
@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/glowstone"
}