ForgePatch/patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch

59 lines
3.2 KiB
Diff

--- a/net/minecraft/block/AbstractRailBlock.java
+++ b/net/minecraft/block/AbstractRailBlock.java
@@ -13,7 +13,7 @@
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
-public abstract class AbstractRailBlock extends Block {
+public abstract class AbstractRailBlock extends Block implements net.minecraftforge.common.extensions.IAbstractRailBlock {
protected static final VoxelShape field_185590_a = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
protected static final VoxelShape field_190959_b = Block.func_208617_a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D);
private final boolean field_196277_c;
@@ -37,6 +37,7 @@
public VoxelShape func_220053_a(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) {
RailShape railshape = p_220053_1_.func_203425_a(this) ? p_220053_1_.func_177229_b(this.func_176560_l()) : null;
+ RailShape railShape2 = p_220053_1_.func_203425_a(this) ? getRailDirection(p_220053_1_, p_220053_2_, p_220053_3_, null) : null;
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
}
@@ -61,7 +62,7 @@
public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
if (!p_220069_2_.field_72995_K && p_220069_2_.func_180495_p(p_220069_3_).func_203425_a(this)) {
- RailShape railshape = p_220069_1_.func_177229_b(this.func_176560_l());
+ RailShape railshape = getRailDirection(p_220069_1_, p_220069_2_, p_220069_3_, null);
if (func_235328_a_(p_220069_3_, p_220069_2_, railshape)) {
func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_);
p_220069_2_.func_217377_a(p_220069_3_, p_220069_6_);
@@ -110,7 +111,7 @@
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, boolean p_196243_5_) {
if (!p_196243_5_) {
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
- if (p_196243_1_.func_177229_b(this.func_176560_l()).func_208092_c()) {
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) {
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
}
@@ -129,5 +130,20 @@
return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
}
+ @Deprecated //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
public abstract Property<RailShape> func_176560_l();
+
+ /* ======================================== FORGE START =====================================*/
+
+ @Override
+ public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos)
+ {
+ return !this.field_196277_c;
+ }
+
+ @Override
+ public RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.minecart.AbstractMinecartEntity cart) {
+ return state.func_177229_b(func_176560_l());
+ }
+ /* ========================================= FORGE END ======================================*/
}