@@ -72,24 +72,28 @@ public void onPlaced(World arg, BlockPos pos, BlockState state, LivingEntity arg
72
72
} else {
73
73
arg .setBlockState (pos .north (), state .with (PART , Part .FRONT ).with (FACING , Direction .NORTH ));
74
74
}
75
+ break ;
75
76
case EAST :
76
77
if (!arg .getBlockState (pos .east ()).isAir ()) {
77
78
arg .breakBlock (pos , true );
78
79
} else {
79
80
arg .setBlockState (pos .east (), state .with (PART , Part .FRONT ).with (FACING , Direction .EAST ));
80
81
}
82
+ break ;
81
83
case SOUTH :
82
84
if (!arg .getBlockState (pos .south ()).isAir ()) {
83
85
arg .breakBlock (pos , true );
84
86
} else {
85
87
arg .setBlockState (pos .south (), state .with (PART , Part .FRONT ).with (FACING , Direction .SOUTH ));
86
88
}
89
+ break ;
87
90
case WEST :
88
91
if (!arg .getBlockState (pos .west ()).isAir ()) {
89
92
arg .breakBlock (pos , true );
90
93
} else {
91
94
arg .setBlockState (pos .west (), state .with (PART , Part .FRONT ).with (FACING , Direction .WEST ));
92
95
}
96
+ break ;
93
97
}
94
98
}
95
99
}
@@ -98,23 +102,47 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl
98
102
switch (state .get (PART )) {
99
103
case BACK : switch (state .get (FACING )) {
100
104
case NORTH :
101
- if (world .getBlockState (pos .north ()).contains (PART )) { world .breakBlock (pos .north (), true );}
105
+ if (world .getBlockState (pos .north ()).contains (PART )) {
106
+ world .breakBlock (pos .north (), true );
107
+ break ;
108
+ }
102
109
case EAST :
103
- if (world .getBlockState (pos .east ()).contains (PART )) { world .breakBlock (pos .east (), true );}
110
+ if (world .getBlockState (pos .east ()).contains (PART )) {
111
+ world .breakBlock (pos .east (), true );
112
+ break ;
113
+ }
104
114
case SOUTH :
105
- if (world .getBlockState (pos .south ()).contains (PART )) { world .breakBlock (pos .south (), true );}
115
+ if (world .getBlockState (pos .south ()).contains (PART )) {
116
+ world .breakBlock (pos .south (), true );
117
+ break ;
118
+ }
106
119
case WEST :
107
- if (world .getBlockState (pos .west ()).contains (PART )) { world .breakBlock (pos .west (), true );}
120
+ if (world .getBlockState (pos .west ()).contains (PART )) {
121
+ world .breakBlock (pos .west (), true );
122
+ break ;
123
+ }
108
124
}
109
125
case FRONT : switch (state .get (FACING )) {
110
126
case NORTH :
111
- if (world .getBlockState (pos .south ()).contains (PART )) { world .breakBlock (pos .south (), true ); }
127
+ if (world .getBlockState (pos .south ()).contains (PART )) {
128
+ world .breakBlock (pos .south (), true );
129
+ break ;
130
+ }
112
131
case EAST :
113
- if (world .getBlockState (pos .west ()).contains (PART )) { world .breakBlock (pos .south (), true ); }
132
+ if (world .getBlockState (pos .west ()).contains (PART )) {
133
+ world .breakBlock (pos .west (), true );
134
+ break ;
135
+ }
114
136
case SOUTH :
115
- if (world .getBlockState (pos .north ()).contains (PART )) { world .breakBlock (pos .south (), true ); }
137
+ if (world .getBlockState (pos .north ()).contains (PART )) {
138
+ world .breakBlock (pos .north (), true );
139
+ break ;
140
+ }
116
141
case WEST :
117
- if (world .getBlockState (pos .east ()).contains (PART )) { world .breakBlock (pos .south (), true ); }
142
+ if (world .getBlockState (pos .east ()).contains (PART )) {
143
+ world .breakBlock (pos .east (), true );
144
+ break ;
145
+ }
118
146
}
119
147
}
120
148
}
@@ -213,7 +241,7 @@ private static VoxelShape rotate(Direction from, Direction to, VoxelShape shape)
213
241
}
214
242
215
243
public boolean canPlaceAt (BlockState state , WorldView worldView , BlockPos pos ) {
216
- return !worldView .isAir (pos .down ());
244
+ return !worldView .isAir (pos .down ()) && worldView . getBlockState ( pos . offset ( state . get ( FACING ))) == Blocks . AIR . getDefaultState () ;
217
245
}
218
246
219
247
}
0 commit comments