ForgePatch/patches/minecraft/net/minecraft/client/entity/EntityPlayerSP.java.patch

83 lines
3.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
@@ -404,6 +404,15 @@
this.field_71159_c.field_71456_v.func_146158_b().func_146227_a(p_146105_1_);
}
+ private boolean isHeadspaceFree(BlockPos pos, int height)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ if (!func_175162_d(pos.func_177982_a(0, y, 0))) return false;
+ }
+ return true;
+ }
+
protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_)
{
if (this.field_70145_X)
@@ -416,30 +425,34 @@
double d0 = p_145771_1_ - (double)blockpos.func_177958_n();
double d1 = p_145771_5_ - (double)blockpos.func_177952_p();
- if (!this.func_175162_d(blockpos))
+ int entHeight = Math.max((int)Math.ceil(this.field_70131_O), 1);
+
+ boolean inTranslucentBlock = !this.isHeadspaceFree(blockpos, entHeight);
+
+ if (inTranslucentBlock)
{
int i = -1;
double d2 = 9999.0D;
- if (this.func_175162_d(blockpos.func_177976_e()) && d0 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177976_e(), entHeight) && d0 < d2)
{
d2 = d0;
i = 0;
}
- if (this.func_175162_d(blockpos.func_177974_f()) && 1.0D - d0 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177974_f(), entHeight) && 1.0D - d0 < d2)
{
d2 = 1.0D - d0;
i = 1;
}
- if (this.func_175162_d(blockpos.func_177978_c()) && d1 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177978_c(), entHeight) && d1 < d2)
{
d2 = d1;
i = 4;
}
- if (this.func_175162_d(blockpos.func_177968_d()) && 1.0D - d1 < d2)
+ if (this.isHeadspaceFree(blockpos.func_177968_d(), entHeight) && 1.0D - d1 < d2)
{
d2 = 1.0D - d1;
i = 5;
@@ -474,7 +487,7 @@
private boolean func_175162_d(BlockPos p_175162_1_)
{
- return !this.field_70170_p.func_180495_p(p_175162_1_).func_185915_l() && !this.field_70170_p.func_180495_p(p_175162_1_.func_177984_a()).func_185915_l();
+ return !this.field_70170_p.func_180495_p(p_175162_1_).func_185915_l();
}
public void func_70031_b(boolean p_70031_1_)
@@ -519,7 +532,13 @@
public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_)
{
- this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false);
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_184185_1_ = event.getSound();
+ p_184185_2_ = event.getVolume();
+ p_184185_3_ = event.getPitch();
+
+ this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false);
}
public boolean func_70613_aW()