@@ -905,9 +905,20 @@ bool nodePlacementPrediction(Client &client,
905
905
// Add node to client map
906
906
MapNode n (id, 0 , param2);
907
907
try {
908
- // This triggers the required mesh update too
909
- client.addNode (p, n);
910
- return true ;
908
+ LocalPlayer* player = client.getEnv ().getLocalPlayer ();
909
+
910
+ // Dont place node when player would be inside new node
911
+ // NOTE: This is to be eventually implemented by a mod as client-side Lua
912
+ if (!nodedef->get (n).walkable ||
913
+ (client.checkPrivilege (" noclip" ) && g_settings->getBool (" noclip" )) ||
914
+ (nodedef->get (n).walkable &&
915
+ neighbourpos != player->getStandingNodePos () + v3s16 (0 ,1 ,0 ) &&
916
+ neighbourpos != player->getStandingNodePos () + v3s16 (0 ,2 ,0 ))) {
917
+
918
+ // This triggers the required mesh update too
919
+ client.addNode (p, n);
920
+ return true ;
921
+ }
911
922
}catch (InvalidPositionException &e){
912
923
errorstream<<" Node placement prediction failed for "
913
924
<<playeritem_def.name <<" (places "
@@ -2798,23 +2809,28 @@ void the_game(
2798
2809
// Otherwise report right click to server
2799
2810
else
2800
2811
{
2801
- // Report to server
2802
- client.interact (3 , pointed);
2803
- camera.setDigging (1 ); // right click animation
2804
-
2812
+ camera.setDigging (1 ); // right click animation (always shown for feedback)
2813
+
2805
2814
// If the wielded item has node placement prediction,
2806
2815
// make that happen
2807
2816
bool placed = nodePlacementPrediction (client,
2808
- playeritem_def,
2809
- nodepos, neighbourpos);
2810
-
2811
- // Read the sound
2812
- if (placed)
2817
+ playeritem_def,
2818
+ nodepos, neighbourpos);
2819
+
2820
+ if (placed) {
2821
+ // Report to server
2822
+ client.interact (3 , pointed);
2823
+ // Read the sound
2813
2824
soundmaker.m_player_rightpunch_sound =
2814
- playeritem_def.sound_place ;
2815
- else
2825
+ playeritem_def.sound_place ;
2826
+ } else {
2816
2827
soundmaker.m_player_rightpunch_sound =
2817
- SimpleSoundSpec ();
2828
+ SimpleSoundSpec ();
2829
+ }
2830
+
2831
+ if (playeritem_def.node_placement_prediction == " " ||
2832
+ nodedef->get (map.getNode (nodepos)).rightclickable )
2833
+ client.interact (3 , pointed); // Report to server
2818
2834
}
2819
2835
}
2820
2836
}
0 commit comments