Add a RayTraceResult method to Block that can be can be overridden (#5354)

This commit is contained in:
ShetiPhian 2019-01-25 16:29:07 -05:00 committed by LexManos
parent fa939a890c
commit 06a6fac23a
2 changed files with 26 additions and 0 deletions

View file

@ -117,6 +117,15 @@
public float func_149638_a() {
return this.field_149781_w;
}
@@ -561,7 +569,7 @@
}
}
- return raytraceresult;
+ return p_180636_0_.func_177230_c().getRayTraceResult(p_180636_0_, p_180636_1_, p_180636_2_, p_180636_3_, p_180636_4_, raytraceresult);
}
public void func_180652_a(World p_180652_1_, BlockPos p_180652_2_, Explosion p_180652_3_) {
@@ -615,16 +623,22 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));

View file

@ -1084,4 +1084,21 @@ public interface IForgeBlock
{
return state.isTopSolid();
}
/**
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
*
* @param state The current state
* @param world The current world
* @param pos Block position in world
* @param start The start vector
* @param end The end vector
* @param original The original result from {@link Block#collisionRayTrace(IBlockState, World, BlockPos, Vec3d, Vec3d)}
* @return A result that suits your block
*/
@Nullable
default RayTraceResult getRayTraceResult(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end, RayTraceResult original)
{
return original;
}
}