Fix PitcherCropBlock not calling canSustainPlant, not allowing it to be placed on custom farmland. Close #9611

This commit is contained in:
LexManos committed 2023-07-03 17:25:01 -07:00
1 parent 47ed2ad401
commit 027f4d3d7b
1 file changed
+15
@@ -0,0 +1,15 @@
--- a/net/minecraft/world/level/block/PitcherCropBlock.java
+++ b/net/minecraft/world/level/block/PitcherCropBlock.java
@@ -69,7 +_,11 @@
if (!m_278754_(p_277671_)) {
return super.m_7898_(p_277671_, p_277477_, p_278085_);
} else {
- return this.m_6266_(p_277477_.m_8055_(p_278085_.m_7495_()), p_277477_, p_278085_.m_7495_()) && m_290004_(p_277477_, p_278085_) && (p_277671_.m_61143_(f_276478_) < 3 || m_290001_(p_277477_.m_8055_(p_278085_.m_7494_())));
+ BlockPos below = p_278085_.m_7495_();
+ boolean isSoil = this.m_6266_(p_277477_.m_8055_(below), p_277477_, below);
+ if (p_277671_.m_60734_() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ isSoil = p_277477_.m_8055_(below).canSustainPlant(p_277477_, below, Direction.UP, this);
+ return isSoil && m_290004_(p_277477_, p_278085_) && (p_277671_.m_61143_(f_276478_) < 3 || m_290001_(p_277477_.m_8055_(p_278085_.m_7494_())));
}
}