Files
MinecraftForge/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch
T

107 lines
5.9 KiB
Diff

--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -290,6 +_,8 @@
this.m_109128_(new ResourceLocation("shaders/post/spider.json"));
} else if (p_109107_ instanceof EnderMan) {
this.m_109128_(new ResourceLocation("shaders/post/invert.json"));
+ } else {
+ net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_109107_, this);
}
}
@@ -549,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> {
f_172607_ = p_234230_;
}));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_172768_, list1));
} catch (IOException ioexception) {
list1.forEach((p_172729_) -> {
p_172729_.getFirst().close();
@@ -630,19 +_,21 @@
boolean flag = false;
int i = 3;
double d1 = d0;
+ double atkRange = this.f_109059_.f_91074_.getAttackRange();
if (this.f_109059_.f_91072_.m_105291_()) {
- d1 = 6.0D;
+ d1 = Math.max(d0, atkRange);
d0 = d1;
} else {
- if (d0 > 3.0D) {
+ if (d0 > atkRange) {
flag = true;
}
d0 = d0;
+ d0 = d1 = Math.max(d0, atkRange); // Pick entities with the max of the reach distance and attack range.
}
d1 *= d1;
- if (this.f_109059_.f_91077_ != null) {
+ if (this.f_109059_.f_91077_ != null && this.f_109059_.f_91077_.m_6662_() != HitResult.Type.MISS) { // Add != MISS to ensure Attack Range is not clamped at the value of Reach Distance.
d1 = this.f_109059_.f_91077_.m_82450_().m_82557_(vec3);
}
@@ -657,7 +_,7 @@
Entity entity1 = entityhitresult.m_82443_();
Vec3 vec33 = entityhitresult.m_82450_();
double d2 = vec3.m_82557_(vec33);
- if (flag && d2 > 9.0D) {
+ if (false && flag && d2 > 9.0D) { //Forge: Always keep the entity result to allow for extended reach interactions.
this.f_109059_.f_91077_ = BlockHitResult.m_82426_(vec33, Direction.m_122366_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_), new BlockPos(vec33));
} else if (d2 < d1 || this.f_109059_.f_91077_ == null) {
this.f_109059_.f_91077_ = entityhitresult;
@@ -711,7 +_,7 @@
d0 *= Mth.m_14139_(this.f_109059_.f_91066_.m_231925_().m_231551_(), 1.0D, (double)0.85714287F);
}
- return d0;
+ return net.minecraftforge.client.ForgeHooksClient.getFieldOfView(this, p_109142_, p_109143_, d0, p_109144_);
}
}
@@ -848,11 +_,11 @@
Window window = this.f_109059_.m_91268_();
RenderSystem.m_69421_(256, Minecraft.f_91002_);
- Matrix4f matrix4f = Matrix4f.m_162203_(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), 0.0F, (float)((double)window.m_85442_() / window.m_85449_()), 1000.0F, 3000.0F);
+ Matrix4f matrix4f = Matrix4f.m_162203_(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), 0.0F, (float)((double)window.m_85442_() / window.m_85449_()), 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157425_(matrix4f);
PoseStack posestack = RenderSystem.m_157191_();
posestack.m_166856_();
- posestack.m_85837_(0.0D, 0.0D, -2000.0D);
+ posestack.m_85837_(0.0D, 0.0D, 1000F-net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157182_();
Lighting.m_84931_();
PoseStack posestack1 = new PoseStack();
@@ -888,7 +_,7 @@
}
} else if (this.f_109059_.f_91080_ != null) {
try {
- this.f_109059_.f_91080_.m_6305_(posestack1, i, j, this.f_109059_.m_91297_());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.f_109059_.f_91080_, posestack1, i, j, this.f_109059_.m_91297_());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details");
@@ -1047,6 +_,11 @@
Matrix4f matrix4f = posestack.m_85850_().m_85861_();
this.m_109111_(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_);
+
+ net.minecraftforge.client.event.ViewportEvent.ComputeCameraAngles cameraSetup = net.minecraftforge.client.ForgeHooksClient.onCameraSetup(this, camera, p_109090_);
+ camera.setAnglesInternal(cameraSetup.getYaw(), cameraSetup.getPitch());
+ p_109092_.m_85845_(Vector3f.f_122227_.m_122240_(cameraSetup.getRoll()));
+
p_109092_.m_85845_(Vector3f.f_122223_.m_122240_(camera.m_90589_()));
p_109092_.m_85845_(Vector3f.f_122225_.m_122240_(camera.m_90590_() + 180.0F));
Matrix3f matrix3f = p_109092_.m_85850_().m_85864_().m_8183_();
@@ -1056,6 +_,8 @@
this.f_109059_.f_91060_.m_172961_(p_109092_, camera.m_90583_(), this.m_172716_(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.dispatchRenderLast(this.f_109059_.f_91060_, p_109092_, p_109090_, matrix4f, p_109091_);
this.f_109059_.m_91307_().m_6182_("hand");
if (this.f_109070_) {
RenderSystem.m_69421_(256, Minecraft.f_91002_);