Skip to content

Commit d370674

Browse files
Painting same block over and over shouldn't add multiple blockdb entries.
1 parent 6f57fce commit d370674

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fCraft/Player/Player.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,14 +1252,16 @@ public bool PlaceBlock( Vector3I coord, ClickAction action, Block type ) {
12521252
RaisePlayerPlacedBlockEvent(this, World.Map, coordBelow, Block.Grass, Block.Dirt, context);
12531253
SendNow(Packet.MakeSetBlock(coordBelow, Block.Dirt));
12541254
}
1255+
12551256
// handle normal blocks
1256-
blockUpdate = new BlockUpdate(this, coord, type);
1257-
Info.ProcessBlockPlaced((byte)type);
12581257
Block old = map.GetBlock(coord);
1259-
map.QueueUpdate(blockUpdate);
1260-
RaisePlayerPlacedBlockEvent(this, World.Map, coord, old, type, context);
1258+
if (old != type) {
1259+
blockUpdate = new BlockUpdate(this, coord, type);
1260+
Info.ProcessBlockPlaced((byte)type);
1261+
map.QueueUpdate(blockUpdate);
1262+
RaisePlayerPlacedBlockEvent(this, World.Map, coord, old, type, context);
1263+
}
12611264
SendNow(Packet.MakeSetBlock(coord, type));
1262-
12631265
break;
12641266

12651267
case CanPlaceResult.BlocktypeDenied:

0 commit comments

Comments
 (0)